diff --git a/Mage/src/mage/abilities/costs/common/PayLifeCost.java b/Mage/src/mage/abilities/costs/common/PayLifeCost.java index 6c06822472..6cbfd27090 100644 --- a/Mage/src/mage/abilities/costs/common/PayLifeCost.java +++ b/Mage/src/mage/abilities/costs/common/PayLifeCost.java @@ -53,6 +53,9 @@ public class PayLifeCost extends CostImpl { @Override public boolean canPay(UUID sourceId, UUID controllerId, Game game) { + if (amount > 0 && !game.getPlayer(controllerId).isLifeTotalCanChange()) { + return false; + } return game.getPlayer(controllerId).getLife() > amount; } diff --git a/Mage/src/mage/abilities/costs/mana/PhyrexianManaCost.java b/Mage/src/mage/abilities/costs/mana/PhyrexianManaCost.java index 876b316640..445f249b46 100644 --- a/Mage/src/mage/abilities/costs/mana/PhyrexianManaCost.java +++ b/Mage/src/mage/abilities/costs/mana/PhyrexianManaCost.java @@ -66,6 +66,9 @@ public class PhyrexianManaCost extends ColoredManaCost { @Override public boolean canPay(UUID sourceId, UUID controllerId, Game game) { + if (!game.getPlayer(controllerId).isLifeTotalCanChange()) { + return false; + } return game.getPlayer(controllerId).getLife() > 2; } diff --git a/Mage/src/mage/players/Player.java b/Mage/src/mage/players/Player.java index be9e17f25b..491d660ee3 100644 --- a/Mage/src/mage/players/Player.java +++ b/Mage/src/mage/players/Player.java @@ -83,6 +83,8 @@ public interface Player extends MageItem, Copyable { public void setLife(int life, Game game); public int loseLife(int amount, Game game); public void gainLife(int amount, Game game); + public boolean isLifeTotalCanChange(); + public void setLifeTotalCanChange(boolean lifeTotalCanChange); public int damage(int damage, UUID sourceId, Game game, boolean combatDamage, boolean preventable); public Cards getHand(); public int getLandsPlayed(); diff --git a/Mage/src/mage/players/PlayerImpl.java b/Mage/src/mage/players/PlayerImpl.java index 99ba5e59ca..308b66db5e 100644 --- a/Mage/src/mage/players/PlayerImpl.java +++ b/Mage/src/mage/players/PlayerImpl.java @@ -98,6 +98,7 @@ public abstract class PlayerImpl> implements Player, Ser protected RangeOfInfluence range; protected Set inRange = new HashSet(); protected boolean isTestMode = false; + protected boolean lifeTotalCanChange = true; @Override public abstract T copy(); @@ -139,6 +140,7 @@ public abstract class PlayerImpl> implements Player, Ser this.passedTurn = player.passedTurn; this.left = player.left; this.range = player.range; + this.lifeTotalCanChange = player.lifeTotalCanChange; for (UUID id: player.inRange) { this.inRange.add(id); } @@ -176,6 +178,7 @@ public abstract class PlayerImpl> implements Player, Ser this.abilities.clear(); this.landsPerTurn = 1; this.maxHandSize = 7; + this.lifeTotalCanChange = true; } @Override @@ -614,11 +617,22 @@ public abstract class PlayerImpl> implements Player, Ser @Override public void setLife(int life, Game game) { - this.life = life; + if (this.lifeTotalCanChange) this.life = life; + } + + @Override + public void setLifeTotalCanChange(boolean lifeTotalCanChange) { + this.lifeTotalCanChange = lifeTotalCanChange; + } + + @Override + public boolean isLifeTotalCanChange() { + return this.lifeTotalCanChange; } @Override public int loseLife(int amount, Game game) { + if (!lifeTotalCanChange) return 0; GameEvent event = new GameEvent(GameEvent.EventType.LOSE_LIFE, playerId, playerId, playerId, amount, false); if (!game.replaceEvent(event)) { setLife(this.life - amount, game); @@ -630,6 +644,7 @@ public abstract class PlayerImpl> implements Player, Ser @Override public void gainLife(int amount, Game game) { + if (!lifeTotalCanChange) return; GameEvent event = new GameEvent(GameEvent.EventType.GAIN_LIFE, playerId, playerId, playerId, amount, false); if (!game.replaceEvent(event)) { setLife(this.life + amount, game);