Search in sources :

Example 6 with MacroParty

use of eidolons.game.module.adventure.entity.MacroParty in project Eidolons by IDemiurge.

the class MacroManager method saveTheWorld.

public static void saveTheWorld() {
    // all locations to regions, etc
    for (Region region : getGame().getState().getRegions()) {
        String places = "";
        for (Place sub : getGame().getPlaces()) {
            if (sub.getRegion() != region)
                continue;
            places += sub.getNameAndCoordinate() + ";";
        }
        region.setProperty(MACRO_PROPS.PLACES, places, true);
        String parties = "";
        for (MacroParty sub : getGame().getParties()) {
            if (sub.getRegion() != region)
                continue;
            parties += sub.getNameAndCoordinate() + ";";
        }
        region.setProperty(MACRO_PROPS.PARTIES, parties, true);
    }
    XML_Writer.writeXML_ForTypeGroup(MACRO_OBJ_TYPES.REGION);
}
Also used : MacroParty(eidolons.game.module.adventure.entity.MacroParty) Region(eidolons.game.module.adventure.map.Region) Place(eidolons.game.module.adventure.map.Place)

Example 7 with MacroParty

use of eidolons.game.module.adventure.entity.MacroParty in project Eidolons by IDemiurge.

the class WorldGenerator method createParty.

private static MacroParty createParty(MacroRef ref, String s) {
    Coordinates coordinates = new Coordinates(true, Integer.valueOf(VariableManager.getVar(s, 0)), Integer.valueOf(VariableManager.getVar(s, 1)));
    String string = (VariableManager.getVar(s, 2));
    Faction faction = null;
    if (StringMaster.isEmpty(string)) {
        faction = game.getPlayerFaction();
    } else if (string.equalsIgnoreCase("player")) {
        Party party = DC_Game.game.getMetaMaster().getPartyManager().getParty();
        if (party == null) {
            return null;
        }
        MacroParty playerParty = new MacroParty(getMacroPartyType(party), game, ref, party);
        game.setPlayerParty(playerParty);
        playerParty.setFaction(game.getPlayerFaction());
        playerParty.setCoordinates(coordinates);
        return playerParty;
    } else
        faction = game.getFaction(string);
    String name = VariableManager.removeVarPart(s);
    MacroParty party = new MacroParty(DataManager.getType(name, DC_TYPE.PARTY), ref.getGame(), ref);
    party.setCoordinates(coordinates);
    party.setFaction(faction);
    party.setOriginalOwner(faction.getOwner());
    party.setOwner(faction.getOwner());
    return party;
}
Also used : Party(eidolons.client.cc.logic.party.Party) MacroParty(eidolons.game.module.adventure.entity.MacroParty) MacroParty(eidolons.game.module.adventure.entity.MacroParty) Coordinates(main.game.bf.Coordinates) Faction(eidolons.game.module.adventure.faction.Faction)

Example 8 with MacroParty

use of eidolons.game.module.adventure.entity.MacroParty in project Eidolons by IDemiurge.

the class MacroGameManager method newTurn.

public void newTurn() {
    // factionsTurn();
    SaveMaster.saveInNewThread();
    getGame().getCampaign().modifyParameter(MACRO_PARAMS.HOURS_ELAPSED, TimeMaster.getHoursPerTurn());
    for (MacroParty p : getGame().getParties()) {
        p.newTurn();
    }
    for (MacroObj p : getGame().getPlaces()) {
        p.newTurn();
    }
    for (MacroObj p : getGame().getFactions()) {
        p.newTurn();
    }
    for (MacroObj p : getGame().getRoutes()) {
        p.newTurn();
    }
    for (TurnRule r : getGame().getTurnRules()) {
        r.newTurn();
    }
    TravelMasterOld.newTurn();
    AreaManager.newTurn();
    refreshAll();
}
Also used : TurnRule(eidolons.game.module.adventure.rules.TurnRule) MacroParty(eidolons.game.module.adventure.entity.MacroParty) MacroObj(eidolons.game.module.adventure.entity.MacroObj)

Example 9 with MacroParty

use of eidolons.game.module.adventure.entity.MacroParty in project Eidolons by IDemiurge.

the class WorldGenerator method createRegion.

public static Region createRegion(ObjType type, MacroRef ref) {
    // template
    // add places, towns and routes
    region = new Region(game, type, ref);
    // init default towns/places ; then add randomized
    for (String s : StringMaster.open(region.getProperty(MACRO_PROPS.AREAS))) {
        type = DataManager.getType(s, MACRO_OBJ_TYPES.AREA);
        Area area = new Area(ref.getGame(), type, ref);
        region.getAreas().add(area);
    }
    for (String s : StringMaster.open(region.getProperty(MACRO_PROPS.PARTIES))) {
        try {
            MacroParty party = createParty(ref, s);
            region.addParty(party);
        } catch (Exception e) {
            main.system.ExceptionMaster.printStackTrace(e);
        }
    }
    for (String s : StringMaster.open(region.getProperty(MACRO_PROPS.PLACES))) {
        Place place = createPlace(ref, s);
        if (place != null)
            region.addPlace(place);
    }
    for (String s : StringMaster.open(region.getProperty(MACRO_PROPS.TOWNS))) {
        Town town = createTown(ref, s);
        region.addTown(town);
    }
    generateRoutes();
    return region;
/*
         * r.getProperty(MACRO_PROPS.PLACES) Places - Power level ++ will be
		 * appearing as the game progresses
		 * 
		 * Routes - there should be at least 1 between each 2 places as
		 * "default" (preset) and then we can generate additional randomized
		 * routes For non-preset Places, we can use some metrics...
		 */
}
Also used : Area(eidolons.game.module.adventure.map.Area) MacroParty(eidolons.game.module.adventure.entity.MacroParty) Town(eidolons.game.module.adventure.town.Town) Region(eidolons.game.module.adventure.map.Region) Place(eidolons.game.module.adventure.map.Place)

Example 10 with MacroParty

use of eidolons.game.module.adventure.entity.MacroParty in project Eidolons by IDemiurge.

the class MapGuiStage method bindEvents.

@Override
protected void bindEvents() {
    super.bindEvents();
    GuiEventManager.bind(MapEvent.TIME_UPDATED, p -> {
        if (!CoreEngine.isMapEditor())
            blackout.fadeIn(1.25f);
    });
    GuiEventManager.bind(CREATE_PARTY, param -> {
        MacroParty party = (MacroParty) param.get();
        if (party == null) {
            return;
        }
        if (party.isMine()) {
            setParty(party);
        }
    });
}
Also used : MacroParty(eidolons.game.module.adventure.entity.MacroParty)

Aggregations

MacroParty (eidolons.game.module.adventure.entity.MacroParty)12 Place (eidolons.game.module.adventure.map.Place)5 Route (eidolons.game.module.adventure.map.Route)3 Area (eidolons.game.module.adventure.map.Area)2 Region (eidolons.game.module.adventure.map.Region)2 Party (eidolons.client.cc.logic.party.Party)1 MacroRef (eidolons.game.module.adventure.MacroRef)1 MacroObj (eidolons.game.module.adventure.entity.MacroObj)1 Faction (eidolons.game.module.adventure.faction.Faction)1 TurnRule (eidolons.game.module.adventure.rules.TurnRule)1 Town (eidolons.game.module.adventure.town.Town)1 ActionValueContainer (eidolons.libgdx.gui.panels.dc.actionpanel.ActionValueContainer)1 Coordinates (main.game.bf.Coordinates)1