Search in sources :

Example 6 with Dungeon

use of eidolons.game.battlecraft.logic.dungeon.universal.Dungeon in project Eidolons by IDemiurge.

the class Location method constructSublevels.

private void constructSublevels() {
    dungeon = bossLevel;
    int z = dungeon.getZ();
    ENTRANCE_LAYOUT entranceLayout = getFirstEntranceLayout(root, DirectionMaster.getRandomDirection());
    if (isScenario()) {
        // Map<SUBDUNGEON_TYPE, String> map = new
        // RandomWizard<SUBDUNGEON_TYPE>()
        // .constructStringWeightMap(scenario.getProperty(MACRO_PROPS.RANDOM_SUBLEVELS),
        // SUBDUNGEON_TYPE.class);
        // e.g. "cave(2);dungeon(3);caste(1); ++ insert *BETWEEN* preset
        // string - lvlN(n) - which could be key?.. perhaps just a list of
        // strings!
        // new RandomWizard<>().constructStringWeightMapInversed(scenario
        // .getProperty(MACRO_PROPS.RANDOM_SUBLEVELS), SUBDUNGEON_TYPE)
        List<String> list = new ArrayList<>();
        for (String stretch : StringMaster.open(scenario.getProperty(MACRO_PROPS.RANDOM_SUBLEVELS))) {
            int i = 0;
            if (StringMaster.isInteger(stretch)) {
                // for (int i = 0; i < StringMaster.getInteger(stretch);
                // i++) {
                // dungeon = dungeon.getSubLevels().getOrCreate(0); // TODO unsafe
                // }
                i = StringMaster.getInteger(stretch);
                continue;
            }
            String typeName;
            if (stretch.contains(StringMaster.OR)) {
                List<String> names = StringMaster.openContainer(stretch, StringMaster.OR);
                stretch = names.get(RandomWizard.getRandomListIndex(names));
            }
            typeName = VariableManager.removeVarPart(stretch);
            int depth = (StringMaster.getInteger(VariableManager.getVarPart(stretch)));
            SUBDUNGEON_TYPE type = new EnumMaster<SUBDUNGEON_TYPE>().retrieveEnumConst(SUBDUNGEON_TYPE.class, typeName);
            String element = i + "=" + typeName + StringMaster.wrapInParenthesis("" + depth);
            list.add(element);
        // depth = Math.max(1, depth);
        }
        Dungeon dungeon = root;
        for (String stretch : StringMaster.open(scenario.getProperty(PROPS.SUBLEVELS))) {
            for (String s : list) {
                int i = StringMaster.getInteger(s.split("=")[0]);
                VariableManager.removeVarPart((s.split("=")[1]));
                VariableManager.getVarPart((s.split("=")[1]));
            }
        }
        String stretch = null;
        int depth = RandomWizard.getRandomInt(StringMaster.getInteger(VariableManager.getVarPart(stretch)));
        for (int level = 0; level < depth; level++) {
            z = (up) ? z++ : z--;
            String typeName = null;
            File randomFile = FileManager.getRandomFile(PathFinder.getDungeonLevelFolder() + typeName);
            // filter?
            String data = FileManager.readFile(randomFile);
            DungeonPlan plan = new LocationBuilder().loadDungeonMap(data);
            ObjType dungeonType = null;
            newSublevel(dungeon, dungeonType, z, level, entranceLayout);
        // adjust plan , set z
        }
    } else {
        int i = maxLevel;
        List<ObjType> typePool = DataManager.toTypeList(getPlaceOrScenario().getProperty(MACRO_PROPS.SUBLEVEL_POOL), DC_TYPE.DUNGEONS);
        Map<Integer, ObjType> map = distributeLevels(typePool, maxLevel);
        ObjType prevType = null;
        int level = 0;
        while (true) {
            i--;
            ObjType type = map.get(i);
            if (type != prevType) {
                level = 0;
            }
            z = (up) ? z++ : z--;
            level++;
            entranceLayout = getNextEntranceLayout(entranceLayout);
            dungeon = newSublevel(dungeon, type, z, level, entranceLayout);
            // checkAddSecretLevels(dungeon);
            if (i <= 0) {
                break;
            }
            prevType = type;
        }
    }
// dungeon.getSubLevels().add(bossLevel);
}
Also used : DungeonPlan(eidolons.game.battlecraft.logic.dungeon.location.building.DungeonPlan) ArrayList(java.util.ArrayList) ENTRANCE_LAYOUT(eidolons.game.module.dungeoncrawl.dungeon.DungeonLevelMaster.ENTRANCE_LAYOUT) LocationBuilder(eidolons.game.battlecraft.logic.dungeon.location.LocationBuilder) ObjType(main.entity.type.ObjType) Dungeon(eidolons.game.battlecraft.logic.dungeon.universal.Dungeon) SUBDUNGEON_TYPE(main.content.enums.DungeonEnums.SUBDUNGEON_TYPE) File(java.io.File)

