Search in sources :

Example 6 with FACING_DIRECTION

use of main.game.bf.Coordinates.FACING_DIRECTION in project Eidolons by IDemiurge.

the class CellCondition method getCoordinates.

@Override
protected Coordinates getCoordinates(Ref ref) {
    if (obj_ref == null) {
        obj_ref = KEYS.MATCH.toString();
    }
    if (direction == null) {
        return super.getCoordinates(ref);
    }
    Obj obj = ref.getObj(obj_ref);
    FACING_DIRECTION f = null;
    if (obj instanceof DC_UnitModel) {
        f = ((DC_UnitModel) obj).getFacing();
    }
    if (f == null) {
        return null;
    }
    return super.getCoordinates(ref).getAdjacentCoordinate(DirectionMaster.getDirectionByFacing(f, direction));
}
Also used : FACING_DIRECTION(main.game.bf.Coordinates.FACING_DIRECTION) DC_UnitModel(eidolons.entity.obj.unit.DC_UnitModel) Obj(main.entity.obj.Obj)

Example 7 with FACING_DIRECTION

use of main.game.bf.Coordinates.FACING_DIRECTION in project Eidolons by IDemiurge.

the class LocationBuilder method placeCulDeSacs.

// public static ObjType getDungeonTypeFromLevelData(String data) {
// return null;
// }
private void placeCulDeSacs() {
    int n = helper.getParams().CUL_DE_SACS;
    n = MathMaster.applyMod(n, getDungeon().getPlan().getWidthMod());
    n = RandomWizard.getRandomIntBetween(n / 2, n * 2);
    Loop.startLoop(10000);
    while (!Loop.loopEnded()) {
        MapBlock block = new RandomWizard<MapBlock>().getRandomListItem(plan.getBlocks());
        FACING_DIRECTION direction = FacingMaster.getRandomFacing();
        Coordinates baseCoordinate = helper.getRandomWallCoordinate(direction, block);
        if (helper.tryPlaceCorridor(block, baseCoordinate, direction, true)) {
            n--;
        }
        if (n < 0) {
            break;
        }
    }
}
Also used : FACING_DIRECTION(main.game.bf.Coordinates.FACING_DIRECTION) Coordinates(main.game.bf.Coordinates) MapBlock(eidolons.game.battlecraft.logic.dungeon.location.building.MapBlock)

Example 8 with FACING_DIRECTION

use of main.game.bf.Coordinates.FACING_DIRECTION in project Eidolons by IDemiurge.

the class ArenaPositioner method getCoordinatesForUnitGroup.

public List<ObjAtCoordinate> getCoordinatesForUnitGroup(List<ObjType> presetGroupTypes, Wave wave, int unitLevel) {
    Map<Coordinates, ObjType> map = new LinkedHashMap<>();
    boolean custom = false;
    Coordinates presetCenterCoordinate = wave.getCoordinates();
    if (wave.isPresetCoordinate()) {
        if (presetCenterCoordinate != null) {
            custom = isAutoOptimalFacing();
        }
    }
    if (wave.getBlock() != null) {
    // TODO return
    // getCoordinatesForUnitGroupInMapBlock(presetGroupTypes, wave,
    // wave.getBlock());
    }
    if (forcedSide != null) {
        side = forcedSide;
    // forcedSide = null;
    } else {
        side = new EnumMaster<FACING_DIRECTION>().retrieveEnumConst(FACING_DIRECTION.class, wave.getProperty(PROPS.SPAWNING_SIDE));
        if (side == null) {
            nextSide();
        }
    }
    unitGroups.put(side, map);
    int maxUnitsPerRow = getMaxUnitsPerRow(side);
    List<Coordinates> list = getCoordinatesForUnits(presetGroupTypes, custom, presetCenterCoordinate, maxUnitsPerRow);
    List<ObjAtCoordinate> group = new ArrayList<>();
    int i = 0;
    for (Coordinates c : list) {
        ObjType type = new ObjType(presetGroupTypes.get(i));
        type.getGame().initType(type);
        i++;
        if (unitLevel > 0) {
            type = new UnitLevelManager().getLeveledType(type, unitLevel, false);
        }
        ObjAtCoordinate objAtCoordinate = new ObjAtCoordinate(type, c);
        group.add(objAtCoordinate);
    }
    return group;
}
Also used : ObjAtCoordinate(main.entity.type.ObjAtCoordinate) Coordinates(main.game.bf.Coordinates) FACING_DIRECTION(main.game.bf.Coordinates.FACING_DIRECTION) UnitLevelManager(eidolons.client.cc.logic.UnitLevelManager) ObjType(main.entity.type.ObjType) EnumMaster(main.system.auxiliary.EnumMaster)

