Search in sources :

Example 16 with DC_Cell

use of eidolons.entity.obj.DC_Cell in project Eidolons by IDemiurge.

the class VisionRule method fullReset.

public void fullReset(Unit... observers) {
    BattleFieldObject[][][] array = master.getGame().getMaster().getObjCells();
    for (int i = 0; i < array.length; i++) {
        for (int j = 0; j < array[0].length; j++) {
            BattleFieldObject[] objects = master.getGame().getMaster().getObjects(i, j);
            DC_Cell cell = master.getGame().getCellByCoordinate(new Coordinates(i, j));
            for (Unit observer : observers) {
                if (!isResetRequired(observer, cell))
                    continue;
                if (isGammaResetRequired(observer, cell)) {
                    cell.setGamma(observer, master.getGammaMaster().getGamma(observer, cell));
                }
                master.getSightMaster().resetUnitVision(observer, cell);
                for (BattleFieldObject sub : objects) {
                    // check ignore?
                    if (!isObjResetRequired(observer, sub))
                        continue;
                    if (isGammaResetRequired(observer, sub))
                        sub.setGamma(observer, master.getGammaMaster().getGamma(observer, sub));
                    // master.getSightMaster().resetSightStatuses(observer);
                    master.getSightMaster().resetUnitVision(observer, sub);
                    // controller.getUnitVisionMapper()
                    // sub.setUnitVisionStatus(observer, master.getUnitVisibilityStatus(sub, observer));
                    controller.getVisibilityLevelMapper().set(observer, sub, visibility(observer, sub));
                    controller.getOutlineMapper().set(observer, sub, outline(observer, sub));
                    controller.getPlayerVisionMapper().set(observer.getOwner(), sub, playerVision(observer, sub));
                }
            }
        }
    }
}
Also used : BattleFieldObject(eidolons.entity.obj.BattleFieldObject) DC_Cell(eidolons.entity.obj.DC_Cell) Coordinates(main.game.bf.Coordinates) Unit(eidolons.entity.obj.unit.Unit)

Example 17 with DC_Cell

use of eidolons.entity.obj.DC_Cell in project Eidolons by IDemiurge.

the class UnitAI method checkOrdersChange.

private void checkOrdersChange() {
    if (unit.isMine()) {
        // could be multiplayer!..
        if (isPlayerOrdered()) {
            // if (!isPromptDisabled())
            String TRUE = "Orders";
            String FALSE = "Proceed";
            // wait, resume last, on your own!
            String NULL = "Cancel";
            Boolean result = DialogMaster.askAndWait("Do you want to change " + getPlayerOrder() + "?", TRUE, FALSE, NULL);
            if (result == null) {
            }
        }
    }
    // groupAI.getOrCreate
    if (orderType == ORDER_TYPE.PURSUIT) {
        if (standingOrders.getLastAction().getTarget() instanceof DC_Cell) {
            DC_Cell cell = (DC_Cell) standingOrders.getLastAction().getTarget();
            cell.getCoordinates();
        } else if (orderType == ORDER_TYPE.WANDER) {
        // groupAI.getWanderDirection()
        }
    }
}
Also used : DC_Cell(eidolons.entity.obj.DC_Cell)

Example 18 with DC_Cell

use of eidolons.entity.obj.DC_Cell in project Eidolons by IDemiurge.

the class Analyzer method getLastSeenEnemyCells.

public static List<DC_Cell> getLastSeenEnemyCells(UnitAI ai) {
    List<DC_Cell> list = new ArrayList<>();
    for (DC_Obj obj : ai.getUnit().getOwner().getLastSeenCache().keySet()) {
        if (isEnemy(obj, ai.getUnit())) {
            Coordinates coordinates = ai.getUnit().getOwner().getLastSeenCache().get(obj);
            list.add(obj.getGame().getCellByCoordinate(coordinates));
        }
    }
    return list;
}
Also used : DC_Obj(eidolons.entity.obj.DC_Obj) DC_Cell(eidolons.entity.obj.DC_Cell) Coordinates(main.game.bf.Coordinates) ArrayList(java.util.ArrayList)

