refactor MagicLoseGameAction -> LoseGameAction
parent
cf92fb73de
commit
5466c3e25c
|
@ -5,7 +5,7 @@ import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.TreeSet;
|
import java.util.TreeSet;
|
||||||
import magic.model.action.MagicLoseGameAction;
|
import magic.model.action.LoseGameAction;
|
||||||
import magic.model.choice.MagicBuilderManaCost;
|
import magic.model.choice.MagicBuilderManaCost;
|
||||||
import magic.model.event.MagicActivationPriority;
|
import magic.model.event.MagicActivationPriority;
|
||||||
import magic.model.event.MagicSourceActivation;
|
import magic.model.event.MagicSourceActivation;
|
||||||
|
@ -749,10 +749,10 @@ public class MagicPlayer extends MagicObjectImpl implements MagicTarget, MagicMa
|
||||||
|
|
||||||
public void generateStateBasedActions() {
|
public void generateStateBasedActions() {
|
||||||
if (getLife() <= 0) {
|
if (getLife() <= 0) {
|
||||||
currGame.addDelayedAction(new MagicLoseGameAction(this,MagicLoseGameAction.LIFE_REASON));
|
currGame.addDelayedAction(new LoseGameAction(this,LoseGameAction.LIFE_REASON));
|
||||||
}
|
}
|
||||||
if (getPoison() >= LOSING_POISON) {
|
if (getPoison() >= LOSING_POISON) {
|
||||||
currGame.addDelayedAction(new MagicLoseGameAction(this,MagicLoseGameAction.POISON_REASON));
|
currGame.addDelayedAction(new LoseGameAction(this,LoseGameAction.POISON_REASON));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ public class DrawAction extends MagicAction {
|
||||||
for (int count=amount;count>0;count--) {
|
for (int count=amount;count>0;count--) {
|
||||||
if (library.isEmpty()) {
|
if (library.isEmpty()) {
|
||||||
if (MagicGame.LOSE_DRAW_EMPTY_LIBRARY) {
|
if (MagicGame.LOSE_DRAW_EMPTY_LIBRARY) {
|
||||||
game.doAction(new MagicLoseGameAction(player,MagicLoseGameAction.DRAW_REASON));
|
game.doAction(new LoseGameAction(player,LoseGameAction.DRAW_REASON));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import magic.model.MagicGame;
|
||||||
import magic.model.MagicPlayer;
|
import magic.model.MagicPlayer;
|
||||||
import magic.model.trigger.MagicTriggerType;
|
import magic.model.trigger.MagicTriggerType;
|
||||||
|
|
||||||
public class MagicLoseGameAction extends MagicAction {
|
public class LoseGameAction extends MagicAction {
|
||||||
|
|
||||||
public static final String LIFE_REASON = " lost the game.";
|
public static final String LIFE_REASON = " lost the game.";
|
||||||
public static final String POISON_REASON = " lost the game because of poisoning.";
|
public static final String POISON_REASON = " lost the game because of poisoning.";
|
||||||
|
@ -15,12 +15,12 @@ public class MagicLoseGameAction extends MagicAction {
|
||||||
private MagicPlayer player;
|
private MagicPlayer player;
|
||||||
private MagicPlayer oldLosingPlayer = MagicPlayer.NONE;
|
private MagicPlayer oldLosingPlayer = MagicPlayer.NONE;
|
||||||
|
|
||||||
public MagicLoseGameAction(final MagicPlayer aPlayer,final String aReason) {
|
public LoseGameAction(final MagicPlayer aPlayer,final String aReason) {
|
||||||
player = aPlayer;
|
player = aPlayer;
|
||||||
reason = aReason;
|
reason = aReason;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MagicLoseGameAction(final MagicPlayer aPlayer) {
|
public LoseGameAction(final MagicPlayer aPlayer) {
|
||||||
this(aPlayer, LIFE_REASON);
|
this(aPlayer, LIFE_REASON);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package magic.model.trigger;
|
package magic.model.trigger;
|
||||||
|
|
||||||
import magic.model.action.MagicLoseGameAction;
|
import magic.model.action.LoseGameAction;
|
||||||
|
|
||||||
public abstract class MagicIfPlayerWouldLoseTrigger extends MagicTrigger<MagicLoseGameAction> {
|
public abstract class MagicIfPlayerWouldLoseTrigger extends MagicTrigger<LoseGameAction> {
|
||||||
public MagicIfPlayerWouldLoseTrigger(final int priority) {
|
public MagicIfPlayerWouldLoseTrigger(final int priority) {
|
||||||
super(priority);
|
super(priority);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue