From a3ab12d953320825ee69051b4bb3baffccdbe204 Mon Sep 17 00:00:00 2001 From: theelk801 Date: Thu, 19 Oct 2023 10:01:14 -0400 Subject: [PATCH] [WHO] Implement The Flood of Mars --- .../src/mage/cards/t/TheFloodOfMars.java | 108 ++++++++++++++++++ Mage.Sets/src/mage/sets/DoctorWho.java | 1 + 2 files changed, 109 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/t/TheFloodOfMars.java diff --git a/Mage.Sets/src/mage/cards/t/TheFloodOfMars.java b/Mage.Sets/src/mage/cards/t/TheFloodOfMars.java new file mode 100644 index 00000000000..b976112ee82 --- /dev/null +++ b/Mage.Sets/src/mage/cards/t/TheFloodOfMars.java @@ -0,0 +1,108 @@ +package mage.cards.t; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.AttacksTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.continuous.AddCardSubTypeTargetEffect; +import mage.abilities.keyword.IslandwalkAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.counters.CounterType; +import mage.filter.FilterPermanent; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.mageobject.AnotherPredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.target.TargetPermanent; +import mage.target.targetpointer.FixedTarget; +import mage.util.functions.EmptyCopyApplier; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class TheFloodOfMars extends CardImpl { + + private static final FilterPermanent filter = new FilterPermanent("another target creature or land"); + + static { + filter.add(AnotherPredicate.instance); + filter.add(Predicates.or( + CardType.CREATURE.getPredicate(), + CardType.LAND.getPredicate() + )); + } + + public TheFloodOfMars(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{U}{U}"); + + this.subtype.add(SubType.ALIEN); + this.subtype.add(SubType.ZOMBIE); + this.subtype.add(SubType.HORROR); + this.power = new MageInt(3); + this.toughness = new MageInt(3); + + // Islandwalk + this.addAbility(new IslandwalkAbility()); + + // Water Always Wins -- Whenever The Flood of Mars attacks, put a flood counter on another target creature or land. If it's a creature, it becomes a copy of The Flood of Mars. If it's a land, it becomes an Island in addition to its other types. + Ability ability = new AttacksTriggeredAbility(new TheFloodOfMarsEffect()); + ability.addTarget(new TargetPermanent(filter)); + this.addAbility(ability.withFlavorWord("Water Always Wins")); + } + + private TheFloodOfMars(final TheFloodOfMars card) { + super(card); + } + + @Override + public TheFloodOfMars copy() { + return new TheFloodOfMars(this); + } +} + +class TheFloodOfMarsEffect extends OneShotEffect { + + TheFloodOfMarsEffect() { + super(Outcome.Benefit); + staticText = "put a flood counter on another target creature or land. If it's a creature, " + + "it becomes a copy of {this}. If it's a land, it becomes an Island in addition to its other types"; + } + + private TheFloodOfMarsEffect(final TheFloodOfMarsEffect effect) { + super(effect); + } + + @Override + public TheFloodOfMarsEffect copy() { + return new TheFloodOfMarsEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source)); + if (permanent == null) { + return false; + } + permanent.addCounters(CounterType.FLOOD.createInstance(), source, game); + boolean isCreature = permanent.isCreature(game); + boolean isLand = permanent.isLand(game); + if (isCreature) { + Permanent sourcePermanent = source.getSourcePermanentOrLKI(game); + if (sourcePermanent != null) { + game.copyPermanent(Duration.Custom, sourcePermanent, permanent.getId(), source, new EmptyCopyApplier()); + } + } + if (isLand) { + game.addEffect(new AddCardSubTypeTargetEffect(SubType.ISLAND, Duration.Custom) + .setTargetPointer(new FixedTarget(permanent, game)), source); + } + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/DoctorWho.java b/Mage.Sets/src/mage/sets/DoctorWho.java index 9591680c7d8..ab58155f1e3 100644 --- a/Mage.Sets/src/mage/sets/DoctorWho.java +++ b/Mage.Sets/src/mage/sets/DoctorWho.java @@ -207,6 +207,7 @@ public final class DoctorWho extends ExpansionSet { cards.add(new SetCardInfo("The Dalek Emperor", 120, Rarity.RARE, mage.cards.t.TheDalekEmperor.class)); cards.add(new SetCardInfo("The Eleventh Hour", 41, Rarity.RARE, mage.cards.t.TheEleventhHour.class)); cards.add(new SetCardInfo("The Fifth Doctor", 127, Rarity.RARE, mage.cards.t.TheFifthDoctor.class)); + cards.add(new SetCardInfo("The Flood of Mars", 45, Rarity.RARE, mage.cards.t.TheFloodOfMars.class)); cards.add(new SetCardInfo("The Flux", 86, Rarity.RARE, mage.cards.t.TheFlux.class)); cards.add(new SetCardInfo("The Fugitive Doctor", 130, Rarity.RARE, mage.cards.t.TheFugitiveDoctor.class)); cards.add(new SetCardInfo("The Ninth Doctor", 148, Rarity.RARE, mage.cards.t.TheNinthDoctor.class, NON_FULL_USE_VARIOUS));