Package org.freerealm.executor

Examples of org.freerealm.executor.CommandResult


            }
        }
        worldMap.setMapItems(mapItems);
        realm.setWorldMap(worldMap);
        realm.setPathFinder(new AStarPathFinder(realm, 100));
        return new CommandResult(CommandResult.RESULT_OK, "");
    }
View Full Code Here


    }

    public CommandResult execute(Realm realm) {
        if (player != null) {
            player.setTurnEnded(true);
            return new CommandResult(CommandResult.RESULT_OK, "", CommandResult.PLAYER_END_TURN_UPDATE);
        } else {
            return new CommandResult(CommandResult.RESULT_ERROR, "Player can not be null");
        }
    }
View Full Code Here

     * @return CommandResult
     */
    public CommandResult execute(Realm realm) {
        if (improvement.canBeBuiltOnTileType(tile.getType())) {
            tile.addImprovement(improvement);
            return new CommandResult(CommandResult.RESULT_OK, "");
        }
        return new CommandResult(CommandResult.RESULT_ERROR, "");
    }
View Full Code Here

            Executor.getInstance().execute(new UnitActivateCommand(unit, unit.getCoordinate()));
            unit.setMovementPoints(unit.getType().getMovementPoints());
        } else if (status == Unit.UNIT_SUSPENDED) {
            Executor.getInstance().execute(new UnitSuspendCommand(player, unit));
        }
        return new CommandResult(CommandResult.RESULT_OK, "");
    }
View Full Code Here

     * @param realm Realm to execute the command
     * @return CommandResult
     */
    public CommandResult execute(Realm realm) {
        if (!settlement.canBuild(buildable)) {
            return new CommandResult(CommandResult.RESULT_ERROR, "Settlement cannot build " + buildable);
        } else {
            settlement.addToProductionQueue(buildable);
            return new CommandResult(CommandResult.RESULT_OK, "");
        }
    }
View Full Code Here

     * @param realm Realm to execute the command
     * @return CommandResult
     */
    public CommandResult execute(Realm realm) {
        realm.getPlayerManager().setActivePlayer(player);
        return new CommandResult(CommandResult.RESULT_OK, "", CommandResult.ACTIVE_PLAYER_UPDATE);
    }
View Full Code Here

     * @return CommandResult
     */
    public CommandResult execute(Realm realm) {
        mission.setPlayer(player);
        player.addMission(mission);
        CommandResult commandResult = new CommandResult(CommandResult.RESULT_OK, "", CommandResult.MISSION_ASSIGNED_UPDATE);
        commandResult.addParameter(player);
        commandResult.addParameter(mission);
        return commandResult;
    }
View Full Code Here

        int productionPointCost = Integer.parseInt(realm.getProperty("production_point_cost"));
        if (currentWealth >= amount * productionPointCost) {
            settlement.getPlayer().setWealth(currentWealth - amount * productionPointCost);
            settlement.setProductionPoints(settlement.getProductionPoints() + amount);
        } else {
            return new CommandResult(CommandResult.RESULT_ERROR, "Not enough wealth");
        }
        return new CommandResult(CommandResult.RESULT_OK, "");
    }
View Full Code Here

    public CommandResult execute(Realm realm) {
        if (populationContainer.canContainPopulation()) {
            int weightPerCitizen = Integer.parseInt(realm.getProperty("weight_per_citizen"));
            if (populationContainer.getRemainingCapacity() >= (population - populationContainer.getContainedPopulation()) * weightPerCitizen) {
                populationContainer.setContainedPopulation(population);
                return new CommandResult(CommandResult.RESULT_OK, "");
            } else {
                return new CommandResult(CommandResult.RESULT_ERROR, "Not enough capacity");
            }
        } else {
            return new CommandResult(CommandResult.RESULT_ERROR, "Container can not carry population");
        }
    }
View Full Code Here

    public CommandResult execute(Realm realm) {
        this.realm = realm;
        manageWealth();
        manageCities();
        manageUnits();
        return new CommandResult(CommandResult.RESULT_OK, "");
    }
View Full Code Here

TOP

Related Classes of org.freerealm.executor.CommandResult

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.