support for second SVar check

This commit is contained in:
Northmoc
2021-03-30 22:59:59 -04:00
parent 58bfc4b36c
commit b99e1f7b28
2 changed files with 54 additions and 1 deletions

View File

@@ -215,6 +215,16 @@ public class SpellAbilityCondition extends SpellAbilityVariables {
this.setSvarOperator(params.get("ConditionSVarCompare").substring(0, 2)); this.setSvarOperator(params.get("ConditionSVarCompare").substring(0, 2));
this.setSvarOperand(params.get("ConditionSVarCompare").substring(2)); this.setSvarOperand(params.get("ConditionSVarCompare").substring(2));
} }
if (params.containsKey("OrOtherConditionSVarCompare")) {
//unless another SVar is specified, check against the same one
if (params.containsKey("OrConditionCheckSVar")) {
this.setSvarToCheck2(params.get("OrConditionCheckSVar"));
} else {
this.setSvarToCheck2(params.get("ConditionCheckSVar"));
}
this.setSvarOperator2(params.get("OrOtherConditionSVarCompare").substring(0, 2));
this.setSvarOperand2(params.get("OrOtherConditionSVarCompare").substring(2));
}
if (params.containsKey("ConditionTargetValidTargeting")) { if (params.containsKey("ConditionTargetValidTargeting")) {
this.setTargetValidTargeting(params.get("ConditionTargetValidTargeting")); this.setTargetValidTargeting(params.get("ConditionTargetValidTargeting"));
} }
@@ -455,8 +465,16 @@ public class SpellAbilityCondition extends SpellAbilityVariables {
if (this.getsVarToCheck() != null) { if (this.getsVarToCheck() != null) {
final int svarValue = AbilityUtils.calculateAmount(host, this.getsVarToCheck(), sa); final int svarValue = AbilityUtils.calculateAmount(host, this.getsVarToCheck(), sa);
final int operandValue = AbilityUtils.calculateAmount(host, this.getsVarOperand(), sa); final int operandValue = AbilityUtils.calculateAmount(host, this.getsVarOperand(), sa);
boolean secondCheck = false;
if (this.getsVarToCheck2() != null) {
final int svarValue2 = AbilityUtils.calculateAmount(host, this.getsVarToCheck2(), sa);
final int operandValue2 = AbilityUtils.calculateAmount(host, this.getsVarOperand2(), sa);
if (Expressions.compare(svarValue2, this.getsVarOperator2(), operandValue2)) {
secondCheck = true;
}
}
if (!Expressions.compare(svarValue, this.getsVarOperator(), operandValue)) { if (!Expressions.compare(svarValue, this.getsVarOperator(), operandValue) && !secondCheck) {
return false; return false;
} }

View File

@@ -81,8 +81,11 @@ public class SpellAbilityVariables implements Cloneable {
this.playerContains = sav.getPlayerContains(); this.playerContains = sav.getPlayerContains();
this.presentZone = sav.getPresentZone(); this.presentZone = sav.getPresentZone();
this.sVarToCheck = sav.getsVarToCheck(); this.sVarToCheck = sav.getsVarToCheck();
this.sVarToCheck2 = sav.getsVarToCheck2();
this.sVarOperator = sav.getsVarOperator(); this.sVarOperator = sav.getsVarOperator();
this.sVarOperator2 = sav.getsVarOperator2();
this.sVarOperand = sav.getsVarOperand(); this.sVarOperand = sav.getsVarOperand();
this.sVarOperand2 = sav.getsVarOperand2();
this.lifeTotal = sav.getLifeTotal(); this.lifeTotal = sav.getLifeTotal();
this.lifeAmount = sav.getLifeAmount(); this.lifeAmount = sav.getLifeAmount();
this.manaSpent = sav.getManaSpent(); this.manaSpent = sav.getManaSpent();
@@ -164,12 +167,15 @@ public class SpellAbilityVariables implements Cloneable {
/** The svar to check. */ /** The svar to check. */
private String sVarToCheck = null; private String sVarToCheck = null;
private String sVarToCheck2 = null;
/** The svar operator. */ /** The svar operator. */
private String sVarOperator = "GE"; private String sVarOperator = "GE";
private String sVarOperator2 = "GE";
/** The svar operand. */ /** The svar operand. */
private String sVarOperand = "1"; private String sVarOperand = "1";
private String sVarOperand2 = "1";
/** The life total. */ /** The life total. */
private String lifeTotal = null; private String lifeTotal = null;
@@ -491,6 +497,9 @@ public class SpellAbilityVariables implements Cloneable {
public final void setSvarToCheck(final String sVar) { public final void setSvarToCheck(final String sVar) {
this.setsVarToCheck(sVar); this.setsVarToCheck(sVar);
} }
public final void setSvarToCheck2(final String sVar) {
this.setsVarToCheck2(sVar);
}
/** /**
* <p> * <p>
@@ -516,6 +525,14 @@ public class SpellAbilityVariables implements Cloneable {
this.setsVarOperand(operand); this.setsVarOperand(operand);
} }
//for second possible SVar condition
public final void setSvarOperator2(final String operator) {
this.setsVarOperator2(operator);
}
public final void setSvarOperand2(final String operand) {
this.setsVarOperand2(operand);
}
/** /**
* Gets the activation limit. * Gets the activation limit.
* *
@@ -729,6 +746,9 @@ public class SpellAbilityVariables implements Cloneable {
public final String getsVarOperand() { public final String getsVarOperand() {
return this.sVarOperand; return this.sVarOperand;
} }
public final String getsVarOperand2() {
return this.sVarOperand2;
}
/** /**
* Sets the s var operand. * Sets the s var operand.
@@ -739,6 +759,9 @@ public class SpellAbilityVariables implements Cloneable {
public final void setsVarOperand(final String sVarOperand0) { public final void setsVarOperand(final String sVarOperand0) {
this.sVarOperand = sVarOperand0; this.sVarOperand = sVarOperand0;
} }
public final void setsVarOperand2(final String sVarOperand0) {
this.sVarOperand2 = sVarOperand0;
}
/** /**
* Gets the s var to check. * Gets the s var to check.
@@ -748,6 +771,9 @@ public class SpellAbilityVariables implements Cloneable {
public final String getsVarToCheck() { public final String getsVarToCheck() {
return this.sVarToCheck; return this.sVarToCheck;
} }
public final String getsVarToCheck2() {
return this.sVarToCheck2;
}
/** /**
* Sets the s var to check. * Sets the s var to check.
@@ -758,6 +784,9 @@ public class SpellAbilityVariables implements Cloneable {
public final void setsVarToCheck(final String sVarToCheck) { public final void setsVarToCheck(final String sVarToCheck) {
this.sVarToCheck = sVarToCheck; this.sVarToCheck = sVarToCheck;
} }
public final void setsVarToCheck2(final String sVarToCheck) {
this.sVarToCheck2 = sVarToCheck;
}
/** /**
* Gets the s var operator. * Gets the s var operator.
@@ -767,6 +796,9 @@ public class SpellAbilityVariables implements Cloneable {
public final String getsVarOperator() { public final String getsVarOperator() {
return this.sVarOperator; return this.sVarOperator;
} }
public final String getsVarOperator2() {
return this.sVarOperator2;
}
/** /**
* Sets the s var operator. * Sets the s var operator.
@@ -777,6 +809,9 @@ public class SpellAbilityVariables implements Cloneable {
public final void setsVarOperator(final String sVarOperator0) { public final void setsVarOperator(final String sVarOperator0) {
this.sVarOperator = sVarOperator0; this.sVarOperator = sVarOperator0;
} }
public final void setsVarOperator2(final String sVarOperator0) {
this.sVarOperator2 = sVarOperator0;
}
/** /**
* Checks if is opponent turn. * Checks if is opponent turn.