CardFactoryUtil: move LevelUp to addSpellAbility section

This commit is contained in:
Hanmac
2017-04-10 19:40:32 +00:00
parent 109be3afc6
commit 263cfe4dd6
3 changed files with 26 additions and 15 deletions

View File

@@ -1503,6 +1503,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|| keyword.startsWith("Evoke") || keyword.startsWith("Bestow") || keyword.startsWith("Dash") || keyword.startsWith("Evoke") || keyword.startsWith("Bestow") || keyword.startsWith("Dash")
|| keyword.startsWith("Surge") || keyword.startsWith("Transmute") || keyword.startsWith("Suspend") || keyword.startsWith("Surge") || keyword.startsWith("Transmute") || keyword.startsWith("Suspend")
|| keyword.equals("Undaunted") || keyword.startsWith("Monstrosity") || keyword.startsWith("Embalm") || keyword.equals("Undaunted") || keyword.startsWith("Monstrosity") || keyword.startsWith("Embalm")
|| keyword.startsWith("Level up")
|| keyword.startsWith("Cycling") || keyword.startsWith("TypeCycling")) { || keyword.startsWith("Cycling") || keyword.startsWith("TypeCycling")) {
// keyword parsing takes care of adding a proper description // keyword parsing takes care of adding a proper description
} else if (keyword.startsWith("CantBeBlockedBy")) { } else if (keyword.startsWith("CantBeBlockedBy")) {

View File

@@ -2003,20 +2003,7 @@ public class CardFactoryUtil {
addSpellAbility(keyword, card, null); addSpellAbility(keyword, card, null);
} }
else if (keyword.startsWith("Level up")) { else if (keyword.startsWith("Level up")) {
final String strMaxLevel = card.getSVar("maxLevel"); addSpellAbility(keyword, card, null);
card.removeIntrinsicKeyword(keyword);
final String[] k = keyword.split(":");
final String manacost = k[1];
String effect = "AB$ PutCounter | Cost$ " + manacost + " | " +
"SorcerySpeed$ True | LevelUp$ True | CounterNum$ 1" +
" | CounterType$ LEVEL | PrecostDesc$ Level Up | MaxLevel$ " +
strMaxLevel + " | SpellDescription$ (Put a level counter on" +
" this permanent. Activate this ability only any time you" +
" could cast a sorcery.)";
card.addSpellAbility(AbilityFactory.getAbility(effect, card));
} }
else if (keyword.startsWith("Cycling")) { else if (keyword.startsWith("Cycling")) {
addSpellAbility(keyword, card, null); addSpellAbility(keyword, card, null);
@@ -3717,6 +3704,29 @@ public class CardFactoryUtil {
sa.setIntrinsic(intrinsic); sa.setIntrinsic(intrinsic);
card.addSpellAbility(sa); card.addSpellAbility(sa);
} }
} else if (keyword.startsWith("Level up")) {
final String[] k = keyword.split(":");
final String manacost = k[1];
StringBuilder sb = new StringBuilder();
sb.append("AB$ PutCounter| Cost$ ").append(manacost);
sb.append(" | PrecostDesc$ Level Up | CostDesc$ ").append(ManaCostParser.parse(manacost));
sb.append(" | SorcerySpeed$ True | LevelUp$ True | CounterNum$ 1 | CounterType$ LEVEL");
if (card.hasSVar("maxLevel")) {
final String strMaxLevel = card.getSVar("maxLevel");
sb.append("| MaxLevel$ ").append(strMaxLevel);
}
sb.append(" | SpellDescription$ (").append(Keyword.getInstance(keyword).getReminderText()).append(")");
final SpellAbility sa = AbilityFactory.getAbility(sb.toString(), card);
sa.setIntrinsic(intrinsic);
if (!intrinsic) {
sa.setTemporary(true);
kws.addSpellAbility(sa);
}
card.addSpellAbility(sa);
} else if (keyword.startsWith("Monstrosity")) { } else if (keyword.startsWith("Monstrosity")) {
final String[] k = keyword.split(":"); final String[] k = keyword.split(":");
final String magnitude = k[1]; final String magnitude = k[1];

View File

@@ -76,7 +76,7 @@ public enum Keyword {
INTIMIDATE(SimpleKeyword.class, true, "This creature can't be blocked except by artifact creatures and/or creatures that share a color with it."), INTIMIDATE(SimpleKeyword.class, true, "This creature can't be blocked except by artifact creatures and/or creatures that share a color with it."),
KICKER(Kicker.class, false, "You may pay an additional %s as you cast this spell."), KICKER(Kicker.class, false, "You may pay an additional %s as you cast this spell."),
LANDWALK(KeywordWithType.class, false, "This creature is unblockable as long as defending player controls a %s."), LANDWALK(KeywordWithType.class, false, "This creature is unblockable as long as defending player controls a %s."),
LEVELUP(KeywordWithCost.class, false, "%s: Put a level counter on this permanent. Activate this ability only any time you could cast a sorcery."), LEVEL_UP(KeywordWithCost.class, false, "%s: Put a level counter on this. Level up only as a sorcery."),
LIFELINK(SimpleKeyword.class, true, "Damage dealt by this creature also causes its controller to gain that much life."), LIFELINK(SimpleKeyword.class, true, "Damage dealt by this creature also causes its controller to gain that much life."),
LIVING_WEAPON(SimpleKeyword.class, true, "When this Equipment enters the battlefield, create a 0/0 black Germ creature token, then attach this Equipment to it."), LIVING_WEAPON(SimpleKeyword.class, true, "When this Equipment enters the battlefield, create a 0/0 black Germ creature token, then attach this Equipment to it."),
MADNESS(KeywordWithCost.class, true, "If you discard this card, you may cast it for %s instead of putting it into your graveyard."), MADNESS(KeywordWithCost.class, true, "If you discard this card, you may cast it for %s instead of putting it into your graveyard."),