forked from External/mage
there were 3 enums to compare ints, refactored to 1
This commit is contained in:
parent
813d84274a
commit
cb693b5826
339 changed files with 1263 additions and 1225 deletions
|
|
@ -27,10 +27,10 @@
|
|||
*/
|
||||
package mage.abilities.common;
|
||||
|
||||
import mage.abilities.CountType;
|
||||
import mage.abilities.StateTriggeredAbility;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.Filter.ComparisonType;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
|
|
@ -44,10 +44,10 @@ import mage.game.events.GameEvent;
|
|||
public class ControlsPermanentsControllerTriggeredAbility extends StateTriggeredAbility {
|
||||
|
||||
protected final FilterPermanent filter;
|
||||
protected final ComparisonType type;
|
||||
protected final CountType type;
|
||||
protected final int value;
|
||||
|
||||
public ControlsPermanentsControllerTriggeredAbility(FilterPermanent filter, ComparisonType type, int value, Effect effect) {
|
||||
public ControlsPermanentsControllerTriggeredAbility(FilterPermanent filter, CountType type, int value, Effect effect) {
|
||||
super(Zone.BATTLEFIELD, effect);
|
||||
this.filter = filter;
|
||||
this.value = value;
|
||||
|
|
@ -69,24 +69,7 @@ public class ControlsPermanentsControllerTriggeredAbility extends StateTriggered
|
|||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
int inputValue = game.getBattlefield().countAll(filter, getControllerId(), game);
|
||||
switch (type) {
|
||||
case Equal:
|
||||
if (inputValue != value) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case GreaterThan:
|
||||
if (inputValue <= value) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case LessThan:
|
||||
if (inputValue >= value) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
return CountType.compare(value, type, inputValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue