diff --git a/projects/mtg/bin/Res/rules/mtg.txt b/projects/mtg/bin/Res/rules/mtg.txt index c40c5eab7..bcb84f441 100644 --- a/projects/mtg/bin/Res/rules/mtg.txt +++ b/projects/mtg/bin/Res/rules/mtg.txt @@ -1,3 +1,4 @@ +#If you change this file, be sure to report your changes into testsuite.txt! name=Classic [INIT] mode=mtg @@ -6,4 +7,7 @@ life:20 auto=shuffle auto=draw:7 auto=@each my draw:draw:1 -auto=maxPlay(land)1 \ No newline at end of file +auto=maxPlay(land)1 +[Player1] +#This is a trick, we put this in player 1's rules so that they most likely won't see that this can be interrupted. Kind of a hack until we can get "noninterruptible" events +auto=@each cleanup:all(*|Battlefield) resetDamage \ No newline at end of file diff --git a/projects/mtg/bin/Res/rules/testsuite.txt b/projects/mtg/bin/Res/rules/testsuite.txt index 21f017e4c..ef9cd793a 100644 --- a/projects/mtg/bin/Res/rules/testsuite.txt +++ b/projects/mtg/bin/Res/rules/testsuite.txt @@ -5,4 +5,7 @@ mode=mtg [PLAYERS] life:20 auto=@each my draw:draw:1 -auto=maxPlay(land)1 \ No newline at end of file +auto=maxPlay(land)1 +[Player1] +#This is a trick, we put this in player 1's rules so that they most likely won't see that this can be interrupted. Kind of a hack until we can get "noninterruptible" events +auto=@each cleanup:all(*|Battlefield) resetDamage \ No newline at end of file diff --git a/projects/mtg/include/AllAbilities.h b/projects/mtg/include/AllAbilities.h index 4ca7c10ea..b15d2ffac 100644 --- a/projects/mtg/include/AllAbilities.h +++ b/projects/mtg/include/AllAbilities.h @@ -865,6 +865,15 @@ public: }; +class AAResetDamage: public ActivatedAbility +{ +public: + AAResetDamage(int id, MTGCardInstance * source, MTGCardInstance * target, ManaCost * cost = NULL); + int resolve(); + const char* getMenuText(); + AAResetDamage * clone() const; +}; + class AAFizzler: public ActivatedAbility { diff --git a/projects/mtg/src/AllAbilities.cpp b/projects/mtg/src/AllAbilities.cpp index d42b82131..c8486e3f9 100644 --- a/projects/mtg/src/AllAbilities.cpp +++ b/projects/mtg/src/AllAbilities.cpp @@ -463,6 +463,32 @@ AARemoveAllCounter * AARemoveAllCounter::clone() const return a; } +//Reset Damage on creatures + AAResetDamage::AAResetDamage(int id, MTGCardInstance * source, MTGCardInstance * _target, ManaCost * cost): + ActivatedAbility(id, source, cost, 0) +{ + this->target = _target; +} +int AAResetDamage::resolve() +{ + MTGCardInstance * _target = (MTGCardInstance *)target; + _target->life = _target->toughness; + return 1; +} + +const char* AAResetDamage::getMenuText() +{ + return "Reset Damages"; +} + +AAResetDamage * AAResetDamage::clone() const +{ + AAResetDamage * a = NEW AAResetDamage(*this); + a->isClone = 1; + return a; +} + + // Fizzler AAFizzler::AAFizzler(int _id, MTGCardInstance * card, Spell * _target, ManaCost * _cost) : ActivatedAbility(_id, card, _cost, 0) diff --git a/projects/mtg/src/MTGAbility.cpp b/projects/mtg/src/MTGAbility.cpp index 117bda474..a3d0997f9 100644 --- a/projects/mtg/src/MTGAbility.cpp +++ b/projects/mtg/src/MTGAbility.cpp @@ -1700,6 +1700,15 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG } } + //Reset damages on cards + found = s.find("resetdamage"); + if (found != string::npos) + { + MTGAbility * a = NEW AAResetDamage(id, card, target); + a->oneShot = 1; + return a; + } + //Damage vector splitDamage = parseBetween(s, "damage:", " ", false); if (splitDamage.size()) diff --git a/projects/mtg/src/MTGCardInstance.cpp b/projects/mtg/src/MTGCardInstance.cpp index 1810e6123..38bf45029 100644 --- a/projects/mtg/src/MTGCardInstance.cpp +++ b/projects/mtg/src/MTGCardInstance.cpp @@ -468,11 +468,10 @@ int MTGCardInstance::initAttackersDefensers() return 1; } -//Function to call to remove all damages, etc to a card (generally at the end of the turn) +//Function to cleanup flags on a card (generally at the end of the turn) int MTGCardInstance::cleanup() { initAttackersDefensers(); - life = toughness; GameObserver * game = GameObserver::GetInstance(); if (!game || game->currentPlayer == controller()) {