From 9ea8a19c5bbb3e9578c8af198702ab61075683cc Mon Sep 17 00:00:00 2001 From: jendave Date: Sat, 6 Aug 2011 21:29:19 +0000 Subject: [PATCH] add LifeTotal restrictions to triggers: LifeTotal$ defines the life total to check (You or Opponent) LifeAmount$ uses standard GE5, LEX, etc (Convalescense and Convalescent Care can be converted to use this) --- src/forge/card/trigger/Trigger.java | 32 +++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/forge/card/trigger/Trigger.java b/src/forge/card/trigger/Trigger.java index d1fb37847d2..fe8b904a0a1 100644 --- a/src/forge/card/trigger/Trigger.java +++ b/src/forge/card/trigger/Trigger.java @@ -195,6 +195,38 @@ public abstract class Trigger { } } + if(mapParams.containsKey("LifeTotal")){ + String player = mapParams.get("LifeTotal"); + String lifeCompare = "GE1"; + int life = 1; + + if(player.equals("You")) { + life = hostCard.getController().getLife(); + } + if(player.equals("Opponent")) { + life = hostCard.getController().getOpponent().getLife(); + } + + if(mapParams.containsKey("LifeAmount")) { + lifeCompare = mapParams.get("LifeAmount"); + } + + + int right = 1; + String rightString = lifeCompare.substring(2); + if(rightString.equals("X")) { + right = CardFactoryUtil.xCount(hostCard, hostCard.getSVar("X")); + } + else { + right = Integer.parseInt(lifeCompare.substring(2)); + } + + if(!Card.compare(life, lifeCompare, right)) { + return false; + } + + } + if (mapParams.containsKey("IsPresent")){ String sIsPresent = mapParams.get("IsPresent"); String presentCompare = "GE1";