Example 7 with Dungeon

use of eidolons.game.battlecraft.logic.dungeon.universal.Dungeon in project Eidolons by IDemiurge.

the class Location method initBossLevel.

private void initBossLevel() {
    if (isScenario()) {
        String data = FileManager.readFile(PathFinder.getDungeonLevelFolder() + getPlaceOrScenario().getProperty(MACRO_PROPS.BOSS_LEVEL));
        if (data.isEmpty()) {
            return;
        }
        DungeonPlan plan = new LocationBuilder().loadDungeonMap(data);
        bossLevel = plan.getDungeon();
        return;
    } else {
        ObjType type = RandomWizard.getObjTypeByWeight(getPlaceOrScenario().getProperty(MACRO_PROPS.BOSS_LEVEL_POOL), DC_TYPE.DUNGEONS);
        bossLevel = new Dungeon(type);
    }
// new DungeonMapGenerator().generateMap(bossLevel); ???
}
Also used : LocationBuilder(eidolons.game.battlecraft.logic.dungeon.location.LocationBuilder) ObjType(main.entity.type.ObjType) DungeonPlan(eidolons.game.battlecraft.logic.dungeon.location.building.DungeonPlan) Dungeon(eidolons.game.battlecraft.logic.dungeon.universal.Dungeon)

Example 8 with Dungeon

use of eidolons.game.battlecraft.logic.dungeon.universal.Dungeon in project Eidolons by IDemiurge.

the class IlluminationMaster method getConcealment.

public Integer getConcealment(Unit source, DC_Obj target) {
    Integer concealment = target.getIntParam(PARAMS.CONCEALMENT);
    // getOrCreate from
    concealment += source.getIntParam(PARAMS.CONCEALMENT) / 2;
    Dungeon dungeon = source.getGame().getDungeon();
    if (dungeon != null) {
        concealment += dungeon.getIntParam(PARAMS.GLOBAL_CONCEALMENT);
    }
    concealment += globalConcealment;
    Integer cMod = 100;
    if (source.checkPassive(UnitEnums.STANDARD_PASSIVES.DARKVISION)) {
        // maybe it
        cMod -= cMod * 50 / 100;
    }
    return concealment * cMod / 100;
}
Also used : Dungeon(eidolons.game.battlecraft.logic.dungeon.universal.Dungeon)

Example 9 with Dungeon

use of eidolons.game.battlecraft.logic.dungeon.universal.Dungeon in project Eidolons by IDemiurge.

the class DrawMaster method drawSpecialOverlays.

