From aeda402d788752a9eb6d5ebf00cd79ab6817e37d Mon Sep 17 00:00:00 2001 From: Hellfish Date: Thu, 5 Jan 2012 10:57:23 +0000 Subject: [PATCH] *Added CheckThirdSVar and CheckFourthSVar and accompanying parameters to StaticAbility. --- .../card/staticability/StaticAbility.java | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/main/java/forge/card/staticability/StaticAbility.java b/src/main/java/forge/card/staticability/StaticAbility.java index 66554d3fc2e..0f610304910 100644 --- a/src/main/java/forge/card/staticability/StaticAbility.java +++ b/src/main/java/forge/card/staticability/StaticAbility.java @@ -468,6 +468,34 @@ public class StaticAbility { return false; } } + + if (this.mapParams.containsKey("CheckThirdSVar")) { + final int sVar = AbilityFactory.calculateAmount(this.hostCard, this.mapParams.get("CheckThirdSVar"), null); + String comparator = "GE1"; + if (this.mapParams.containsKey("ThirdSVarCompare")) { + comparator = this.mapParams.get("ThirdSVarCompare"); + } + final String svarOperator = comparator.substring(0, 2); + final String svarOperand = comparator.substring(2); + final int operandValue = AbilityFactory.calculateAmount(this.hostCard, svarOperand, null); + if (!AllZoneUtil.compare(sVar, svarOperator, operandValue)) { + return false; + } + } + + if (this.mapParams.containsKey("CheckFourthSVar")) { + final int sVar = AbilityFactory.calculateAmount(this.hostCard, this.mapParams.get("CheckFourthSVar"), null); + String comparator = "GE1"; + if (this.mapParams.containsKey("FourthSVarCompare")) { + comparator = this.mapParams.get("FourthSVarCompare"); + } + final String svarOperator = comparator.substring(0, 2); + final String svarOperand = comparator.substring(2); + final int operandValue = AbilityFactory.calculateAmount(this.hostCard, svarOperand, null); + if (!AllZoneUtil.compare(sVar, svarOperator, operandValue)) { + return false; + } + } return true; }