use of mage.game.command.Plane in project mage by magefree.
the class SystemUtil method putPlaneToGame.
public static boolean putPlaneToGame(Game game, Player player, String planeClassName) {
// remove the last plane and set its effects to discarded
for (CommandObject comObject : game.getState().getCommand()) {
if (comObject instanceof Plane) {
if (comObject.getAbilities() != null) {
for (Ability ability : comObject.getAbilities()) {
for (Effect effect : ability.getEffects()) {
if (effect instanceof ContinuousEffect) {
((ContinuousEffect) effect).discard();
}
}
}
}
game.getState().removeTriggersOfSourceId(comObject.getId());
game.getState().getCommand().remove(comObject);
break;
}
}
// put new plane to game
Planes planeType = Planes.fromClassName(planeClassName);
Plane plane = Plane.createPlane(planeType);
if (plane != null) {
plane.setControllerId(player.getId());
game.addPlane(plane, null, player.getId());
return true;
}
return false;
}
use of mage.game.command.Plane in project mage by magefree.
the class GameController method getGameStateDebugMessage.
public String getGameStateDebugMessage() {
if (game == null) {
return "";
}
GameState state = game.getState();
if (state == null) {
return "";
}
StringBuilder sb = new StringBuilder();
sb.append("<br/>Game State:<br/><font size=-2>");
sb.append(state);
sb.append("<br>Active player is: ");
sb.append(game.getPlayer(state.getActivePlayerId()).getName());
sb.append("<br>isGameOver: ");
sb.append(state.isGameOver());
sb.append("<br>Current phase is: ");
sb.append(state.getTurn().getPhase());
sb.append("<br>getBattlefield: ");
sb.append(state.getBattlefield());
sb.append("<br>getChoosingPlayerId: ");
if (state.getChoosingPlayerId() != null) {
sb.append(game.getPlayer(state.getChoosingPlayerId()).getName());
} else {
sb.append("noone!");
}
sb.append("<br>getCombat: ");
sb.append(state.getCombat());
sb.append("<br>getCommand: ");
sb.append(state.getCommand());
sb.append("<br>getContinuousEffects: ");
sb.append(state.getContinuousEffects());
sb.append("<br>getCopiedCards: ");
sb.append(state.getCopiedCards());
sb.append("<br>getDelayed: ");
sb.append(state.getDelayed());
sb.append("<br>getDesignations: ");
sb.append(state.getDesignations());
sb.append("<br>getExile: ");
sb.append(state.getExile());
sb.append("<br>getMonarchId: ");
sb.append(state.getMonarchId());
sb.append("<br>getNextPermanentOrderNumber: ");
sb.append(state.getNextPermanentOrderNumber());
sb.append("<br>getPlayerByOrderId: ");
if (state.getPlayerByOrderId() != null) {
sb.append(game.getPlayer(state.getPlayerByOrderId()).getName());
} else {
sb.append("noone!");
}
sb.append("<br>getPlayerList: ");
sb.append(state.getPlayerList());
sb.append("<br>getPlayers: ");
sb.append(state.getPlayers());
sb.append("<br><font color=orange>Player with Priority is: ");
if (state.getPriorityPlayerId() != null) {
sb.append(game.getPlayer(state.getPriorityPlayerId()).getName());
} else {
sb.append("noone!");
}
sb.append("</font><br>getRevealed: ");
sb.append(state.getRevealed());
sb.append("<br>getSpecialActions: ");
sb.append(state.getSpecialActions());
sb.append("<br>getStack: ");
sb.append(state.getStack());
sb.append("<br>getStepNum: ");
sb.append(state.getStepNum());
sb.append("<br>getTurn: ");
sb.append(state.getTurn());
sb.append("<br>getTurnId: ");
sb.append(state.getTurnId());
sb.append("<br>getTurnMods: ");
sb.append(state.getTurnMods());
sb.append("<br>getTurnNum: ");
sb.append(state.getTurnNum());
sb.append("<br>Using plane chase?:" + state.isPlaneChase());
if (state.isPlaneChase()) {
Plane currentPlane = state.getCurrentPlane();
if (currentPlane != null) {
sb.append("<br>Current plane:" + currentPlane.getName());
}
}
sb.append("<br>Future Timeout:");
if (futureTimeout != null) {
sb.append("Cancelled?=");
sb.append(futureTimeout.isCancelled());
sb.append(",,,Done?=");
sb.append(futureTimeout.isDone());
sb.append(",,,GetDelay?=");
sb.append((int) futureTimeout.getDelay(TimeUnit.SECONDS));
} else {
sb.append("Not using future Timeout!");
}
sb.append("</font>");
return sb.toString();
}
Aggregations