[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

@ -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<Cost> 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&mdash;" + 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.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&mdash;" + this.manaCost + ", Exile " + CardUtil.numberToText(this.exileCount) +
" other cards from your graveyard. <i>(You may cast this card from your graveyard for its escape cost.)</i>";
return staticText;
}
@Override