forked from External/mage
* [STX] Implement Efreet Flamepainter * Add null check * Target needs to be chosen before ability resolution
50 lines
1.5 KiB
Java
50 lines
1.5 KiB
Java
package mage.abilities.effects.common;
|
|
|
|
import mage.abilities.Ability;
|
|
import mage.abilities.effects.ReplacementEffectImpl;
|
|
import mage.constants.Duration;
|
|
import mage.constants.Outcome;
|
|
import mage.constants.Zone;
|
|
import mage.game.Game;
|
|
import mage.game.events.GameEvent;
|
|
import mage.game.events.ZoneChangeEvent;
|
|
|
|
import java.util.UUID;
|
|
|
|
public class ExileCardEnteringGraveyardReplacementEffect extends ReplacementEffectImpl {
|
|
|
|
private final UUID cardId;
|
|
|
|
public ExileCardEnteringGraveyardReplacementEffect(UUID cardId) {
|
|
super(Duration.EndOfTurn, Outcome.Exile);
|
|
this.cardId = cardId;
|
|
}
|
|
|
|
ExileCardEnteringGraveyardReplacementEffect(final ExileCardEnteringGraveyardReplacementEffect effect) {
|
|
super(effect);
|
|
this.cardId = effect.cardId;
|
|
}
|
|
|
|
@Override
|
|
public ExileCardEnteringGraveyardReplacementEffect copy() {
|
|
return new ExileCardEnteringGraveyardReplacementEffect(this);
|
|
}
|
|
|
|
@Override
|
|
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
|
((ZoneChangeEvent) event).setToZone(Zone.EXILED);
|
|
return false;
|
|
}
|
|
|
|
@Override
|
|
public boolean checksEventType(GameEvent event, Game game) {
|
|
return event.getType() == GameEvent.EventType.ZONE_CHANGE;
|
|
}
|
|
|
|
@Override
|
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
|
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
|
|
return zEvent.getToZone() == Zone.GRAVEYARD
|
|
&& zEvent.getTargetId().equals(this.cardId);
|
|
}
|
|
}
|