[WHO] Implement The Flood of Mars

This commit is contained in:
theelk801 2023-10-19 10:01:14 -04:00
parent 764bc096cd
commit a3ab12d953
2 changed files with 109 additions and 0 deletions

View file

@ -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;
}
}

View file

@ -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));