Example 19 with DC_Cell

use of eidolons.entity.obj.DC_Cell in project Eidolons by IDemiurge.

the class Analyzer method getSummonCells.

public static List<DC_Cell> getSummonCells(UnitAI ai, DC_ActiveObj action) {
    if (EffectFinder.check(action, RaiseEffect.class)) {
        return getCorpseCells(ai.getUnit());
    }
    List<DC_Cell> cells = getCells(ai, true, true, true);
    boolean melee = true;
    // } preCheck melee TODO
    if (melee) {
        for (Unit e : getVisibleEnemies(ai)) {
            // e.getCoordinates().getAdjacentCoordinates()
            cells.addAll(getCells(e, true, false, true));
        }
    }
    cells.removeIf(cell -> {
        boolean result = true;
        if (ai.getUnit().getGame().getObjectByCoordinate(cell.getCoordinates()) instanceof BattleFieldObject) {
            if (((BattleFieldObject) ai.getUnit().getGame().getObjectByCoordinate(cell.getCoordinates())).isWall())
                result = false;
        }
        return result;
    });
    return cells;
}
Also used : DC_Cell(eidolons.entity.obj.DC_Cell) BattleFieldObject(eidolons.entity.obj.BattleFieldObject) Unit(eidolons.entity.obj.unit.Unit)

Example 20 with DC_Cell

use of eidolons.entity.obj.DC_Cell in project Eidolons by IDemiurge.

the class Analyzer method getZoneDamageCells.

public static List<? extends DC_Obj> getZoneDamageCells(Unit unit) {
    List<DC_Cell> cells = getCells(unit.getUnitAI(), false, false, true);
    List<DC_Cell> remove_cells = new ArrayList<>();
    loop: for (DC_Cell c : cells) {
        for (Coordinates c1 : c.getCoordinates().getAdjacentCoordinates()) {
            Unit enemy = unit.getGame().getUnitByCoordinate(c1);
            if (isEnemy(enemy, unit)) {
                continue loop;
            }
        }
        remove_cells.add(c);
    }
    for (DC_Cell c : remove_cells) {
        cells.remove(c);
    }
    return cells;
}
Also used : DC_Cell(eidolons.entity.obj.DC_Cell) Coordinates(main.game.bf.Coordinates) ArrayList(java.util.ArrayList) Unit(eidolons.entity.obj.unit.Unit)

Aggregations

DC_Cell (eidolons.entity.obj.DC_Cell)23 Coordinates (main.game.bf.Coordinates)11 Unit (eidolons.entity.obj.unit.Unit)10 DC_Obj (eidolons.entity.obj.DC_Obj)6 DC_ActiveObj (eidolons.entity.active.DC_ActiveObj)5 ArrayList (java.util.ArrayList)5 Obj (main.entity.obj.Obj)5 BattleFieldObject (eidolons.entity.obj.BattleFieldObject)3 Ref (main.entity.Ref)3 DC_SpellObj (eidolons.entity.active.DC_SpellObj)2 DC_UnitAction (eidolons.entity.active.DC_UnitAction)2 Action (eidolons.game.battlecraft.ai.elements.actions.Action)2 UNIT_VISION (main.content.enums.rules.VisionEnums.UNIT_VISION)2 DIRECTION (main.game.bf.Coordinates.DIRECTION)2 Label (com.badlogic.gdx.scenes.scene2d.ui.Label)1 AddBuffEffect (eidolons.ability.effects.attachment.AddBuffEffect)1 ModifyPropertyEffect (eidolons.ability.effects.common.ModifyPropertyEffect)1 SelfMoveEffect (eidolons.ability.effects.oneshot.move.SelfMoveEffect)1 DC_QuickItemAction (eidolons.entity.active.DC_QuickItemAction)1 DC_HeroItemObj (eidolons.entity.item.DC_HeroItemObj)1