From 3b44fb19679f887c106b305eea40a427f60ddb15 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Thu, 31 Mar 2022 17:34:25 -0400 Subject: [PATCH] [SNC] Implemented Lord Xander, the Collector --- .../mage/cards/l/LordXanderTheCollector.java | 149 ++++++++++++++++++ .../src/mage/sets/StreetsOfNewCapenna.java | 1 + Utils/mtg-cards-data.txt | 1 + 3 files changed, 151 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/l/LordXanderTheCollector.java diff --git a/Mage.Sets/src/mage/cards/l/LordXanderTheCollector.java b/Mage.Sets/src/mage/cards/l/LordXanderTheCollector.java new file mode 100644 index 0000000000..f9e4101f38 --- /dev/null +++ b/Mage.Sets/src/mage/cards/l/LordXanderTheCollector.java @@ -0,0 +1,149 @@ +package mage.cards.l; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.Mode; +import mage.abilities.common.AttacksTriggeredAbility; +import mage.abilities.common.DiesSourceTriggeredAbility; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.filter.StaticFilters; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.TargetPermanent; +import mage.target.common.TargetControlledPermanent; +import mage.target.common.TargetOpponent; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class LordXanderTheCollector extends CardImpl { + + public LordXanderTheCollector(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{U}{B}{R}"); + + this.addSuperType(SuperType.LEGENDARY); + this.subtype.add(SubType.VAMPIRE); + this.subtype.add(SubType.DEMON); + this.subtype.add(SubType.NOBLE); + this.power = new MageInt(6); + this.toughness = new MageInt(6); + + // When Lord Xander, the Collector enters the battlefield, target opponent discards half the cards in their hand, rounded down. + Ability ability = new EntersBattlefieldTriggeredAbility(LordXanderTheCollectorEffectType.DISCARD.makeEffect()); + ability.addTarget(new TargetOpponent()); + this.addAbility(ability); + + // Whenever Lord Xander attacks, defending player mills half their library, rounded down. + this.addAbility(new AttacksTriggeredAbility( + LordXanderTheCollectorEffectType.MILL.makeEffect(), + false, null, SetTargetPointer.PLAYER + )); + + // When Lord Xander dies, target opponent sacrifices half the nonland permanents they control, rounded down. + ability = new DiesSourceTriggeredAbility(LordXanderTheCollectorEffectType.SACRIFICE.makeEffect()); + ability.addTarget(new TargetOpponent()); + this.addAbility(ability); + } + + private LordXanderTheCollector(final LordXanderTheCollector card) { + super(card); + } + + @Override + public LordXanderTheCollector copy() { + return new LordXanderTheCollector(this); + } +} + +enum LordXanderTheCollectorEffectType { + DISCARD, MILL, SACRIFICE; + + LordXanderTheCollectorEffect makeEffect() { + return new LordXanderTheCollectorEffect(this); + } +} + +class LordXanderTheCollectorEffect extends OneShotEffect { + private final LordXanderTheCollectorEffectType effectType; + + LordXanderTheCollectorEffect(LordXanderTheCollectorEffectType LordXanderTheCollectorEffectType) { + super(Outcome.Benefit); + this.effectType = LordXanderTheCollectorEffectType; + } + + private LordXanderTheCollectorEffect(final LordXanderTheCollectorEffect effect) { + super(effect); + this.effectType = effect.effectType; + } + + @Override + public LordXanderTheCollectorEffect copy() { + return new LordXanderTheCollectorEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(getTargetPointer().getFirst(game, source)); + if (player == null) { + return false; + } + int count; + switch (effectType) { + case DISCARD: + count = player.getHand().size(); + if (count < 2) { + return false; + } + player.discard(count / 2, false, false, source, game); + return true; + case MILL: + count = player.getLibrary().size(); + if (count < 2) { + return false; + } + player.millCards(count / 2, source, game); + return true; + case SACRIFICE: + count = game.getBattlefield().count( + StaticFilters.FILTER_CONTROLLED_PERMANENT_NON_LAND, player.getId(), source, game + ); + if (count < 2) { + return false; + } + TargetPermanent target = new TargetControlledPermanent( + count / 2, StaticFilters.FILTER_CONTROLLED_PERMANENT_NON_LAND + ); + target.setNotTarget(true); + target.withChooseHint("sacrifice"); + player.choose(outcome, target, source, game); + for (UUID permanentId : target.getTargets()) { + Permanent permanent = game.getPermanent(permanentId); + if (permanent != null) { + permanent.sacrifice(source, game); + } + } + return true; + } + return false; + } + + @Override + public String getText(Mode mode) { + switch (effectType) { + case DISCARD: + return "target opponent discards half the cards in their hand, rounded down"; + case MILL: + return "defending player mills half their library, rounded down"; + case SACRIFICE: + return "target opponent sacrifices half the nonland permanents they control, rounded down"; + } + return ""; + } +} diff --git a/Mage.Sets/src/mage/sets/StreetsOfNewCapenna.java b/Mage.Sets/src/mage/sets/StreetsOfNewCapenna.java index f314214125..2933969e16 100644 --- a/Mage.Sets/src/mage/sets/StreetsOfNewCapenna.java +++ b/Mage.Sets/src/mage/sets/StreetsOfNewCapenna.java @@ -26,6 +26,7 @@ public final class StreetsOfNewCapenna extends ExpansionSet { cards.add(new SetCardInfo("Forest", 280, Rarity.LAND, mage.cards.basiclands.Forest.class, FULL_ART_BFZ_VARIOUS)); cards.add(new SetCardInfo("Island", 274, Rarity.LAND, mage.cards.basiclands.Island.class, FULL_ART_BFZ_VARIOUS)); cards.add(new SetCardInfo("Jetmir's Garden", 250, Rarity.RARE, mage.cards.j.JetmirsGarden.class)); + cards.add(new SetCardInfo("Lord Xander, the Collector", 197, Rarity.MYTHIC, mage.cards.l.LordXanderTheCollector.class)); cards.add(new SetCardInfo("Maestros Charm", 199, Rarity.UNCOMMON, mage.cards.m.MaestrosCharm.class)); cards.add(new SetCardInfo("Mountain", 278, Rarity.LAND, mage.cards.basiclands.Mountain.class, FULL_ART_BFZ_VARIOUS)); cards.add(new SetCardInfo("Obscura Charm", 208, Rarity.UNCOMMON, mage.cards.o.ObscuraCharm.class)); diff --git a/Utils/mtg-cards-data.txt b/Utils/mtg-cards-data.txt index 7463a996d8..3d1a78bc5b 100644 --- a/Utils/mtg-cards-data.txt +++ b/Utils/mtg-cards-data.txt @@ -43919,6 +43919,7 @@ Ominous Traveler|Alchemy: Innistrad|62|R|{2}|Creature - Human|1|1|When Ominous T Forsaken Crossroads|Alchemy: Innistrad|63|R||Land|||Forsaken Crossroads enters the battlefield tapped.$As Forsaken Crossroads enters the battlefield, choose a color.$When Forsaken Crossroads enters the battlefield, scry 1. If you weren't the starting player, you may untap Forsaken Crossroads instead.${T}: Add one mana of the chosen color.| Brokers Ascendancy|Streets of New Capenna|170|R|{G}{W}{U}|Enchantment|||At the beginning of your end step, put a +1/+1 counter on each creature you control and a loyalty counter on each planeswalker you control.| Cabaretti Charm|Streets of New Capenna|173|U|{R}{G}{W}|Instant|||Choose one —$• Cabaretti Charm deals damage equal to the number of creatures you control to target creature or planeswalker.$• Creatures you control get +1/+1 and gain trample until end of turn.$• Create two 1/1 green and white Citizen creature tokens.| +Lord Xander, the Collector|Streets of New Capenna|197|M|{4}{U}{B}{R}|Legendary Creature - Vampire Demon Noble|6|6|When Lord Xander, the Collector enters the battlefield, target opponent discards half the cards in their hand, rounded down.$Whenever Lord Xander attacks, defending player mills half their library, rounded down.$When Lord Xander dies, target opponent sacrifices half the nonland permanents they control, rounded down.| Maestros Charm|Streets of New Capenna|199|U|{U}{B}{R}|Instant|||Choose one —$• Look at the top five cards of your library. Put one of those cards into your hand and the rest into your graveyard.$• Each opponent loses 3 life and you gain 3 life.$• Maestros Charm deals 5 damage to target creature or planeswalker.| Obscura Charm|Streets of New Capenna|208|U|{W}{U}{B}|Instant|||Choose one —$• Return target multicolored permanent card with mana value 3 or less from your graveyard to the battlefield tapped.$• Counter target instant or sorcery spell.$• Destroy target creature or planeswalker with mana value 3 or less.| Raffine, Scheming Seer|Streets of New Capenna|213|M|{W}{U}{B}|Legendary Creature - Sphinx Demon|1|4|Flying, ward {1}$Whenever you attack, target creature connives X, where X is the number of attacking creatures.|