From 2428a6b0b1081c0af5073a42d8589a8f63331c5c Mon Sep 17 00:00:00 2001 From: swordshine Date: Sat, 4 Oct 2014 12:31:09 +0000 Subject: [PATCH] - A better fix for ComputerUtilCard.applyStaticContPT() --- .../main/java/forge/ai/ComputerUtilCard.java | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/forge-ai/src/main/java/forge/ai/ComputerUtilCard.java b/forge-ai/src/main/java/forge/ai/ComputerUtilCard.java index f669ba1e700..85c3fa3610e 100644 --- a/forge-ai/src/main/java/forge/ai/ComputerUtilCard.java +++ b/forge-ai/src/main/java/forge/ai/ComputerUtilCard.java @@ -1136,24 +1136,22 @@ public class ComputerUtilCard { continue; } if (params.containsKey("AddPower")) { + String addP = params.get("AddPower"); int att = 0; - if (params.get("AddPower").equals("X")) { - att = CardFactoryUtil.xCount(c, c.getSVar("X")); - } else if (params.get("AddPower").equals("Y")) { - att = CardFactoryUtil.xCount(c, c.getSVar("Y")); + if (addP.equals("AffectedX")) { + att = CardFactoryUtil.xCount(vCard, AbilityUtils.getSVar(stAb, addP)); } else { - att = AbilityUtils.calculateAmount(c, params.get("AddPower"), stAb); + att = AbilityUtils.calculateAmount(c, addP, stAb); } vCard.addTempAttackBoost(att); } if (params.containsKey("AddToughness")) { + String addT = params.get("AddToughness"); int def = 0; - if (params.get("AddToughness").equals("X")) { - def = CardFactoryUtil.xCount(c, c.getSVar("X")); - } else if (params.get("AddToughness").equals("Y")) { - def = CardFactoryUtil.xCount(c, c.getSVar("Y")); + if (addT.equals("AffectedY")) { + def = CardFactoryUtil.xCount(vCard, AbilityUtils.getSVar(stAb, addT)); } else { - def = AbilityUtils.calculateAmount(c, params.get("AddToughness"), stAb); + def = AbilityUtils.calculateAmount(c, addT, stAb); } vCard.addTempDefenseBoost(def); }