CardFactoryUtil: add Fabricate Keyword

This commit is contained in:
Hanmac
2016-09-12 10:50:54 +00:00
parent 8247310cc0
commit 0295baeec0
4 changed files with 34 additions and 2 deletions

View File

@@ -1415,7 +1415,7 @@ public class Card extends GameEntity implements Comparable<Card> {
} else if (keyword.startsWith("Provoke") || keyword.startsWith("Devour") || keyword.equals("Unleash")
|| keyword.startsWith("Soulbond")) {
sbLong.append(keyword + " (" + Keyword.getInstance(keyword).getReminderText() + ")");
} else if (keyword.startsWith("Soulshift")) {
} else if (keyword.startsWith("Fabricate") || keyword.startsWith("Soulshift")) {
final String[] k = keyword.split(":");
sbLong.append(k[0] + " " + k[1] + " (" + Keyword.getInstance(keyword).getReminderText() + ")");
} else if (keyword.contains("Haunt")) {

View File

@@ -2525,6 +2525,9 @@ public class CardFactoryUtil {
else if (keyword.startsWith("Escalate")) {
addStaticAbility(keyword, card, null);
}
else if (keyword.startsWith("Fabricate")) {
addTriggerAbility(keyword, card, null);
}
else if (keyword.startsWith("Rampage")) {
addTriggerAbility(keyword, card, null);
}
@@ -3019,6 +3022,34 @@ public class CardFactoryUtil {
card.setSVar("ExtortOpps", abString);
card.setSVar("ExtortGainLife", dbString);
card.setSVar("AFLifeLost", "Number$0");
if (!intrinsic) {
kws.addTrigger(cardTrigger);
}
} else if (keyword.startsWith("Fabricate")) {
final String[] k = keyword.split(":");
final String n = k[1];
final String name = StringUtils.join(k);
final String trigStr = "Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield "
+ " | Execute$ " + name + "Choose | ValidCard$ Card.Self | Secondary$ True"
+ " | TriggerDescription$ Fabricate " + n + " (" + Keyword.getInstance(keyword).getReminderText() + ")";
final String choose = "DB$ GenericChoice | Choices$ DB" + name + "Counter,DB" + name + "Token | ConditionPresent$ Card.StrictlySelf | SubAbility$ DB" + name + "Token2 | AILogic$ " + name;
final String counter = "DB$ PutCounter | Defined$ Self | CounterType$ P1P1 | CounterNum$ " + n + " | SpellDescription$ put "
+ Lang.nounWithNumeral(n, "+1/+1 counter") + " on it";
final String token = "DB$ Token | TokenAmount$ " + n + " | TokenName$ Servo | TokenTypes$ Artifact,Creature,Servo "
+ " | TokenOwner$ You | TokenColors$ Colorless | TokenPower$ 1 | TokenToughness$ 1 | TokenImage$ c 1 1 servo KLD | SpellDescription$ Create "
+ Lang.nounWithNumeral(n, "1/1 colorless Servo artifact creature token") + ".";
final Trigger trigger = TriggerHandler.parseTrigger(trigStr, card, intrinsic);
final Trigger cardTrigger = card.addTrigger(trigger);
card.setSVar(name + "Choose", choose);
card.setSVar("DB" + name + "Counter", counter);
card.setSVar("DB" + name + "Token", token);
card.setSVar("DB" + name + "Token2", token + " | ConditionPresent$ Card.StrictlySelf | ConditionCompare$ EQ0");
if (!intrinsic) {
kws.addTrigger(cardTrigger);
}

View File

@@ -49,6 +49,7 @@ public enum Keyword {
EXALTED(SimpleKeyword.class, false, "Whenever a creature you control attacks alone, that creature gets +1/+1 until end of turn."),
EXTORT(SimpleKeyword.class, false, "Whenever you cast a spell, you may pay {W/B}. If you do, each opponent loses 1 life and you gain that much life."),
EXPLOIT(SimpleKeyword.class, false, "When this creature enters the battlefield, you may sacrifice a creature."),
FABRICATE(KeywordWithAmount.class, false, "When this creature enters the battlefield, put {%1$d:+1/+1 counter} on it, or create {%1$d:1/1 colorless Servo artifact creature token}."),
FADING(KeywordWithAmount.class, false, "This permanent enters the battlefield with %d fade counters on it. At the beginning of your upkeep, remove a fade counter from it. If you can't, sacrifice it."),
FATESEAL(KeywordWithAmount.class, false, "Look at the top %d cards of an opponent's library, then put any number of them on the bottom of that player's library and the rest on top in any order."),
FEAR(SimpleKeyword.class, true, "This creature can't be blocked except by artifact creatures and/or black creatures."),

View File

@@ -13,7 +13,7 @@ public abstract class KeywordInstance<T extends KeywordInstance<?>> {
}
public String getReminderText() {
String result = formatReminderText(keyword.reminderText);
Matcher m = Pattern.compile("\\{(\\w):(.+)\\}").matcher(result);
Matcher m = Pattern.compile("\\{(\\w):(.+?)\\}").matcher(result);
StringBuffer sb = new StringBuffer();
while (m.find()) {