Fixed ConvertedManaCostPredicate for stackObject

This commit is contained in:
Plopman 2013-08-13 19:04:09 +02:00
parent 827952ebb5
commit 61d0e7db0d

View file

@ -28,8 +28,11 @@
package mage.filter.predicate.mageobject;
import mage.MageObject;
import mage.abilities.costs.mana.ManaCost;
import mage.abilities.costs.mana.VariableManaCost;
import mage.filter.Filter;
import mage.filter.predicate.IntComparePredicate;
import mage.game.stack.StackObject;
/**
*
@ -43,8 +46,22 @@ public class ConvertedManaCostPredicate extends IntComparePredicate<MageObject>
@Override
protected int getInputValue(MageObject input) {
if(input instanceof StackObject){
int manaCost = 0;
for(ManaCost cost : input.getManaCost()){
if(cost instanceof VariableManaCost){
manaCost += ((StackObject)input).getStackAbility().getManaCostsToPay().getX();
}
else{
manaCost += cost.convertedManaCost();
}
}
return manaCost;
}
else{
return input.getManaCost().convertedManaCost();
}
}
@Override
public String toString() {