mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 04:52:07 -08:00
[WHO] Implement Lunar Hatchling (#11269)
This commit is contained in:
parent
8e1ef15b70
commit
2d9f29b60e
4 changed files with 127 additions and 8 deletions
|
|
@ -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—" + 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—" + 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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue