From 58dbd7729b0e80aaea198852db2b5c56d5cd0e6c Mon Sep 17 00:00:00 2001 From: jendave Date: Sat, 6 Aug 2011 22:20:21 +0000 Subject: [PATCH] - Converted the following card abilities to Keyword for possible use with other cards: Platinum Angel, Abyssal Persecutor, Ali From Cairo (and friends), Lich - Added Angel's Grace using newly converted keywords and AF_Effect --- .gitattributes | 1 + res/cardsfolder/abyssal_persecutor.txt | 4 ++- res/cardsfolder/ali_from_cairo.txt | 3 +- res/cardsfolder/angels_grace.txt | 13 ++++++++ res/cardsfolder/fortune_thief.txt | 3 +- res/cardsfolder/lich.txt | 1 + res/cardsfolder/platinum_angel.txt | 4 ++- res/cardsfolder/sustaining_spirit.txt | 3 +- res/cardsfolder/worship.txt | 3 +- src/forge/Player.java | 31 +++++++++++++------ src/forge/PlayerUtil.java | 19 ++++++------ .../abilityFactory/AbilityFactory_Effect.java | 6 ++++ 12 files changed, 67 insertions(+), 24 deletions(-) create mode 100644 res/cardsfolder/angels_grace.txt diff --git a/.gitattributes b/.gitattributes index ede5e5d0f50..c3193993058 100644 --- a/.gitattributes +++ b/.gitattributes @@ -225,6 +225,7 @@ res/cardsfolder/angelic_shield.txt svneol=native#text/plain res/cardsfolder/angelic_voices.txt -text svneol=native#text/plain res/cardsfolder/angelic_wall.txt -text svneol=native#text/plain res/cardsfolder/angels_feather.txt -text svneol=native#text/plain +res/cardsfolder/angels_grace.txt -text svneol=native#text/plain res/cardsfolder/angels_mercy.txt -text svneol=native#text/plain res/cardsfolder/angelsong.txt -text svneol=native#text/plain res/cardsfolder/anger.txt -text svneol=native#text/plain diff --git a/res/cardsfolder/abyssal_persecutor.txt b/res/cardsfolder/abyssal_persecutor.txt index 0c538f287d1..66ce5e2b621 100644 --- a/res/cardsfolder/abyssal_persecutor.txt +++ b/res/cardsfolder/abyssal_persecutor.txt @@ -1,10 +1,12 @@ Name:Abyssal Persecutor ManaCost:2 B B Types:Creature Demon -Text:You can't win the game and your opponents can't lose the game. +Text:no text PT:6/6 K:Flying K:Trample +K:You can't win the game. +K:Your opponents can't lose the game. SVar:RemAIDeck:True SVar:Rarity:Mythic SVar:Picture:http://www.wizards.com/global/images/magic/general/abyssal_persecutor.jpg diff --git a/res/cardsfolder/ali_from_cairo.txt b/res/cardsfolder/ali_from_cairo.txt index eaff64fc6c8..9c47a47a099 100644 --- a/res/cardsfolder/ali_from_cairo.txt +++ b/res/cardsfolder/ali_from_cairo.txt @@ -1,8 +1,9 @@ Name:Ali from Cairo ManaCost:2 R R Types:Creature Human -Text:Damage that would reduce your life total to less than 1 reduces it to 1 instead. +Text:no text PT:0/1 +K:Damage that would reduce your life total to less than 1 reduces it to 1 instead. SVar:Rarity:Uncommon SVar:Picture:http://www.wizards.com/global/images/magic/general/ali_from_cairo.jpg SetInfo:ARN|Uncommon|http://magiccards.info/scans/en/an/44.jpg diff --git a/res/cardsfolder/angels_grace.txt b/res/cardsfolder/angels_grace.txt new file mode 100644 index 00000000000..c4240f7beda --- /dev/null +++ b/res/cardsfolder/angels_grace.txt @@ -0,0 +1,13 @@ +Name:Angel's Grace +ManaCost:W +Types:Instant +Text:no text +K:Split second +A:SP$ Effect | Cost$ W | Name$ Angel's Grace Effect | Keywords$ CantLose,OppsCantWin,AliFromCairo | SpellDescription$ You can't lose the game this turn and your opponents can't win the game this turn. Until end of turn, damage that would reduce your life total to less than 1 reduces it to 1 instead. +SVar:CantLose:You can't lose the game. +SVar:OppsCantWin:Your opponents can't win the game. +SVar:AliFromCairo:Damage that would reduce your life total to less than 1 reduces it to 1 instead. +SVar:RemAIDeck:True +SVar:Rarity:Rare +SVar:Picture:http://www.wizards.com/global/images/magic/general/angels_grace.jpg +End \ No newline at end of file diff --git a/res/cardsfolder/fortune_thief.txt b/res/cardsfolder/fortune_thief.txt index 68ce7011370..f097c50343f 100644 --- a/res/cardsfolder/fortune_thief.txt +++ b/res/cardsfolder/fortune_thief.txt @@ -1,9 +1,10 @@ Name:Fortune Thief ManaCost:4 R Types:Creature Human Rogue -Text:Damage that would reduce your life total to less than 1 reduces it to 1 instead. +Text:no text PT:0/1 K:Morph:R R +K:Damage that would reduce your life total to less than 1 reduces it to 1 instead. SVar:Rarity:Rare SVar:Picture:http://www.wizards.com/global/images/magic/general/fortune_thief.jpg SetInfo:TSP|Rare|http://magiccards.info/scans/en/ts/156.jpg diff --git a/res/cardsfolder/lich.txt b/res/cardsfolder/lich.txt index dc2e7f781c3..ad692d59353 100644 --- a/res/cardsfolder/lich.txt +++ b/res/cardsfolder/lich.txt @@ -2,6 +2,7 @@ Name:Lich ManaCost:B B B B Types:Enchantment Text:As CARDNAME enters the battlefield, you lose life equal to your life total.\r\nYou don't lose the game for having 0 or less life.\r\nIf you would gain life, draw that many cards instead.\r\nWhenever you're dealt damage, sacrifice that many nontoken permanents. If you can't, you lose the game.\r\nWhen CARDNAME is put into a graveyard from the battlefield, you lose the game. +K:You don't lose the game for having 0 or less life. SVar:RemRandomDeck:True SVar:Rarity:Rare SVar:Picture:http://www.wizards.com/global/images/magic/general/lich.jpg diff --git a/res/cardsfolder/platinum_angel.txt b/res/cardsfolder/platinum_angel.txt index 65ec23718a6..6115c996dcd 100644 --- a/res/cardsfolder/platinum_angel.txt +++ b/res/cardsfolder/platinum_angel.txt @@ -1,9 +1,11 @@ Name:Platinum Angel ManaCost:7 Types:Artifact Creature Angel -Text:You can't lose the game and your opponents can't win the game. +Text:no text PT:4/4 K:Flying +K:You can't lose the game. +K:Your opponents can't win the game. SVar:Rarity:Rare SVar:Picture:http://www.wizards.com/global/images/magic/general/platinum_angel.jpg SetInfo:M11|Mythic|http://magiccards.info/scans/en/m11/212.jpg diff --git a/res/cardsfolder/sustaining_spirit.txt b/res/cardsfolder/sustaining_spirit.txt index ed88cfa0e27..1476dc30a13 100644 --- a/res/cardsfolder/sustaining_spirit.txt +++ b/res/cardsfolder/sustaining_spirit.txt @@ -1,9 +1,10 @@ Name:Sustaining Spirit ManaCost:1 W Types:Creature Angel Spirit -Text:Damage that would reduce your life total to less than 1 reduces it to 1 instead. +Text:no text PT:0/3 K:Cumulative upkeep:1 W +K:Damage that would reduce your life total to less than 1 reduces it to 1 instead. SVar:Rarity:Rare SVar:Picture:http://www.wizards.com/global/images/magic/general/sustaining_spirit.jpg SetInfo:ALL|Rare|http://magiccards.info/scans/en/ai/151.jpg diff --git a/res/cardsfolder/worship.txt b/res/cardsfolder/worship.txt index 0115ba7500a..98022a7f64c 100644 --- a/res/cardsfolder/worship.txt +++ b/res/cardsfolder/worship.txt @@ -1,7 +1,8 @@ Name:Worship ManaCost:3 W Types:Enchantment -Text:If you control a creature, damage that would reduce your life total to less than 1 reduces it to 1 instead. +Text:no text +K:stPumpSelf:Permanent:0/0/Damage that would reduce your life total to less than 1 reduces it to 1 instead.:isPresent Creature.YouCtrl:If you control a creature, damage that would reduce your life total to less than 1 reduces it to 1 instead. SVar:Rarity:Rare SVar:Picture:http://www.wizards.com/global/images/magic/general/worship.jpg SetInfo:8ED|Rare|http://magiccards.info/scans/en/8e/57.jpg diff --git a/src/forge/Player.java b/src/forge/Player.java index cc508f91063..88233a18bd9 100644 --- a/src/forge/Player.java +++ b/src/forge/Player.java @@ -905,23 +905,36 @@ public abstract class Player extends MyObservable{ } public boolean cantLose(){ - if ((AllZoneUtil.getPlayerCardsInPlay(this, "Platinum Angel").size() > 0) || - (AllZoneUtil.getPlayerCardsInPlay(getOpponent(), "Abyssal Persecutor").size() > 0)){ + CardList list = AllZoneUtil.getPlayerCardsInPlay(this); + list = list.getKeyword("You can't lose the game."); + + if (list.size() > 0) return true; - } - return false; + + CardList oppList = AllZoneUtil.getPlayerCardsInPlay(getOpponent()); + oppList = oppList.getKeyword("Your opponents can't win the game."); + + return oppList.size() > 0; } public boolean cantLoseForZeroOrLessLife() { - return AllZoneUtil.isCardInPlay("Lich", this); + CardList list = AllZoneUtil.getPlayerCardsInPlay(this); + list = list.getKeyword("You don't lose the game for having 0 or less life."); + + return list.size() > 0; } public boolean cantWin(){ - if ((AllZoneUtil.getPlayerCardsInPlay(getOpponent(), "Platinum Angel").size() > 0) || - (AllZoneUtil.getPlayerCardsInPlay(this, "Abyssal Persecutor").size() > 0)){ + CardList list = AllZoneUtil.getPlayerCardsInPlay(getOpponent()); + list = list.getKeyword("You can't win the game."); + + if (list.size() > 0) return true; - } - return false; + + CardList oppList = AllZoneUtil.getPlayerCardsInPlay(this); + oppList = oppList.getKeyword("Your opponents can't lose the game."); + + return oppList.size() > 0; } public boolean hasLost(){ diff --git a/src/forge/PlayerUtil.java b/src/forge/PlayerUtil.java index c70a1a3d9c3..43cd76d94a3 100644 --- a/src/forge/PlayerUtil.java +++ b/src/forge/PlayerUtil.java @@ -4,14 +4,15 @@ package forge; public class PlayerUtil { public static boolean worshipFlag(Player player) { - if( AllZoneUtil.isCardInPlay("Ali from Cairo", player) - || (AllZoneUtil.isCardInPlay("Worship", player) && AllZoneUtil.getCreaturesInPlay(player).size() > 0) - || AllZoneUtil.isCardInPlay("Fortune Thief", player) - || AllZoneUtil.isCardInPlay("Sustaining Spirit", player)) { - return true; - } - else { - return false; - } + // Instead of hardcoded Ali from Cairo like cards, it is now a Keyword + CardList list = AllZoneUtil.getPlayerCardsInPlay(player); + list = list.getKeyword("Damage that would reduce your life total to less than 1 reduces it to 1 instead."); + list = list.filter(new CardListFilter() { + public boolean addCard(Card c) { + return !c.isFaceDown(); + } + }); + + return list.size() > 0; } } \ No newline at end of file diff --git a/src/forge/card/abilityFactory/AbilityFactory_Effect.java b/src/forge/card/abilityFactory/AbilityFactory_Effect.java index 04744f1dc4c..cd17e829b98 100644 --- a/src/forge/card/abilityFactory/AbilityFactory_Effect.java +++ b/src/forge/card/abilityFactory/AbilityFactory_Effect.java @@ -112,6 +112,11 @@ public class AbilityFactory_Effect { public static String effectStackDescription(AbilityFactory af, SpellAbility sa){ StringBuilder sb = new StringBuilder(); + if (sa instanceof Ability_Sub) + sb.append(" "); + else + sb.append(sa.getSourceCard().getName()).append(" - "); + sb.append(sa.getDescription()); Ability_Sub abSub = sa.getSubAbility(); @@ -186,6 +191,7 @@ public class AbilityFactory_Effect { eff.setController(controller); eff.setOwner(controller); eff.setImageName(card.getImageName()); + eff.setColor(card.getColor()); // Effects should be Orange or something probably