changed ExileSpellEffect from being singleton

This commit is contained in:
Evan Kranzler 2021-04-17 18:47:45 -04:00
parent b5e3ad2814
commit 213564f8cd
70 changed files with 81 additions and 91 deletions

View file

@ -1,9 +1,7 @@
package mage.abilities.effects.common;
import mage.abilities.Ability;
import mage.abilities.MageSingleton;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.game.Game;
@ -13,37 +11,29 @@ import mage.players.Player;
/**
* @author BetaSteward_at_googlemail.com
*/
public class ExileSpellEffect extends OneShotEffect implements MageSingleton {
private static final ExileSpellEffect instance = new ExileSpellEffect();
public static ExileSpellEffect getInstance() {
return instance;
}
public class ExileSpellEffect extends OneShotEffect {
private ExileSpellEffect() {
super(Outcome.Exile);
staticText = "Exile {this}";
}
private ExileSpellEffect(final ExileSpellEffect effect) {
super(effect);
}
@Override
public ExileSpellEffect copy() {
return instance;
return new ExileSpellEffect();
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
Spell spell = game.getStack().getSpell(source.getId());
if (spell != null) {
Card spellCard = spell.getCard();
if (spellCard != null) {
controller.moveCards(spellCard, Zone.EXILED, source, game);
}
}
Spell spell = game.getStack().getSpell(source.getId());
if (controller == null || spell == null) {
return true;
}
return false;
return controller.moveCards(spell.getCard(), Zone.EXILED, source, game);
}
}