use of main.game.bf.Coordinates.FACING_DIRECTION in project Eidolons by IDemiurge.
the class FormationMaster method formationArrives.
public void formationArrives(FORMATION formation, Party party) {
Coordinates origin = getDefaultPoint(getMaster().getDungeonMaster().getDungeon(), formation);
FACING_DIRECTION facing;
// calculateOrganizationValue
}
use of main.game.bf.Coordinates.FACING_DIRECTION in project Eidolons by IDemiurge.
the class DungeonLevelMaster method getEntranceCoordinates.
public static Coordinates getEntranceCoordinates(ENTRANCE_LAYOUT entranceLayout, Dungeon dungeon) {
FACING_DIRECTION side;
ENTRANCE_POINT_TEMPLATE template = null;
switch(entranceLayout) {
case CENTER:
case CENTER_EAST:
case CENTER_NORTH:
case CENTER_SOUTH:
case CENTER_WEST:
template = ENTRANCE_POINT_TEMPLATE.CENTER;
break;
case MIDDLE_EAST:
case MIDDLE_NORTH:
case MIDDLE_SOUTH:
case MIDDLE_WEST:
template = ENTRANCE_POINT_TEMPLATE.MIDDLE;
break;
case NORTH_EAST:
case NORTH_WEST:
case SOUTH_EAST:
case SOUTH_WEST:
template = ENTRANCE_POINT_TEMPLATE.CORNER;
break;
}
// return new Coordinates(x - 1, y - 1);
// case NORTH:
// return new Coordinates(x - 1, 0);
// case SOUTH:
// return new Coordinates(0, y - 1);
// case WEST:
// return new Coordinates(0, 0);
side = FACING_DIRECTION.SOUTH;
return getEntranceCoordinates(side, template, dungeon);
}
use of main.game.bf.Coordinates.FACING_DIRECTION in project Eidolons by IDemiurge.
the class FacingMaster method getOptimalFacingTowardsUnits.
public static FACING_DIRECTION getOptimalFacingTowardsUnits(Coordinates c, Collection<? extends Obj> units, Function<Entity, Integer> function) {
HashMap<FACING_DIRECTION, Double> map = new LinkedHashMap<>();
for (FACING_DIRECTION facing : FACING_DIRECTION.values()) for (Obj member : units) {
if (FacingMaster.getSingleFacing(facing, c, member.getCoordinates()) != FACING_SINGLE.IN_FRONT) {
continue;
}
double x = ((Unit) member).calculatePower() / PositionMaster.getExactDistance(member.getCoordinates(), c);
Double i = map.get(facing);
if (i == null) {
i = 0.0;
}
i += function.apply(member) * x;
map.put(facing, i);
}
FACING_DIRECTION pick = null;
Double max = 0.0;
for (FACING_DIRECTION fac : map.keySet()) {
if (map.get(fac) > max) {
max = map.get(fac);
pick = fac;
}
}
return pick;
}
use of main.game.bf.Coordinates.FACING_DIRECTION in project Eidolons by IDemiurge.
the class ArenaBattleConstructor method constructWaveSequence.
public Map<Wave, Integer> constructWaveSequence(ENCOUNTER_TYPE[] encounter_sequence) {
Integer round = getRoundNumber();
if (SkirmishMaster.isSkirmish()) {
return SkirmishMaster.constructWaveSequences(round);
}
Map<Wave, Integer> map = new XLinkedMap<>();
if (alt != null) {
alt = !alt;
} else {
alt = checkAltEncounter();
}
List<ObjType> waves = getWaveTypes(getDungeon().getType(), alt);
List<ObjType> waveBuffer = new ArrayList<>(waves);
for (ENCOUNTER_TYPE type : encounter_sequence) {
if (waveBuffer.isEmpty()) {
waveBuffer = DataManager.getTypesGroup(DC_TYPE.ENCOUNTERS, StringMaster.getWellFormattedString(type.toString()));
}
waves = new ArrayList<>(waveBuffer);
Conditions conditions = new Conditions(getEncounterTypeCondition(type));
List<ObjType> filteredWaves = new Filter<ObjType>(game, conditions).filter(waves);
if (!filteredWaves.isEmpty()) {
waves = filteredWaves;
} else {
continue;
}
ObjType waveType = getWaveType(waves, type);
waveType = new ObjType(waveType);
FACING_DIRECTION side = null;
// getMaster().getDungeonMaster().getPositioner().nextSide();
waveType.setProperty(PROPS.SPAWNING_SIDE, side.getName());
Coordinates c = pickSpawnCoordinateForWave(type, round, waveType);
Wave wave = new Wave(c, waveType, game, new Ref(game), game.getPlayer(false));
wave.initUnitMap();
map.put(wave, round);
if (Eidolons.DEV_MODE) {
game.getLogManager().logInfo(wave.toString() + " on round #" + round);
}
LogMaster.log(1, wave.toString() + " on round #" + round);
// TODO subtract from
round += getRoundsToFight(waveType, type);
// total pool
}
setIndex(getIndex() + 1);
return map;
}
use of main.game.bf.Coordinates.FACING_DIRECTION in project Eidolons by IDemiurge.
the class WaveAssembler method applyFill.
public boolean applyFill() {
// TODO for each group, add a (next) unit from filler pool
int i = 0;
for (List<ObjAtCoordinate> group : unitGroups) {
ObjType objType = getFillingType();
if (objType == null) {
return false;
}
FACING_DIRECTION side;
try {
side = positioner.getSides().get(i);
} catch (Exception e) {
// if (group.size() == 0)
return false;
// Coordinates c = (Coordinates) group.keySet().toArray()[0];
// if (c == null)
// return false;
// side = positioner.getFacingForEnemy(c);
}
i++;
Coordinates c = null;
try {
c = positioner.getCoordinatesForNewUnitInGroup(side, objType);
} catch (Exception e) {
main.system.ExceptionMaster.printStackTrace(e);
}
if (c == null) {
return false;
}
ObjAtCoordinate objAtCoordinate = new ObjAtCoordinate(objType, c);
group.add(objAtCoordinate);
typeMap.add(objAtCoordinate);
if (fillApplied >= getMaxFillNumber() || !checkPowerAdjustmentNeeded()) {
return false;
}
}
return true;
}
Aggregations