[WHO] Implement Lunar Hatchling (#11269)

This commit is contained in:
Susucre 2023-10-08 23:53:13 +02:00 committed by GitHub
parent 8e1ef15b70
commit 2d9f29b60e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 127 additions and 8 deletions

View file

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

View file

@ -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("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("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("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("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("Martha Jones", 48, Rarity.RARE, mage.cards.m.MarthaJones.class));
cards.add(new SetCardInfo("Memory Worm", 90, Rarity.UNCOMMON, mage.cards.m.MemoryWorm.class)); cards.add(new SetCardInfo("Memory Worm", 90, Rarity.UNCOMMON, mage.cards.m.MemoryWorm.class));

View file

@ -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
* <p>
* 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.)
* <p>
* 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);
}
}

View file

@ -1,6 +1,9 @@
package mage.abilities.keyword; package mage.abilities.keyword;
import mage.abilities.SpellAbility; 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.common.ExileFromGraveCost;
import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.costs.mana.ManaCostsImpl;
import mage.cards.Card; import mage.cards.Card;
@ -26,28 +29,39 @@ public class EscapeAbility extends SpellAbility {
filter.add(AnotherPredicate.instance); filter.add(AnotherPredicate.instance);
} }
private final String manaCost; private final String staticText;
private final int exileCount;
public EscapeAbility(Card card, String manaCost, int exileCount) { public EscapeAbility(Card card, String manaCost, int exileCount) {
this(card, manaCost, exileCount, new CostsImpl<>());
}
public EscapeAbility(Card card, String manaCost, int exileCount, Costs<Cost> additionalCosts) {
super(card.getSpellAbility()); super(card.getSpellAbility());
this.newId(); this.newId();
this.setCardName(card.getName() + " with Escape"); this.setCardName(card.getName() + " with Escape");
this.zone = Zone.GRAVEYARD; this.zone = Zone.GRAVEYARD;
this.spellAbilityType = SpellAbilityType.BASE_ALTERNATE; this.spellAbilityType = SpellAbilityType.BASE_ALTERNATE;
this.manaCost = manaCost;
this.exileCount = exileCount;
this.clearManaCosts(); this.clearManaCosts();
this.clearManaCostsToPay(); this.clearManaCostsToPay();
String text = "Escape&mdash;" + manaCost;
this.addManaCost(new ManaCostsImpl<>(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."
+ "<i>(You may cast this card from your graveyard for its escape cost.)</i>";
this.addCost(new ExileFromGraveCost(new TargetCardInYourGraveyard(exileCount, filter), "")); // hide additional cost text from rules this.addCost(new ExileFromGraveCost(new TargetCardInYourGraveyard(exileCount, filter), "")); // hide additional cost text from rules
this.staticText = text;
} }
private EscapeAbility(final EscapeAbility ability) { private EscapeAbility(final EscapeAbility ability) {
super(ability); super(ability);
this.manaCost = ability.manaCost; this.staticText = ability.staticText;
this.exileCount = ability.exileCount;
} }
@Override @Override
@ -62,8 +76,7 @@ public class EscapeAbility extends SpellAbility {
@Override @Override
public String getRule() { public String getRule() {
return "Escape&mdash;" + this.manaCost + ", Exile " + CardUtil.numberToText(this.exileCount) + return staticText;
" other cards from your graveyard. <i>(You may cast this card from your graveyard for its escape cost.)</i>";
} }
@Override @Override