Merge branch 'keyword-escape' into 'master'

Keyword: add Escape Mechanic

Closes #1199

See merge request core-developers/forge!2331
This commit is contained in:
Michael Kamensky
2019-12-18 10:38:02 +00:00
4 changed files with 39 additions and 0 deletions

View File

@@ -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];

View File

@@ -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;

View File

@@ -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."),

View File

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