From 6bbe2907625655aefa1c6cc862738d7a79c9274f Mon Sep 17 00:00:00 2001 From: Dmitry Panin Date: Wed, 30 Oct 2013 12:39:08 +0400 Subject: [PATCH] Fixed bug with syncopate to consume all the mana available Now pay[[{x}]] is not supported because of this. use "pay[[{value:storedx}]]" instead --- projects/mtg/bin/Res/sets/primitives/mtg.txt | 2 +- projects/mtg/bin/Res/test/counter_unless_pay_x.txt | 6 +++--- projects/mtg/src/AllAbilities.cpp | 9 +++------ projects/mtg/src/ManaCost.cpp | 2 +- 4 files changed, 8 insertions(+), 11 deletions(-) diff --git a/projects/mtg/bin/Res/sets/primitives/mtg.txt b/projects/mtg/bin/Res/sets/primitives/mtg.txt index a35932502..bf8f0e792 100644 --- a/projects/mtg/bin/Res/sets/primitives/mtg.txt +++ b/projects/mtg/bin/Res/sets/primitives/mtg.txt @@ -88480,7 +88480,7 @@ toughness=3 [card] name=Syncopate target=*|stack -auto=transforms((,newability[pay[[{x}]] name(pay {value} mana) donothing?fizzleto(exile)])) forever +auto=transforms((,newability[pay[[{value:storedx}]] name(pay {value} mana) donothing?fizzleto(exile)])) forever text=Counter target spell unless its controller pays {X}. If that spell is countered this way, exile it instead of putting it into its owner's graveyard. mana={X}{U} type=Instant diff --git a/projects/mtg/bin/Res/test/counter_unless_pay_x.txt b/projects/mtg/bin/Res/test/counter_unless_pay_x.txt index 8c156d14f..e68e3a0fd 100644 --- a/projects/mtg/bin/Res/test/counter_unless_pay_x.txt +++ b/projects/mtg/bin/Res/test/counter_unless_pay_x.txt @@ -1,10 +1,10 @@ #Testing Counter unless pay {X} mechanic -#P1 casts Think Twice with {4} left in his mana pool and P2 counters with Syncopate using X = 3. P1 chooses to pay {3} and Think Twice resolves with {1} left in his mana pool. +#P1 casts Think Twice with {5} left in his mana pool and P2 counters with Syncopate using X = 3. P1 chooses to pay {3} and Think Twice resolves with {2} left in his mana pool. [INIT] firstmain [PLAYER1] hand:think twice -manapool:{5}{U} +manapool:{1}{U}{5} library:counterspell [PLAYER2] hand:syncopate @@ -21,7 +21,7 @@ firstmain [PLAYER1] hand:counterspell graveyard:think twice -manapool:{1} +manapool:{2} [PLAYER2] graveyard:syncopate [END] \ No newline at end of file diff --git a/projects/mtg/src/AllAbilities.cpp b/projects/mtg/src/AllAbilities.cpp index 96ae5650b..00cf88989 100644 --- a/projects/mtg/src/AllAbilities.cpp +++ b/projects/mtg/src/AllAbilities.cpp @@ -1144,9 +1144,6 @@ int GenericPaidAbility::resolve() baseAbility = Af.parseMagicLine(baseAbilityStrSplit[0], this->GetId(), NULL, source); baseAbility->target = target; optionalCost = ManaCost::parseManaCost(baseCost, NULL, source); - if (optionalCost->hasX()) { - optionalCost->add(Constants::MTG_COLOR_ARTIFACT, source->storedSourceCard->X); - } // hacky way to produce better MenuText AAFakeAbility* isFake = dynamic_cast< AAFakeAbility* >( baseAbility ); @@ -3530,10 +3527,10 @@ int MenuAbility::reactToChoiceClick(Targetable * object,int choice,int control) if (mClone && !toPay && optionalCosts.size() && i < int(optionalCosts.size()) && optionalCosts[i])//paidability only supports the first ability as paid for now. { toPay = NEW ManaCost(); - if(optionalCosts[i]->extraCosts) - toPay->extraCosts = optionalCosts[i]->extraCosts->clone(); + if (optionalCosts[i]->extraCosts) + toPay->extraCosts = optionalCosts[i]->extraCosts->clone(); toPay->addExtraCost(NEW ExtraManaCost(NEW ManaCost(optionalCosts[i]))); - toPay->setExtraCostsAction(this,source); + toPay->setExtraCostsAction(this, source); game->mExtraPayment = toPay->extraCosts; return 0; } diff --git a/projects/mtg/src/ManaCost.cpp b/projects/mtg/src/ManaCost.cpp index be10a2b55..7f866c179 100644 --- a/projects/mtg/src/ManaCost.cpp +++ b/projects/mtg/src/ManaCost.cpp @@ -424,7 +424,7 @@ int ManaCost::hasX() DebugTrace("Seems ManaCost was not properly initialized"); return 0; } - if(xColor > 0) + if (xColor > 0) return 0; return cost[Constants::NB_Colors];