- Converted all cards with stPreventDamage keyword to the PreventDamage static ability.

- Removed the code of the stPreventDamage keyword.
This commit is contained in:
Sloth
2011-09-25 18:39:55 +00:00
parent f02bb10ab0
commit 46c6f3af4d
12 changed files with 16 additions and 55 deletions

View File

@@ -4,7 +4,7 @@ Types:Creature Angel
Text:no text Text:no text
PT:3/4 PT:3/4
K:Flying 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:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/guardian_seraph.jpg SVar:Picture:http://www.wizards.com/global/images/magic/general/guardian_seraph.jpg
SetInfo:M10|Rare|http://magiccards.info/scans/en/m10/13.jpg SetInfo:M10|Rare|http://magiccards.info/scans/en/m10/13.jpg

View File

@@ -2,7 +2,7 @@ Name:Light of Sanction
ManaCost:1 W W ManaCost:1 W W
Types:Enchantment Types:Enchantment
Text:no text 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:RemRandomDeck:True
SVar:Rarity:Rare SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/light_of_sanction.jpg SVar:Picture:http://www.wizards.com/global/images/magic/general/light_of_sanction.jpg

View File

@@ -5,8 +5,7 @@ Text:no text
PT:1/2 PT:1/2
K:Flash K:Flash
K:Flying 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. 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.
K:stPreventDamage:Creature:Spell:1:no text
SVar:Rarity:Uncommon SVar:Rarity:Uncommon
SVar:Picture:http://www.wizards.com/global/images/magic/general/plated_pegasus.jpg SVar:Picture:http://www.wizards.com/global/images/magic/general/plated_pegasus.jpg
SetInfo:TSP|Uncommon|http://magiccards.info/scans/en/ts/34.jpg SetInfo:TSP|Uncommon|http://magiccards.info/scans/en/ts/34.jpg

View File

@@ -2,7 +2,7 @@ Name:Sphere of Duty
ManaCost:3 W ManaCost:3 W
Types:Enchantment Types:Enchantment
Text:no text 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:RemRandomDeck:True
SVar:Rarity:Uncommon SVar:Rarity:Uncommon
SVar:Picture:http://www.wizards.com/global/images/magic/general/sphere_of_duty.jpg SVar:Picture:http://www.wizards.com/global/images/magic/general/sphere_of_duty.jpg

View File

@@ -2,7 +2,7 @@ Name:Sphere of Grace
ManaCost:3 W ManaCost:3 W
Types:Enchantment Types:Enchantment
Text:no text 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:RemRandomDeck:True
SVar:Rarity:Uncommon SVar:Rarity:Uncommon
SVar:Picture:http://www.wizards.com/global/images/magic/general/sphere_of_grace.jpg SVar:Picture:http://www.wizards.com/global/images/magic/general/sphere_of_grace.jpg

View File

@@ -1,8 +1,8 @@
Name:Sphere of Law Name:Sphere of Law
ManaCost:3 W ManaCost:3 W
Types:Enchantment Types:Enchantment
Text: Text:no text
K:stPreventDamage:You:Card.Red:2:If a red source would deal damage to you, prevent 2 of that damage. 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:RemRandomDeck:True
SVar:Rarity:Uncommon SVar:Rarity:Uncommon
SVar:Picture:http://www.wizards.com/global/images/magic/general/sphere_of_law.jpg SVar:Picture:http://www.wizards.com/global/images/magic/general/sphere_of_law.jpg

View File

@@ -2,7 +2,7 @@ Name:Sphere of Purity
ManaCost:3 W ManaCost:3 W
Types:Enchantment Types:Enchantment
Text:no text 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:RemRandomDeck:True
SVar:Rarity:Uncommon SVar:Rarity:Uncommon
SVar:Picture:http://www.wizards.com/global/images/magic/general/sphere_of_purity.jpg SVar:Picture:http://www.wizards.com/global/images/magic/general/sphere_of_purity.jpg

View File

@@ -2,7 +2,7 @@ Name:Sphere of Reason
ManaCost:3 W ManaCost:3 W
Types:Enchantment Types:Enchantment
Text:no text 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:RemRandomDeck:True
SVar:Rarity:Uncommon SVar:Rarity:Uncommon
SVar:Picture:http://www.wizards.com/global/images/magic/general/sphere_of_reason.jpg SVar:Picture:http://www.wizards.com/global/images/magic/general/sphere_of_reason.jpg

View File

@@ -2,7 +2,7 @@ Name:Sphere of Truth
ManaCost:3 W ManaCost:3 W
Types:Enchantment Types:Enchantment
Text:no text 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:RemRandomDeck:True
SVar:Rarity:Uncommon SVar:Rarity:Uncommon
SVar:Picture:http://www.wizards.com/global/images/magic/general/sphere_of_truth.jpg SVar:Picture:http://www.wizards.com/global/images/magic/general/sphere_of_truth.jpg

View File

@@ -2,9 +2,10 @@ Name:Urza's Armor
ManaCost:6 ManaCost:6
Types:Artifact Types:Artifact
Text:no text 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:Rarity:Uncommon
SVar:Picture:http://www.wizards.com/global/images/magic/general/urzas_armor.jpg 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 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. Oracle:If a source would deal damage to you, prevent 1 of that damage.
End End

View File

@@ -1569,11 +1569,6 @@ public class Card extends GameEntity implements Comparable<Card> {
} else if (keyword.get(i).toString().contains("Protection:")) { } else if (keyword.get(i).toString().contains("Protection:")) {
String[] k = keyword.get(i).split(":"); String[] k = keyword.get(i).split(":");
sbLong.append(k[2]).append("\r\n"); 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")) { } else if (keyword.get(i).toString().contains("Creatures can't attack unless their controller pays")) {
String[] k = keyword.get(i).split(":"); String[] k = keyword.get(i).split(":");
if (!k[3].equals("no text")) { if (!k[3].equals("no text")) {
@@ -5701,33 +5696,14 @@ public class Card extends GameEntity implements Comparable<Card> {
//stPreventDamage //Prevent Damage static abilities
CardList allp = AllZoneUtil.getCardsIn(Zone.Battlefield); CardList allp = AllZoneUtil.getCardsIn(Zone.Battlefield);
for (Card ca : allp) { for (Card ca : allp) {
ArrayList<StaticAbility> staticAbilities = ca.getStaticAbilities(); ArrayList<StaticAbility> staticAbilities = ca.getStaticAbilities();
for (StaticAbility stAb : staticAbilities) { for (StaticAbility stAb : staticAbilities) {
restDamage = stAb.applyAbility("PreventDamage", source, this, restDamage); 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 // specific Cards
if (isCreature()) { //and not a planeswalker if (isCreature()) { //and not a planeswalker

View File

@@ -409,29 +409,14 @@ public abstract class Player extends GameEntity {
return 0; return 0;
} }
//stPreventDamage //Prevent Damage static abilities
CardList allp = AllZoneUtil.getCardsIn(Zone.Battlefield); CardList allp = AllZoneUtil.getCardsIn(Zone.Battlefield);
for (Card ca : allp) { for (Card ca : allp) {
ArrayList<StaticAbility> staticAbilities = ca.getStaticAbilities(); ArrayList<StaticAbility> staticAbilities = ca.getStaticAbilities();
for (StaticAbility stAb : staticAbilities) { for (StaticAbility stAb : staticAbilities) {
restDamage = stAb.applyAbility("PreventDamage", source, this, restDamage); 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 //specific cards
if (AllZoneUtil.isCardInPlay("Spirit of Resistance", this)) { if (AllZoneUtil.isCardInPlay("Spirit of Resistance", this)) {