Search in sources :

Example 1 with Wave

use of eidolons.game.battlecraft.logic.battle.arena.Wave in project Eidolons by IDemiurge.

the class LocationSpawner method getCreepGroupForBlock.

private Wave getCreepGroupForBlock(int preferredPower, Dungeon dungeon, MapBlock block, int min, int max) {
    // alt? vielleicht fur einige spezielle orte...
    String property = dungeon.getProperty(PROPS.ENCOUNTERS);
    int mod = block.getSpawningPriority();
    if (mod == 0) {
        mod = 100;
    }
    Wave wave;
    List<ObjType> list = DataManager.toTypeList(property, DC_TYPE.ENCOUNTERS);
    Collections.shuffle(list);
    ObjType type = null;
    for (ObjType t : list) {
        type = t;
        if (EncounterMaster.getPower(type, false) < min * mod / 100) {
            continue;
        }
        if (EncounterMaster.getPower(type, false) > max * mod / 100) {
            continue;
        }
        break;
    }
    if (type == null) {
        type = new RandomWizard<ObjType>().getObjectByWeight(property, ObjType.class);
    }
    wave = new Wave(type, game, new Ref(game), game.getPlayer(false));
    wave.setPreferredPower(preferredPower * mod / 100);
    wave.setBlock(block);
    return wave;
}
Also used : Wave(eidolons.game.battlecraft.logic.battle.arena.Wave) Ref(main.entity.Ref) ObjType(main.entity.type.ObjType) RandomWizard(main.system.auxiliary.RandomWizard)

Example 2 with Wave

use of eidolons.game.battlecraft.logic.battle.arena.Wave in project Eidolons by IDemiurge.

the class LocationSpawner method spawnDungeonCreeps.

public void spawnDungeonCreeps(Location dungeon) {
    String info = dungeon.getProperty(PROPS.ENCOUNTER_INFO);
    Map<Coordinates, Integer> delayMap = new HashMap<>();
    for (String substring : StringMaster.open(info)) {
        Coordinates c = new Coordinates(substring.split("")[0]);
        int round = StringMaster.getInteger(substring.split("=")[1]);
        delayMap.put(c, round);
    }
    /*
         * Assign block per creep group? So a dungeon has a repertoire and map template...
		 * then we calculate total power...
		 * First, spawn the 'must have' groups, around entrances and treasures
		 */
    if (dungeon.isSublevel()) {
    } else {
    // different alg?
    }
    // PartyManager.getParty().getTotalPower();
    // int power = DungeonMaster.getDungeonPowerTotal(dungeon);
    // int maxGroups = dungeon.getIntParam(PARAMS.MAX_GROUPS);
    int power = 0;
    int preferredPower = dungeon.getLevel() + // + PartyManager.getParty().getPower()
    getBattleMaster().getOptionManager().getOptions().getBattleLevel();
    int min = preferredPower * 2 / 3;
    int max = preferredPower * 3 / 2;
    for (MapBlock block : dungeon.getPlan().getBlocks()) {
        Wave group;
        if (specialEncounters.get(dungeon) != null) {
            Map<Coordinates, ObjType> specEncounters = specialEncounters.get(dungeon).get(block);
            for (Coordinates c : specEncounters.keySet()) {
                ObjType waveType = specEncounters.get(c);
                if (waveType.getGroup().equalsIgnoreCase("Substitute")) {
                    waveType = EncounterMaster.getSubstituteEncounterType(waveType, dungeon.getDungeon(), preferredPower);
                }
                group = new Wave(waveType, game, new Ref(), game.getPlayer(false));
                group.setCoordinates(c);
                Integer delay = delayMap.get(c);
                // TODO    getBattleMaster().getConstructor().scheduleEncounter(group, delay);
                // spawnWave(group, true);
                // initGroup(group);
                power += group.getPower();
            }
        } else {
            // TODO POWER PER BLOCK!
            if (!autoSpawnOn) {
                continue;
            }
            // break;
            if (!checkSpawnBlock(block)) {
                continue;
            }
            // sort blocks! by spawn priority...
            // can be more than 1 group, right? maybe merge?
            group = getCreepGroupForBlock(preferredPower, dungeon.getDungeon(), block, min, max);
            group.setPreferredPower(preferredPower);
            // spawnWave(group, true);
            // initGroup(group);
            // power -= group.getPower();
            power += group.getPower();
        }
    }
    if (power > min) {
    // spawn wandering creeps - apart from groups? in max distance from
    // them?
    }
}
Also used : Wave(eidolons.game.battlecraft.logic.battle.arena.Wave) Ref(main.entity.Ref) ObjType(main.entity.type.ObjType) Coordinates(main.game.bf.Coordinates) MapBlock(eidolons.game.battlecraft.logic.dungeon.location.building.MapBlock)

