Implemented Crystalline Resonance

This commit is contained in:
Evan Kranzler 2020-04-07 20:52:03 -04:00
parent 357d1873db
commit 2d11f69d0e
6 changed files with 186 additions and 88 deletions

View file

@ -14,16 +14,24 @@ import mage.game.stack.StackObject;
*/
public class CycleControllerTriggeredAbility extends TriggeredAbilityImpl {
private final boolean excludeSource;
public CycleControllerTriggeredAbility(Effect effect) {
this(effect, false);
}
public CycleControllerTriggeredAbility(Effect effect, boolean optional) {
this(effect, optional, false);
}
public CycleControllerTriggeredAbility(Effect effect, boolean optional, boolean excludeSource) {
super(Zone.BATTLEFIELD, effect, optional);
this.excludeSource = excludeSource;
}
private CycleControllerTriggeredAbility(final CycleControllerTriggeredAbility ability) {
super(ability);
this.excludeSource = ability.excludeSource;
}
@Override
@ -35,7 +43,7 @@ public class CycleControllerTriggeredAbility extends TriggeredAbilityImpl {
public boolean checkTrigger(GameEvent event, Game game) {
if (game.getState().getStack().isEmpty()
|| !event.getPlayerId().equals(this.getControllerId())
|| event.getSourceId().equals(this.getSourceId())) {
|| (event.getSourceId().equals(this.getSourceId()) && excludeSource)) {
return false;
}
StackObject item = game.getState().getStack().getFirst();
@ -45,7 +53,7 @@ public class CycleControllerTriggeredAbility extends TriggeredAbilityImpl {
@Override
public String getRule() {
return "Whenever you cycle another card, " + super.getRule();
return "Whenever you cycle " + (excludeSource ? "another" : "a") + " card, " + super.getRule();
}
@Override