From 9947b3281b9f7f4c81f76358f6c76ce236914b33 Mon Sep 17 00:00:00 2001 From: Sol Date: Wed, 24 Aug 2011 04:05:37 +0000 Subject: [PATCH] Add XChoice to PayLife Add Hatred --- .gitattributes | 1 + res/cardsfolder/h/hatred.txt | 11 +++++++++++ src/main/java/forge/card/cost/CostPayLife.java | 13 ++++++------- 3 files changed, 18 insertions(+), 7 deletions(-) create mode 100644 res/cardsfolder/h/hatred.txt diff --git a/.gitattributes b/.gitattributes index e618924cc52..8353d027f95 100644 --- a/.gitattributes +++ b/.gitattributes @@ -3417,6 +3417,7 @@ res/cardsfolder/h/hatchet_bully.txt svneol=native#text/plain res/cardsfolder/h/hatching_plans.txt svneol=native#text/plain res/cardsfolder/h/hate_weaver.txt svneol=native#text/plain res/cardsfolder/h/hateflayer.txt svneol=native#text/plain +res/cardsfolder/h/hatred.txt -text res/cardsfolder/h/haunted_angel.txt svneol=native#text/plain res/cardsfolder/h/haunted_cadaver.txt svneol=native#text/plain res/cardsfolder/h/haunted_crossroads.txt svneol=native#text/plain diff --git a/res/cardsfolder/h/hatred.txt b/res/cardsfolder/h/hatred.txt new file mode 100644 index 00000000000..44edbf504b8 --- /dev/null +++ b/res/cardsfolder/h/hatred.txt @@ -0,0 +1,11 @@ +Name:Hatred +ManaCost:3 B B +Types:Instant +Text:no text +A:SP$ Pump | Cost$ 3 B B PayLife | Tgt$ TgtC | NumAtt$ ChosenX | SpellDescription$ Target creature gets +X/+0 until end of turn. +SVar:X:XChoice +#ChosenX SVar created by Cost payment +SVar:RemAIDeck:True +SVar:Rarity:Rare +SVar:Picture:http://www.wizards.com/global/images/magic/general/hatred.jpg +End \ No newline at end of file diff --git a/src/main/java/forge/card/cost/CostPayLife.java b/src/main/java/forge/card/cost/CostPayLife.java index b256111231c..992fa7287ea 100644 --- a/src/main/java/forge/card/cost/CostPayLife.java +++ b/src/main/java/forge/card/cost/CostPayLife.java @@ -53,7 +53,8 @@ public class CostPayLife extends CostPart { @Override public boolean payHuman(SpellAbility ability, Card source, Cost_Payment payment) { String amount = getAmount(); - int life = ability.getActivatingPlayer().getLife(); + Player activator = ability.getActivatingPlayer(); + int life = activator.getLife(); Integer c = convertAmount(); if (c == null){ @@ -70,8 +71,8 @@ public class CostPayLife extends CostPart { StringBuilder sb = new StringBuilder(); sb.append(source.getName()).append(" - Pay ").append(c).append(" Life?"); - if (GameActionUtil.showYesNoDialog(source, sb.toString())) { - AllZone.getHumanPlayer().payLife(c, null); + if (GameActionUtil.showYesNoDialog(source, sb.toString()) && activator.canPayLife(c)) { + activator.payLife(c, null); setLastPaidAmount(c); payment.setPaidManaPart(this, true); } else { @@ -91,9 +92,7 @@ public class CostPayLife extends CostPart { String sVar = source.getSVar(amount); // Generalize this if (sVar.equals("XChoice")){ - // This decision should be locked in the AF and be calculable at this state - //c = chooseXValue(life); - // Figure out what to do here + return false; } else{ c = AbilityFactory.calculateAmount(source, amount, ability); @@ -102,7 +101,7 @@ public class CostPayLife extends CostPart { if (!activator.canPayLife(c)){ return false; } - + activator.payLife(c, null); setLastPaidAmount(c); return true; }