From f8800b8bbdf9c09c6030e41c6644de57405a7e56 Mon Sep 17 00:00:00 2001 From: "omegablast2002@yahoo.com" Date: Wed, 30 Jan 2013 02:38:25 +0000 Subject: [PATCH] added an ability keyword that resolves to do nothing. "donothing" this is to avoid using powerandtoughness 0/0 ability to mean "do nothing" old code [card] name=Inquisition target=player auto=target(*|targetedpersonshand) 0/0 auto=foreach(*[white]|targetedpersonshand) damage:1 targetedplayer text=Target player reveals his or her hand. Inquisition deals damage to that player equal to the number of white cards in his or her hand. mana={2}{B} type=Sorcery [/card] new code [card] name=Inquisition target=player auto=target(*|targetedpersonshand) donothing auto=foreach(*[white]|targetedpersonshand) damage:1 targetedplayer text=Target player reveals his or her hand. Inquisition deals damage to that player equal to the number of white cards in his or her hand. mana={2}{B} type=Sorcery [/card] --- projects/mtg/include/AllAbilities.h | 9 +++++++++ projects/mtg/src/AllAbilities.cpp | 20 ++++++++++++++++++++ projects/mtg/src/MTGAbility.cpp | 9 +++++++++ 3 files changed, 38 insertions(+) diff --git a/projects/mtg/include/AllAbilities.h b/projects/mtg/include/AllAbilities.h index baae3aac1..92c8faa03 100644 --- a/projects/mtg/include/AllAbilities.h +++ b/projects/mtg/include/AllAbilities.h @@ -1028,6 +1028,15 @@ public: AAResetDamage * clone() const; }; +class AAFakeAbility: public ActivatedAbility +{ +public: + AAFakeAbility(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * target, ManaCost * cost = NULL); + int resolve(); + const char* getMenuText(); + AAFakeAbility * clone() const; +}; + class AAFizzler: public ActivatedAbility { diff --git a/projects/mtg/src/AllAbilities.cpp b/projects/mtg/src/AllAbilities.cpp index 8bae5ee1c..e938b8b6f 100644 --- a/projects/mtg/src/AllAbilities.cpp +++ b/projects/mtg/src/AllAbilities.cpp @@ -1176,6 +1176,26 @@ AAResetDamage * AAResetDamage::clone() const return NEW AAResetDamage(*this); } +//ability that resolves to do nothing. + AAFakeAbility::AAFakeAbility(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * _target, ManaCost * cost): + ActivatedAbility(observer, id, source, cost, 0) +{ + this->target = _target; +} +int AAFakeAbility::resolve() +{ + return 1; +} + +const char* AAFakeAbility::getMenuText() +{ + return "Ability"; +} + +AAFakeAbility * AAFakeAbility::clone() const +{ + return NEW AAFakeAbility(*this); +} // Fizzler AAFizzler::AAFizzler(GameObserver* observer, int _id, MTGCardInstance * card, Spell * _target, ManaCost * _cost) : diff --git a/projects/mtg/src/MTGAbility.cpp b/projects/mtg/src/MTGAbility.cpp index 26a59cd96..044e24f70 100644 --- a/projects/mtg/src/MTGAbility.cpp +++ b/projects/mtg/src/MTGAbility.cpp @@ -2196,6 +2196,15 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG return a; } + //Reset damages on cards + found = s.find("donothing"); + if (found != string::npos) + { + MTGAbility * a = NEW AAFakeAbility(observer, id, card, target); + a->oneShot = 1; + return a; + } + //Damage vector splitDamage = parseBetween(s, "damage:", " ", false); if (splitDamage.size())