From f012e4567807df1e2a563c53de45e0b344cb637b Mon Sep 17 00:00:00 2001 From: theelk801 Date: Sun, 31 Mar 2024 11:01:00 -0400 Subject: [PATCH] [OTJ] Implement Magebane Lizard --- .../src/mage/cards/m/MagebaneLizard.java | 80 +++++++++++++++++++ .../mage/sets/OutlawsOfThunderJunction.java | 1 + 2 files changed, 81 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/m/MagebaneLizard.java diff --git a/Mage.Sets/src/mage/cards/m/MagebaneLizard.java b/Mage.Sets/src/mage/cards/m/MagebaneLizard.java new file mode 100644 index 00000000000..782ccfa60c4 --- /dev/null +++ b/Mage.Sets/src/mage/cards/m/MagebaneLizard.java @@ -0,0 +1,80 @@ +package mage.cards.m; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.SpellCastAllTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.SetTargetPointer; +import mage.constants.SubType; +import mage.filter.StaticFilters; +import mage.game.Game; +import mage.players.Player; +import mage.watchers.common.SpellsCastWatcher; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class MagebaneLizard extends CardImpl { + + public MagebaneLizard(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{R}"); + + this.subtype.add(SubType.LIZARD); + this.power = new MageInt(1); + this.toughness = new MageInt(4); + + // Whenever a player casts a noncreature spell, Magebane Lizard deals damage to that player equal to the number of noncreature spells they've cast this turn. + this.addAbility(new SpellCastAllTriggeredAbility( + new MagebaneLizardEffect(), StaticFilters.FILTER_SPELL_A_NON_CREATURE, + false, SetTargetPointer.PLAYER + )); + } + + private MagebaneLizard(final MagebaneLizard card) { + super(card); + } + + @Override + public MagebaneLizard copy() { + return new MagebaneLizard(this); + } +} + +class MagebaneLizardEffect extends OneShotEffect { + + MagebaneLizardEffect() { + super(Outcome.Benefit); + staticText = "{this} deals damage to that player equal to the number of noncreature spells they've cast this turn"; + } + + private MagebaneLizardEffect(final MagebaneLizardEffect effect) { + super(effect); + } + + @Override + public MagebaneLizardEffect copy() { + return new MagebaneLizardEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(getTargetPointer().getFirst(game, source)); + if (player == null) { + return false; + } + int count = game + .getState() + .getWatcher(SpellsCastWatcher.class) + .getSpellsCastThisTurn(player.getId()) + .stream() + .mapToInt(spell -> !spell.isCreature(game) ? 1 : 0) + .sum(); + return player.damage(count, source, game) > 0; + } +} diff --git a/Mage.Sets/src/mage/sets/OutlawsOfThunderJunction.java b/Mage.Sets/src/mage/sets/OutlawsOfThunderJunction.java index e5793252b7b..fb09a793552 100644 --- a/Mage.Sets/src/mage/sets/OutlawsOfThunderJunction.java +++ b/Mage.Sets/src/mage/sets/OutlawsOfThunderJunction.java @@ -124,6 +124,7 @@ public final class OutlawsOfThunderJunction extends ExpansionSet { cards.add(new SetCardInfo("Lush Oasis", 261, Rarity.COMMON, mage.cards.l.LushOasis.class)); cards.add(new SetCardInfo("Luxurious Locomotive", 244, Rarity.UNCOMMON, mage.cards.l.LuxuriousLocomotive.class)); cards.add(new SetCardInfo("Magda, the Hoardmaster", 133, Rarity.RARE, mage.cards.m.MagdaTheHoardmaster.class)); + cards.add(new SetCardInfo("Magebane Lizard", 134, Rarity.UNCOMMON, mage.cards.m.MagebaneLizard.class)); cards.add(new SetCardInfo("Make Your Own Luck", 218, Rarity.UNCOMMON, mage.cards.m.MakeYourOwnLuck.class)); cards.add(new SetCardInfo("Malcolm, the Eyes", 219, Rarity.RARE, mage.cards.m.MalcolmTheEyes.class)); cards.add(new SetCardInfo("Marauding Sphinx", 56, Rarity.UNCOMMON, mage.cards.m.MaraudingSphinx.class));