From 71f24a03bfab46a97499adaf3b2d82550863121c Mon Sep 17 00:00:00 2001 From: Daniel Bomar Date: Sun, 6 Nov 2022 19:32:12 -0600 Subject: [PATCH] [BRO] Implemented Cityscape Leveler --- .../src/mage/cards/c/CityscapeLeveler.java | 128 ++++++++++++++++++ Mage.Sets/src/mage/sets/TheBrothersWar.java | 1 + 2 files changed, 129 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/c/CityscapeLeveler.java diff --git a/Mage.Sets/src/mage/cards/c/CityscapeLeveler.java b/Mage.Sets/src/mage/cards/c/CityscapeLeveler.java new file mode 100644 index 0000000000..d9b7e97aa1 --- /dev/null +++ b/Mage.Sets/src/mage/cards/c/CityscapeLeveler.java @@ -0,0 +1,128 @@ +package mage.cards.c; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.effects.OneShotEffect; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.abilities.keyword.TrampleAbility; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.keyword.UnearthAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Zone; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.permanent.Permanent; +import mage.game.permanent.token.PowerstoneToken; +import mage.target.common.TargetNonlandPermanent; + +/** + * + * @author weirddan455 + */ +public final class CityscapeLeveler extends CardImpl { + + public CityscapeLeveler(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{8}"); + + this.subtype.add(SubType.CONSTRUCT); + this.power = new MageInt(8); + this.toughness = new MageInt(8); + + // Trample + this.addAbility(TrampleAbility.getInstance()); + + // When you cast this spell and whenever Cityscape Leveler attacks, destroy up to one target nonland permanent. Its controller creates a tapped Powerstone token. + Ability ability = new CityscapeLevelerAbility(); + ability.addTarget(new TargetNonlandPermanent(0, 1)); + this.addAbility(ability); + + // Unearth {8} + this.addAbility(new UnearthAbility(new ManaCostsImpl<>("{8}"))); + } + + private CityscapeLeveler(final CityscapeLeveler card) { + super(card); + } + + @Override + public CityscapeLeveler copy() { + return new CityscapeLeveler(this); + } +} + +class CityscapeLevelerAbility extends TriggeredAbilityImpl { + + public CityscapeLevelerAbility() { + super(Zone.ALL, new CityscapeLevelerEffect()); + setTriggerPhrase("When you cast this spell and whenever {this} attacks, "); + } + + private CityscapeLevelerAbility(final CityscapeLevelerAbility ability) { + super(ability); + } + + @Override + public CityscapeLevelerAbility copy() { + return new CityscapeLevelerAbility(this); + } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + switch (event.getType()) { + case SPELL_CAST: + case DECLARED_ATTACKERS: + return true; + default: + return false; + } + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + if (sourceId == null) { + return false; + } + switch (event.getType()) { + case SPELL_CAST: + return sourceId.equals(event.getSourceId()); + case DECLARED_ATTACKERS: + return game.getCombat().getAttackers().contains(sourceId); + default: + return false; + } + } +} + +class CityscapeLevelerEffect extends OneShotEffect { + + public CityscapeLevelerEffect() { + super(Outcome.DestroyPermanent); + this.staticText = "destroy up to one target nonland permanent. Its controller creates a tapped Powerstone token."; + } + + private CityscapeLevelerEffect(final CityscapeLevelerEffect effect) { + super(effect); + } + + @Override + public CityscapeLevelerEffect copy() { + return new CityscapeLevelerEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent permanent = game.getPermanent(source.getFirstTarget()); + if (permanent == null) { + return false; + } + UUID controllerId = permanent.getControllerId(); + permanent.destroy(source, game); + new PowerstoneToken().putOntoBattlefield(1, game, source, controllerId, true, false); + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/TheBrothersWar.java b/Mage.Sets/src/mage/sets/TheBrothersWar.java index f6f05e5b73..1f15dc6e35 100644 --- a/Mage.Sets/src/mage/sets/TheBrothersWar.java +++ b/Mage.Sets/src/mage/sets/TheBrothersWar.java @@ -69,6 +69,7 @@ public final class TheBrothersWar extends ExpansionSet { cards.add(new SetCardInfo("Calamity's Wake", 4, Rarity.UNCOMMON, mage.cards.c.CalamitysWake.class)); cards.add(new SetCardInfo("Carrion Locust", 87, Rarity.COMMON, mage.cards.c.CarrionLocust.class)); cards.add(new SetCardInfo("Citanul Stalwart", 175, Rarity.COMMON, mage.cards.c.CitanulStalwart.class)); + cards.add(new SetCardInfo("Cityscape Leveler", 233, Rarity.MYTHIC, mage.cards.c.CityscapeLeveler.class)); cards.add(new SetCardInfo("Clay Champion", 230, Rarity.MYTHIC, mage.cards.c.ClayChampion.class)); cards.add(new SetCardInfo("Clay Revenant", 118, Rarity.COMMON, mage.cards.c.ClayRevenant.class)); cards.add(new SetCardInfo("Coastal Bulwark", 76, Rarity.COMMON, mage.cards.c.CoastalBulwark.class));