diff --git a/Mage.Sets/src/mage/cards/c/CourageousResolve.java b/Mage.Sets/src/mage/cards/c/CourageousResolve.java index 361f8523223..b3719ad8181 100644 --- a/Mage.Sets/src/mage/cards/c/CourageousResolve.java +++ b/Mage.Sets/src/mage/cards/c/CourageousResolve.java @@ -1,4 +1,3 @@ - package mage.cards.c; import mage.MageObject; @@ -15,9 +14,7 @@ import mage.abilities.keyword.ProtectionAbility; import mage.cards.Card; import mage.cards.CardImpl; import mage.cards.CardSetInfo; -import mage.constants.CardType; -import mage.constants.Duration; -import mage.constants.Outcome; +import mage.constants.*; import mage.filter.StaticFilters; import mage.game.Game; import mage.game.events.GameEvent; @@ -46,9 +43,9 @@ public final class CourageousResolve extends CardImpl { this.getSpellAbility().addEffect(new DrawCardSourceControllerEffect(1).setText("Draw a card. (It can't be blocked, targeted, dealt damage, enchanted, or equipped by anything controlled by those players.)")); - //Fateful hour — If you have 5 or less life, you can't lose life this turn, you can't lose the game this turn, + // Fateful hour — If you have 5 or less life, you can't lose life this turn, you can't lose the game this turn, // and your opponents can't win the game this turn. - this.getSpellAbility().addEffect(new ConditionalContinuousEffect(new CantLoseLifeEffect(), FatefulHourCondition.instance, "
Fateful hour — If you have 5 or less life, you can't lose life this turn")); + this.getSpellAbility().addEffect(new ConditionalContinuousEffect(new CourageousResolveCantLoseLifeEffect(), FatefulHourCondition.instance, "
Fateful hour — If you have 5 or less life, you can't lose life this turn")); this.getSpellAbility().addEffect(new ConditionalContinuousRuleModifyingEffect(new CourageousResolveWinLoseEffect(), FatefulHourCondition.instance)); @@ -132,19 +129,19 @@ class CourageousResolveProtectionAbility extends ProtectionAbility { } } -class CantLoseLifeEffect extends ContinuousEffectImpl { +class CourageousResolveCantLoseLifeEffect extends ContinuousEffectImpl { - public CantLoseLifeEffect() { - super(Duration.EndOfTurn, Outcome.Benefit); + CourageousResolveCantLoseLifeEffect() { + super(Duration.EndOfTurn, Layer.PlayerEffects, SubLayer.NA, Outcome.Benefit); } - protected CantLoseLifeEffect(final CantLoseLifeEffect effect) { + protected CourageousResolveCantLoseLifeEffect(final CourageousResolveCantLoseLifeEffect effect) { super(effect); } @Override - public CantLoseLifeEffect copy() { - return new CantLoseLifeEffect(this); + public CourageousResolveCantLoseLifeEffect copy() { + return new CourageousResolveCantLoseLifeEffect(this); } @Override @@ -154,7 +151,7 @@ class CantLoseLifeEffect extends ContinuousEffectImpl { player.setCanLoseLife(false); return true; } - return true; + return false; } } diff --git a/Mage.Sets/src/mage/cards/e/EverybodyLives.java b/Mage.Sets/src/mage/cards/e/EverybodyLives.java new file mode 100644 index 00000000000..f719f9fb6b6 --- /dev/null +++ b/Mage.Sets/src/mage/cards/e/EverybodyLives.java @@ -0,0 +1,108 @@ +package mage.cards.e; + +import mage.abilities.Ability; +import mage.abilities.effects.ContinuousEffectImpl; +import mage.abilities.effects.ContinuousRuleModifyingEffectImpl; +import mage.abilities.effects.common.continuous.GainAbilityAllEffect; +import mage.abilities.keyword.HexproofAbility; +import mage.abilities.keyword.IndestructibleAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.filter.StaticFilters; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.players.Player; + +import java.util.UUID; + +/** + * @author padfoot + */ +public final class EverybodyLives extends CardImpl { + + public EverybodyLives(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{W}"); + + // All creatures gain hexproof and indestructible until end of turn. + this.getSpellAbility().addEffect(new GainAbilityAllEffect( + HexproofAbility.getInstance(), + Duration.EndOfTurn, + StaticFilters.FILTER_PERMANENT_ALL_CREATURES + ).setText("all creatures gain hexproof")); + this.getSpellAbility().addEffect(new GainAbilityAllEffect( + IndestructibleAbility.getInstance(), + Duration.EndOfTurn, + StaticFilters.FILTER_PERMANENT_ALL_CREATURES + ).setText("and indestructible until end of turn")); + + // Players gain hexproof until end of turn. Players can't lose life this turn and players can't lose the game or win the game this turn. + this.getSpellAbility().addEffect(new EverybodyLivesPlayerEffect()); + this.getSpellAbility().addEffect(new EverybodyLivesCantLoseOrWinGameEffect()); + } + + private EverybodyLives(final EverybodyLives card) { + super(card); + } + + @Override + public EverybodyLives copy() { + return new EverybodyLives(this); + } +} + +class EverybodyLivesPlayerEffect extends ContinuousEffectImpl { + + EverybodyLivesPlayerEffect() { + super(Duration.EndOfTurn, Layer.PlayerEffects, SubLayer.NA, Outcome.AddAbility); + this.staticText = "Players gain hexproof until end of turn. Players can't lose life this turn"; + } + + private EverybodyLivesPlayerEffect(final EverybodyLivesPlayerEffect effect) { + super(effect); + } + + @Override + public EverybodyLivesPlayerEffect copy() { + return new EverybodyLivesPlayerEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) { + Player player = game.getPlayer(playerId); + if (player != null) { + player.addAbility(HexproofAbility.getInstance()); + player.setCanLoseLife(false); + } + } + return true; + } +} + +class EverybodyLivesCantLoseOrWinGameEffect extends ContinuousRuleModifyingEffectImpl { + + EverybodyLivesCantLoseOrWinGameEffect() { + super(Duration.EndOfTurn, Outcome.Benefit, false, false); + staticText = "and players can't lose the game or win the game this turn"; + } + + private EverybodyLivesCantLoseOrWinGameEffect(final EverybodyLivesCantLoseOrWinGameEffect effect) { + super(effect); + } + + @Override + public EverybodyLivesCantLoseOrWinGameEffect copy() { + return new EverybodyLivesCantLoseOrWinGameEffect(this); + } + + @Override + public boolean checksEventType(GameEvent event, Game game) { + return (event.getType() == GameEvent.EventType.LOSES || event.getType() == GameEvent.EventType.WINS); + } + + @Override + public boolean applies(GameEvent event, Ability source, Game game) { + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/DoctorWho.java b/Mage.Sets/src/mage/sets/DoctorWho.java index a7eec56c7bf..355a2dcda6c 100644 --- a/Mage.Sets/src/mage/sets/DoctorWho.java +++ b/Mage.Sets/src/mage/sets/DoctorWho.java @@ -295,10 +295,10 @@ public final class DoctorWho extends ExpansionSet { cards.add(new SetCardInfo("Ensnared by the Mara", 689, Rarity.RARE, mage.cards.e.EnsnaredByTheMara.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Ensnared by the Mara", 84, Rarity.RARE, mage.cards.e.EnsnaredByTheMara.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Ensnared by the Mara", 975, Rarity.RARE, mage.cards.e.EnsnaredByTheMara.class, NON_FULL_USE_VARIOUS)); - //cards.add(new SetCardInfo("Everybody Lives!", 18, Rarity.RARE, mage.cards.e.EverybodyLives.class, NON_FULL_USE_VARIOUS)); - //cards.add(new SetCardInfo("Everybody Lives!", 338, Rarity.RARE, mage.cards.e.EverybodyLives.class, NON_FULL_USE_VARIOUS)); - //cards.add(new SetCardInfo("Everybody Lives!", 623, Rarity.RARE, mage.cards.e.EverybodyLives.class, NON_FULL_USE_VARIOUS)); - //cards.add(new SetCardInfo("Everybody Lives!", 929, Rarity.RARE, mage.cards.e.EverybodyLives.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Everybody Lives!", 18, Rarity.RARE, mage.cards.e.EverybodyLives.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Everybody Lives!", 338, Rarity.RARE, mage.cards.e.EverybodyLives.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Everybody Lives!", 623, Rarity.RARE, mage.cards.e.EverybodyLives.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Everybody Lives!", 929, Rarity.RARE, mage.cards.e.EverybodyLives.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Everything Comes to Dust", 19, Rarity.RARE, mage.cards.e.EverythingComesToDust.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Everything Comes to Dust", 339, Rarity.RARE, mage.cards.e.EverythingComesToDust.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Everything Comes to Dust", 624, Rarity.RARE, mage.cards.e.EverythingComesToDust.class, NON_FULL_USE_VARIOUS));