From 6e327379fd1dcad6dcc4ff206347fda3fa0faff5 Mon Sep 17 00:00:00 2001 From: "wrenczes@gmail.com" Date: Sat, 4 Dec 2010 07:39:32 +0000 Subject: [PATCH] Fix for Issue 529, May abilities with counters shouldn't present selection dialog when counters == 0. The problem I found was specific to ManaProducer. I added an additional check when calling isReactingToClick(), if the cost has an extra cost, check if it can be paid. For this to work though, I had to change things around a little - there was a hack in the parsing code for ManaProducer abilities, where the cost wasn't being passed into the constructor. To compensate, the extra cost was being set during reactToClick, but this is too late, as isReactingToClick is called first. Now, where the hack occurs, after we construct the ManaProducer, if there's a cost, make sure we set the extra cost action immediately. This seems to work well for the Vivid Creek card case: once the counters are tapped out, the menu system doesn't add the extra card abilities anymore, and you simply get the land tap without the menu popping up. I'm not seeing any adverse effects so far with other mana producer cards, but I'd appreciate a sanity check from other people here in case there's some other fallout I'm not seeing from this change. --- projects/mtg/src/MTGAbility.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/projects/mtg/src/MTGAbility.cpp b/projects/mtg/src/MTGAbility.cpp index b8ab0e03c..2177992d3 100644 --- a/projects/mtg/src/MTGAbility.cpp +++ b/projects/mtg/src/MTGAbility.cpp @@ -569,6 +569,8 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG if (amp) { amp->cost = cost; + if (cost && card->typeAsTarget() == TARGET_CARD) + cost->setExtraCostsAction(a, card); amp->oneShot = 0; amp->tap = doTap; return amp; @@ -3640,6 +3642,10 @@ int AManaProducer::isReactingToClick(MTGCardInstance * _card, ManaCost * mana) if (!cost || mana->canAfford(cost)) { result = 1; + if (cost && cost->extraCosts != NULL) + { + return cost->canPayExtra(); + } } } return result; @@ -3671,7 +3677,6 @@ int AManaProducer::reactToClick(MTGCardInstance * _card) return 0; if (cost) { - cost->setExtraCostsAction(this, _card); if (!cost->isExtraPaymentSet()) { GameObserver::GetInstance()->waitForExtraPayment = cost->extraCosts;