From 70cf2158a9458be322ea8a40b71302938ed8ee49 Mon Sep 17 00:00:00 2001 From: Paul Davies Date: Sat, 29 Apr 2023 13:40:11 +0100 Subject: [PATCH] [MIR] implemented Basalt Golem (#10285) * added MIR Basalt Golem + Wall Token * fixed card number, effect text, possible NPE simplified effect code --- Mage.Sets/src/mage/cards/b/BasaltGolem.java | 88 +++++++++++++++++++ Mage.Sets/src/mage/sets/Mirage.java | 3 +- .../mage/game/permanent/token/WallToken.java | 31 +++++++ 3 files changed, 121 insertions(+), 1 deletion(-) create mode 100644 Mage.Sets/src/mage/cards/b/BasaltGolem.java create mode 100644 Mage/src/main/java/mage/game/permanent/token/WallToken.java diff --git a/Mage.Sets/src/mage/cards/b/BasaltGolem.java b/Mage.Sets/src/mage/cards/b/BasaltGolem.java new file mode 100644 index 0000000000..92b3fbd754 --- /dev/null +++ b/Mage.Sets/src/mage/cards/b/BasaltGolem.java @@ -0,0 +1,88 @@ +package mage.cards.b; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.BecomesBlockedByCreatureTriggeredAbility; +import mage.abilities.common.SimpleEvasionAbility; +import mage.abilities.common.delayed.AtTheEndOfCombatDelayedTriggeredAbility; +import mage.abilities.effects.Effect; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect; +import mage.abilities.effects.common.combat.CantBeBlockedByCreaturesSourceEffect; +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.filter.StaticFilters; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.game.permanent.token.WallToken; +import mage.players.Player; + +/** + * + * @author lagdotcom + */ +public final class BasaltGolem extends CardImpl { + + public BasaltGolem(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{5}"); + + this.subtype.add(SubType.GOLEM); + this.power = new MageInt(2); + this.toughness = new MageInt(4); + + // Basalt Golem can't be blocked by artifact creatures. + this.addAbility(new SimpleEvasionAbility(new CantBeBlockedByCreaturesSourceEffect( + StaticFilters.FILTER_PERMANENTS_ARTIFACT_CREATURE, Duration.WhileOnBattlefield))); + + // Whenever Basalt Golem becomes blocked by a creature, that creature's controller sacrifices it at end of combat. If the player does, they put a 0/2 colorless Wall artifact creature token with defender onto the battlefield. + Effect effect = new CreateDelayedTriggeredAbilityEffect(new AtTheEndOfCombatDelayedTriggeredAbility(new BasaltGolemEffect()), true); + effect.setText("that creature's controller sacrifices it at end of combat. If the player does, they put a 0/2 colorless Wall artifact creature token with defender onto the battlefield."); + this.addAbility(new BecomesBlockedByCreatureTriggeredAbility(effect, false)); + } + + private BasaltGolem(final BasaltGolem card) { + super(card); + } + + @Override + public BasaltGolem copy() { + return new BasaltGolem(this); + } +} + +class BasaltGolemEffect extends OneShotEffect { + BasaltGolemEffect() { + super(Outcome.DestroyPermanent); + staticText = "that creature's controller sacrifices it. If the player does, they create a 0/2 colorless Wall artifact creature token with defender."; + } + + private BasaltGolemEffect(final BasaltGolemEffect effect) { + super(effect); + } + + @Override + public BasaltGolemEffect copy() { + return new BasaltGolemEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent creature = game.getPermanent(targetPointer.getFirst(game, source)); + if (creature == null) + return false; + + Player player = game.getPlayer(creature.getControllerId()); + if (player == null) + return false; + + if (!creature.sacrifice(source, game)) + return false; + + return new WallToken().putOntoBattlefield(1, game, source, player.getId()); + } +} diff --git a/Mage.Sets/src/mage/sets/Mirage.java b/Mage.Sets/src/mage/sets/Mirage.java index b610c32683..47d804ddfc 100644 --- a/Mage.Sets/src/mage/sets/Mirage.java +++ b/Mage.Sets/src/mage/sets/Mirage.java @@ -43,6 +43,7 @@ public final class Mirage extends ExpansionSet { cards.add(new SetCardInfo("Bad River", 324, Rarity.UNCOMMON, mage.cards.b.BadRiver.class)); cards.add(new SetCardInfo("Barbed Foliage", 207, Rarity.UNCOMMON, mage.cards.b.BarbedFoliage.class)); cards.add(new SetCardInfo("Barbed-Back Wurm", 105, Rarity.UNCOMMON, mage.cards.b.BarbedBackWurm.class)); + cards.add(new SetCardInfo("Basalt Golem", 294, Rarity.UNCOMMON, mage.cards.b.BasaltGolem.class)); cards.add(new SetCardInfo("Bay Falcon", 54, Rarity.COMMON, mage.cards.b.BayFalcon.class)); cards.add(new SetCardInfo("Bazaar of Wonders", 55, Rarity.RARE, mage.cards.b.BazaarOfWonders.class)); cards.add(new SetCardInfo("Benevolent Unicorn", 4, Rarity.COMMON, mage.cards.b.BenevolentUnicorn.class)); @@ -354,4 +355,4 @@ public final class Mirage extends ExpansionSet { cards.add(new SetCardInfo("Zombie Mob", 153, Rarity.UNCOMMON, mage.cards.z.ZombieMob.class)); cards.add(new SetCardInfo("Zuberi, Golden Feather", 51, Rarity.RARE, mage.cards.z.ZuberiGoldenFeather.class)); } -} \ No newline at end of file +} diff --git a/Mage/src/main/java/mage/game/permanent/token/WallToken.java b/Mage/src/main/java/mage/game/permanent/token/WallToken.java new file mode 100644 index 0000000000..0a92727b0c --- /dev/null +++ b/Mage/src/main/java/mage/game/permanent/token/WallToken.java @@ -0,0 +1,31 @@ +package mage.game.permanent.token; + +import mage.MageInt; +import mage.abilities.keyword.DefenderAbility; +import mage.constants.CardType; +import mage.constants.SubType; + +/** + * + * @author lagdotcom + */ +public final class WallToken extends TokenImpl { + + public WallToken() { + super("Wall Token", "0/2 colorless Wall artifact creature token with defender"); + cardType.add(CardType.ARTIFACT); + cardType.add(CardType.CREATURE); + subtype.add(SubType.WALL); + power = new MageInt(0); + toughness = new MageInt(2); + addAbility(DefenderAbility.getInstance()); + } + + public WallToken(final WallToken token) { + super(token); + } + + public WallToken copy() { + return new WallToken(this); + } +}