forked from External/mage
52 lines
1.4 KiB
Java
52 lines
1.4 KiB
Java
|
|
package mage.abilities.common;
|
|
|
|
import mage.abilities.TriggeredAbilityImpl;
|
|
import mage.abilities.effects.Effect;
|
|
import mage.abilities.keyword.CyclingAbility;
|
|
import mage.constants.Zone;
|
|
import mage.game.Game;
|
|
import mage.game.events.GameEvent;
|
|
import mage.game.stack.StackAbility;
|
|
import mage.game.stack.StackObject;
|
|
|
|
/**
|
|
*
|
|
* @author LevelX2
|
|
*/
|
|
public class CycleAllTriggeredAbility extends TriggeredAbilityImpl {
|
|
|
|
public CycleAllTriggeredAbility(Effect effect, boolean optional) {
|
|
super(Zone.BATTLEFIELD, effect, optional);
|
|
}
|
|
|
|
public CycleAllTriggeredAbility(final CycleAllTriggeredAbility ability) {
|
|
super(ability);
|
|
}
|
|
|
|
@Override
|
|
public boolean checkEventType(GameEvent event, Game game) {
|
|
return event.getType() == GameEvent.EventType.ACTIVATED_ABILITY;
|
|
}
|
|
|
|
@Override
|
|
public boolean checkTrigger(GameEvent event, Game game) {
|
|
if (game.getState().getStack().isEmpty()) {
|
|
return false;
|
|
}
|
|
StackObject item = game.getState().getStack().getFirst();
|
|
return item instanceof StackAbility
|
|
&& item.getStackAbility() instanceof CyclingAbility;
|
|
}
|
|
|
|
@Override
|
|
public String getRule() {
|
|
return "Whenever a player cycles a card, " + super.getRule();
|
|
}
|
|
|
|
@Override
|
|
public CycleAllTriggeredAbility copy() {
|
|
return new CycleAllTriggeredAbility(this);
|
|
}
|
|
|
|
}
|