From 14c22137ce6816b8bd97e6ba975f6ffae7dffe02 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Mon, 6 Jan 2020 21:40:50 -0500 Subject: [PATCH] Implemented Anax, Hardened in the Forge --- .../mage/cards/a/AnaxHardenedInTheForge.java | 97 +++++++++++++++++++ .../src/mage/sets/TherosBeyondDeath.java | 1 + .../permanent/token/SatyrCantBlockToken.java | 34 +++++++ 3 files changed, 132 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/a/AnaxHardenedInTheForge.java create mode 100644 Mage/src/main/java/mage/game/permanent/token/SatyrCantBlockToken.java diff --git a/Mage.Sets/src/mage/cards/a/AnaxHardenedInTheForge.java b/Mage.Sets/src/mage/cards/a/AnaxHardenedInTheForge.java new file mode 100644 index 0000000000..dc7ab23b07 --- /dev/null +++ b/Mage.Sets/src/mage/cards/a/AnaxHardenedInTheForge.java @@ -0,0 +1,97 @@ +package mage.cards.a; + +import mage.MageInt; +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.dynamicvalue.common.DevotionCount; +import mage.abilities.effects.common.CreateTokenEffect; +import mage.abilities.effects.common.continuous.SetPowerSourceEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.events.ZoneChangeEvent; +import mage.game.permanent.PermanentToken; +import mage.game.permanent.token.SatyrCantBlockToken; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class AnaxHardenedInTheForge extends CardImpl { + + public AnaxHardenedInTheForge(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT, CardType.CREATURE}, "{1}{R}{R}{R}"); + + this.addSuperType(SuperType.LEGENDARY); + this.subtype.add(SubType.DEMIGOD); + this.power = new MageInt(0); + this.toughness = new MageInt(3); + + // Anax's power is equal to your devotion to red. + this.addAbility(new SimpleStaticAbility( + Zone.ALL, + new SetPowerSourceEffect(DevotionCount.R, Duration.EndOfGame) + .setText("{this}'s power is equal to your devotion to red") + ).addHint(DevotionCount.R.getHint())); + + // Whenever Anax or another nontoken creature you control dies, create a 1/1 red Satyr creature token with "This creature can't block." If the creature had 4 power or greater, create two of those tokens instead. + this.addAbility(new AnaxHardenedInTheForgeTriggeredAbility()); + } + + private AnaxHardenedInTheForge(final AnaxHardenedInTheForge card) { + super(card); + } + + @Override + public AnaxHardenedInTheForge copy() { + return new AnaxHardenedInTheForge(this); + } +} + +class AnaxHardenedInTheForgeTriggeredAbility extends TriggeredAbilityImpl { + + AnaxHardenedInTheForgeTriggeredAbility() { + super(Zone.BATTLEFIELD, null, false); + } + + private AnaxHardenedInTheForgeTriggeredAbility(final AnaxHardenedInTheForgeTriggeredAbility ability) { + super(ability); + } + + @Override + public AnaxHardenedInTheForgeTriggeredAbility copy() { + return new AnaxHardenedInTheForgeTriggeredAbility(this); + } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.ZONE_CHANGE; + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + ZoneChangeEvent zEvent = (ZoneChangeEvent) event; + if (!zEvent.isDiesEvent()) { + return false; + } + if (!zEvent.getTarget().getId().equals(getSourceId()) + && (zEvent.getTarget() instanceof PermanentToken + || !zEvent.getTarget().isCreature())) { + return false; + } + int tokenCount = zEvent.getTarget().getPower().getValue() > 3 ? 2 : 1; + this.getEffects().clear(); + this.addEffect(new CreateTokenEffect(new SatyrCantBlockToken(), tokenCount)); + return true; + } + + @Override + public String getRule() { + return "Whenever {this} or another nontoken creature you control dies, " + + "create a 1/1 red Satyr creature token with \"This creature can't block.\" " + + "If the creature had 4 power or greater, create two of those tokens instead."; + } +} diff --git a/Mage.Sets/src/mage/sets/TherosBeyondDeath.java b/Mage.Sets/src/mage/sets/TherosBeyondDeath.java index aa8d08af0a..54c6afe065 100644 --- a/Mage.Sets/src/mage/sets/TherosBeyondDeath.java +++ b/Mage.Sets/src/mage/sets/TherosBeyondDeath.java @@ -27,6 +27,7 @@ public final class TherosBeyondDeath extends ExpansionSet { this.maxCardNumberInBooster = 254; cards.add(new SetCardInfo("Allure of the Unknown", 207, Rarity.RARE, mage.cards.a.AllureOfTheUnknown.class)); + cards.add(new SetCardInfo("Anax, Hardened in the Forge", 125, Rarity.UNCOMMON, mage.cards.a.AnaxHardenedInTheForge.class)); cards.add(new SetCardInfo("Aphemia, the Cacophony", 84, Rarity.RARE, mage.cards.a.AphemiaTheCacophony.class)); cards.add(new SetCardInfo("Arasta of the Endless Web", 165, Rarity.RARE, mage.cards.a.ArastaOfTheEndlessWeb.class)); cards.add(new SetCardInfo("Archon of Falling Stars", 2, Rarity.UNCOMMON, mage.cards.a.ArchonOfFallingStars.class)); diff --git a/Mage/src/main/java/mage/game/permanent/token/SatyrCantBlockToken.java b/Mage/src/main/java/mage/game/permanent/token/SatyrCantBlockToken.java new file mode 100644 index 0000000000..89998d219a --- /dev/null +++ b/Mage/src/main/java/mage/game/permanent/token/SatyrCantBlockToken.java @@ -0,0 +1,34 @@ +package mage.game.permanent.token; + +import mage.MageInt; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.common.combat.CantBlockSourceEffect; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.SubType; + +/** + * @author TheElk801 + */ +public final class SatyrCantBlockToken extends TokenImpl { + + public SatyrCantBlockToken() { + super("Satyr", "1/1 red Satyr creature token with \"This creature can't block.\""); + cardType.add(CardType.CREATURE); + color.setRed(true); + subtype.add(SubType.SATYR); + power = new MageInt(1); + toughness = new MageInt(1); + + this.addAbility(new SimpleStaticAbility(new CantBlockSourceEffect(Duration.WhileOnBattlefield) + .setText("this creature can't block"))); + } + + private SatyrCantBlockToken(final SatyrCantBlockToken token) { + super(token); + } + + public SatyrCantBlockToken copy() { + return new SatyrCantBlockToken(this); + } +}