From b84dd5dad3123141f18c07d3bfa55590ad0ca0a4 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Tue, 18 Jun 2019 19:29:13 -0400 Subject: [PATCH] Implemented Field of the Dead --- .../src/mage/cards/f/FieldOfTheDead.java | 72 +++++++++++++++++++ Mage.Sets/src/mage/sets/CoreSet2020.java | 1 + 2 files changed, 73 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/f/FieldOfTheDead.java diff --git a/Mage.Sets/src/mage/cards/f/FieldOfTheDead.java b/Mage.Sets/src/mage/cards/f/FieldOfTheDead.java new file mode 100644 index 00000000000..e4eca676bdb --- /dev/null +++ b/Mage.Sets/src/mage/cards/f/FieldOfTheDead.java @@ -0,0 +1,72 @@ +package mage.cards.f; + +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldControlledTriggeredAbility; +import mage.abilities.common.EntersBattlefieldTappedAbility; +import mage.abilities.condition.Condition; +import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility; +import mage.abilities.effects.common.CreateTokenEffect; +import mage.abilities.mana.ColorlessManaAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.filter.StaticFilters; +import mage.game.Game; +import mage.game.permanent.token.ZombieToken; +import mage.players.Player; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class FieldOfTheDead extends CardImpl { + + public FieldOfTheDead(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.LAND}, ""); + + // Field of the Dead enters the battlefield tapped. + this.addAbility(new EntersBattlefieldTappedAbility()); + + // {T}: Add {C}. + this.addAbility(new ColorlessManaAbility()); + + // Whenever Field of the Dead or another land enters the battlefield under your control, if you control seven or more lands with different names, create a 2/2 black Zombie creature token. + this.addAbility(new ConditionalInterveningIfTriggeredAbility( + new EntersBattlefieldControlledTriggeredAbility( + new CreateTokenEffect(new ZombieToken()), StaticFilters.FILTER_LAND + ), FieldOfTheDeadCondition.instance, "Whenever {this} or another land " + + "enters the battlefield under your control, if you control seven or more lands with different names, " + + "create a 2/2 black Zombie creature token." + )); + } + + private FieldOfTheDead(final FieldOfTheDead card) { + super(card); + } + + @Override + public FieldOfTheDead copy() { + return new FieldOfTheDead(this); + } +} + +enum FieldOfTheDeadCondition implements Condition { + instance; + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + if (player == null) { + return false; + } + return game + .getBattlefield() + .getAllActivePermanents(StaticFilters.FILTER_LAND, source.getControllerId(), game) + .stream() + .map(permanent -> permanent.getName()) + .filter(s -> s.length() > 0) + .distinct() + .count() > 6; + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/CoreSet2020.java b/Mage.Sets/src/mage/sets/CoreSet2020.java index 95147f9fc0f..1dd64293b03 100644 --- a/Mage.Sets/src/mage/sets/CoreSet2020.java +++ b/Mage.Sets/src/mage/sets/CoreSet2020.java @@ -47,6 +47,7 @@ public final class CoreSet2020 extends ExpansionSet { cards.add(new SetCardInfo("Dungeon Geists", 57, Rarity.RARE, mage.cards.d.DungeonGeists.class)); cards.add(new SetCardInfo("Ember Hauler", 137, Rarity.UNCOMMON, mage.cards.e.EmberHauler.class)); cards.add(new SetCardInfo("Empyrean Eagle", 208, Rarity.UNCOMMON, mage.cards.e.EmpyreanEagle.class)); + cards.add(new SetCardInfo("Field of the Dead", 247, Rarity.RARE, mage.cards.f.FieldOfTheDead.class)); cards.add(new SetCardInfo("Flame Sweep", 139, Rarity.UNCOMMON, mage.cards.f.FlameSweep.class)); cards.add(new SetCardInfo("Flood of Tears", 59, Rarity.RARE, mage.cards.f.FloodOfTears.class)); cards.add(new SetCardInfo("Goblin Ringleader", 141, Rarity.UNCOMMON, mage.cards.g.GoblinRingleader.class));