* Fixed a problem of VariableCostImpl with stack abilities.

This commit is contained in:
LevelX2 2017-03-31 17:30:41 +02:00
parent a06470294b
commit db25867067

View file

@ -30,7 +30,7 @@ package mage.abilities.costs;
import java.util.UUID; import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.game.Game; import mage.game.Game;
import mage.game.stack.Spell; import mage.game.stack.StackObject;
import mage.players.Player; import mage.players.Player;
import mage.target.Target; import mage.target.Target;
import mage.target.Targets; import mage.target.Targets;
@ -132,13 +132,15 @@ public abstract class VariableCostImpl implements Cost, VariableCost {
@Override @Override
public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) {
return true; /* not used */ return true;
/* not used */
} }
@Override @Override
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) {
return true; /* not used */ return true;
/* not used */
} }
@ -166,9 +168,9 @@ public abstract class VariableCostImpl implements Cost, VariableCost {
public int announceXValue(Ability source, Game game) { public int announceXValue(Ability source, Game game) {
int xValue = 0; int xValue = 0;
Player controller = game.getPlayer(source.getControllerId()); Player controller = game.getPlayer(source.getControllerId());
Spell spell = game.getStack().getSpell(source.getId()); StackObject stackObject = game.getStack().getStackObject(source.getId());
if (controller != null if (controller != null
&& spell != null) { && stackObject != null) {
xValue = controller.announceXCost(getMinValue(source, game), getMaxValue(source, game), xValue = controller.announceXCost(getMinValue(source, game), getMaxValue(source, game),
"Announce the number of " + actionText, game, source, this); "Announce the number of " + actionText, game, source, this);
} }