Example 9 with FACING_DIRECTION

use of main.game.bf.Coordinates.FACING_DIRECTION in project Eidolons by IDemiurge.

the class ArenaPositioner method getPartyCoordinates.

@Unimplemented
public List<Coordinates> getPartyCoordinates(Coordinates origin, Boolean me, List<String> partyTypes) {
    List<Coordinates> list = new ArrayList<>();
    // TODO
    if (CoreEngine.isArcaneVault() || CoreEngine.isLevelEditor()) {
        origin = new Coordinates(PositionMaster.getMiddleIndex(false), PositionMaster.getMiddleIndex(true));
    } else {
        FACING_DIRECTION side = ArenaPositioner.DEFAULT_PLAYER_SIDE;
        // if ( getSpawningSide() != null) {
        // side =   getSpawningSide();
        // }
        unitGroups.put(side, new LinkedHashMap<>());
    }
    return list;
}
Also used : FACING_DIRECTION(main.game.bf.Coordinates.FACING_DIRECTION) Coordinates(main.game.bf.Coordinates) Unimplemented(main.system.util.Unimplemented)

Example 10 with FACING_DIRECTION

use of main.game.bf.Coordinates.FACING_DIRECTION in project Eidolons by IDemiurge.

the class ArenaSpawner method spawnWave.

private void spawnWave(List<ObjAtCoordinate> unitMap, Wave wave, boolean prespawnMode) {
    game.getLogManager().log("New encounter: " + wave.getName());
    if (unitMap == null) {
        getPositioner().setMaxSpacePercentageTaken(MAX_SPACE_PERC_CREEPS);
        wave.initUnitMap();
        unitMap = wave.getUnitMap();
    }
    try {
        getBattleMaster().getWaveAssembler().resetPositions(wave);
    } catch (Exception e) {
        main.system.ExceptionMaster.printStackTrace(e);
    }
    for (ObjAtCoordinate oac : unitMap) {
        Coordinates c = oac.getCoordinates();
        FACING_DIRECTION facing = getFacingAdjuster().getFacingForEnemy(c);
        boolean invalid = false;
        if (c == null) {
            invalid = true;
        } else if (c.isInvalid()) {
            invalid = true;
        } else if (game.getBattleField().getGrid().isCoordinateObstructed(c)) {
            invalid = true;
        }
        if (invalid) {
            c = Positioner.adjustCoordinate(c, facing);
        }
        ObjType type = oac.getType();
        Unit unit = (Unit) game.createUnit(type, c, wave.getOwner());
        UnitTrainingMaster.train(unit);
        unit.setFacing(facing);
        wave.addUnit(unit);
        game.fireEvent(new Event(STANDARD_EVENT_TYPE.UNIT_HAS_CHANGED_FACING, Ref.getSelfTargetingRefCopy(unit)));
    }
    if (!PartyHelper.checkMergeParty(wave)) {
        try {
            PartyHelper.addCreepParty(wave);
        } catch (Exception e) {
            main.system.ExceptionMaster.printStackTrace(e);
        }
    }
}
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) Event(main.game.logic.event.Event) Unit(eidolons.entity.obj.unit.Unit)

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