Search in sources :

Example 16 with Plane

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;
}
Also used : CommandObject(mage.game.command.CommandObject) SimpleStaticAbility(mage.abilities.common.SimpleStaticAbility) ActivatedAbility(mage.abilities.ActivatedAbility) Ability(mage.abilities.Ability) Planes(mage.constants.Planes) Plane(mage.game.command.Plane) ContinuousEffect(mage.abilities.effects.ContinuousEffect) Effect(mage.abilities.effects.Effect) InfoEffect(mage.abilities.effects.common.InfoEffect) ContinuousEffect(mage.abilities.effects.ContinuousEffect)

Example 17 with Plane

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();
}
Also used : Plane(mage.game.command.Plane)

Aggregations

Plane (mage.game.command.Plane)17 Effect (mage.abilities.effects.Effect)6 Player (mage.players.Player)6 Card (mage.cards.Card)4 FixedTarget (mage.target.targetpointer.FixedTarget)4 UUID (java.util.UUID)3 MageObject (mage.MageObject)3 Ability (mage.abilities.Ability)3 ContinuousEffect (mage.abilities.effects.ContinuousEffect)3 RollPlanarDieEffect (mage.abilities.effects.common.RollPlanarDieEffect)3 PlanarDieRollCostIncreasingEffect (mage.abilities.effects.common.cost.PlanarDieRollCostIncreasingEffect)3 FilterCard (mage.filter.FilterCard)3 Permanent (mage.game.permanent.Permanent)3 ActivatedAbility (mage.abilities.ActivatedAbility)2 SpellAbility (mage.abilities.SpellAbility)2 SimpleStaticAbility (mage.abilities.common.SimpleStaticAbility)2 OneShotEffect (mage.abilities.effects.OneShotEffect)2 InfoEffect (mage.abilities.effects.common.InfoEffect)2 CardInfo (mage.cards.repository.CardInfo)2 CommandObject (mage.game.command.CommandObject)2