From 10ee22d8aee3571ce0a099373779a29b1b02c168 Mon Sep 17 00:00:00 2001 From: PurpleCrowbar <26198472+PurpleCrowbar@users.noreply.github.com> Date: Sun, 28 Aug 2022 04:48:31 +0100 Subject: [PATCH] [CLB] Implement Mazzy, Truesword Paladin (#9421) --- .../mage/cards/m/MazzyTrueswordPaladin.java | 142 ++++++++++++++++++ .../CommanderLegendsBattleForBaldursGate.java | 3 + 2 files changed, 145 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/m/MazzyTrueswordPaladin.java diff --git a/Mage.Sets/src/mage/cards/m/MazzyTrueswordPaladin.java b/Mage.Sets/src/mage/cards/m/MazzyTrueswordPaladin.java new file mode 100644 index 00000000000..b659d39dd13 --- /dev/null +++ b/Mage.Sets/src/mage/cards/m/MazzyTrueswordPaladin.java @@ -0,0 +1,142 @@ +package mage.cards.m; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.AttacksAllTriggeredAbility; +import mage.abilities.common.PutIntoGraveFromBattlefieldAllTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.asthought.PlayFromNotOwnHandZoneTargetEffect; +import mage.abilities.effects.common.continuous.BoostTargetEffect; +import mage.abilities.effects.common.continuous.GainAbilityTargetEffect; +import mage.abilities.keyword.TrampleAbility; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.common.FilterEnchantmentPermanent; +import mage.filter.predicate.permanent.EnchantedPredicate; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.players.Player; +import mage.target.targetpointer.FixedTarget; + +import java.util.Set; +import java.util.UUID; + +/** + * @author PurpleCrowbar + */ +public final class MazzyTrueswordPaladin extends CardImpl { + + private static final FilterEnchantmentPermanent filter + = new FilterEnchantmentPermanent("an Aura you control"); + + static { + filter.add(SubType.AURA.getPredicate()); + filter.add(TargetController.YOU.getControllerPredicate()); + } + + public MazzyTrueswordPaladin(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{R}{G}{W}"); + + this.addSuperType(SuperType.LEGENDARY); + this.subtype.add(SubType.HALFLING); + this.subtype.add(SubType.KNIGHT); + this.power = new MageInt(3); + this.toughness = new MageInt(4); + + // Whenever an enchanted creature attacks one of your opponents, it gets +2/+0 and gains trample until end of turn. + this.addAbility(new MazzyAttackTriggeredAbility()); + + // Whenever an Aura you control is put into your graveyard from the battlefield, exile it. Until the end of your next turn, you may cast that card. + this.addAbility(new PutIntoGraveFromBattlefieldAllTriggeredAbility(new MazzyExileEffect(), false, filter, true, true)); + } + + private MazzyTrueswordPaladin(final MazzyTrueswordPaladin card) { + super(card); + } + + @Override + public MazzyTrueswordPaladin copy() { + return new MazzyTrueswordPaladin(this); + } +} + +class MazzyAttackTriggeredAbility extends AttacksAllTriggeredAbility { + + private static final FilterCreaturePermanent filter + = new FilterCreaturePermanent("enchanted creature"); + + static { + filter.add(EnchantedPredicate.instance); + } + + MazzyAttackTriggeredAbility() { + super(new BoostTargetEffect(2, 0, Duration.EndOfTurn) + .setText("it gets +2/+0 and gains trample until end of turn"), false, filter, SetTargetPointer.PERMANENT, false); + this.addEffect(new GainAbilityTargetEffect(TrampleAbility.getInstance(), Duration.EndOfTurn)); + } + + MazzyAttackTriggeredAbility(final MazzyAttackTriggeredAbility effect) { + super(effect); + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + if (super.checkTrigger(event, game)) { + Player defender = game.getPlayer(event.getTargetId()); + if (defender == null) { + return false; + } + Set opponents = game.getOpponents(this.getControllerId()); + if (opponents != null && opponents.contains(defender.getId())) { + getEffects().setTargetPointer(new FixedTarget(event.getSourceId(), game)); + return true; + } + } + return false; + } + + @Override + public String getRule() { + return "Whenever an enchanted creature attacks one of your opponents, it gets +2/+0 and gains trample until end of turn."; + } + + @Override + public MazzyAttackTriggeredAbility copy() { + return new MazzyAttackTriggeredAbility(this); + } +} + + +class MazzyExileEffect extends OneShotEffect { + + public MazzyExileEffect() { + super(Outcome.Benefit); + staticText = "exile it. Until the end of your next turn, you may cast that card."; + } + + private MazzyExileEffect(final MazzyExileEffect effect) { + super(effect); + } + + @Override + public MazzyExileEffect copy() { + return new MazzyExileEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Card aura = getTargetPointer().getFirstTargetPermanentOrLKI(game, source); + if (aura == null) { + return false; + } + PlayFromNotOwnHandZoneTargetEffect.exileAndPlayFromExile( + game, source, aura, TargetController.YOU, + Duration.UntilEndOfYourNextTurn, + false, false, true + ); + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/CommanderLegendsBattleForBaldursGate.java b/Mage.Sets/src/mage/sets/CommanderLegendsBattleForBaldursGate.java index 191c8539d1e..d3f7475d1bb 100644 --- a/Mage.Sets/src/mage/sets/CommanderLegendsBattleForBaldursGate.java +++ b/Mage.Sets/src/mage/sets/CommanderLegendsBattleForBaldursGate.java @@ -364,6 +364,9 @@ public final class CommanderLegendsBattleForBaldursGate extends ExpansionSet { cards.add(new SetCardInfo("Martial Impetus", 33, Rarity.COMMON, mage.cards.m.MartialImpetus.class)); cards.add(new SetCardInfo("Marut", 322, Rarity.COMMON, mage.cards.m.Marut.class)); cards.add(new SetCardInfo("Maskwood Nexus", 865, Rarity.RARE, mage.cards.m.MaskwoodNexus.class)); + cards.add(new SetCardInfo("Mazzy, Truesword Paladin", 283, Rarity.RARE, mage.cards.m.MazzyTrueswordPaladin.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Mazzy, Truesword Paladin", 430, Rarity.RARE, mage.cards.m.MazzyTrueswordPaladin.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Mazzy, Truesword Paladin", 541, Rarity.RARE, mage.cards.m.MazzyTrueswordPaladin.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Memory Plunder", 849, Rarity.RARE, mage.cards.m.MemoryPlunder.class)); cards.add(new SetCardInfo("Meteor Golem", 323, Rarity.UNCOMMON, mage.cards.m.MeteorGolem.class)); cards.add(new SetCardInfo("Midnight Clock", 727, Rarity.RARE, mage.cards.m.MidnightClock.class));