private void drawSpecialOverlays(CellComp cellComp, Graphics g, int zoom2) {
    zoom2 = MathMaster.getMinMax(zoom * 2, 50, 100);
    if (isEditorMode() || cellComp.getGame().isDebugMode()) {
        Dungeon dungeon = cellComp.getGame().getDungeon();
        if (dungeon.checkProperty(PROPS.PARTY_SPAWN_COORDINATES)) {
            if (cellComp.getCoordinates().equals(new Coordinates(dungeon.getProperty(PROPS.PARTY_SPAWN_COORDINATES)))) {
                Image img = ImageManager.getSizedVersion(STD_IMAGES.ENGAGER.getImage(), zoom2);
                drawImageCentered(g, img);
            }
        }
        if (dungeon.checkProperty(PROPS.ENEMY_SPAWN_COORDINATES)) {
            if (cellComp.getCoordinates().equals(new Coordinates(dungeon.getProperty(PROPS.ENEMY_SPAWN_COORDINATES)))) {
                Image img = ImageManager.getSizedVersion(STD_IMAGES.ENGAGER.getImage(), zoom2);
                img = ImageTransformer.flipVertically(ImageManager.getBufferedImage(img));
                drawImageCentered(g, img);
            }
        }
        for (String substring : StringMaster.open(dungeon.getProperty(PROPS.ENCOUNTER_SPAWN_POINTS))) {
            if (!cellComp.getCoordinates().equals(new Coordinates(substring))) {
                continue;
            }
            Image img = ImageManager.getSizedVersion(STD_IMAGES.FLAG.getImage(), zoom2);
            drawImageCentered(g, img);
        // TODO OR STRING/CHAR
        }
        for (String substring : StringMaster.open(dungeon.getProperty(PROPS.ENCOUNTER_BOSS_SPAWN_POINTS))) {
            if (!cellComp.getCoordinates().equals(new Coordinates(substring))) {
                continue;
            }
            Image img = ImageManager.getSizedVersion(STD_IMAGES.ENGAGEMENT_TARGET.getImage(), zoom2);
            drawImageCentered(g, img);
        // TODO OR STRING/CHAR
        }
    }
}
Also used : Dungeon(eidolons.game.battlecraft.logic.dungeon.universal.Dungeon) Coordinates(main.game.bf.Coordinates) BufferedImage(java.awt.image.BufferedImage)

Example 10 with Dungeon

use of eidolons.game.battlecraft.logic.dungeon.universal.Dungeon in project Eidolons by IDemiurge.

the class Location method generateSublevels.

public void generateSublevels() {
    entrances = new ArrayList<>();
    if (DungeonLevelMaster.isSublevelTestOn() && !sublevel) {
        setProperty(PROPS.SUBLEVELS, DungeonLevelMaster.TEST_ENTRANCE_DATA, true);
    }
    subLevels = new ArrayList<>();
    for (String sublevel : StringMaster.open(getProperty(PROPS.SUBLEVELS))) {
        Dungeon dungeon = new Dungeon(VariableManager.removeVarPart(sublevel), true);
        // getMaster().getDungeons().add(dungeon);
        addSublevel(sublevel, dungeon);
    }
// by default?same bf types, smaller size down
// in most cases, some levels at least should be set...
// other dungeon types should be eligible as sublevels for
// multi-dungeons
// new spawning std - big level with 2R1E, medium level with E and small
// with B.
}
Also used : Dungeon(eidolons.game.battlecraft.logic.dungeon.universal.Dungeon)

Aggregations

Dungeon (eidolons.game.battlecraft.logic.dungeon.universal.Dungeon)16 LocationBuilder (eidolons.game.battlecraft.logic.dungeon.location.LocationBuilder)4 DungeonPlan (eidolons.game.battlecraft.logic.dungeon.location.building.DungeonPlan)4 ObjType (main.entity.type.ObjType)4 File (java.io.File)2 Ref (main.entity.Ref)2 Coordinates (main.game.bf.Coordinates)2 Color (com.badlogic.gdx.graphics.Color)1 EndGameEffect (eidolons.ability.effects.special.meta.EndGameEffect)1 Structure (eidolons.entity.obj.Structure)1 DUNGEON_TEMPLATES (eidolons.game.battlecraft.logic.dungeon.location.LocationBuilder.DUNGEON_TEMPLATES)1 DungeonMaster (eidolons.game.battlecraft.logic.dungeon.universal.DungeonMaster)1 ENTRANCE_LAYOUT (eidolons.game.module.dungeoncrawl.dungeon.DungeonLevelMaster.ENTRANCE_LAYOUT)1 Location (eidolons.game.module.dungeoncrawl.dungeon.Location)1 BufferedImage (java.awt.image.BufferedImage)1 ArrayList (java.util.ArrayList)1 Abilities (main.ability.Abilities)1 ActiveAbility (main.ability.ActiveAbility)1 COLOR_THEME (main.content.CONTENT_CONSTS.COLOR_THEME)1 SUBDUNGEON_TYPE (main.content.enums.DungeonEnums.SUBDUNGEON_TYPE)1