From be9a82aeeed78489f47bc12e2d08cf603124b90e Mon Sep 17 00:00:00 2001 From: jendave Date: Sat, 6 Aug 2011 12:49:50 +0000 Subject: [PATCH] - Added the keyword "Whenever CARDNAME deals damage, you gain that much life.". - Converted some of the lifelink abilities to it. - Added Noble Purpose. --- .gitattributes | 1 + res/cardsfolder/el_hajjaj.txt | 2 +- res/cardsfolder/exalted_angel.txt | 2 +- res/cardsfolder/horned_cheetah.txt | 2 +- res/cardsfolder/kjeldoran_gargoyle.txt | 2 +- res/cardsfolder/mourning_thrull.txt | 2 +- res/cardsfolder/noble_purpose.txt | 8 ++++++ res/cardsfolder/rite_of_passage.txt | 6 ++--- src/forge/Card.java | 16 ++++++------ src/forge/GameActionUtil.java | 35 ++++++++++++++++++++++++-- 10 files changed, 57 insertions(+), 19 deletions(-) create mode 100644 res/cardsfolder/noble_purpose.txt diff --git a/.gitattributes b/.gitattributes index f88dce8b7e7..96403e6e130 100644 --- a/.gitattributes +++ b/.gitattributes @@ -3229,6 +3229,7 @@ res/cardsfolder/no_mercy.txt -text svneol=native#text/plain res/cardsfolder/nobilis_of_war.txt -text svneol=native#text/plain res/cardsfolder/noble_hierarch.txt -text svneol=native#text/plain res/cardsfolder/noble_panther.txt -text svneol=native#text/plain +res/cardsfolder/noble_purpose.txt -text svneol=native#text/plain res/cardsfolder/noble_steeds.txt -text svneol=native#text/plain res/cardsfolder/noble_templar.txt -text svneol=native#text/plain res/cardsfolder/nocturnal_raid.txt -text svneol=native#text/plain diff --git a/res/cardsfolder/el_hajjaj.txt b/res/cardsfolder/el_hajjaj.txt index a537b76e716..8f1a1f5313a 100644 --- a/res/cardsfolder/el_hajjaj.txt +++ b/res/cardsfolder/el_hajjaj.txt @@ -3,7 +3,7 @@ ManaCost:1 B B Types:Creature Human Wizard Text:no text PT:1/1 -K:Lifelink +K:Whenever CARDNAME deals damage, you gain that much life. SVar:Rarity:Rare SVar:Picture:http://www.wizards.com/global/images/magic/general/el_hajjaj.jpg SetInfo:3ED|Rare|http://magiccards.info/scans/en/rv/16.jpg diff --git a/res/cardsfolder/exalted_angel.txt b/res/cardsfolder/exalted_angel.txt index c4f99557cec..6ce80ad901b 100644 --- a/res/cardsfolder/exalted_angel.txt +++ b/res/cardsfolder/exalted_angel.txt @@ -4,7 +4,7 @@ Types:Creature Angel Text:no text PT:4/5 K:Flying -K:Lifelink +K:Whenever Exalted Angel deals damage, you gain that much life. K:Morph:2 W W SVar:Rarity:Rare SVar:Picture:http://www.wizards.com/global/images/magic/general/exalted_angel.jpg diff --git a/res/cardsfolder/horned_cheetah.txt b/res/cardsfolder/horned_cheetah.txt index 40358236441..1264165f617 100644 --- a/res/cardsfolder/horned_cheetah.txt +++ b/res/cardsfolder/horned_cheetah.txt @@ -3,7 +3,7 @@ ManaCost:2 G W Types:Creature Cat Text:no text PT:2/2 -K:Lifelink +K:Whenever CARDNAME deals damage, you gain that much life. SVar:Rarity:Uncommon SVar:Picture:http://www.wizards.com/global/images/magic/general/horned_cheetah.jpg SetInfo:INV|Uncommon|http://magiccards.info/scans/en/in/251.jpg diff --git a/res/cardsfolder/kjeldoran_gargoyle.txt b/res/cardsfolder/kjeldoran_gargoyle.txt index e9c7bf35b80..28703b75d5b 100644 --- a/res/cardsfolder/kjeldoran_gargoyle.txt +++ b/res/cardsfolder/kjeldoran_gargoyle.txt @@ -5,7 +5,7 @@ Text:no text PT:3/3 K:Flying K:First Strike -K:Lifelink +K:Whenever CARDNAME deals damage, you gain that much life. SVar:Rarity:Uncommon SVar:Picture:http://www.wizards.com/global/images/magic/general/kjeldoran_gargoyle.jpg SetInfo:CSP|Uncommon|http://magiccards.info/scans/en/cs/10.jpg diff --git a/res/cardsfolder/mourning_thrull.txt b/res/cardsfolder/mourning_thrull.txt index 53867932189..3e7cb0c17bd 100644 --- a/res/cardsfolder/mourning_thrull.txt +++ b/res/cardsfolder/mourning_thrull.txt @@ -4,7 +4,7 @@ Types:Creature Thrull Text:no text PT:1/1 K:Flying -K:Lifelink +K:Whenever CARDNAME deals damage, you gain that much life. SVar:Rarity:Common SVar:Picture:http://www.wizards.com/global/images/magic/general/mourning_thrull.jpg SetInfo:GPT|Common|http://magiccards.info/scans/en/gp/146.jpg diff --git a/res/cardsfolder/noble_purpose.txt b/res/cardsfolder/noble_purpose.txt new file mode 100644 index 00000000000..c8177f708cb --- /dev/null +++ b/res/cardsfolder/noble_purpose.txt @@ -0,0 +1,8 @@ +Name:Noble Purpose +ManaCost:3 W W +Types:Enchantment +Text:no text +K:stPumpAll:Creature.YouCtrl:0/0/HIDDEN Whenever CARDNAME deals damage, you gain that much life.:No Condition:Whenever a creature you control deals combat damage, you gain that much life. +SVar:Rarity:Rare +SVar:Picture:http://www.wizards.com/global/images/magic/general/noble_purpose.jpg +End diff --git a/res/cardsfolder/rite_of_passage.txt b/res/cardsfolder/rite_of_passage.txt index 2be9525b403..8d25f3baacd 100644 --- a/res/cardsfolder/rite_of_passage.txt +++ b/res/cardsfolder/rite_of_passage.txt @@ -1,8 +1,8 @@ -Name:Rite of Passage -ManaCost:2 G +Name:Noble Purpose +ManaCost:3 W W Types:Enchantment Text:no text -K:stPumpAll:Creature.YouCtrl:0/0/HIDDEN Whenever CARDNAME is dealt damage, put a +1/+1 counter on it.:No Condition:Whenever a creature you control is dealt damage, put a +1/+1 counter on it. (The damage is dealt before the counter is put on.) +K:stPumpAll:Creature.YouCtrl:0/0/HIDDEN Whenever CARDNAME deals damage, you gain that much life.:No Condition:Whenever a creature you control is dealt damage, put a +1/+1 counter on it. (The damage is dealt before the counter is put on.) SVar:Rarity:Rare SVar:Picture:http://www.wizards.com/global/images/magic/general/rite_of_passage.jpg End diff --git a/src/forge/Card.java b/src/forge/Card.java index 462580dcde9..89577809bce 100644 --- a/src/forge/Card.java +++ b/src/forge/Card.java @@ -2853,24 +2853,22 @@ public class Card extends MyObservable { System.out.println("Adding " + damageToAdd + " damage to " + getName()); Log.debug("Adding " + damageToAdd + " damage to " + getName()); - if(source.getKeyword().contains("Lifelink")) GameActionUtil.executeLifeLinkEffects(source, damageToAdd); + GameActionUtil.executeDamageDealingEffects(source, this, damageToAdd); - CardList cl = CardFactoryUtil.getAurasEnchanting(source, "Guilty Conscience"); - for(Card c:cl) { - GameActionUtil.executeGuiltyConscienceEffects(source, c, damageToAdd); + if(this.isPlaneswalker()) { + this.subtractCounter(Counters.LOYALTY, damageToAdd); + return; } + GameActionUtil.executeDamageToCreatureEffects(source, this, damageToAdd); + if((source.getKeyword().contains("Wither") || source.getKeyword().contains("Infect")) && this.isCreature()) { this.addCounterFromNonEffect(Counters.M1M1, damageToAdd); damageToAdd = 0; } - if(this.isPlaneswalker()) { - this.subtractCounter(Counters.LOYALTY, damageToAdd); - } else - if(AllZoneUtil.isCardInPlay(this)) damage += damageToAdd; + if(AllZoneUtil.isCardInPlay(this)) damage += damageToAdd; - GameActionUtil.executeCreatureDamageEffects(source, this, damageToAdd); } private ArrayList Sets = new ArrayList(); private String curSetCode = ""; diff --git a/src/forge/GameActionUtil.java b/src/forge/GameActionUtil.java index ed75551cc70..bab46a2cd95 100644 --- a/src/forge/GameActionUtil.java +++ b/src/forge/GameActionUtil.java @@ -5333,8 +5333,39 @@ public class GameActionUtil { AllZone.Stack.add(ability2); } - //not restricted to combat damage - public static void executeCreatureDamageEffects(final Card source, final Card affected, int damage) { + //not restricted to combat damage, not restricted to dealing damage to creatures + public static void executeDamageDealingEffects(final Card source, final Card affected, int damage) { + + final Player player = affected.getController(); + + if(source.getKeyword().contains("Lifelink")) GameActionUtil.executeLifeLinkEffects(source, damage); + + if(source.getKeyword().contains("Whenever CARDNAME deals damage, you gain that much life.")) { + final int life = damage; + + Ability ability = new Ability(source, "0") { + @Override + public void resolve() { + player.gainLife(life, affected); + } + }; + StringBuilder sb = new StringBuilder(); + sb.append(source.getName()+" - ").append(player).append(" gains ").append(life).append(" life"); + ability.setStackDescription(sb.toString()); + int amount = affected.getAmountOfKeyword("Whenever CARDNAME deals damage, you gain that much life."); + + for(int i=0 ; i < amount ; i++) + AllZone.Stack.add(ability); + } + + CardList cl = CardFactoryUtil.getAurasEnchanting(source, "Guilty Conscience"); + for(Card c:cl) { + GameActionUtil.executeGuiltyConscienceEffects(source, c, damage); + } + } + + //not restricted to combat damage, restricted to dealing damage to creatures + public static void executeDamageToCreatureEffects(final Card source, final Card affected, int damage) { final Player player = affected.getController();