foul-magics/Mage/src/main/java/mage/abilities/effects/common/ExileSpellEffect.java
Oleg Agafonov 07ddad6e48 Game: fixed rare bugs in some cards after rollback or cancel actions:
* Cumulative upkeep cost - fixed that it can lost payed state (cards: Aboroth, Karplusan Minotaur, Psychic Vortex, Sheltering Ancient);
 * Effects - fixed that it can lost selected targets or other settings (cards: Citadel of Pain, Crimson Honor Guard, Curfew, Leveler, Mana Cache, Monsoon, Paradigm Shift, Saprazzan Bailiff);
 * Exile all cards from graveyard ability - fixed that it can lost targets (example: Agent of Erebos);
 * Melee ability - fixed that it can lost targets (example: Adriana, Captain of the Guard).
2021-07-07 16:51:53 +04:00

39 lines
1 KiB
Java

package mage.abilities.effects.common;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.stack.Spell;
import mage.players.Player;
/**
* @author BetaSteward_at_googlemail.com
*/
public class ExileSpellEffect extends OneShotEffect {
public ExileSpellEffect() {
super(Outcome.Exile);
staticText = "Exile {this}";
}
private ExileSpellEffect(final ExileSpellEffect effect) {
super(effect);
}
@Override
public ExileSpellEffect copy() {
return new ExileSpellEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Spell spell = game.getStack().getSpell(source.getId());
if (controller == null || spell == null) {
return true;
}
return controller.moveCards(spell.getCard(), Zone.EXILED, source, game);
}
}