diff --git a/.gitattributes b/.gitattributes index 7fc02d84468..8e1504f9eeb 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1621,7 +1621,7 @@ res/cardsfolder/daru_lancer.txt -text svneol=native#text/plain res/cardsfolder/daru_mender.txt svneol=native#text/plain res/cardsfolder/daru_sanctifier.txt svneol=native#text/plain res/cardsfolder/daru_warchief.txt -text svneol=native#text/plain -res/cardsfolder/daunting_defender.txt svneol=native#text/plain +res/cardsfolder/daunting_defender.txt -text svneol=native#text/plain res/cardsfolder/dauntless_dourbark.txt -text svneol=native#text/plain res/cardsfolder/dauntless_escort.txt -text svneol=native#text/plain res/cardsfolder/dauthi_cutthroat.txt -text svneol=native#text/plain diff --git a/res/cardsfolder/daunting_defender.txt b/res/cardsfolder/daunting_defender.txt index d39c10f518e..d0a0498b02f 100644 --- a/res/cardsfolder/daunting_defender.txt +++ b/res/cardsfolder/daunting_defender.txt @@ -1,9 +1,10 @@ -Name:Daunting Defender -ManaCost:4 W -Types:Creature Human Cleric -Text:If a source would deal damage to a Cleric creature you control, prevent 1 of that damage. -PT:3/3 -SVar:Rarity:Common -SVar:Picture:http://www.wizards.com/global/images/magic/general/daunting_defender.jpg -SetInfo:ONS|Common|http://magiccards.info/scans/en/on/21.jpg +Name:Daunting Defender +ManaCost:4 W +Types:Creature Human Cleric +Text:no text +K:stPreventDamage:Creature.Cleric+YouCtrl:Card:1:If a source would deal damage to a Cleric creature you control, prevent 1 of that damage. +PT:3/3 +SVar:Rarity:Common +SVar:Picture:http://www.wizards.com/global/images/magic/general/daunting_defender.jpg +SetInfo:ONS|Common|http://magiccards.info/scans/en/on/21.jpg End \ No newline at end of file diff --git a/res/cardsfolder/light_of_sanction.txt b/res/cardsfolder/light_of_sanction.txt index 733bfca33b6..b1cbc1ba3f6 100644 --- a/res/cardsfolder/light_of_sanction.txt +++ b/res/cardsfolder/light_of_sanction.txt @@ -1,7 +1,8 @@ Name:Light of Sanction ManaCost:1 W W Types:Enchantment -Text:Prevent all damage that would be dealt to creatures you control by sources you control. +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. 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/plated_pegasus.txt b/res/cardsfolder/plated_pegasus.txt index c2a29599d43..e3716153bc0 100644 --- a/res/cardsfolder/plated_pegasus.txt +++ b/res/cardsfolder/plated_pegasus.txt @@ -6,6 +6,7 @@ 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 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/src/forge/Card.java b/src/forge/Card.java index 3a534d783df..737192b88f6 100644 --- a/src/forge/Card.java +++ b/src/forge/Card.java @@ -986,7 +986,8 @@ public class Card extends MyObservable { sbLong.append(k[2]).append("\r\n"); }else if (keyword.get(i).toString().contains("stPreventDamage:")) { String k[] = keyword.get(i).split(":"); - sbLong.append(k[4]).append("\r\n"); + if(!k[4].equals("no text")) + sbLong.append(k[4]).append("\r\n"); } else if (keyword.get(i).startsWith("Enchant")) { String k = keyword.get(i); k = k.replace("Curse", ""); @@ -3212,25 +3213,48 @@ public class Card extends MyObservable { if (source.isValid(valid,this.getController(),this)) return 0; } + + //stPreventDamage + CardList allp = AllZoneUtil.getCardsInPlay(); + for(Card ca : allp) { + 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)) { + if(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 if((source.isCreature() && AllZoneUtil.isCardInPlay("Well-Laid Plans") && source.sharesColorWith(this)))return 0; if((!isCombat && AllZoneUtil.isCardInPlay("Mark of Asylum", player)))return 0; - + + /* if((AllZoneUtil.isCardInPlay("Light of Sanction", player) && source.getController().isPlayer(player))) return 0; if (AllZoneUtil.isCardInPlay("Plated Pegasus") && source.isSpell()&& restDamage > 0) { int amount = AllZoneUtil.getCardsInPlay("Plated Pegasus").size(); for (int i = 0; i < amount;i++) - if ( restDamage > 0 ) + if ( restDamage > 0 ) % restDamage -= 1; } if (isType("Cleric") && AllZoneUtil.isCardInPlay("Daunting Defender", player)) restDamage = restDamage - AllZoneUtil.getPlayerCardsInPlay(player, "Daunting Defender").size(); + */ if(getName().equals("Callous Giant") && restDamage <= 3) return 0; } //Creature end diff --git a/src/forge/Player.java b/src/forge/Player.java index 615b585fdae..5c007f0ef0c 100644 --- a/src/forge/Player.java +++ b/src/forge/Player.java @@ -300,12 +300,11 @@ public abstract class Player extends MyObservable{ 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]); - } + 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