CardFactoryUtil: add Scavenge as Keyword

This commit is contained in:
Hanmac
2016-07-20 14:37:31 +00:00
parent dab0a28931
commit 805e6a718c
15 changed files with 45 additions and 28 deletions

View File

@@ -1419,7 +1419,7 @@ public class Card extends GameEntity implements Comparable<Card> {
} else if (keyword.startsWith("Soulbond")) {
sbLong.append(keyword + " (" + Keyword.getInstance(keyword).getReminderText() + ")");
} else if (keyword.startsWith("Equip") || keyword.startsWith("Fortify") || keyword.startsWith("Outlast")
|| keyword.startsWith("Unearth")) {
|| keyword.startsWith("Unearth") || keyword.startsWith("Scavenge")) {
// keyword parsing takes care of adding a proper description
} else if (keyword.startsWith("CantBeBlockedBy")) {
sbLong.append(getName()).append(" can't be blocked ");

View File

@@ -2220,6 +2220,9 @@ public class CardFactoryUtil {
// add ability to instrinic strings so copies/clones create the ability also
card.getCurrentState().addUnparsedAbility(effect);
}
else if (keyword.startsWith("Scavenge")) {
addSpellAbility(keyword, card, null);
}
else if (keyword.startsWith("Unearth")) {
addSpellAbility(keyword, card, null);
}
@@ -2667,7 +2670,7 @@ public class CardFactoryUtil {
abilityStr.append("- ");
}
abilityStr.append("| CostDesc$ " + cost.toSimpleString() + " ");
abilityStr.append("| SpellDescription$ (" + cost.toSimpleString() + ", {T}: Put a +1/+1 counter on this creature. Outlast only as a sorcery.)");
abilityStr.append("| SpellDescription$ (" + Keyword.getInstance(keyword).getReminderText() + ")");
final SpellAbility sa = AbilityFactory.getAbility(abilityStr.toString(), card);
card.addSpellAbility(sa);
// add ability to instrinic strings so copies/clones create the ability also
@@ -3018,7 +3021,30 @@ public class CardFactoryUtil {
public static void addSpellAbility(final String keyword, final Card card, final KeywordsChange kws) {
final boolean intrinsic = kws == null;
if (keyword.startsWith("Unearth")) {
if (keyword.startsWith("Scavenge")) {
final String[] k = keyword.split(":");
final String manacost = k[1];
String effect = "AB$ PutCounter | Cost$ " + manacost + " ExileFromGrave<1/CARDNAME> " +
"| ActivationZone$ Graveyard | ValidTgts$ Creature | CounterType$ P1P1 " +
"| CounterNum$ ScavengeX | SorcerySpeed$ True | References$ ScavengeX " +
"| PrecostDesc$ Scavenge | | CostDesc$ " + ManaCostParser.parse(manacost) +
"| SpellDescription$ (" + Keyword.getInstance("Scavenge:" + manacost).getReminderText() + ")";
card.setSVar("ScavengeX", "Count$CardPower");
final SpellAbility sa = AbilityFactory.getAbility(effect, card);
if (!intrinsic) {
sa.setTemporary(true);
sa.setIntrinsic(false);
//sa.setOriginalHost(hostCard);
kws.addSpellAbility(sa);
} else {
// add ability to instrinic strings so copies/clones create the ability also
card.getCurrentState().addUnparsedAbility(effect);
}
card.addSpellAbility(sa);
} else if (keyword.startsWith("Unearth")) {
final String[] k = keyword.split(":");
final String manacost = k[1];
@@ -3046,6 +3072,9 @@ public class CardFactoryUtil {
sa.setIntrinsic(false);
//sa.setOriginalHost(hostCard);
kws.addSpellAbility(sa);
} else {
// add ability to instrinic strings so copies/clones create the ability also
card.getCurrentState().addUnparsedAbility(effect);
}
card.addSpellAbility(sa);
}

View File

@@ -99,6 +99,7 @@ public enum Keyword {
SHADOW(SimpleKeyword.class, true, "This creature can block or be blocked by only creatures with shadow."),
SHROUD(SimpleKeyword.class, true, "This can't be the target of spells or abilities."),
SKULK(SimpleKeyword.class, true, "This creature can't be blocked by creatures with greater power."),
SCAVENGE(KeywordWithCost.class, false, "%s, Exile this card from your graveyard: Put a number of +1/+1 counters equal to this card's power on target creature. Scavenge only as a sorcery."),
SOULBOND(SimpleKeyword.class, true, "You may pair this creature with another unpaired creature when either enters the battlefield. They remain paired for as long as you control both of them"),
SOULSHIFT(KeywordWithAmount.class, false, "When this creature dies, you may return target Spirit card with converted mana cost %d or less from your graveyard to your hand."),
SPLICE(KeywordWithCostAndType.class, false, "You may reveal this card from your hand as you cast a %s spell. If you do, copy this card's text box onto that spell and pay %s as an additional cost to cast that spell."),