diff --git a/Mage.Sets/src/mage/cards/c/CloudsteelKirin.java b/Mage.Sets/src/mage/cards/c/CloudsteelKirin.java index dde6497a1c9..3b3404ccb03 100644 --- a/Mage.Sets/src/mage/cards/c/CloudsteelKirin.java +++ b/Mage.Sets/src/mage/cards/c/CloudsteelKirin.java @@ -3,15 +3,15 @@ package mage.cards.c; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.effects.ContinuousRuleModifyingEffectImpl; +import mage.abilities.effects.common.continuous.CantLoseGameSourceControllerEffect; import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect; import mage.abilities.keyword.FlyingAbility; import mage.abilities.keyword.ReconfigureAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; -import mage.constants.*; -import mage.game.Game; -import mage.game.events.GameEvent; +import mage.constants.AttachmentType; +import mage.constants.CardType; +import mage.constants.SubType; import java.util.UUID; @@ -36,7 +36,7 @@ public final class CloudsteelKirin extends CardImpl { FlyingAbility.getInstance(), AttachmentType.EQUIPMENT )); ability.addEffect(new GainAbilityAttachedEffect( - new SimpleStaticAbility(new CloudsteelKirinEffect()), AttachmentType.EQUIPMENT + new SimpleStaticAbility(new CantLoseGameSourceControllerEffect()), AttachmentType.EQUIPMENT ).setText("and \"You can't lose the game and your opponents can't win the game.\"")); this.addAbility(ability); @@ -53,37 +53,3 @@ public final class CloudsteelKirin extends CardImpl { return new CloudsteelKirin(this); } } - -class CloudsteelKirinEffect extends ContinuousRuleModifyingEffectImpl { - - CloudsteelKirinEffect() { - super(Duration.WhileOnBattlefield, Outcome.Benefit, false, false); - staticText = "You can't lose the game and your opponents can't win the game"; - } - - private CloudsteelKirinEffect(final CloudsteelKirinEffect effect) { - super(effect); - } - - @Override - public CloudsteelKirinEffect copy() { - return new CloudsteelKirinEffect(this); - } - - @Override - public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == GameEvent.EventType.WINS - || event.getType() == GameEvent.EventType.LOSES; - } - - @Override - public boolean applies(GameEvent event, Ability source, Game game) { - switch (event.getType()) { - case WINS: - return game.getOpponents(source.getControllerId()).contains(event.getPlayerId()); - case LOSES: - return source.isControlledBy(event.getPlayerId()); - } - return false; - } -} diff --git a/Mage.Sets/src/mage/cards/h/HeraldOfEternalDawn.java b/Mage.Sets/src/mage/cards/h/HeraldOfEternalDawn.java new file mode 100644 index 00000000000..a2179208682 --- /dev/null +++ b/Mage.Sets/src/mage/cards/h/HeraldOfEternalDawn.java @@ -0,0 +1,45 @@ +package mage.cards.h; + +import mage.MageInt; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.common.continuous.CantLoseGameSourceControllerEffect; +import mage.abilities.keyword.FlashAbility; +import mage.abilities.keyword.FlyingAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.SubType; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class HeraldOfEternalDawn extends CardImpl { + + public HeraldOfEternalDawn(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{W}{W}{W}"); + + this.subtype.add(SubType.ANGEL); + this.power = new MageInt(6); + this.toughness = new MageInt(6); + + // Flash + this.addAbility(FlashAbility.getInstance()); + + // Flying + this.addAbility(FlyingAbility.getInstance()); + + // You can't lose the game and your opponents can't win the game. + this.addAbility(new SimpleStaticAbility(new CantLoseGameSourceControllerEffect())); + } + + private HeraldOfEternalDawn(final HeraldOfEternalDawn card) { + super(card); + } + + @Override + public HeraldOfEternalDawn copy() { + return new HeraldOfEternalDawn(this); + } +} diff --git a/Mage.Sets/src/mage/cards/p/PlatinumAngel.java b/Mage.Sets/src/mage/cards/p/PlatinumAngel.java index 626b5856509..c4454f3a041 100644 --- a/Mage.Sets/src/mage/cards/p/PlatinumAngel.java +++ b/Mage.Sets/src/mage/cards/p/PlatinumAngel.java @@ -1,18 +1,13 @@ package mage.cards.p; import mage.MageInt; -import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.effects.ContinuousRuleModifyingEffectImpl; +import mage.abilities.effects.common.continuous.CantLoseGameSourceControllerEffect; import mage.abilities.keyword.FlyingAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.constants.Duration; -import mage.constants.Outcome; import mage.constants.SubType; -import mage.game.Game; -import mage.game.events.GameEvent; import java.util.UUID; @@ -28,7 +23,7 @@ public final class PlatinumAngel extends CardImpl { this.toughness = new MageInt(4); this.addAbility(FlyingAbility.getInstance()); - this.addAbility(new SimpleStaticAbility(new PlatinumAngelEffect())); + this.addAbility(new SimpleStaticAbility(new CantLoseGameSourceControllerEffect())); } private PlatinumAngel(final PlatinumAngel card) { @@ -40,37 +35,3 @@ public final class PlatinumAngel extends CardImpl { return new PlatinumAngel(this); } } - -class PlatinumAngelEffect extends ContinuousRuleModifyingEffectImpl { - - PlatinumAngelEffect() { - super(Duration.WhileOnBattlefield, Outcome.Benefit, false, false); - staticText = "You can't lose the game and your opponents can't win the game"; - } - - private PlatinumAngelEffect(final PlatinumAngelEffect effect) { - super(effect); - } - - @Override - public PlatinumAngelEffect copy() { - return new PlatinumAngelEffect(this); - } - - @Override - public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == GameEvent.EventType.WINS - || event.getType() == GameEvent.EventType.LOSES; - } - - @Override - public boolean applies(GameEvent event, Ability source, Game game) { - switch (event.getType()) { - case WINS: - return game.getOpponents(source.getControllerId()).contains(event.getPlayerId()); - case LOSES: - return source.isControlledBy(event.getPlayerId()); - } - return false; - } -} diff --git a/Mage.Sets/src/mage/cards/t/TheBookOfExaltedDeeds.java b/Mage.Sets/src/mage/cards/t/TheBookOfExaltedDeeds.java index 738792cdec8..b0bf6d21c85 100644 --- a/Mage.Sets/src/mage/cards/t/TheBookOfExaltedDeeds.java +++ b/Mage.Sets/src/mage/cards/t/TheBookOfExaltedDeeds.java @@ -2,7 +2,6 @@ package mage.cards.t; import mage.abilities.Ability; import mage.abilities.common.ActivateAsSorceryActivatedAbility; -import mage.abilities.triggers.BeginningOfEndStepTriggeredAbility; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.condition.Condition; import mage.abilities.condition.common.YouGainedLifeCondition; @@ -10,24 +9,23 @@ import mage.abilities.costs.common.ExileSourceCost; import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility; -import mage.abilities.effects.ContinuousRuleModifyingEffectImpl; import mage.abilities.effects.common.CreateTokenEffect; +import mage.abilities.effects.common.continuous.CantLoseGameSourceControllerEffect; import mage.abilities.effects.common.continuous.GainAbilityTargetEffect; import mage.abilities.effects.common.counter.AddCountersTargetEffect; import mage.abilities.hint.ConditionHint; import mage.abilities.hint.Hint; +import mage.abilities.triggers.BeginningOfEndStepTriggeredAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.*; import mage.counters.CounterType; import mage.filter.FilterPermanent; -import mage.game.Game; -import mage.game.events.GameEvent; +import mage.game.permanent.token.Angel33Token; import mage.target.TargetPermanent; import mage.watchers.common.PlayerGainedLifeWatcher; import java.util.UUID; -import mage.game.permanent.token.Angel33Token; /** * @author TheElk801 @@ -56,7 +54,7 @@ public final class TheBookOfExaltedDeeds extends CardImpl { new AddCountersTargetEffect(CounterType.ENLIGHTENED.createInstance()), new ManaCostsImpl<>("{W}{W}{W}") ); ability.addEffect(new GainAbilityTargetEffect( - new SimpleStaticAbility(new TheBookOfExaltedDeedsEffect()), Duration.Custom, + new SimpleStaticAbility(new CantLoseGameSourceControllerEffect()), Duration.Custom, "It gains \"You can't lose the game and your opponents can't win the game.\"" )); ability.addCost(new TapSourceCost()); @@ -74,37 +72,3 @@ public final class TheBookOfExaltedDeeds extends CardImpl { return new TheBookOfExaltedDeeds(this); } } - -class TheBookOfExaltedDeedsEffect extends ContinuousRuleModifyingEffectImpl { - - TheBookOfExaltedDeedsEffect() { - super(Duration.WhileOnBattlefield, Outcome.Benefit, false, false); - staticText = "You can't lose the game and your opponents can't win the game"; - } - - private TheBookOfExaltedDeedsEffect(final TheBookOfExaltedDeedsEffect effect) { - super(effect); - } - - @Override - public TheBookOfExaltedDeedsEffect copy() { - return new TheBookOfExaltedDeedsEffect(this); - } - - @Override - public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == GameEvent.EventType.WINS - || event.getType() == GameEvent.EventType.LOSES; - } - - @Override - public boolean applies(GameEvent event, Ability source, Game game) { - switch (event.getType()) { - case WINS: - return game.getOpponents(source.getControllerId()).contains(event.getPlayerId()); - case LOSES: - return source.isControlledBy(event.getPlayerId()); - } - return false; - } -} diff --git a/Mage.Sets/src/mage/sets/Foundations.java b/Mage.Sets/src/mage/sets/Foundations.java index 67b7dcce8f3..2b3a8474a2b 100644 --- a/Mage.Sets/src/mage/sets/Foundations.java +++ b/Mage.Sets/src/mage/sets/Foundations.java @@ -51,6 +51,7 @@ public final class Foundations extends ExpansionSet { cards.add(new SetCardInfo("Halana and Alena, Partners", 659, Rarity.RARE, mage.cards.h.HalanaAndAlenaPartners.class)); cards.add(new SetCardInfo("Harmless Offering", 625, Rarity.RARE, mage.cards.h.HarmlessOffering.class)); cards.add(new SetCardInfo("Helpful Hunter", 16, Rarity.COMMON, mage.cards.h.HelpfulHunter.class)); + cards.add(new SetCardInfo("Herald of Eternal Dawn", 17, Rarity.MYTHIC, mage.cards.h.HeraldOfEternalDawn.class)); cards.add(new SetCardInfo("Hero's Downfall", 175, Rarity.UNCOMMON, mage.cards.h.HerosDownfall.class)); cards.add(new SetCardInfo("Hidetsugu's Second Rite", 202, Rarity.UNCOMMON, mage.cards.h.HidetsugusSecondRite.class)); cards.add(new SetCardInfo("Highborn Vampire", 522, Rarity.COMMON, mage.cards.h.HighbornVampire.class)); diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/CantLoseGameSourceControllerEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/CantLoseGameSourceControllerEffect.java new file mode 100644 index 00000000000..4b207fb2533 --- /dev/null +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/CantLoseGameSourceControllerEffect.java @@ -0,0 +1,49 @@ +package mage.abilities.effects.common.continuous; + +import mage.abilities.Ability; +import mage.abilities.effects.ContinuousRuleModifyingEffectImpl; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.game.Game; +import mage.game.events.GameEvent; + +/** + * @author TheElk801 + */ +public class CantLoseGameSourceControllerEffect extends ContinuousRuleModifyingEffectImpl { + + public CantLoseGameSourceControllerEffect() { + super(Duration.WhileOnBattlefield, Outcome.Benefit, false, false); + staticText = "you can't lose the game and your opponents can't win the game"; + } + + private CantLoseGameSourceControllerEffect(final CantLoseGameSourceControllerEffect effect) { + super(effect); + } + + @Override + public CantLoseGameSourceControllerEffect copy() { + return new CantLoseGameSourceControllerEffect(this); + } + + @Override + public boolean checksEventType(GameEvent event, Game game) { + switch (event.getType()) { + case WINS: + case LOSES: + return true; + } + return false; + } + + @Override + public boolean applies(GameEvent event, Ability source, Game game) { + switch (event.getType()) { + case WINS: + return game.getOpponents(source.getControllerId()).contains(event.getPlayerId()); + case LOSES: + return source.isControlledBy(event.getPlayerId()); + } + return false; + } +} diff --git a/Mage/src/main/java/mage/game/command/emblems/GideonOfTheTrialsEmblem.java b/Mage/src/main/java/mage/game/command/emblems/GideonOfTheTrialsEmblem.java index bc9107acd9e..18c74af43d8 100644 --- a/Mage/src/main/java/mage/game/command/emblems/GideonOfTheTrialsEmblem.java +++ b/Mage/src/main/java/mage/game/command/emblems/GideonOfTheTrialsEmblem.java @@ -1,26 +1,31 @@ package mage.game.command.emblems; -import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.effects.ContinuousRuleModifyingEffectImpl; -import mage.constants.Duration; -import mage.constants.Outcome; +import mage.abilities.condition.Condition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; +import mage.abilities.decorator.ConditionalContinuousRuleModifyingEffect; +import mage.abilities.effects.common.continuous.CantLoseGameSourceControllerEffect; import mage.constants.SubType; import mage.constants.Zone; import mage.filter.common.FilterPlaneswalkerPermanent; -import mage.game.Game; import mage.game.command.Emblem; -import mage.game.events.GameEvent; /** * @author spjspj */ public final class GideonOfTheTrialsEmblem extends Emblem { + private static final Condition condition = new PermanentsOnTheBattlefieldCondition( + new FilterPlaneswalkerPermanent(SubType.GIDEON), true + ); + public GideonOfTheTrialsEmblem() { super("Emblem Gideon"); - Ability ability = new SimpleStaticAbility(Zone.COMMAND, new GideonOfTheTrialsCantLoseEffect()); - this.getAbilities().add(ability); + this.getAbilities().add(new SimpleStaticAbility( + Zone.COMMAND, + new ConditionalContinuousRuleModifyingEffect(new CantLoseGameSourceControllerEffect(), condition) + .setText("as long as you control a Gideon planeswalker, you can't lose the game and your opponents can't win the game") + )); } private GideonOfTheTrialsEmblem(final GideonOfTheTrialsEmblem card) { @@ -32,41 +37,3 @@ public final class GideonOfTheTrialsEmblem extends Emblem { return new GideonOfTheTrialsEmblem(this); } } - -class GideonOfTheTrialsCantLoseEffect extends ContinuousRuleModifyingEffectImpl { - - private static final FilterPlaneswalkerPermanent filter = new FilterPlaneswalkerPermanent("a Gideon planeswalker"); - - static { - filter.add(SubType.GIDEON.getPredicate()); - } - - public GideonOfTheTrialsCantLoseEffect() { - super(Duration.EndOfGame, Outcome.Benefit, false, false); - staticText = "As long as you control a Gideon planeswalker, you can't lose the game and your opponents can't win the game"; - } - - protected GideonOfTheTrialsCantLoseEffect(final GideonOfTheTrialsCantLoseEffect effect) { - super(effect); - } - - @Override - public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == GameEvent.EventType.WINS - || event.getType() == GameEvent.EventType.LOSES; - } - - @Override - public boolean applies(GameEvent event, Ability source, Game game) { - if ((event.getType() == GameEvent.EventType.WINS && game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) - || (event.getType() == GameEvent.EventType.LOSES && event.getPlayerId().equals(source.getControllerId()))) { - return game.getBattlefield().containsControlled(filter, source, game, 1); - } - return false; - } - - @Override - public GideonOfTheTrialsCantLoseEffect copy() { - return new GideonOfTheTrialsCantLoseEffect(this); - } -}