From 448d618a8a67a570dfe6beb9887747bc77ef3080 Mon Sep 17 00:00:00 2001 From: jeffwadsworth Date: Thu, 27 Feb 2020 13:26:25 -0600 Subject: [PATCH] - Fixed #6297 --- Mage.Sets/src/mage/cards/a/AngelsGrace.java | 31 ++++++++++++--------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/Mage.Sets/src/mage/cards/a/AngelsGrace.java b/Mage.Sets/src/mage/cards/a/AngelsGrace.java index 41531be397b..ed5fc3d7992 100644 --- a/Mage.Sets/src/mage/cards/a/AngelsGrace.java +++ b/Mage.Sets/src/mage/cards/a/AngelsGrace.java @@ -1,4 +1,3 @@ - package mage.cards.a; import java.util.UUID; @@ -23,13 +22,15 @@ import mage.players.Player; public final class AngelsGrace extends CardImpl { public AngelsGrace(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{W}"); + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{W}"); - - // Split second (As long as this spell is on the stack, players can't cast spells or activate abilities that aren't mana abilities.) + // Split second (As long as this spell is on the stack, players can't + // cast spells or activate abilities that aren't mana abilities.) this.addAbility(new SplitSecondAbility()); - - // You can't lose the game this turn and your opponents can't win the game this turn. Until end of turn, damage that would reduce your life total to less than 1 reduces it to 1 instead. + + // You can't lose the game this turn and your opponents can't win the + // game this turn. Until end of turn, damage that would reduce your + // life total to less than 1 reduces it to 1 instead. this.getSpellAbility().addEffect(new AngelsGraceEffect()); this.getSpellAbility().addEffect(new AngelsGraceReplacementEffect()); } @@ -48,7 +49,8 @@ class AngelsGraceEffect extends ContinuousRuleModifyingEffectImpl { public AngelsGraceEffect() { super(Duration.EndOfTurn, Outcome.Benefit, false, false); - staticText = "You can't lose the game this turn and your opponents can't win the game this turn"; + staticText = "You can't lose the game this turn " + + "and your opponents can't win the game this turn"; } public AngelsGraceEffect(final AngelsGraceEffect effect) { @@ -64,11 +66,13 @@ class AngelsGraceEffect extends ContinuousRuleModifyingEffectImpl { public boolean checksEventType(GameEvent event, Game game) { return event.getType() == EventType.WINS || event.getType() == EventType.LOSES; } - + @Override public boolean applies(GameEvent event, Ability source, Game game) { - return (event.getType() == EventType.WINS && game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) || - (event.getType() == EventType.LOSES && event.getPlayerId().equals(source.getControllerId())); + return (event.getType() == EventType.WINS + && game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) + || (event.getType() == EventType.LOSES + && event.getPlayerId().equals(source.getControllerId())); } } @@ -77,7 +81,8 @@ class AngelsGraceReplacementEffect extends ReplacementEffectImpl { public AngelsGraceReplacementEffect() { super(Duration.EndOfTurn, Outcome.Benefit); - staticText = "Until end of turn, damage that would reduce your life total to less than 1 reduces it to 1 instead"; + staticText = "Until end of turn, damage that would reduce your " + + "life total to less than 1 reduces it to 1 instead"; } public AngelsGraceReplacementEffect(final AngelsGraceReplacementEffect effect) { @@ -94,13 +99,13 @@ class AngelsGraceReplacementEffect extends ReplacementEffectImpl { return event.getType() == EventType.DAMAGE_CAUSES_LIFE_LOSS; } - @Override public boolean applies(GameEvent event, Ability source, Game game) { if (event.getPlayerId().equals(source.getControllerId())) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null - && (controller.getLife() - event.getAmount()) < 1 ) { + && controller.getLife() > 0 + && (controller.getLife() - event.getAmount()) < 1) { event.setAmount(controller.getLife() - 1); } }