From 7f01da10eb935df2dbf4a11fded0af7c19af66ef Mon Sep 17 00:00:00 2001 From: Hanmac Date: Wed, 20 Jul 2016 10:18:18 +0000 Subject: [PATCH] CardFactoryUtil & Card: move Uneath to addSpellAbility Sedris, the Traitor King: make this card more easier. --- .../src/main/java/forge/game/card/Card.java | 3 +- .../java/forge/game/card/CardFactoryUtil.java | 60 ++++++++++--------- .../cardsfolder/s/sedris_the_traitor_king.txt | 6 +- 3 files changed, 36 insertions(+), 33 deletions(-) diff --git a/forge-game/src/main/java/forge/game/card/Card.java b/forge-game/src/main/java/forge/game/card/Card.java index 43a9a42badf..0b22d9e81b3 100644 --- a/forge-game/src/main/java/forge/game/card/Card.java +++ b/forge-game/src/main/java/forge/game/card/Card.java @@ -1423,7 +1423,8 @@ public class Card extends GameEntity implements Comparable { sbLong.append(". Mana cost includes color.)"); } else if (keyword.startsWith("Soulbond")) { sbLong.append(keyword + " (" + Keyword.getInstance(keyword).getReminderText() + ")"); - } else if (keyword.startsWith("Equip") || keyword.startsWith("Fortify") || keyword.startsWith("Outlast")) { + } else if (keyword.startsWith("Equip") || keyword.startsWith("Fortify") || keyword.startsWith("Outlast") + || keyword.startsWith("Unearth")) { // keyword parsing takes care of adding a proper description } else if (keyword.startsWith("CantBeBlockedBy")) { sbLong.append(getName()).append(" can't be blocked "); diff --git a/forge-game/src/main/java/forge/game/card/CardFactoryUtil.java b/forge-game/src/main/java/forge/game/card/CardFactoryUtil.java index 8136630f34a..9b45731b97f 100644 --- a/forge-game/src/main/java/forge/game/card/CardFactoryUtil.java +++ b/forge-game/src/main/java/forge/game/card/CardFactoryUtil.java @@ -2221,33 +2221,7 @@ public class CardFactoryUtil { card.getCurrentState().addUnparsedAbility(effect); } else if (keyword.startsWith("Unearth")) { - card.removeIntrinsicKeyword(keyword); - - final String[] k = keyword.split(":"); - final String manacost = k[1]; - - String effect = "AB$ ChangeZone | Cost$ " + manacost + " | Defined$ Self" + - " | Origin$ Graveyard | Destination$ Battlefield | SorcerySpeed$" + - " True | ActivationZone$ Graveyard | Unearth$ True | SubAbility$" + - " UnearthPumpSVar | PrecostDesc$ Unearth | StackDescription$ " + - "Unearth: Return CARDNAME to the battlefield. | SpellDescription$" + - " (" + ManaCostParser.parse(manacost) + ": Return CARDNAME to the " + - "battlefield. It gains haste. Exile it at the beginning of the next" + - " end step or if it would leave the battlefield. Unearth only as a sorcery.)"; - String dbpump = "DB$ Pump | Defined$ Self | KW$ Haste & HIDDEN If CARDNAME" + - " would leave the battlefield, exile it instead of putting it " + - "anywhere else. | Permanent$ True | SubAbility$ UnearthDelayTrigger"; - String delTrig = "DB$ DelayedTrigger | Mode$ Phase | Phase$ End of Turn" + - " | Execute$ UnearthTrueDeath | TriggerDescription$ Exile " + - "CARDNAME at the beginning of the next end step."; - String truedeath = "DB$ ChangeZone | Defined$ Self | Origin$ Battlefield" + - " | Destination$ Exile"; - card.setSVar("UnearthPumpSVar", dbpump); - card.setSVar("UnearthDelayTrigger", delTrig); - card.setSVar("UnearthTrueDeath", truedeath); - card.addSpellAbility(AbilityFactory.getAbility(effect, card)); - // add ability to instrinic strings so copies/clones create the ability also - card.getCurrentState().addUnparsedAbility(effect); + addSpellAbility(keyword, card, null); } else if (keyword.startsWith("Level up")) { final String strMaxLevel = card.getSVar("maxLevel"); @@ -2948,7 +2922,39 @@ 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")) { + final String[] k = keyword.split(":"); + final String manacost = k[1]; + + String effect = "AB$ ChangeZone | Cost$ " + manacost + " | Defined$ Self" + + " | Origin$ Graveyard | Destination$ Battlefield | SorcerySpeed$" + + " True | ActivationZone$ Graveyard | Unearth$ True | SubAbility$" + + " UnearthPumpSVar | PrecostDesc$ Unearth | StackDescription$ " + + "Unearth: Return CARDNAME to the battlefield. | SpellDescription$" + + " (" + Keyword.getInstance(keyword).getReminderText() + ")"; + String dbpump = "DB$ Pump | Defined$ Self | KW$ Haste & HIDDEN If CARDNAME" + + " would leave the battlefield, exile it instead of putting it " + + "anywhere else. | Permanent$ True | SubAbility$ UnearthDelayTrigger"; + String delTrig = "DB$ DelayedTrigger | Mode$ Phase | Phase$ End of Turn" + + " | Execute$ UnearthTrueDeath | TriggerDescription$ Exile " + + "CARDNAME at the beginning of the next end step."; + String truedeath = "DB$ ChangeZone | Defined$ Self | Origin$ Battlefield" + + " | Destination$ Exile"; + card.setSVar("UnearthPumpSVar", dbpump); + card.setSVar("UnearthDelayTrigger", delTrig); + card.setSVar("UnearthTrueDeath", truedeath); + + final SpellAbility sa = AbilityFactory.getAbility(effect, card); + if (!intrinsic) { + sa.setTemporary(true); + sa.setIntrinsic(false); + //sa.setOriginalHost(hostCard); + kws.addSpellAbility(sa); + } + card.addSpellAbility(sa); + } } /** diff --git a/forge-gui/res/cardsfolder/s/sedris_the_traitor_king.txt b/forge-gui/res/cardsfolder/s/sedris_the_traitor_king.txt index 84a07df5f39..29abbddff66 100644 --- a/forge-gui/res/cardsfolder/s/sedris_the_traitor_king.txt +++ b/forge-gui/res/cardsfolder/s/sedris_the_traitor_king.txt @@ -2,10 +2,6 @@ Name:Sedris, the Traitor King ManaCost:3 U B R Types:Legendary Creature Zombie Warrior PT:5/5 -S:Mode$ Continuous | EffectZone$ Battlefield | AffectedZone$ Graveyard | Affected$ Creature.YouCtrl | AddAbility$ Unearth | AddSVar$ SedrisUnearthed & SedrisTrueDeath & SedrisUnavailable | Description$ Each creature card in your graveyard has unearth {2}{B}. ({2}{B}: Return the card to the battlefield. The creature gains haste. Exile it at the beginning of the next end step or if it would leave the battlefield. Unearth only as a sorcery.) -SVar:Unearth:AB$ ChangeZone | Cost$ 2 B | Defined$ Self | Origin$ Graveyard | Destination$ Battlefield | SorcerySpeed$ True | ActivationZone$ Graveyard | Unearth$ True | SubAbility$ SedrisUnearthed | PrecostDesc$ Unearth | CostDesc$ {2}{B} | StackDescription$ Unearth: Return CARDNAME to the battlefield. | SpellDescription$ ({2}{B}: Return CARDNAME to the battlefield. It gains haste. Exile it at the beginning of the next end step or if it would leave the battlefield. Unearth only as a sorcery.) -SVar:SedrisUnearthed:DB$ Pump | Defined$ Self | KW$ Haste & HIDDEN If CARDNAME would leave the battlefield, exile it instead of putting it anywhere else. | Permanent$ True | SubAbility$ SedrisTrueDeath | StackDescription$ It gains haste. Exile it at the beginning of the next end step or if it would leave the battlefield. -SVar:SedrisTrueDeath:DB$ DelayedTrigger | Mode$ Phase | Phase$ End of Turn | Execute$ SedrisUnavailable | TriggerDescription$ Exile CARDNAME at the beginning of the next end step. -SVar:SedrisUnavailable:DB$ ChangeZone | Defined$ Self | Origin$ Battlefield | Destination$ Exile +S:Mode$ Continuous | EffectZone$ Battlefield | AffectedZone$ Graveyard | Affected$ Creature.YouCtrl | AddKeyword$ Unearth:2 B | Description$ Each creature card in your graveyard has unearth {2}{B}. ({2}{B}: Return the card to the battlefield. The creature gains haste. Exile it at the beginning of the next end step or if it would leave the battlefield. Unearth only as a sorcery.) SVar:Picture:http://www.wizards.com/global/images/magic/general/sedris_the_traitor_king.jpg Oracle:Each creature card in your graveyard has unearth {2}{B}. ({2}{B}: Return the card to the battlefield. The creature gains haste. Exile it at the beginning of the next end step or if it would leave the battlefield. Unearth only as a sorcery.)