diff --git a/Mage.Sets/src/mage/cards/l/LunarHatchling.java b/Mage.Sets/src/mage/cards/l/LunarHatchling.java new file mode 100644 index 00000000000..6b17638e061 --- /dev/null +++ b/Mage.Sets/src/mage/cards/l/LunarHatchling.java @@ -0,0 +1,57 @@ +package mage.cards.l; + +import mage.MageInt; +import mage.abilities.costs.Cost; +import mage.abilities.costs.CostsImpl; +import mage.abilities.costs.common.ExileTargetCost; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.keyword.BasicLandcyclingAbility; +import mage.abilities.keyword.EscapeAbility; +import mage.abilities.keyword.FlyingAbility; +import mage.abilities.keyword.TrampleAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.SubType; +import mage.filter.StaticFilters; +import mage.target.common.TargetControlledPermanent; + +import java.util.UUID; + +/** + * @author Susucr + */ +public final class LunarHatchling extends CardImpl { + + public LunarHatchling(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{G}{U}"); + + this.subtype.add(SubType.ALIEN); + this.subtype.add(SubType.BEAST); + this.power = new MageInt(6); + this.toughness = new MageInt(6); + + // Flying + this.addAbility(FlyingAbility.getInstance()); + + // Trample + this.addAbility(TrampleAbility.getInstance()); + + // Basic landcycling {2} + this.addAbility(new BasicLandcyclingAbility(new ManaCostsImpl<>("{2}"))); + + // Escape-{4}{G}{U}, Exile a land you control, Exile five other cards from your graveyard. + CostsImpl additionalCost = new CostsImpl(); + additionalCost.add(new ExileTargetCost(new TargetControlledPermanent(StaticFilters.FILTER_CONTROLLED_PERMANENT_A_LAND))); + this.addAbility(new EscapeAbility(this, "{4}{G}{U}", 5, additionalCost)); + } + + private LunarHatchling(final LunarHatchling card) { + super(card); + } + + @Override + public LunarHatchling copy() { + return new LunarHatchling(this); + } +} diff --git a/Mage.Sets/src/mage/sets/DoctorWho.java b/Mage.Sets/src/mage/sets/DoctorWho.java index dd1ed7759ed..a4636e16bae 100644 --- a/Mage.Sets/src/mage/sets/DoctorWho.java +++ b/Mage.Sets/src/mage/sets/DoctorWho.java @@ -102,6 +102,7 @@ public final class DoctorWho extends ExpansionSet { cards.add(new SetCardInfo("Laser Screwdriver", 178, Rarity.UNCOMMON, mage.cards.l.LaserScrewdriver.class)); cards.add(new SetCardInfo("Lavaclaw Reaches", 289, Rarity.RARE, mage.cards.l.LavaclawReaches.class)); cards.add(new SetCardInfo("Lightning Greaves", 243, Rarity.UNCOMMON, mage.cards.l.LightningGreaves.class)); + cards.add(new SetCardInfo("Lunar Hatchling", 141, Rarity.RARE, mage.cards.l.LunarHatchling.class)); cards.add(new SetCardInfo("Madame Vastra", 142, Rarity.RARE, mage.cards.m.MadameVastra.class)); cards.add(new SetCardInfo("Martha Jones", 48, Rarity.RARE, mage.cards.m.MarthaJones.class)); cards.add(new SetCardInfo("Memory Worm", 90, Rarity.UNCOMMON, mage.cards.m.MemoryWorm.class)); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/single/who/LunarHatchlingTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/single/who/LunarHatchlingTest.java new file mode 100644 index 00000000000..7f4416549a2 --- /dev/null +++ b/Mage.Tests/src/test/java/org/mage/test/cards/single/who/LunarHatchlingTest.java @@ -0,0 +1,48 @@ +package org.mage.test.cards.single.who; + +import mage.constants.PhaseStep; +import mage.constants.Zone; +import org.junit.Test; +import org.mage.test.serverside.base.CardTestPlayerBase; + +/** + * @author Susucr + */ +public class LunarHatchlingTest extends CardTestPlayerBase { + + /** + * Lunar Hatchling + * {4}{G}{U} + * Creature — Alien Beast + *

+ * Flying, trample + * Basic landcycling {2} ({2}, Discard this card: Search your library for a basic land card, reveal it, put it into your hand, then shuffle.) + * Escape-{4}{G}{U}, Exile a land you control, Exile five other cards from your graveyard. (You may cast this card from your graveyard for its escape cost.) + *

+ * 6/6 + */ + private static final String hatchling = "Lunar Hatchling"; + + @Test + public void test_EscapeWithAdditionalCost() { + setStrictChooseMode(true); + addCard(Zone.GRAVEYARD, playerA, hatchling); + addCard(Zone.BATTLEFIELD, playerA, "Forest", 3); + addCard(Zone.BATTLEFIELD, playerA, "Island", 3); + addCard(Zone.GRAVEYARD, playerA, "Balduvian Bears", 5); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, hatchling + " with Escape"); + setChoice(playerA, "Forest"); // choose to exile a Forest + setChoice(playerA, "Balduvian Bears^Balduvian Bears^Balduvian Bears^Balduvian Bears^Balduvian Bears"); + + setStopAt(1, PhaseStep.BEGIN_COMBAT); + execute(); + + assertPermanentCount(playerA, hatchling, 1); + assertPermanentCount(playerA, "Forest", 2); + assertPermanentCount(playerA, "Island", 3); + assertExileCount(playerA, "Forest", 1); + assertExileCount(playerA, "Balduvian Bears", 5); + assertGraveyardCount(playerA, "Balduvian Bears", 0); + } +} diff --git a/Mage/src/main/java/mage/abilities/keyword/EscapeAbility.java b/Mage/src/main/java/mage/abilities/keyword/EscapeAbility.java index 23a21aae588..b382cdeb45b 100644 --- a/Mage/src/main/java/mage/abilities/keyword/EscapeAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/EscapeAbility.java @@ -1,6 +1,9 @@ package mage.abilities.keyword; import mage.abilities.SpellAbility; +import mage.abilities.costs.Cost; +import mage.abilities.costs.Costs; +import mage.abilities.costs.CostsImpl; import mage.abilities.costs.common.ExileFromGraveCost; import mage.abilities.costs.mana.ManaCostsImpl; import mage.cards.Card; @@ -26,28 +29,39 @@ public class EscapeAbility extends SpellAbility { filter.add(AnotherPredicate.instance); } - private final String manaCost; - private final int exileCount; + private final String staticText; public EscapeAbility(Card card, String manaCost, int exileCount) { + this(card, manaCost, exileCount, new CostsImpl<>()); + } + + public EscapeAbility(Card card, String manaCost, int exileCount, Costs additionalCosts) { super(card.getSpellAbility()); this.newId(); this.setCardName(card.getName() + " with Escape"); this.zone = Zone.GRAVEYARD; this.spellAbilityType = SpellAbilityType.BASE_ALTERNATE; - this.manaCost = manaCost; - this.exileCount = exileCount; this.clearManaCosts(); this.clearManaCostsToPay(); + + String text = "Escape—" + manaCost; this.addManaCost(new ManaCostsImpl<>(manaCost)); + for (Cost cost : additionalCosts) { + text += ", " + CardUtil.getTextWithFirstCharUpperCase(cost.getText()); + this.addCost(cost.copy().setText("")); // hide additional cost text from rules + } + + text += ", Exile " + CardUtil.numberToText(exileCount) + " other cards from your graveyard." + + "(You may cast this card from your graveyard for its escape cost.)"; this.addCost(new ExileFromGraveCost(new TargetCardInYourGraveyard(exileCount, filter), "")); // hide additional cost text from rules + + this.staticText = text; } private EscapeAbility(final EscapeAbility ability) { super(ability); - this.manaCost = ability.manaCost; - this.exileCount = ability.exileCount; + this.staticText = ability.staticText; } @Override @@ -62,8 +76,7 @@ public class EscapeAbility extends SpellAbility { @Override public String getRule() { - return "Escape—" + this.manaCost + ", Exile " + CardUtil.numberToText(this.exileCount) + - " other cards from your graveyard. (You may cast this card from your graveyard for its escape cost.)"; + return staticText; } @Override