mirror of
https://github.com/correl/mage.git
synced 2025-04-11 01:01:05 -09:00
33 lines
1,005 B
Java
33 lines
1,005 B
Java
|
|
package mage.abilities.condition.common;
|
|
|
|
import mage.abilities.Ability;
|
|
import mage.abilities.condition.Condition;
|
|
import mage.abilities.keyword.SpectacleAbility;
|
|
import mage.constants.AbilityType;
|
|
import mage.game.Game;
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
|
|
/**
|
|
* @author TheElk801
|
|
*/
|
|
public enum SpectacleCondition implements Condition {
|
|
|
|
instance;
|
|
|
|
@Override
|
|
public boolean apply(Game game, Ability source) {
|
|
if (source.getAbilityType() == AbilityType.TRIGGERED) {
|
|
@SuppressWarnings("unchecked")
|
|
List<Integer> spectacleActivations = (ArrayList) game.getState().getValue(SpectacleAbility.SPECTACLE_ACTIVATION_VALUE_KEY + source.getSourceId());
|
|
if (spectacleActivations != null) {
|
|
return spectacleActivations.contains(game.getState().getZoneChangeCounter(source.getSourceId()) - 1);
|
|
}
|
|
return false;
|
|
} else {
|
|
return source instanceof SpectacleAbility;
|
|
}
|
|
}
|
|
}
|