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)
This commit is contained in:
jendave
2011-08-06 21:29:19 +00:00
parent f324ae9619
commit 9ea8a19c5b

View File

@@ -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";