mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 10:40:06 -08:00
Refactor: Delete Unused MageLoseGameAction (#9306)
This commit is contained in:
parent
a133fb348e
commit
9f22664bf1
1 changed files with 0 additions and 47 deletions
|
|
@ -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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue