From d8450548c72a97cfbcc6550e32809a60f69e84d8 Mon Sep 17 00:00:00 2001 From: "omegablast2002@yahoo.com" Date: Sun, 27 Feb 2011 15:19:02 +0000 Subject: [PATCH] suspend changes, suspended cards which would have a counter removed are checked for time counters and cast if no time counters are present as a statebased effect, as per MTG rules.. case changes, "Time" != "time" aparently our parser now strings all counters as lower case...so "Charge" is no longer string "Charge" and can not be compared to "Charge"..not sure if that makes any sense :) anyways removel of time counters on exiled cards by triggers or effects now happen correctly. --- projects/mtg/src/AllAbilities.cpp | 1 + projects/mtg/src/Counters.cpp | 8 ++++++++ projects/mtg/src/MTGRules.cpp | 12 +++--------- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/projects/mtg/src/AllAbilities.cpp b/projects/mtg/src/AllAbilities.cpp index 509fee777..6fa590906 100644 --- a/projects/mtg/src/AllAbilities.cpp +++ b/projects/mtg/src/AllAbilities.cpp @@ -332,6 +332,7 @@ AACounter::AACounter(int id, MTGCardInstance * source, MTGCardInstance * target, _target->counters->removeCounter(name.c_str(), power, toughness); } } + //specail cases, indestructible creatures which recieve enough counters to kill it are destroyed as a state based effect if(_target->toughness <= 0 && _target->has(Constants::INDESTRUCTIBLE) && toughness < 0) _target->controller()->game->putInGraveyard(_target); return nb; diff --git a/projects/mtg/src/Counters.cpp b/projects/mtg/src/Counters.cpp index 1814203bc..1dc24ae8d 100644 --- a/projects/mtg/src/Counters.cpp +++ b/projects/mtg/src/Counters.cpp @@ -134,6 +134,14 @@ int Counters::removeCounter(const char * _name, int _power, int _toughness) return 0; counters[i]->removed(); counters[i]->nb--; + //special case:if a card is suspended and no longer has a time counter when the last is removed, the card is cast. + if (target->suspended && !target->counters->hasCounter("time",0,0)) + { + GameObserver * game = game->GetInstance(); + MTGCardInstance * copy = target->controller()->game->putInZone(target, target->currentZone, target->controller()->game->stack); + Spell * spell = game->mLayers->stackLayer()->addSpell(copy, game->targetChooser, NULL,1, 0); + game->targetChooser = NULL; + } return mCount; } } diff --git a/projects/mtg/src/MTGRules.cpp b/projects/mtg/src/MTGRules.cpp index 63c33edc7..e8668035f 100644 --- a/projects/mtg/src/MTGRules.cpp +++ b/projects/mtg/src/MTGRules.cpp @@ -551,14 +551,8 @@ int MTGSuspendRule::receiveEvent(WEvent *e) { MTGCardInstance * card = z->cards[i]; - if (card->suspended && card->counters->hasCounter("Time",0,0)) - card->counters->removeCounter("Time",0,0); - if (card->suspended && !card->counters->hasCounter("Time",0,0)) - { - MTGCardInstance * copy = p->game->putInZone(card, card->currentZone, p->game->stack); - Spell * spell = game->mLayers->stackLayer()->addSpell(copy, game->targetChooser, NULL,1, 0); - game->targetChooser = NULL; - } + if (card->suspended && card->counters->hasCounter("time",0,0)) + card->counters->removeCounter("time",0,0); } return 1; } @@ -599,7 +593,7 @@ int MTGSuspendRule::reactToClick(MTGCardInstance * card) player->game->putInZone(card, card->currentZone, player->game->exile); card->next->suspended = true; for(signed int i = 0; i < card->suspendedTime;i++) - card->next->counters->addCounter("Time",0,0); + card->next->counters->addCounter("time",0,0); return 1; }