mirror of
https://github.com/correl/mage.git
synced 2024-11-16 03:00:12 +00:00
Fixed ConvertedManaCostPredicate for stackObject
This commit is contained in:
parent
827952ebb5
commit
61d0e7db0d
1 changed files with 18 additions and 1 deletions
|
@ -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() {
|
||||
|
|
Loading…
Reference in a new issue