Erwan
- Added WEvent class, allows to send events to abilities - Cards that change zones now becomes new objects (as specified in the Comprehensive rules). This should allow to fix lots of stupid bugs in the near future, but probably brings loads of new issues :(
This commit is contained in:
@@ -22,6 +22,8 @@ MTGCardInstance::MTGCardInstance(MTGCard * card, MTGPlayerCards * _belongs_to):
|
||||
attacker = 0;
|
||||
lifeOrig = life;
|
||||
belongs_to=_belongs_to;
|
||||
owner = _belongs_to->library->owner;
|
||||
lastController = owner;
|
||||
initAttackersDefensers();
|
||||
life=toughness;
|
||||
LOG("==Creating MTGCardInstance Successful==");
|
||||
@@ -32,6 +34,7 @@ MTGCardInstance::~MTGCardInstance(){
|
||||
LOG("==Deleting MTGCardInstance==");
|
||||
SAFE_DELETE(blockers);
|
||||
SAFE_DELETE(counters);
|
||||
SAFE_DELETE(previous);
|
||||
LOG("==Deleting MTGCardInstance Succesfull==");
|
||||
}
|
||||
void MTGCardInstance::initMTGCI(){
|
||||
@@ -53,6 +56,9 @@ void MTGCardInstance::initMTGCI(){
|
||||
changedZoneRecently = 0;
|
||||
counters = NEW Counters(this);
|
||||
previousZone = NULL;
|
||||
previous = NULL;
|
||||
next = NULL;
|
||||
lastController = NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -164,9 +170,19 @@ int MTGCardInstance::cleanup(){
|
||||
life=toughness;
|
||||
GameObserver * game = GameObserver::GetInstance();
|
||||
if (!game || game->currentPlayer == controller()) summoningSickness = 0;
|
||||
if (previous && !previous->stillInUse()){
|
||||
SAFE_DELETE(previous);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int MTGCardInstance::stillInUse(){
|
||||
GameObserver * game = GameObserver::GetInstance();
|
||||
if (game->mLayers->actionLayer()->stillInUse(this)) return 1;
|
||||
if (!previous) return 0;
|
||||
return previous->stillInUse();
|
||||
}
|
||||
|
||||
/* Summoning Sickness
|
||||
* 212.3f A creature<72>fs activated ability with the tap symbol or the untap symbol in its activation cost
|
||||
* can<61>ft be played unless the creature has been under its controller<65>fs control since the start of his or
|
||||
@@ -184,9 +200,9 @@ int MTGCardInstance::hasSummoningSickness(){
|
||||
int MTGCardInstance::changeController(Player * newController){
|
||||
Player * originalOwner = controller();
|
||||
if (originalOwner == newController) return 0;
|
||||
originalOwner->game->inPlay->removeCard(this);
|
||||
newController->game->inPlay->addCard(this);
|
||||
summoningSickness = 1;
|
||||
MTGCardInstance * copy = originalOwner->game->inPlay->removeCard(this);
|
||||
newController->game->inPlay->addCard(copy);
|
||||
//summoningSickness = 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -204,12 +220,12 @@ Player * MTGCardInstance::controller(){
|
||||
GameObserver * game = GameObserver::GetInstance();
|
||||
if (!game) return NULL;
|
||||
for (int i = 0; i < 2; i++){
|
||||
if (game->players[i]->game->inPlay->hasCard(this)) return game->players[i];
|
||||
if (game->players[i]->game->stack->hasCard(this)) return game->players[i];
|
||||
if (game->players[i]->game->graveyard->hasCard(this)) return game->players[i];
|
||||
if (game->players[i]->game->hand->hasCard(this)) return game->players[i];
|
||||
if (game->players[i]->game->inPlay->hasCard(this)) return game->players[i];
|
||||
if (game->players[i]->game->stack->hasCard(this)) return game->players[i];
|
||||
if (game->players[i]->game->graveyard->hasCard(this)) return game->players[i];
|
||||
if (game->players[i]->game->hand->hasCard(this)) return game->players[i];
|
||||
}
|
||||
return NULL;
|
||||
return lastController;
|
||||
}
|
||||
|
||||
int MTGCardInstance::canAttack(){
|
||||
|
||||
Reference in New Issue
Block a user