Search in sources :

Example 1 with DUNGEON_MAP_TEMPLATE

use of main.content.enums.DungeonEnums.DUNGEON_MAP_TEMPLATE in project Eidolons by IDemiurge.

the class DungeonMapGenerator method fill.

private void fill(Coordinates c, String fillerType) {
    ObjType type = DataManager.getType(fillerType, DC_TYPE.BF_OBJ);
    if (type == null) {
        MAP_FILL_TEMPLATE leTemplate = new EnumMaster<MAP_FILL_TEMPLATE>().retrieveEnumConst(MAP_FILL_TEMPLATE.class, fillerType);
        if (leTemplate != null) {
            int i = 0;
            for (Coordinates adj : c.getAdjacentCoordinates()) {
                ObjType objType = objMap.get(adj);
                if (objType != null) {
                    if ((leTemplate.getPeripheryObjects() + leTemplate.getCenterObjects()).contains(objType.getName())) {
                        i++;
                    }
                }
            }
            if (i >= c.getAdjacentCoordinates().size() * 2 / 5) {
                type = RandomWizard.getObjTypeByWeight(leTemplate.getCenterObjects(), DC_TYPE.BF_OBJ);
                objMap.put(c, type);
                return;
            }
            type = RandomWizard.getObjTypeByWeight(leTemplate.getPeripheryObjects(), DC_TYPE.BF_OBJ);
        } else {
            // other random groups
            DUNGEON_MAP_TEMPLATE template = new EnumMaster<DUNGEON_MAP_TEMPLATE>().retrieveEnumConst(DUNGEON_MAP_TEMPLATE.class, fillerType);
            if (template != null) {
                type = RandomWizard.getObjTypeByWeight(template.getObjects(), DC_TYPE.BF_OBJ);
            }
        }
    }
    objMap.put(c, type);
}
Also used : DUNGEON_MAP_TEMPLATE(main.content.enums.DungeonEnums.DUNGEON_MAP_TEMPLATE) ObjType(main.entity.type.ObjType) MAP_FILL_TEMPLATE(main.content.enums.DungeonEnums.MAP_FILL_TEMPLATE) Coordinates(main.game.bf.Coordinates)

Aggregations

DUNGEON_MAP_TEMPLATE (main.content.enums.DungeonEnums.DUNGEON_MAP_TEMPLATE)1 MAP_FILL_TEMPLATE (main.content.enums.DungeonEnums.MAP_FILL_TEMPLATE)1 ObjType (main.entity.type.ObjType)1 Coordinates (main.game.bf.Coordinates)1