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;
}
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?
}
}
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));
}
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;
}
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);
}
Aggregations