From 46c6f3af4d741146b94f2fc7c853cc59f3c9250e Mon Sep 17 00:00:00 2001 From: Sloth Date: Sun, 25 Sep 2011 18:39:55 +0000 Subject: [PATCH] - Converted all cards with stPreventDamage keyword to the PreventDamage static ability. - Removed the code of the stPreventDamage keyword. --- res/cardsfolder/g/guardian_seraph.txt | 2 +- res/cardsfolder/l/light_of_sanction.txt | 2 +- res/cardsfolder/p/plated_pegasus.txt | 3 +-- res/cardsfolder/s/sphere_of_duty.txt | 2 +- res/cardsfolder/s/sphere_of_grace.txt | 2 +- res/cardsfolder/s/sphere_of_law.txt | 4 ++-- res/cardsfolder/s/sphere_of_purity.txt | 2 +- res/cardsfolder/s/sphere_of_reason.txt | 2 +- res/cardsfolder/s/sphere_of_truth.txt | 2 +- res/cardsfolder/u/urzas_armor.txt | 3 ++- src/main/java/forge/Card.java | 28 ++----------------------- src/main/java/forge/Player.java | 19 ++--------------- 12 files changed, 16 insertions(+), 55 deletions(-) diff --git a/res/cardsfolder/g/guardian_seraph.txt b/res/cardsfolder/g/guardian_seraph.txt index f19fb4066d6..84b3d85fdfa 100644 --- a/res/cardsfolder/g/guardian_seraph.txt +++ b/res/cardsfolder/g/guardian_seraph.txt @@ -4,7 +4,7 @@ Types:Creature Angel Text:no text PT:3/4 K:Flying -K:stPreventDamage:You:Card.YouDontCtrl:1:If a source an opponent controls would deal damage to you, prevent 1 of that damage. +S:Mode$ PreventDamage | Target$ You | Source$ Card.YouDontCtrl | Amount$ 1 | Description$ If a source an opponent controls would deal damage to you, prevent 1 of that damage. SVar:Rarity:Rare SVar:Picture:http://www.wizards.com/global/images/magic/general/guardian_seraph.jpg SetInfo:M10|Rare|http://magiccards.info/scans/en/m10/13.jpg diff --git a/res/cardsfolder/l/light_of_sanction.txt b/res/cardsfolder/l/light_of_sanction.txt index d0fc3483f4b..b1ee267572e 100644 --- a/res/cardsfolder/l/light_of_sanction.txt +++ b/res/cardsfolder/l/light_of_sanction.txt @@ -2,7 +2,7 @@ Name:Light of Sanction ManaCost:1 W W Types:Enchantment Text:no text -K:stPreventDamage:Creature.YouCtrl:Card.YouCtrl:All:Prevent all damage that would be dealt to creatures you control by sources you control. +S:Mode$ PreventDamage | Target$ Creature.YouCtrl | Source$ Card.YouCtrl | Amount$ All | Description$ Prevent all damage that would be dealt to creatures you control by sources you control. SVar:RemRandomDeck:True SVar:Rarity:Rare SVar:Picture:http://www.wizards.com/global/images/magic/general/light_of_sanction.jpg diff --git a/res/cardsfolder/p/plated_pegasus.txt b/res/cardsfolder/p/plated_pegasus.txt index ef181624037..ec0f874f085 100644 --- a/res/cardsfolder/p/plated_pegasus.txt +++ b/res/cardsfolder/p/plated_pegasus.txt @@ -5,8 +5,7 @@ Text:no text PT:1/2 K:Flash K:Flying -K:stPreventDamage:Player:Spell:1:If a spell would deal damage to a creature or player, prevent 1 damage that spell would deal to that creature or player. -K:stPreventDamage:Creature:Spell:1:no text +S:Mode$ PreventDamage | Target$ Creature,Player | Source$ Spell | Amount$ 1 | Description$ If a spell would deal damage to a creature or player, prevent 1 damage that spell would deal to that creature or player. SVar:Rarity:Uncommon SVar:Picture:http://www.wizards.com/global/images/magic/general/plated_pegasus.jpg SetInfo:TSP|Uncommon|http://magiccards.info/scans/en/ts/34.jpg diff --git a/res/cardsfolder/s/sphere_of_duty.txt b/res/cardsfolder/s/sphere_of_duty.txt index a65a551c119..5f8b4f4b2c4 100644 --- a/res/cardsfolder/s/sphere_of_duty.txt +++ b/res/cardsfolder/s/sphere_of_duty.txt @@ -2,7 +2,7 @@ Name:Sphere of Duty ManaCost:3 W Types:Enchantment Text:no text -K:stPreventDamage:You:Card.Green:2:If a green source would deal damage to you, prevent 2 of that damage. +S:Mode$ PreventDamage | Target$ You | Source$ Card.Green | Amount$ 2 | Description$ If a green source would deal damage to you, prevent 2 of that damage. SVar:RemRandomDeck:True SVar:Rarity:Uncommon SVar:Picture:http://www.wizards.com/global/images/magic/general/sphere_of_duty.jpg diff --git a/res/cardsfolder/s/sphere_of_grace.txt b/res/cardsfolder/s/sphere_of_grace.txt index ff149d94d72..efc148bfed0 100644 --- a/res/cardsfolder/s/sphere_of_grace.txt +++ b/res/cardsfolder/s/sphere_of_grace.txt @@ -2,7 +2,7 @@ Name:Sphere of Grace ManaCost:3 W Types:Enchantment Text:no text -K:stPreventDamage:You:Card.Black:2:If a black source would deal damage to you, prevent 2 of that damage. +S:Mode$ PreventDamage | Target$ You | Source$ Card.Black | Amount$ 2 | Description$ If a black source would deal damage to you, prevent 2 of that damage. SVar:RemRandomDeck:True SVar:Rarity:Uncommon SVar:Picture:http://www.wizards.com/global/images/magic/general/sphere_of_grace.jpg diff --git a/res/cardsfolder/s/sphere_of_law.txt b/res/cardsfolder/s/sphere_of_law.txt index 2bc5d268928..314ded915b0 100644 --- a/res/cardsfolder/s/sphere_of_law.txt +++ b/res/cardsfolder/s/sphere_of_law.txt @@ -1,8 +1,8 @@ Name:Sphere of Law ManaCost:3 W Types:Enchantment -Text: -K:stPreventDamage:You:Card.Red:2:If a red source would deal damage to you, prevent 2 of that damage. +Text:no text +S:Mode$ PreventDamage | Target$ You | Source$ Card.Red | Amount$ 2 | Description$ If a red source would deal damage to you, prevent 2 of that damage. SVar:RemRandomDeck:True SVar:Rarity:Uncommon SVar:Picture:http://www.wizards.com/global/images/magic/general/sphere_of_law.jpg diff --git a/res/cardsfolder/s/sphere_of_purity.txt b/res/cardsfolder/s/sphere_of_purity.txt index 934e8ae811c..a13b7c6d562 100644 --- a/res/cardsfolder/s/sphere_of_purity.txt +++ b/res/cardsfolder/s/sphere_of_purity.txt @@ -2,7 +2,7 @@ Name:Sphere of Purity ManaCost:3 W Types:Enchantment Text:no text -K:stPreventDamage:You:Artifact:1:If an artifact source would deal damage to you, prevent 1 of that damage. +S:Mode$ PreventDamage | Target$ You | Source$ Artifact | Amount$ 1 | Description$ If an artifact source would deal damage to you, prevent 1 of that damage. SVar:RemRandomDeck:True SVar:Rarity:Uncommon SVar:Picture:http://www.wizards.com/global/images/magic/general/sphere_of_purity.jpg diff --git a/res/cardsfolder/s/sphere_of_reason.txt b/res/cardsfolder/s/sphere_of_reason.txt index 29bef13e46c..251f54bd39b 100644 --- a/res/cardsfolder/s/sphere_of_reason.txt +++ b/res/cardsfolder/s/sphere_of_reason.txt @@ -2,7 +2,7 @@ Name:Sphere of Reason ManaCost:3 W Types:Enchantment Text:no text -K:stPreventDamage:You:Card.Blue:2:If a blue source would deal damage to you, prevent 2 of that damage. +S:Mode$ PreventDamage | Target$ You | Source$ Card.Blue | Amount$ 2 | Description$ If a blue source would deal damage to you, prevent 2 of that damage. SVar:RemRandomDeck:True SVar:Rarity:Uncommon SVar:Picture:http://www.wizards.com/global/images/magic/general/sphere_of_reason.jpg diff --git a/res/cardsfolder/s/sphere_of_truth.txt b/res/cardsfolder/s/sphere_of_truth.txt index 149a92b2ca6..36d48c88b5b 100644 --- a/res/cardsfolder/s/sphere_of_truth.txt +++ b/res/cardsfolder/s/sphere_of_truth.txt @@ -2,7 +2,7 @@ Name:Sphere of Truth ManaCost:3 W Types:Enchantment Text:no text -K:stPreventDamage:You:Card.White:2:If a white source would deal damage to you, prevent 2 of that damage. +S:Mode$ PreventDamage | Target$ You | Source$ Card.White | Amount$ 2 | Description$ If a white source would deal damage to you, prevent 2 of that damage. SVar:RemRandomDeck:True SVar:Rarity:Uncommon SVar:Picture:http://www.wizards.com/global/images/magic/general/sphere_of_truth.jpg diff --git a/res/cardsfolder/u/urzas_armor.txt b/res/cardsfolder/u/urzas_armor.txt index 90bc0e23a5c..2eba81e096e 100644 --- a/res/cardsfolder/u/urzas_armor.txt +++ b/res/cardsfolder/u/urzas_armor.txt @@ -2,9 +2,10 @@ Name:Urza's Armor ManaCost:6 Types:Artifact Text:no text -K:stPreventDamage:You:Card:1:If a source would deal damage to you, prevent 1 of that damage. +S:Mode$ PreventDamage | Target$ You | Source$ Card | Amount$ 1 | Description$ If a source would deal damage to you, prevent 1 of that damage. SVar:Rarity:Uncommon SVar:Picture:http://www.wizards.com/global/images/magic/general/urzas_armor.jpg +SetInfo:8ED|Rare|http://magiccards.info/scans/en/8e/318.jpg SetInfo:USG|Uncommon|http://magiccards.info/scans/en/us/313.jpg Oracle:If a source would deal damage to you, prevent 1 of that damage. End \ No newline at end of file diff --git a/src/main/java/forge/Card.java b/src/main/java/forge/Card.java index c786bd142e8..e636e2bea74 100644 --- a/src/main/java/forge/Card.java +++ b/src/main/java/forge/Card.java @@ -1569,11 +1569,6 @@ public class Card extends GameEntity implements Comparable { } else if (keyword.get(i).toString().contains("Protection:")) { String[] k = keyword.get(i).split(":"); sbLong.append(k[2]).append("\r\n"); - } else if (keyword.get(i).toString().contains("stPreventDamage:")) { - String[] k = keyword.get(i).split(":"); - if (!k[4].equals("no text")) { - sbLong.append(k[4]).append("\r\n"); - } } else if (keyword.get(i).toString().contains("Creatures can't attack unless their controller pays")) { String[] k = keyword.get(i).split(":"); if (!k[3].equals("no text")) { @@ -5701,33 +5696,14 @@ public class Card extends GameEntity implements Comparable { - //stPreventDamage + //Prevent Damage static abilities CardList allp = AllZoneUtil.getCardsIn(Zone.Battlefield); for (Card ca : allp) { ArrayList staticAbilities = ca.getStaticAbilities(); for (StaticAbility stAb : staticAbilities) { restDamage = stAb.applyAbility("PreventDamage", source, this, restDamage); } - - if (ca.hasStartOfKeyword("stPreventDamage")) { - //syntax stPreventDamage:[Who is protected(You/Player/ValidCards)]:[ValidSource]:[Amount/All] - int keywordPosition = ca.getKeywordPosition("stPreventDamage"); - String parse = ca.getKeyword().get(keywordPosition).toString(); - String[] k = parse.split(":"); - - final String[] restrictions1 = k[1].split(","); - final String[] restrictions2 = k[2].split(","); - final Card card = ca; - if (this.isValidCard(restrictions1, card.getController(), card) - && source.isValidCard(restrictions2, card.getController(), card)) - { - if (k[3].equals("All")) { - return 0; - } - restDamage = restDamage - Integer.valueOf(k[3]); - } - } - } //stPreventDamage + } // specific Cards if (isCreature()) { //and not a planeswalker diff --git a/src/main/java/forge/Player.java b/src/main/java/forge/Player.java index 82059f892a7..87a6842f1f0 100644 --- a/src/main/java/forge/Player.java +++ b/src/main/java/forge/Player.java @@ -409,29 +409,14 @@ public abstract class Player extends GameEntity { return 0; } - //stPreventDamage + //Prevent Damage static abilities CardList allp = AllZoneUtil.getCardsIn(Zone.Battlefield); for (Card ca : allp) { ArrayList staticAbilities = ca.getStaticAbilities(); for (StaticAbility stAb : staticAbilities) { restDamage = stAb.applyAbility("PreventDamage", source, this, restDamage); } - if (ca.hasStartOfKeyword("stPreventDamage")) { - //syntax stPreventDamage:[Who is protected(You/Player/ValidCards)]:[ValidSource]:[Amount/All] - int KeywordPosition = ca.getKeywordPosition("stPreventDamage"); - String parse = ca.getKeyword().get(KeywordPosition).toString(); - String k[] = parse.split(":"); - - final Card card = ca; - if (k[1].equals("Player") || (k[1].equals("You") && card.getController().isPlayer(this))) { - final String restrictions[] = k[2].split(","); - if (source.isValidCard(restrictions, card.getController(), card)) { - if (k[3].equals("All")) return 0; - restDamage = restDamage - Integer.valueOf(k[3]); - } - } - } - } //stPreventDamage + } //specific cards if (AllZoneUtil.isCardInPlay("Spirit of Resistance", this)) {