diff --git a/projects/mtg/bin/Res/sets/RV/_cards.dat b/projects/mtg/bin/Res/sets/RV/_cards.dat index a78da4bfb..671d7fb6d 100644 --- a/projects/mtg/bin/Res/sets/RV/_cards.dat +++ b/projects/mtg/bin/Res/sets/RV/_cards.dat @@ -1069,6 +1069,7 @@ abilities=flying text=Enchant creature Enchanted creature has haste. {0}: Untap enchanted creature. Activate this ability only during your turn and only once each turn. target=creature auto=haste +auto={0}:untap limit:1 myTurnOnly id=1252 name=Instill Energy rarity=U diff --git a/projects/mtg/bin/Res/test/_tests.txt b/projects/mtg/bin/Res/test/_tests.txt index f356ccedf..a01c6c32e 100644 --- a/projects/mtg/bin/Res/test/_tests.txt +++ b/projects/mtg/bin/Res/test/_tests.txt @@ -163,6 +163,7 @@ hypnotic_specter.txt icatian_priest.txt imaginary_pet.txt immaculate_magistrate.txt +instill_energy_i166.txt jump.txt keldon_warlord.txt keldon_warlord2.txt diff --git a/projects/mtg/bin/Res/test/bugs/instill_energy_i166.txt b/projects/mtg/bin/Res/test/instill_energy_i166.txt similarity index 80% rename from projects/mtg/bin/Res/test/bugs/instill_energy_i166.txt rename to projects/mtg/bin/Res/test/instill_energy_i166.txt index f266ba46e..e17be1f81 100644 --- a/projects/mtg/bin/Res/test/bugs/instill_energy_i166.txt +++ b/projects/mtg/bin/Res/test/instill_energy_i166.txt @@ -20,11 +20,7 @@ next next next # Try to untap Grizzly Bears. -# Not sure whether this is supposed to work by -# clicking on the bears or on the aura, so we -# do both: Instill Energy -Grizzly Bears # Now try to cast Assassinate on them. This will # only have an effect if the untapping failed. Swamp @@ -33,7 +29,7 @@ Plains Assassinate Grizzly Bears [ASSERT] -firstmain +secondmain [PLAYER1] inplay:Swamp,Forest,Plains,Grizzly Bears,Instill Energy hand:Assassinate diff --git a/projects/mtg/include/AllAbilities.h b/projects/mtg/include/AllAbilities.h index 79f5f2e65..f33af55d6 100644 --- a/projects/mtg/include/AllAbilities.h +++ b/projects/mtg/include/AllAbilities.h @@ -381,7 +381,7 @@ class GenericActivatedAbility:public ActivatedAbility{ MTGAbility * ability; int limitPerTurn; int counters; - GenericActivatedAbility(int _id, MTGCardInstance * card, MTGAbility * a, ManaCost * _cost, int _tap = 0, int limit = 0):ActivatedAbility(_id, card,_cost,0,_tap),ability(a),limitPerTurn(limit){ + GenericActivatedAbility(int _id, MTGCardInstance * card, MTGAbility * a, ManaCost * _cost, int _tap = 0, int limit = 0, int myTurnOnly = 0):ActivatedAbility(_id, card,_cost,myTurnOnly,_tap),ability(a),limitPerTurn(limit){ counters = 0; target = ability->target; } @@ -430,7 +430,7 @@ class GenericTargetAbility:public TargetAbility{ public: int limitPerTurn; int counters; - GenericTargetAbility(int _id, MTGCardInstance * _source, TargetChooser * _tc,MTGAbility * a, ManaCost * _cost = NULL, int _tap=0, int limit = 0):TargetAbility(_id,_source, _tc,_cost,0,_tap),limitPerTurn(limit){ + GenericTargetAbility(int _id, MTGCardInstance * _source, TargetChooser * _tc,MTGAbility * a, ManaCost * _cost = NULL, int _tap=0, int limit = 0, int myTurnOnly = 0):TargetAbility(_id,_source, _tc,_cost,myTurnOnly,_tap),limitPerTurn(limit){ ability = a; counters = 0; } @@ -1021,48 +1021,6 @@ class AUnBlocker:public MTGAbility{ }; -//Allows to untap target card once per turn for a manaCost -class AUntaperOnceDuringTurn:public AUnBlocker{ - public: - int untappedThisTurn; - int onlyPlayerTurn; - AUntaperOnceDuringTurn(int id, MTGCardInstance * _source, MTGCardInstance * _target, ManaCost * _cost, int _onlyPlayerTurn = 1):AUnBlocker(id, _source, _target, _cost){ - onlyPlayerTurn = _onlyPlayerTurn; - untappedThisTurn = 0; - } - - void Update(float dt){ - if (newPhase != currentPhase && newPhase == Constants::MTG_PHASE_UNTAP) untappedThisTurn = 0; - AUnBlocker::Update(dt); - } - - int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL){ - if (onlyPlayerTurn && game->currentPlayer!=source->controller()) return 0; - if (untappedThisTurn) return 0; - return AUnBlocker::isReactingToClick(card,mana); - } - - int reactToClick(MTGCardInstance * card){ - untappedThisTurn = 1; - return AUnBlocker::reactToClick(card); - } - - virtual ostream& toString(ostream& out) const - { - out << "AUntaperOnceDuringTurn ::: untappedThisTurn : " << untappedThisTurn - << " ; onlyPlayerTurn : " << onlyPlayerTurn - << " ("; - return AUnBlocker::toString(out) << ")"; - } - - AUntaperOnceDuringTurn * clone() const{ - AUntaperOnceDuringTurn * a = NEW AUntaperOnceDuringTurn(*this); - a->isClone = 1; - return a; - } - -}; - //Alteration of Power and Toughness (enchantments) class APowerToughnessModifier: public MTGAbility{ public: diff --git a/projects/mtg/src/MTGAbility.cpp b/projects/mtg/src/MTGAbility.cpp index 587c3414d..916341a0e 100644 --- a/projects/mtg/src/MTGAbility.cpp +++ b/projects/mtg/src/MTGAbility.cpp @@ -204,11 +204,14 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG int doTap = 0; //Tap in the cost ? if (s.find("{t}") != string::npos) doTap = 1; + int myTurnOnly = 0; + if (s.find("myturnonly") != string::npos) myTurnOnly = 1; + size_t delimiter = s.find("}:"); size_t firstNonSpace = s.find_first_not_of(" "); if (delimiter!= string::npos && firstNonSpace !=string::npos && s[firstNonSpace] == '{'){ ManaCost * cost = ManaCost::parseManaCost(s.substr(0,delimiter+1),NULL,card); - if (doTap || (cost && !cost->isNull())){ + if (doTap || cost){ string s1 = s.substr(delimiter+2); MTGAbility * a = parseMagicLine(s1, id, spell, card, 1); @@ -244,8 +247,8 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG tc = tcf.createTargetChooser(starget, card); } - if (tc) return NEW GenericTargetAbility(id, card, tc, a,cost, doTap,limit); - return NEW GenericActivatedAbility(id, card, a,cost,doTap,limit); + if (tc) return NEW GenericTargetAbility(id, card, tc, a,cost, doTap,limit,myTurnOnly); + return NEW GenericActivatedAbility(id, card, a,cost,doTap,limit,myTurnOnly); } SAFE_DELETE(cost); } @@ -1041,11 +1044,6 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){ game->addObserver(NEW AHowlingMine(_id, card)); break; } - case 1252: //Instill Energy - { - game->addObserver(NEW AUntaperOnceDuringTurn(_id, card, card->target, NEW ManaCost())); - break; - } case 1113: //Iron Star { int cost[] = {Constants::MTG_COLOR_ARTIFACT, 1};