From 55efef6406c530e408d28801e8a0834597ff46cb Mon Sep 17 00:00:00 2001 From: elcnesh Date: Sat, 16 Aug 2014 07:53:22 +0000 Subject: [PATCH] Fix changing color words in "Protection from all colors". --- .../java/forge/game/ability/AbilityUtils.java | 4 ++-- .../src/main/java/forge/game/card/Card.java | 18 +++++++++++------- .../res/cardsfolder/e/etched_champion.txt | 3 ++- .../res/cardsfolder/f/favor_of_the_mighty.txt | 3 ++- .../res/cardsfolder/i/iridescent_angel.txt | 2 ++ forge-gui/res/cardsfolder/p/pristine_angel.txt | 3 ++- 6 files changed, 21 insertions(+), 12 deletions(-) diff --git a/forge-game/src/main/java/forge/game/ability/AbilityUtils.java b/forge-game/src/main/java/forge/game/ability/AbilityUtils.java index a00ed14bb5e..d20d86ed88d 100644 --- a/forge-game/src/main/java/forge/game/ability/AbilityUtils.java +++ b/forge-game/src/main/java/forge/game/ability/AbilityUtils.java @@ -1517,8 +1517,8 @@ public class AbilityUtils { return sas; } - public static final String applyAbilityTextChangeEffects(final String def, final CardTraitBase ability) { - if (ability == null || !ability.isIntrinsic()) { + public static final String applyAbilityTextChangeEffects(final String def, final CardTraitBase ability) { + if (ability == null || !ability.isIntrinsic() || ability.getMapParams().containsKey("LockInText")) { return def; } return applyTextChangeEffects(def, ability.getHostCard()); 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 3634610550c..583d83b4f43 100644 --- a/forge-game/src/main/java/forge/game/card/Card.java +++ b/forge-game/src/main/java/forge/game/card/Card.java @@ -4593,6 +4593,10 @@ public class Card extends GameEntity implements Comparable { } private final void updateKeywordsChangedText(final Long timestamp) { + if (this.hasSVar("LockInKeywords")) { + return; + } + final List addKeywords = Lists.newArrayList(), removeKeywords = Lists.newArrayList(this.keywordsGrantedByTextChanges); @@ -4608,7 +4612,9 @@ public class Card extends GameEntity implements Comparable { } private final void updateKeywordsOnRemoveChangedText(final KeywordsChange k) { - this.keywordsGrantedByTextChanges.removeAll(k.getKeywords()); + if (k != null) { + this.keywordsGrantedByTextChanges.removeAll(k.getKeywords()); + } } /** @@ -8403,12 +8409,10 @@ public class Card extends GameEntity implements Comparable { return true; } - if (this.getKeyword() != null) { - final List list = this.getKeyword(); - - String kw = ""; - for (int i = 0; i < list.size(); i++) { - kw = list.get(i); + final List keywords = this.getKeyword(); + if (keywords != null) { + for (int i = 0; i < keywords.size(); i++) { + final String kw = keywords.get(i); if (!kw.startsWith("Protection")) { continue; } diff --git a/forge-gui/res/cardsfolder/e/etched_champion.txt b/forge-gui/res/cardsfolder/e/etched_champion.txt index 135e2a9ff1f..c693be00899 100644 --- a/forge-gui/res/cardsfolder/e/etched_champion.txt +++ b/forge-gui/res/cardsfolder/e/etched_champion.txt @@ -2,7 +2,8 @@ Name:Etched Champion ManaCost:3 Types:Artifact Creature Soldier PT:2/2 -S:Mode$ Continuous | Affected$ Card.Self | AddKeyword$ Protection from white & Protection from blue & Protection from black & Protection from red & Protection from green | Condition$ Metalcraft | Description$ Metalcraft - CARDNAME has protection from all colors as long as you control three or more artifacts. +# Lock in text so can't change color words in "Protection from all colors" +S:Mode$ Continuous | Affected$ Card.Self | AddKeyword$ Protection from white & Protection from blue & Protection from black & Protection from red & Protection from green | LockInText$ True | Condition$ Metalcraft | Description$ Metalcraft - CARDNAME has protection from all colors as long as you control three or more artifacts. SVar:BuffedBy:Artifact SVar:Picture:http://www.wizards.com/global/images/magic/general/etched_champion.jpg Oracle:Metalcraft - Etched Champion has protection from all colors as long as you control three or more artifacts. diff --git a/forge-gui/res/cardsfolder/f/favor_of_the_mighty.txt b/forge-gui/res/cardsfolder/f/favor_of_the_mighty.txt index 503fa0b5e9f..64b603c9228 100644 --- a/forge-gui/res/cardsfolder/f/favor_of_the_mighty.txt +++ b/forge-gui/res/cardsfolder/f/favor_of_the_mighty.txt @@ -1,7 +1,8 @@ Name:Favor of the Mighty ManaCost:1 W Types:Tribal Enchantment Giant -S:Mode$ Continuous | Affected$ Creature.greatestCMC | AddKeyword$ Protection from white & Protection from blue & Protection from black & Protection from red & Protection from green | Description$ Each creature with the highest converted mana cost has protection from all colors. +# Lock in text so can't change color words in "Protection from all colors" +S:Mode$ Continuous | Affected$ Creature.greatestCMC | AddKeyword$ Protection from white & Protection from blue & Protection from black & Protection from red & Protection from green | LockInText$ True | Description$ Each creature with the highest converted mana cost has protection from all colors. SVar:NonStackingEffect:True SVar:RemRandomDeck:True SVar:Picture:http://www.wizards.com/global/images/magic/general/favor_of_the_mighty.jpg diff --git a/forge-gui/res/cardsfolder/i/iridescent_angel.txt b/forge-gui/res/cardsfolder/i/iridescent_angel.txt index 95fee6e0572..cc0acc37334 100644 --- a/forge-gui/res/cardsfolder/i/iridescent_angel.txt +++ b/forge-gui/res/cardsfolder/i/iridescent_angel.txt @@ -8,5 +8,7 @@ K:Protection from blue K:Protection from black K:Protection from red K:Protection from green +# Lock in keywords so can't change color words in "Protection from all colors" +SVar:LockInKeywords:True SVar:Picture:http://www.wizards.com/global/images/magic/general/iridescent_angel.jpg Oracle:Flying, protection from all colors diff --git a/forge-gui/res/cardsfolder/p/pristine_angel.txt b/forge-gui/res/cardsfolder/p/pristine_angel.txt index 7bfa8a29ee1..ac8acfa2264 100644 --- a/forge-gui/res/cardsfolder/p/pristine_angel.txt +++ b/forge-gui/res/cardsfolder/p/pristine_angel.txt @@ -3,7 +3,8 @@ ManaCost:4 W W Types:Creature Angel PT:4/4 K:Flying -S:Mode$ Continuous | Affected$ Card.Self+untapped | AddKeyword$ Protection from artifacts & Protection from white & Protection from blue & Protection from black & Protection from red & Protection from green | Description$ As long as CARDNAME is untapped, it has protection from artifacts and from all colors. +# Lock in text so can't change color words in "Protection from all colors" +S:Mode$ Continuous | Affected$ Card.Self+untapped | AddKeyword$ Protection from artifacts & Protection from white & Protection from blue & Protection from black & Protection from red & Protection from green | LockInText$ True | Description$ As long as CARDNAME is untapped, it has protection from artifacts and from all colors. T:Mode$ SpellCast | ValidCard$ Card | ValidActivatingPlayer$ You | TriggerZones$ Battlefield | OptionalDecider$ You | Execute$ TrigUntap | TriggerDescription$ Whenever you cast a spell, you may untap CARDNAME. SVar:TrigUntap:AB$Untap | Cost$ 0 | Defined$ Self SVar:Picture:http://www.wizards.com/global/images/magic/general/pristine_angel.jpg