From d87ce663475778483cb4eeef9f911b3bcf634df1 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Sun, 31 Dec 2017 12:55:21 +0100 Subject: [PATCH] Added Even the Odds and reworked Feast of Blood's cast restriction. --- Mage.Sets/src/mage/cards/e/EvenTheOdds.java | 65 ++++++++++++++ Mage.Sets/src/mage/cards/f/FeastOfBlood.java | 50 ++--------- .../CastOnlyDuringPhaseStepSourceAbility.java | 28 +++++- .../CastOnlyIfConditionIsTrueAbility.java | 59 +++++++++++++ .../CastOnlyIfConditionIsTrueEffect.java | 85 +++++++++++++++++++ ...ermanentsComparedToOpponentsCondition.java | 76 +++++++++++++++++ .../CastOnlyDuringPhaseStepSourceEffect.java | 28 +++++- .../java/mage/constants/ComparisonType.java | 17 +++- 8 files changed, 358 insertions(+), 50 deletions(-) create mode 100644 Mage.Sets/src/mage/cards/e/EvenTheOdds.java create mode 100644 Mage/src/main/java/mage/abilities/common/CastOnlyIfConditionIsTrueAbility.java create mode 100644 Mage/src/main/java/mage/abilities/common/CastOnlyIfConditionIsTrueEffect.java create mode 100644 Mage/src/main/java/mage/abilities/condition/common/ControlsPermanentsComparedToOpponentsCondition.java diff --git a/Mage.Sets/src/mage/cards/e/EvenTheOdds.java b/Mage.Sets/src/mage/cards/e/EvenTheOdds.java new file mode 100644 index 00000000000..125a314497f --- /dev/null +++ b/Mage.Sets/src/mage/cards/e/EvenTheOdds.java @@ -0,0 +1,65 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.cards.e; + +import java.util.UUID; +import mage.abilities.common.CastOnlyIfConditionIsTrueAbility; +import mage.abilities.condition.common.ControlsPermanentsComparedToOpponentsCondition; +import mage.abilities.effects.common.CreateTokenEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.ComparisonType; +import mage.filter.StaticFilters; +import mage.game.permanent.token.SoldierToken; + +/** + * + * @author LevelX2 + */ +public class EvenTheOdds extends CardImpl { + + public EvenTheOdds(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{W}"); + + // Cast Even the Odds only if you control fewer creatures than each opponent. + this.addAbility(new CastOnlyIfConditionIsTrueAbility(new ControlsPermanentsComparedToOpponentsCondition(ComparisonType.FEWER_THAN, StaticFilters.FILTER_PERMANENT_CREATURES))); + + // Create three 1/1 white Soldier creature tokens. + this.getSpellAbility().addEffect(new CreateTokenEffect(new SoldierToken(), 3)); + } + + public EvenTheOdds(final EvenTheOdds card) { + super(card); + } + + @Override + public EvenTheOdds copy() { + return new EvenTheOdds(this); + } +} diff --git a/Mage.Sets/src/mage/cards/f/FeastOfBlood.java b/Mage.Sets/src/mage/cards/f/FeastOfBlood.java index dca065ae8f4..f13592fe8c7 100644 --- a/Mage.Sets/src/mage/cards/f/FeastOfBlood.java +++ b/Mage.Sets/src/mage/cards/f/FeastOfBlood.java @@ -28,18 +28,16 @@ package mage.cards.f; import java.util.UUID; -import mage.abilities.Ability; -import mage.abilities.costs.Cost; -import mage.abilities.costs.CostImpl; +import mage.abilities.common.CastOnlyIfConditionIsTrueAbility; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.effects.common.DestroyTargetEffect; import mage.abilities.effects.common.GainLifeEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; +import mage.constants.ComparisonType; import mage.constants.SubType; import mage.filter.common.FilterControlledCreaturePermanent; -import mage.filter.predicate.mageobject.SubtypePredicate; -import mage.game.Game; import mage.target.common.TargetCreaturePermanent; /** @@ -49,11 +47,14 @@ import mage.target.common.TargetCreaturePermanent; public class FeastOfBlood extends CardImpl { public FeastOfBlood(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{1}{B}"); - + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{1}{B}"); // Cast Feast of Blood only if you control two or more Vampires. - this.getSpellAbility().addCost(new FeastOfBloodCost()); + this.addAbility(new CastOnlyIfConditionIsTrueAbility( + new PermanentsOnTheBattlefieldCondition( + new FilterControlledCreaturePermanent(SubType.VAMPIRE, "if you control two or more Vampires"), + ComparisonType.MORE_THAN, 1))); + // Destroy target creature. You gain 4 life. this.getSpellAbility().addTarget(new TargetCreaturePermanent()); this.getSpellAbility().addEffect(new DestroyTargetEffect()); @@ -69,36 +70,3 @@ public class FeastOfBlood extends CardImpl { return new FeastOfBlood(this); } } - -class FeastOfBloodCost extends CostImpl { - - private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent(); - - static { - filter.add(new SubtypePredicate(SubType.VAMPIRE)); - } - - public FeastOfBloodCost() { - this.text = "you must control two or more Vampires"; - } - - public FeastOfBloodCost(final FeastOfBloodCost cost) { - super(cost); - } - - @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { - return game.getBattlefield().contains(filter, controllerId, 2, game); - } - - @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { - this.paid = true; - return paid; - } - - @Override - public FeastOfBloodCost copy() { - return new FeastOfBloodCost(this); - } -} diff --git a/Mage/src/main/java/mage/abilities/common/CastOnlyDuringPhaseStepSourceAbility.java b/Mage/src/main/java/mage/abilities/common/CastOnlyDuringPhaseStepSourceAbility.java index cc62092feef..dda7c8283b9 100644 --- a/Mage/src/main/java/mage/abilities/common/CastOnlyDuringPhaseStepSourceAbility.java +++ b/Mage/src/main/java/mage/abilities/common/CastOnlyDuringPhaseStepSourceAbility.java @@ -1,7 +1,29 @@ /* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. */ package mage.abilities.common; diff --git a/Mage/src/main/java/mage/abilities/common/CastOnlyIfConditionIsTrueAbility.java b/Mage/src/main/java/mage/abilities/common/CastOnlyIfConditionIsTrueAbility.java new file mode 100644 index 00000000000..247d1bd8428 --- /dev/null +++ b/Mage/src/main/java/mage/abilities/common/CastOnlyIfConditionIsTrueAbility.java @@ -0,0 +1,59 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.abilities.common; + +import mage.abilities.condition.Condition; +import mage.constants.Zone; + +/** + * + * @author LevelX2 + */ +public class CastOnlyIfConditionIsTrueAbility extends SimpleStaticAbility { + + public CastOnlyIfConditionIsTrueAbility(Condition condition) { + this(condition, null); + } + + public CastOnlyIfConditionIsTrueAbility(Condition condition, String effectText) { + super(Zone.ALL, new CastOnlyIfConditionIsTrueEffect(condition)); + this.setRuleAtTheTop(true); + if (effectText != null) { + getEffects().get(0).setText(effectText); + } + } + + private CastOnlyIfConditionIsTrueAbility(final CastOnlyIfConditionIsTrueAbility ability) { + super(ability); + } + + @Override + public CastOnlyIfConditionIsTrueAbility copy() { + return new CastOnlyIfConditionIsTrueAbility(this); + } +} diff --git a/Mage/src/main/java/mage/abilities/common/CastOnlyIfConditionIsTrueEffect.java b/Mage/src/main/java/mage/abilities/common/CastOnlyIfConditionIsTrueEffect.java new file mode 100644 index 00000000000..0fdc05f7608 --- /dev/null +++ b/Mage/src/main/java/mage/abilities/common/CastOnlyIfConditionIsTrueEffect.java @@ -0,0 +1,85 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.abilities.common; + +import mage.abilities.Ability; +import mage.abilities.condition.Condition; +import mage.abilities.effects.ContinuousRuleModifyingEffectImpl; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.game.Game; +import mage.game.events.GameEvent; + +/** + * + * @author LevelX2 + */ +public class CastOnlyIfConditionIsTrueEffect extends ContinuousRuleModifyingEffectImpl { + + private final Condition condition; + + public CastOnlyIfConditionIsTrueEffect(Condition condition) { + super(Duration.EndOfGame, Outcome.Detriment); + this.condition = condition; + staticText = setText(); + } + + private CastOnlyIfConditionIsTrueEffect(final CastOnlyIfConditionIsTrueEffect effect) { + super(effect); + this.condition = effect.condition; + } + + @Override + public boolean checksEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.CAST_SPELL; + } + + @Override + public boolean applies(GameEvent event, Ability source, Game game) { + // has to return true, if the spell cannot be cast in the current phase / step + if (event.getSourceId().equals(source.getSourceId())) { + if (condition != null && !condition.apply(game, source)) { + return true; + } + } + return false; // cast not prevented by this effect + } + + @Override + public CastOnlyIfConditionIsTrueEffect copy() { + return new CastOnlyIfConditionIsTrueEffect(this); + } + + private String setText() { + StringBuilder sb = new StringBuilder("cast {this} only "); + if (condition != null) { + sb.append(' ').append(condition.toString()); + } + return sb.toString(); + } +} diff --git a/Mage/src/main/java/mage/abilities/condition/common/ControlsPermanentsComparedToOpponentsCondition.java b/Mage/src/main/java/mage/abilities/condition/common/ControlsPermanentsComparedToOpponentsCondition.java new file mode 100644 index 00000000000..1acd1f596cf --- /dev/null +++ b/Mage/src/main/java/mage/abilities/condition/common/ControlsPermanentsComparedToOpponentsCondition.java @@ -0,0 +1,76 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.abilities.condition.common; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.condition.Condition; +import mage.constants.ComparisonType; +import mage.filter.FilterPermanent; +import mage.game.Game; +import mage.players.Player; + +/** + * + * @author LevelX2 + */ +public class ControlsPermanentsComparedToOpponentsCondition implements Condition { + + private final ComparisonType type; + private final FilterPermanent filterPermanent; + + public ControlsPermanentsComparedToOpponentsCondition(ComparisonType type, FilterPermanent filterPermanent) { + this.type = type; + this.filterPermanent = filterPermanent; + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + if (controller != null) { + int ownNumber = game.getBattlefield().countAll(filterPermanent, source.getControllerId(), game); + for (UUID playerId : game.getOpponents(source.getControllerId())) { + if (!ComparisonType.compare(ownNumber, type, game.getBattlefield().countAll(filterPermanent, playerId, game))) { + return false; + } + } + } + return true; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("if you control "); + sb.append(type.getText1()).append(" "); + sb.append(filterPermanent.getMessage()).append(" "); + sb.append(type.getText2()); + sb.append(" each opponent"); + return sb.toString(); + } + +} diff --git a/Mage/src/main/java/mage/abilities/effects/common/ruleModifying/CastOnlyDuringPhaseStepSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/ruleModifying/CastOnlyDuringPhaseStepSourceEffect.java index 6b8f615222c..4787c7579f7 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/ruleModifying/CastOnlyDuringPhaseStepSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/ruleModifying/CastOnlyDuringPhaseStepSourceEffect.java @@ -1,7 +1,29 @@ /* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. */ package mage.abilities.effects.common.ruleModifying; diff --git a/Mage/src/main/java/mage/constants/ComparisonType.java b/Mage/src/main/java/mage/constants/ComparisonType.java index 7f62a51f2ca..f47bd1839c4 100644 --- a/Mage/src/main/java/mage/constants/ComparisonType.java +++ b/Mage/src/main/java/mage/constants/ComparisonType.java @@ -4,12 +4,16 @@ package mage.constants; * Created by IGOUDT on 5-3-2017. */ public enum ComparisonType { - MORE_THAN(">"), FEWER_THAN("<"), EQUAL_TO("=="); + MORE_THAN(">", "more", "than"), FEWER_THAN("<", "fewer", "than"), EQUAL_TO("==", "equal", "to"); String operator; + String text1; + String text2; - ComparisonType(String op) { - operator = op; + ComparisonType(String op, String text1, String text2) { + this.operator = op; + this.text1 = text1; + this.text2 = text2; } @Override @@ -17,6 +21,13 @@ public enum ComparisonType { return operator; } + public String getText1() { + return text1; + } + + public String getText2() { + return text2; + } public static boolean compare(int source, ComparisonType comparison, int target) { switch (comparison) {