ifthen ability sometimes wasn't grabbing the right target, i now pass it through MTGAbility creations target.
also, i see now why targeted counter cost were left broken for so long. i think this way fixes it in all cases. what a pain.
This commit is contained in:
@@ -626,11 +626,19 @@ int CounterCost::canPay()
|
||||
if (counter->nb >= 0)
|
||||
return 1; //add counters always possible
|
||||
// otherwise, move on only if target has enough counters
|
||||
Counter * targetCounter = NULL;
|
||||
if(target)
|
||||
{
|
||||
Counter * targetCounter = target->counters->hasCounter(counter->name.c_str(), counter->power, counter->toughness);
|
||||
if (targetCounter && targetCounter->nb >= -counter->nb)
|
||||
return 1;
|
||||
targetCounter = target->counters->hasCounter(counter->name.c_str(), counter->power, counter->toughness);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
targetCounter = source->counters->hasCounter(counter->name.c_str(), counter->power, counter->toughness);
|
||||
}
|
||||
if (targetCounter && targetCounter->nb >= -counter->nb)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user