Search in sources :

Example 11 with FACING_DIRECTION

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
}
Also used : FACING_DIRECTION(main.game.bf.Coordinates.FACING_DIRECTION) Coordinates(main.game.bf.Coordinates)

Example 12 with FACING_DIRECTION

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);
}
Also used : FACING_DIRECTION(main.game.bf.Coordinates.FACING_DIRECTION)

Example 13 with FACING_DIRECTION

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;
}
Also used : FACING_DIRECTION(main.game.bf.Coordinates.FACING_DIRECTION) Obj(main.entity.obj.Obj) BfObj(main.entity.obj.BfObj) Unit(eidolons.entity.obj.unit.Unit)

Example 14 with FACING_DIRECTION

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;
}
Also used : XLinkedMap(main.data.XLinkedMap) ENCOUNTER_TYPE(main.content.enums.EncounterEnums.ENCOUNTER_TYPE) Coordinates(main.game.bf.Coordinates) ArrayList(java.util.ArrayList) Conditions(main.elements.conditions.Conditions) FACING_DIRECTION(main.game.bf.Coordinates.FACING_DIRECTION) Ref(main.entity.Ref) ObjType(main.entity.type.ObjType)

Example 15 with FACING_DIRECTION

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;
}
Also used : FACING_DIRECTION(main.game.bf.Coordinates.FACING_DIRECTION) ObjAtCoordinate(main.entity.type.ObjAtCoordinate) ObjType(main.entity.type.ObjType) Coordinates(main.game.bf.Coordinates)

Aggregations

FACING_DIRECTION (main.game.bf.Coordinates.FACING_DIRECTION)31 Coordinates (main.game.bf.Coordinates)17 Unit (eidolons.entity.obj.unit.Unit)5 ArrayList (java.util.ArrayList)5 Ref (main.entity.Ref)5 ObjType (main.entity.type.ObjType)5 Obj (main.entity.obj.Obj)4 BattleFieldObject (eidolons.entity.obj.BattleFieldObject)3 DC_UnitModel (eidolons.entity.obj.unit.DC_UnitModel)3 ObjAtCoordinate (main.entity.type.ObjAtCoordinate)3 TemplateSelectiveTargeting (eidolons.ability.targeting.TemplateSelectiveTargeting)2 UnitLevelManager (eidolons.client.cc.logic.UnitLevelManager)2 DC_UnitAction (eidolons.entity.active.DC_UnitAction)2 MapBlock (eidolons.game.battlecraft.logic.dungeon.location.building.MapBlock)2 FACING_SINGLE (main.content.enums.entity.UnitEnums.FACING_SINGLE)2 Conditions (main.elements.conditions.Conditions)2 AutoTargeting (main.elements.targeting.AutoTargeting)2 MultiTargeting (main.elements.targeting.MultiTargeting)2 SelectiveTargeting (main.elements.targeting.SelectiveTargeting)2 Targeting (main.elements.targeting.Targeting)2