CardFactoryUtil: move Extort to addTrigger

Pontiff of Blight: cleanup the code
This commit is contained in:
Hanmac
2016-07-20 08:01:12 +00:00
parent 5d3ffcce0f
commit 83a810e710
2 changed files with 22 additions and 18 deletions

View File

@@ -53,6 +53,7 @@ import forge.game.card.CardPredicates.Presets;
import forge.game.cost.Cost;
import forge.game.cost.CostPayment;
import forge.game.event.GameEventCardStatsChanged;
import forge.game.keyword.Keyword;
import forge.game.keyword.KeywordsChange;
import forge.game.phase.PhaseHandler;
import forge.game.player.Player;
@@ -2546,18 +2547,7 @@ public class CardFactoryUtil {
card.setSVar("TrigBondSelf", abStringOther);
}
else if (keyword.equals("Extort")) {
final String extortTrigger = "Mode$ SpellCast | ValidCard$ Card | ValidActivatingPlayer$ You | "
+ "TriggerZones$ Battlefield | Execute$ ExtortOpps | Secondary$ True"
+ " | TriggerDescription$ Extort (Whenever you cast a spell, you may pay W/B. If you do, "
+ "each opponent loses 1 life and you gain that much life.)";
final String abString = "AB$ LoseLife | Cost$ WB | Defined$ Player.Opponent | "
+ "LifeAmount$ 1 | SubAbility$ ExtortGainLife";
final String dbString = "DB$ GainLife | Defined$ You | LifeAmount$ AFLifeLost | References$ AFLifeLost";
final Trigger parsedTrigger = TriggerHandler.parseTrigger(extortTrigger, card, true);
card.addTrigger(parsedTrigger);
card.setSVar("ExtortOpps", abString);
card.setSVar("ExtortGainLife", dbString);
card.setSVar("AFLifeLost", "Number$0");
addTriggerAbility(keyword, card, null);
}
else if (keyword.equals("Evolve")) {
final String evolveTrigger = "Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | "
@@ -2917,7 +2907,24 @@ public class CardFactoryUtil {
}
public static void addTriggerAbility(final String keyword, final Card card, final KeywordsChange kws) {
final boolean intrinsic = kws == null;
if (keyword.equals("Extort")) {
final String extortTrigger = "Mode$ SpellCast | ValidCard$ Card | ValidActivatingPlayer$ You | "
+ "TriggerZones$ Battlefield | Execute$ ExtortOpps | Secondary$ True"
+ " | TriggerDescription$ Extort ("+ Keyword.getInstance(keyword).getReminderText() +")";
final String abString = "AB$ LoseLife | Cost$ WB | Defined$ Player.Opponent | "
+ "LifeAmount$ 1 | SubAbility$ ExtortGainLife";
final String dbString = "DB$ GainLife | Defined$ You | LifeAmount$ AFLifeLost | References$ AFLifeLost";
final Trigger parsedTrigger = TriggerHandler.parseTrigger(extortTrigger, card, intrinsic);
final Trigger cardTrigger = card.addTrigger(parsedTrigger);
card.setSVar("ExtortOpps", abString);
card.setSVar("ExtortGainLife", dbString);
card.setSVar("AFLifeLost", "Number$0");
if (!intrinsic) {
kws.addTrigger(cardTrigger);
}
}
}
public static void addReplacementEffect(final String keyword, final Card card, final KeywordsChange kws) {

View File

@@ -3,11 +3,8 @@ ManaCost:4 B B
Types:Creature Zombie Cleric
PT:2/7
K:Extort
# Put "AddKeyword$ Extort" here to show the keyword in panel
S:Mode$ Continuous | Affected$ Creature.Other+YouCtrl | AddTrigger$ PontiffExtort | AddSVar$ PontiffExtortOpps & PontiffExtortGainLife | Description$ Other creatures you control have Extort.
SVar:PontiffExtort:Mode$ SpellCast | ValidCard$ Card | ValidActivatingPlayer$ You | TriggerZones$ Battlefield | Execute$ PontiffExtortOpps | TriggerDescription$ Extort (Whenever you cast a spell, you may pay {W/B}. If you do, each opponent loses 1 life and you gain that much life.)
SVar:PontiffExtortOpps:AB$ LoseLife | Cost$ WB | Defined$ Player.Opponent | LifeAmount$ 1 | SubAbility$ PontiffExtortGainLife
SVar:PontiffExtortGainLife:DB$ GainLife | Defined$ You | LifeAmount$ AFLifeLost
SVar:AFLifeLost:Number$0
S:Mode$ Continuous | Affected$ Creature.Other+YouCtrl | AddKeyword$ Extort | Description$ Other creatures you control have Extort.
SVar:Picture:http://www.wizards.com/global/images/magic/general/pontiff_of_blight.jpg
Oracle:Extort (Whenever you cast a spell, you may pay {W/B}. If you do, each opponent loses 1 life and you gain that much life.)\nOther creatures you control have extort. (If a creature has multiple instances of extort, each triggers separately.)