forked from External/mage
* Fixed a problem with variable life costs (e.g. Toxic Deluge) and prevent pay life effects (e.g. Angel of Jubilation) that did not work for those spells.
This commit is contained in:
parent
5b3bc1f96d
commit
4365449be3
2 changed files with 10 additions and 12 deletions
|
|
@ -1,16 +1,13 @@
|
|||
|
||||
|
||||
package mage.abilities.costs.common;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.CostImpl;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.dynamicvalue.common.StaticValue;
|
||||
import mage.game.Game;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.costs.Cost;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
|
|
@ -36,11 +33,12 @@ public class PayLifeCost extends CostImpl {
|
|||
|
||||
@Override
|
||||
public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) {
|
||||
//118.4. If a cost or effect allows a player to pay an amount of life greater than 0,
|
||||
//118.4. If a cost or effect allows a player to pay an amount of life greater than 0,
|
||||
//the player may do so only if their life total is greater than or equal to the
|
||||
//amount of the payment. If a player pays life, the payment is subtracted from his or
|
||||
//amount of the payment. If a player pays life, the payment is subtracted from his or
|
||||
//her life total; in other words, the player loses that much life. (Players can always pay 0 life.)
|
||||
int lifeToPayAmount = amount.calculate(game, ability, null);
|
||||
// Paying 0 life is not considered paying any life.
|
||||
if (lifeToPayAmount > 0 && !game.getPlayer(controllerId).canPayLifeCost()) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue