From a4b502a6e0e0701d7178c3c4dc4101164313b3b5 Mon Sep 17 00:00:00 2001 From: jendave Date: Sat, 6 Aug 2011 03:02:41 +0000 Subject: [PATCH] - I have updated the spLoseLifeGainLife keyword. The keyword will now look for an additional 2 fields as the keyword is parsed. The third and fourth fields contain the spell description and the stack description. - I had to create a test to see if the card is "Absorb Vis" and if it is the spLoseLifeGainLife code will add the basic landcycling. This was the only way I could get it to work. I tried --- res/cards.txt | 20 ++++++++++---------- res/main.properties | 2 +- src/forge/CardFactory.java | 38 +++++++++++++++++++++++++++++++------- 3 files changed, 42 insertions(+), 18 deletions(-) diff --git a/res/cards.txt b/res/cards.txt index d9a8e494ede..c6a4af463ce 100644 --- a/res/cards.txt +++ b/res/cards.txt @@ -565,7 +565,7 @@ TypeCycling:Basic:1 R Absorb Vis 6 B Sorcery -Target player loses 4 life and you gain 4 life. +no text spLoseLifeGainLife:4 TypeCycling:Basic:1 B @@ -3590,8 +3590,8 @@ This creature cannot block Vampiric Touch 2 B Sorcery -Vampiric Touch deals 2 damage to target opponent and you gain 2 life. -spLoseLifeGainLife:2 +no text +spLoseLifeGainLife:2:Vampiric Touch deals 2 damage to target opponent and you gain 2 life. Wings of Hope W U @@ -4070,14 +4070,14 @@ Landfall Kiss of Death 4 B B Sorcery -Kiss of Death deals 4 damage to target opponent. You gain 4 life. -spLoseLifeGainLife:4 +no text +spLoseLifeGainLife:4:Kiss of Death deals 4 damage to target opponent. You gain 4 life. Stolen Grain 4 B B Sorcery -Stolen Grain deals 5 damage to target opponent. You gain 5 life. -spLoseLifeGainLife:5 +no text +spLoseLifeGainLife:5:Stolen Grain deals 5 damage to target opponent. You gain 5 life. Privileged Position 2 GW GW GW @@ -4135,20 +4135,20 @@ Creatures you control have horsemanship. Last Caress 2 B Sorcery -Target player loses 1 life and you gain 1 life. Draw a card. +Draw a card. spLoseLifeGainLife:1 Cantrip Morsel Theft 2 B B Tribal Sorcery Rogue -Target player loses 3 life and you gain 3 life. (NOTE: "Prowl" is not implemented.) +(NOTE: "Prowl" is not implemented.) spLoseLifeGainLife:3 Soul Feast 3 B B Sorcery -Target player loses 4 life and you gain 4 life. +no text spLoseLifeGainLife:4 Shu Grain Caravan diff --git a/res/main.properties b/res/main.properties index ac8d1188303..11dd9b3ccfd 100644 --- a/res/main.properties +++ b/res/main.properties @@ -1,6 +1,6 @@ program/mail=mtgerror@yahoo.com program/forum=http://www.slightlymagic.net/forum/viewforum.php?f=26 -program/version=Forge -- official beta: 09/11/25, SVN revision: 198 +program/version=Forge -- official beta: 09/11/25, SVN revision: 199 tokens--file=AllTokens.txt diff --git a/src/forge/CardFactory.java b/src/forge/CardFactory.java index c0ae2bc9a3a..b8eeb6b480d 100644 --- a/src/forge/CardFactory.java +++ b/src/forge/CardFactory.java @@ -1842,27 +1842,33 @@ public class CardFactory implements NewConstants { card.addSpellAbility(spDraw); }//spDrawCards - //Spell gain life lose life cards (like Soul Feast) + //Spell gain life lose life cards (like Soul Feast) if (hasKeyword(card, "spLoseLifeGainLife") != -1) { int n = hasKeyword(card, "spLoseLifeGainLife"); if (n != -1) { - String parse = card.getKeyword().get(n).toString(); + String parse = card.getKeyword().get(n).toString(); card.removeIntrinsicKeyword(parse); - card.clearSpellAbility(); - String k[] = parse.split(":"); final String lfdmg = k[1]; + + final String spDesc[] = {"none"}; + final String stDesc[] = {"none"}; + + if (k.length > 2) + spDesc[0] = k[2]; + if (k.length > 3) + stDesc[0] = k[3]; final SpellAbility spell = new Spell(card) { - private static final long serialVersionUID = -8277174319360648715L; + private static final long serialVersionUID = -8361697584661592092L; - public void resolve() + public void resolve() { - final int n = Integer.parseInt(lfdmg); + final int n = Integer.parseInt(lfdmg); AllZone.GameAction.getPlayerLife(getTargetPlayer()).subtractLife(n); PlayerLife life = AllZone.GameAction.getPlayerLife(card.getController()); @@ -1873,8 +1879,26 @@ public class CardFactory implements NewConstants { spell.setChooseTargetAI(CardFactoryUtil.AI_targetHuman()); spell.setBeforePayMana(CardFactoryUtil.input_targetPlayer(spell)); + if (spDesc[0].equals("none")) // create the card description + { + spDesc[0] = ("Target player loses " + lfdmg + " life and you gain " + lfdmg + " life."); + } + + if (stDesc[0].equals("none")) // create the card stack description + { + stDesc[0] = (card.getName() + " - target loses life and you gain life."); + } + + spell.setDescription(spDesc[0]); + spell.setStackDescription(stDesc[0]); + card.clearSpellAbility(); card.addSpellAbility(spell); + + if (cardName.equals("Absorb Vis")) + { + card.addSpellAbility(CardFactoryUtil.ability_typecycle(card, "1 B","Basic")); + } return card; }