Search in sources :

Example 21 with MapBlock

use of eidolons.game.battlecraft.logic.dungeon.location.building.MapBlock in project Eidolons by IDemiurge.

the class LocationBuilder method initZones.

private void initZones(Node zonesNode, DungeonPlan plan) {
    int id = 0;
    int zoneId = 0;
    List<MapZone> zones = new ArrayList<>();
    for (Node zoneNode : XML_Converter.getNodeList(zonesNode)) {
        MapZone zone;
        try {
            zone = createZone(plan, zoneId, zoneNode);
        } catch (Exception e) {
            // main.system.ExceptionMaster.printStackTrace(e);
            zone = new MapZone(plan.getDungeon(), zoneId, 0, plan.getDungeon().getWidth(), 0, plan.getDungeon().getHeight());
        }
        // ++ add coord exceptions
        zoneId++;
        zones.add(zone);
        for (Node node : XML_Converter.getNodeList(XML_Converter.getNodeList(zoneNode).get(0))) {
            // if (node.getNodeName().equalsIgnoreCase(BLOCKS_NODE))
            // blocks = initBlocks(XML_Converter.getStringFromXML(node));
            MapBlock block = constructBlock(node, id, zone, plan, getDungeon().getDungeon());
            id++;
            zone.addBlock(block);
            plan.getBlocks().add(block);
        }
    }
    if (plan.getBlocks().size() == 1) {
        int w = plan.getBlocks().get(0).getWidth();
        int h = plan.getBlocks().get(0).getHeight();
        dungeon.setParam(PARAMS.BF_WIDTH, w, true);
        dungeon.setParam(PARAMS.BF_HEIGHT, h, true);
    }
    plan.setZones(zones);
}
Also used : MapZone(eidolons.game.battlecraft.logic.dungeon.location.building.MapZone) Node(org.w3c.dom.Node) MapBlock(eidolons.game.battlecraft.logic.dungeon.location.building.MapBlock)

Example 22 with MapBlock

use of eidolons.game.battlecraft.logic.dungeon.location.building.MapBlock in project Eidolons by IDemiurge.

the class TestSpawner method initGroup.

private void initGroup(Wave group) {
    GroupAI groupAi = new GroupAI(group);
    groupAi.setLeader(group.getParty().getLeader());
    groupAi.setWanderDirection(FacingMaster.getRandomFacing().getDirection());
    group.setAi(groupAi);
    if (getGame().getGameMode() == GAME_MODES.DUNGEON_CRAWL) {
        XList<MapBlock> permittedBlocks = new XList<>();
        permittedBlocks.addAllUnique(group.getBlock().getConnectedBlocks().keySet());
        int wanderBlockDistance = 1;
        for (int i = 0; i < wanderBlockDistance; i++) {
            for (MapBlock b : group.getBlock().getConnectedBlocks().keySet()) {
                permittedBlocks.addAllUnique(b.getConnectedBlocks().keySet());
            }
        }
        groupAi.setPermittedBlocks(permittedBlocks);
    }
}
Also used : GroupAI(eidolons.game.battlecraft.ai.GroupAI) XList(main.data.XList) MapBlock(eidolons.game.battlecraft.logic.dungeon.location.building.MapBlock)

Aggregations

MapBlock (eidolons.game.battlecraft.logic.dungeon.location.building.MapBlock)22 Coordinates (main.game.bf.Coordinates)13 MapZone (eidolons.game.battlecraft.logic.dungeon.location.building.MapZone)9 Obj (main.entity.obj.Obj)4 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)3 ObjType (main.entity.type.ObjType)3 ArrayList (java.util.ArrayList)2 XList (main.data.XList)2 Ref (main.entity.Ref)2 FACING_DIRECTION (main.game.bf.Coordinates.FACING_DIRECTION)2 Node (org.w3c.dom.Node)2 BattleFieldObject (eidolons.entity.obj.BattleFieldObject)1 DC_Obj (eidolons.entity.obj.DC_Obj)1 Unit (eidolons.entity.obj.unit.Unit)1 GroupAI (eidolons.game.battlecraft.ai.GroupAI)1 Wave (eidolons.game.battlecraft.logic.battle.arena.Wave)1 ROOM_TYPE (eidolons.game.battlecraft.logic.dungeon.location.LocationBuilder.ROOM_TYPE)1 BuildHelper (eidolons.game.battlecraft.logic.dungeon.location.building.BuildHelper)1 DungeonPlan (eidolons.game.battlecraft.logic.dungeon.location.building.DungeonPlan)1 Entrance (eidolons.game.module.dungeoncrawl.dungeon.Entrance)1