Example 3 with Wave

use of eidolons.game.battlecraft.logic.battle.arena.Wave in project Eidolons by IDemiurge.

the class ArenaSpawner method newWave.

public void newWave(DC_Player player) {
    String type = ListChooser.chooseType(DC_TYPE.ENCOUNTERS);
    if (type == null) {
        return;
    }
    newWave(new Wave(DataManager.getType(type, DC_TYPE.ENCOUNTERS), game, new Ref(game), player));
}
Also used : Wave(eidolons.game.battlecraft.logic.battle.arena.Wave) Ref(main.entity.Ref)

Example 4 with Wave

use of eidolons.game.battlecraft.logic.battle.arena.Wave in project Eidolons by IDemiurge.

the class EncounterMaster method getWaveSequence.

private static Map<Wave, Integer> getWaveSequence(Encounter e) {
    Map<Wave, Integer> waves = new XLinkedMap<>();
    int i = 0;
    for (String typeName : StringMaster.open(e.getTypeNames())) {
        ObjType waveType = DataManager.getType(typeName, DC_TYPE.ENCOUNTERS);
        Wave wave = new Wave(waveType, DC_Game.game, new Ref(), DC_Game.game.getPlayer(false));
        // TODO is the field ready for coordinates?
        wave.initUnitMap();
        int j = i;
        // + DC_Game.game.getBattleMaster().getBattleConstructor().getRoundsToFight(
        // waveType);
        Integer round = RandomWizard.getRandomIntBetween(i, j);
        i += round;
        waves.put(wave, round);
    }
    return waves;
}
Also used : Wave(eidolons.game.battlecraft.logic.battle.arena.Wave) Ref(main.entity.Ref) MacroRef(eidolons.game.module.adventure.MacroRef) ObjType(main.entity.type.ObjType) XLinkedMap(main.data.XLinkedMap)

Example 5 with Wave

use of eidolons.game.battlecraft.logic.battle.arena.Wave in project Eidolons by IDemiurge.

the class ArenaSpawner method spawnWave.

public void spawnWave(String typeName, DC_Player player, Coordinates coordinate) {
    ObjType waveType = DataManager.getType(typeName, DC_TYPE.ENCOUNTERS);
    Wave wave = new Wave(coordinate, waveType, game, new Ref(), player);
    spawnWave(null, wave, false);
// initGroup(wave);
}
Also used : Wave(eidolons.game.battlecraft.logic.battle.arena.Wave) Ref(main.entity.Ref) ObjType(main.entity.type.ObjType)

Aggregations

Wave (eidolons.game.battlecraft.logic.battle.arena.Wave)8 Ref (main.entity.Ref)7 ObjType (main.entity.type.ObjType)6 XLinkedMap (main.data.XLinkedMap)2 Coordinates (main.game.bf.Coordinates)2 AddBuffEffect (eidolons.ability.effects.attachment.AddBuffEffect)1 ModifyPropertyEffect (eidolons.ability.effects.common.ModifyPropertyEffect)1 DC_SpellObj (eidolons.entity.active.DC_SpellObj)1 DC_HeroItemObj (eidolons.entity.item.DC_HeroItemObj)1 DC_Cell (eidolons.entity.obj.DC_Cell)1 Unit (eidolons.entity.obj.unit.Unit)1 ArenaBattleMaster (eidolons.game.battlecraft.logic.battle.arena.ArenaBattleMaster)1 MapBlock (eidolons.game.battlecraft.logic.dungeon.location.building.MapBlock)1 MacroRef (eidolons.game.module.adventure.MacroRef)1 File (java.io.File)1 OwnershipChangeEffect (main.ability.effects.common.OwnershipChangeEffect)1 DC_TYPE (main.content.DC_TYPE)1 PROPERTY (main.content.values.properties.PROPERTY)1 Conditions (main.elements.conditions.Conditions)1 SelectiveTargeting (main.elements.targeting.SelectiveTargeting)1