From a221392ff31b704eed799d82da6961c61276964c Mon Sep 17 00:00:00 2001 From: theelk801 Date: Tue, 23 Jul 2024 16:47:05 -0400 Subject: [PATCH] [BLB] Implement Dour Port-Mage --- Mage.Sets/src/mage/cards/d/DourPortMage.java | 93 ++++++++++++++++++++ Mage.Sets/src/mage/sets/Bloomburrow.java | 1 + 2 files changed, 94 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/d/DourPortMage.java diff --git a/Mage.Sets/src/mage/cards/d/DourPortMage.java b/Mage.Sets/src/mage/cards/d/DourPortMage.java new file mode 100644 index 00000000000..596501b027d --- /dev/null +++ b/Mage.Sets/src/mage/cards/d/DourPortMage.java @@ -0,0 +1,93 @@ +package mage.cards.d; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.common.DrawCardSourceControllerEffect; +import mage.abilities.effects.common.ReturnToHandTargetEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.SubType; +import mage.constants.Zone; +import mage.filter.StaticFilters; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.events.ZoneChangeBatchEvent; +import mage.game.events.ZoneChangeEvent; +import mage.target.TargetPermanent; + +import java.util.Objects; +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class DourPortMage extends CardImpl { + + public DourPortMage(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{U}"); + + this.subtype.add(SubType.FROG); + this.subtype.add(SubType.WIZARD); + this.power = new MageInt(1); + this.toughness = new MageInt(3); + + // Whenever one or more other creatures you control leave the battlefield without dying, draw a card. + this.addAbility(new DourPortMageTriggeredAbility()); + + // {1}{U}, {T}: Return another target creature you control to its owner's hand. + Ability ability = new SimpleActivatedAbility(new ReturnToHandTargetEffect(), new ManaCostsImpl<>("{1}{U}")); + ability.addCost(new TapSourceCost()); + ability.addTarget(new TargetPermanent(StaticFilters.FILTER_ANOTHER_TARGET_CREATURE_YOU_CONTROL)); + this.addAbility(ability); + } + + private DourPortMage(final DourPortMage card) { + super(card); + } + + @Override + public DourPortMage copy() { + return new DourPortMage(this); + } +} + +class DourPortMageTriggeredAbility extends TriggeredAbilityImpl { + + DourPortMageTriggeredAbility() { + super(Zone.BATTLEFIELD, new DrawCardSourceControllerEffect(1)); + setTriggerPhrase("Whenever one or more other creatures you control leave the battlefield without dying, "); + } + + private DourPortMageTriggeredAbility(final DourPortMageTriggeredAbility ability) { + super(ability); + } + + @Override + public DourPortMageTriggeredAbility copy() { + return new DourPortMageTriggeredAbility(this); + } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.ZONE_CHANGE_BATCH; + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + return ((ZoneChangeBatchEvent) event) + .getEvents() + .stream() + .filter(zoneChangeEvent -> Zone.BATTLEFIELD.match(zoneChangeEvent.getFromZone())) + .filter(zoneChangeEvent -> !Zone.GRAVEYARD.match(zoneChangeEvent.getToZone())) + .map(ZoneChangeEvent::getTargetId) + .filter(uuid -> !getSourceId().equals(uuid)) + .map(game::getPermanentOrLKIBattlefield) + .filter(Objects::nonNull) + .anyMatch(p -> p.isCreature(game) && p.isControlledBy(getControllerId())); + } +} diff --git a/Mage.Sets/src/mage/sets/Bloomburrow.java b/Mage.Sets/src/mage/sets/Bloomburrow.java index bcda29e6c80..9cb0d0f949e 100644 --- a/Mage.Sets/src/mage/sets/Bloomburrow.java +++ b/Mage.Sets/src/mage/sets/Bloomburrow.java @@ -68,6 +68,7 @@ public final class Bloomburrow extends ExpansionSet { cards.add(new SetCardInfo("Dewdrop Cure", 10, Rarity.UNCOMMON, mage.cards.d.DewdropCure.class)); cards.add(new SetCardInfo("Dire Downdraft", 46, Rarity.COMMON, mage.cards.d.DireDowndraft.class)); cards.add(new SetCardInfo("Diresight", 91, Rarity.COMMON, mage.cards.d.Diresight.class)); + cards.add(new SetCardInfo("Dour Port-Mage", 47, Rarity.RARE, mage.cards.d.DourPortMage.class)); cards.add(new SetCardInfo("Downwind Ambusher", 92, Rarity.UNCOMMON, mage.cards.d.DownwindAmbusher.class)); cards.add(new SetCardInfo("Dreamdew Entrancer", 211, Rarity.RARE, mage.cards.d.DreamdewEntrancer.class)); cards.add(new SetCardInfo("Druid of the Spade", 170, Rarity.COMMON, mage.cards.d.DruidOfTheSpade.class));