Search in sources :

Example 1 with MAP_FILL_TEMPLATE

use of main.content.enums.DungeonEnums.MAP_FILL_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)

Example 2 with MAP_FILL_TEMPLATE

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

the class LE_ObjMaster method fillAreaCustomFiller.

public static boolean fillAreaCustomFiller() {
    MAP_FILL_TEMPLATE template = new EnumMaster<MAP_FILL_TEMPLATE>().retrieveEnumConst(MAP_FILL_TEMPLATE.class, ListChooser.chooseEnum(MAP_FILL_TEMPLATE.class));
    if (template == null) {
        return false;
    }
    List<Coordinates> coordinates = LE_MapMaster.pickCoordinates();
    String data = template.getCenterObjects() + template.getPeripheryObjects();
    for (Coordinates c : coordinates) {
        ObjType type;
        int i = 0;
        for (Coordinates adj : c.getAdjacentCoordinates()) {
            if (coordinates.contains(adj)) {
                i++;
            } else {
                if (data.contains(LevelEditor.getCurrentLevel().getDungeon().getGame().getObjectByCoordinate(c, true).getName())) {
                    i++;
                }
            }
        }
        if (i >= c.getAdjacentCoordinates().size() / 2) {
            type = RandomWizard.getObjTypeByWeight(template.getCenterObjects(), DC_TYPE.BF_OBJ);
        } else {
            type = RandomWizard.getObjTypeByWeight(template.getCenterObjects(), DC_TYPE.BF_OBJ);
        }
        LevelEditor.getObjMaster().addObj(type, c);
    }
    return true;
}
Also used : ObjType(main.entity.type.ObjType) MAP_FILL_TEMPLATE(main.content.enums.DungeonEnums.MAP_FILL_TEMPLATE) Coordinates(main.game.bf.Coordinates)

Aggregations

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