diff --git a/forge-game/src/main/java/forge/game/card/CardFactoryUtil.java b/forge-game/src/main/java/forge/game/card/CardFactoryUtil.java index d5ffd39750c..210d98ab489 100644 --- a/forge-game/src/main/java/forge/game/card/CardFactoryUtil.java +++ b/forge-game/src/main/java/forge/game/card/CardFactoryUtil.java @@ -3938,6 +3938,30 @@ public class CardFactoryUtil { final SpellAbility newSA = AbilityFactory.getAbility(abilityStr.toString(), card); newSA.setIntrinsic(intrinsic); inst.addSpellAbility(newSA); + } else if (keyword.startsWith("Escape")) { + final String[] k = keyword.split(":"); + final Cost escapeCost = new Cost(k[1], false); + final SpellAbility sa = card.getFirstSpellAbility(); + + final SpellAbility newSA = sa.copyWithDefinedCost(escapeCost); + + newSA.getMapParams().put("PrecostDesc", "Escape—"); + newSA.getMapParams().put("CostDesc", ManaCostParser.parse(k[1])); + + // makes new SpellDescription + final StringBuilder desc = new StringBuilder(); + desc.append(newSA.getCostDescription()); + desc.append("(").append(inst.getReminderText()).append(")"); + newSA.setDescription(desc.toString()); + + final StringBuilder sbStack = new StringBuilder(); + sbStack.append(sa.getStackDescription()).append(" (Escaped)"); + newSA.setStackDescription(sbStack.toString()); + newSA.setBasicSpell(false); + newSA.setEscape(true); + newSA.setIntrinsic(intrinsic); + newSA.getRestrictions().setZone(ZoneType.Graveyard); + inst.addSpellAbility(newSA); } else if (keyword.startsWith("Eternalize")) { final String[] kw = keyword.split(":"); String costStr = kw[1]; diff --git a/forge-game/src/main/java/forge/game/card/CardProperty.java b/forge-game/src/main/java/forge/game/card/CardProperty.java index 3de4411ab84..d325f11e771 100644 --- a/forge-game/src/main/java/forge/game/card/CardProperty.java +++ b/forge-game/src/main/java/forge/game/card/CardProperty.java @@ -1615,6 +1615,11 @@ public class CardProperty { return false; } return card.getCastSA().isDash(); + } else if (property.startsWith("escaped")) { + if (card.getCastSA() == null) { + return false; + } + return card.getCastSA().isEscape(); } else if (property.startsWith("evoked")) { if (card.getCastSA() == null) { return false; diff --git a/forge-game/src/main/java/forge/game/keyword/Keyword.java b/forge-game/src/main/java/forge/game/keyword/Keyword.java index 805b00f6f92..cb7cc03082b 100644 --- a/forge-game/src/main/java/forge/game/keyword/Keyword.java +++ b/forge-game/src/main/java/forge/game/keyword/Keyword.java @@ -55,6 +55,7 @@ public enum Keyword { ENTWINE(KeywordWithCost.class, true, "You may choose all modes of this spell instead of just one. If you do, you pay an additional %s."), EPIC(SimpleKeyword.class, true, "For the rest of the game, you can't cast spells. At the beginning of each of your upkeeps for the rest of the game, copy this spell except for its epic ability. If the spell has any targets, you may choose new targets for the copy."), EQUIP(Equip.class, false, "%s: Attach to target %s you control. Equip only as a sorcery."), + ESCAPE(KeywordWithCost.class, false, "You may cast this card from your graveyard for its escape cost."), ESCALATE(KeywordWithCost.class, true, "Pay this cost for each mode chosen beyond the first."), ETERNALIZE(KeywordWithCost.class, false, "Create a token that's a copy of this card, except it's black, it's 4/4, it has no mana cost, and it's a Zombie in addition to its other types. Eternalize only as a sorcery."), EVOKE(KeywordWithCost.class, false, "You may cast this spell for its evoke cost. If you do, it's sacrificed when it enters the battlefield."), diff --git a/forge-game/src/main/java/forge/game/spellability/SpellAbility.java b/forge-game/src/main/java/forge/game/spellability/SpellAbility.java index 55760357af4..f92b5538483 100644 --- a/forge-game/src/main/java/forge/game/spellability/SpellAbility.java +++ b/forge-game/src/main/java/forge/game/spellability/SpellAbility.java @@ -106,6 +106,7 @@ public abstract class SpellAbility extends CardTraitBase implements ISpellAbilit private boolean aftermath = false; private boolean cycling = false; private boolean dash = false; + private boolean escape = false; private boolean evoke = false; private boolean prowl = false; private boolean surge = false; @@ -1171,6 +1172,14 @@ public abstract class SpellAbility extends CardTraitBase implements ISpellAbilit dash = isDash; } + public final boolean isEscape() { + return escape; + } + + public final void setEscape(final boolean isEscape) { + escape = isEscape; + } + public final boolean isEvoke() { return evoke; }