Refactor: Delete Unused MageLoseGameAction (#9306)

This commit is contained in:
DeepCrimson 2022-08-03 11:52:54 -07:00 committed by GitHub
parent a133fb348e
commit 9f22664bf1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,47 +0,0 @@
package mage.actions;
import mage.abilities.Ability;
import mage.actions.impl.MageAction;
import mage.actions.score.ArtificialScoringSystem;
import mage.game.Game;
import mage.players.Player;
import java.util.UUID;
/**
* Lose game action.
*
* @author ayratn
*/
public class MageLoseGameAction extends MageAction {
public static final String LIFE_REASON = "{L} You lose the game.";
public static final String POISON_REASON = "{L} You are poisoned. You lose the game.";
public static final String DRAW_REASON = "{L} You attempt to draw from an empty library. You lose the game.";
private final Player player;
private final String reason;
private Player oldLosingPlayer;
public MageLoseGameAction(final Player player, final String reason) {
this.player = player;
this.reason = reason;
}
@Override
public int doAction(Ability source, final Game game) {
oldLosingPlayer = game.getLosingPlayer();
if (oldLosingPlayer == null && player.canLose(game)) {
setScore(player, ArtificialScoringSystem.inst.getLoseGameScore(game));
game.setLosingPlayer(player);
if (!game.isSimulation())
game.informPlayer(player, reason);
}
return 0;
}
@Override
public void undoAction(final Game game) {
game.setLosingPlayer(oldLosingPlayer);
}
}