Search in sources :

Example 11 with DC_Cell

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

the class CellPrioritizer method getMeleePriorityCellsForUnit.

public List<Coordinates> getMeleePriorityCellsForUnit(UnitAI ai) {
    // DC_PriorityManager.setUnitAi(ai);
    List<Coordinates> list = new ArrayList<>();
    List<Obj> cells = new ArrayList<>(50);
    int max_priority = Integer.MIN_VALUE;
    DC_Cell priority_cell = null;
    for (Unit enemy : Analyzer.getVisibleEnemies(ai)) {
        for (Coordinates c : enemy.getCoordinates().getAdjacentCoordinates()) {
            if (!cells.contains(c)) {
                DC_Cell cell = enemy.getGame().getCellByCoordinate(c);
                int priority = getMeleePriorityForCell(ai.getUnit(), cell);
                if (// threshold maybe
                priority > max_priority) {
                    max_priority = priority;
                    // list.add(cell.getCoordinates());
                    priority_cell = cell;
                }
            // cells.add(enemy.getGame().getCellByCoordinate(c));
            }
        }
    }
    list.add(priority_cell.getCoordinates());
    // Collections.sort(cells, getPrioritySorter(ai.getUnit()));
    // 
    // for (int i = 0; i < prune_threshold; i++)
    // list.add(cells.getOrCreate(i).getCoordinates());
    LogMaster.log(1, "Prioritized cells: " + list);
    return list;
}
Also used : DC_Cell(eidolons.entity.obj.DC_Cell) DC_Obj(eidolons.entity.obj.DC_Obj) DC_ActiveObj(eidolons.entity.active.DC_ActiveObj) Obj(main.entity.obj.Obj) Coordinates(main.game.bf.Coordinates) Unit(eidolons.entity.obj.unit.Unit)

Example 12 with DC_Cell

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

the class Analyzer method getWanderCells.

public static List<? extends DC_Obj> getWanderCells(UnitAI ai) {
    DIRECTION d = ai.getGroup().getWanderDirection();
    // permittedCells = ai.getGroup().getWanderBlocks();
    List<DC_Obj> list = new ArrayList<>();
    for (DC_Cell cell : getCells(ai, false, false, true)) {
        if (d != null) {
            if (DirectionMaster.getRelativeDirection(cell, ai.getUnit()) != d) {
                continue;
            }
        }
        if (PositionMaster.getDistance(cell, ai.getUnit()) <= ai.getMaxWanderDistance()) {
            list.add(cell);
        }
    }
    if (list.isEmpty()) {
    // change direction?
    }
    return list;
}
Also used : DC_Obj(eidolons.entity.obj.DC_Obj) DC_Cell(eidolons.entity.obj.DC_Cell) DIRECTION(main.game.bf.Coordinates.DIRECTION) ArrayList(java.util.ArrayList)

Example 13 with DC_Cell

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

the class Analyzer method getCells.

public static List<DC_Cell> getCells(Unit targetUnit, boolean adjacent, boolean detected, boolean free) {
    List<DC_Cell> list = new ArrayList<>();
    for (Obj obj : targetUnit.getGame().getCells()) {
        DC_Cell cell = (DC_Cell) obj;
        if (adjacent) {
            if (!obj.getCoordinates().isAdjacent(targetUnit.getCoordinates())) {
                continue;
            }
        }
        if (free) {
            if (!StackingRule.checkCanPlace(cell.getCoordinates(), targetUnit, null))
                continue;
        // Unit unit = targetUnit.getGame().getUnitByCoordinate(
        // cell.getCoordinates());
        // if (unit != null) {
        // if (VisionManager.checkVisible(unit)) {
        // continue;
        // }
        // }
        }
        if (// TODO in sight etc
        detected) {
            if (cell.getActivePlayerVisionStatus() != PLAYER_VISION.DETECTED) {
                continue;
            }
        }
        list.add(cell);
    }
    return list;
}
Also used : DC_Cell(eidolons.entity.obj.DC_Cell) DC_SpellObj(eidolons.entity.active.DC_SpellObj) DC_Obj(eidolons.entity.obj.DC_Obj) DC_ActiveObj(eidolons.entity.active.DC_ActiveObj) Obj(main.entity.obj.Obj) ArrayList(java.util.ArrayList)

Example 14 with DC_Cell

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

the class OverlaysManager method drawOverlaysForCell.

private void drawOverlaysForCell(GridCellContainer container, int x, int y, Batch batch) {
    if (sightInfoDisplayed) {
        DC_Cell cell = observer.getGame().getMaster().getCellByCoordinate(new Coordinates(x, y));
        UNIT_VISION vision = cell.getUnitVisionStatus(observer);
        if (vision == null) {
            return;
        }
        switch(vision) {
            case IN_PLAIN_SIGHT:
                drawOverlay(container, IN_PLAIN_SIGHT, batch);
                break;
            case IN_SIGHT:
                drawOverlay(container, IN_SIGHT, batch);
                break;
            case BLOCKED:
                drawOverlay(container, BLOCKED, batch);
                break;
            case CONCEALED:
                drawOverlay(container, FOG_OF_WAR, batch);
                break;
        }
    }
}
Also used : UNIT_VISION(main.content.enums.rules.VisionEnums.UNIT_VISION) DC_Cell(eidolons.entity.obj.DC_Cell) Coordinates(main.game.bf.Coordinates)

Example 15 with DC_Cell

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

the class VisibilityMaster method getDisplayImagePathForUnit.

public String getDisplayImagePathForUnit(DC_Obj obj) {
    // construct and cache an Outline obj per unit?
    OUTLINE_TYPE type = obj.getOutlineType();
    if (type == null) {
        return null;
    }
    if (type == VisionEnums.OUTLINE_TYPE.BLOCKED_OUTLINE) {
        return getImagePath(VisionEnums.OUTLINE_TYPE.DEEPER_DARKNESS, obj);
    }
    if ((type == VisionEnums.OUTLINE_TYPE.DEEPER_DARKNESS || type == VisionEnums.OUTLINE_TYPE.BLINDING_LIGHT)) {
        return getImagePath(type, obj);
    }
    if (obj instanceof DC_Cell) {
        return null;
    }
    String outlinePath = "ui\\outlines\\" + type.toString();
    OUTLINE_IMAGE outlineImage;
    if (type == VisionEnums.OUTLINE_TYPE.VAGUE_OUTLINE) {
        outlineImage = master.getOutlineMaster().getImageVague((Unit) obj);
    } else {
        outlineImage = master.getOutlineMaster().getImageDark((Unit) obj);
    }
    if (outlineImage != OUTLINE_IMAGE.UNKNOWN) {
        outlinePath += "_" + outlineImage.toString();
    }
    if (obj.isTargetHighlighted()) {
        outlinePath += TARGET;
    } else {
        if (obj.isInfoSelected()) {
            outlinePath += INFO;
        }
    }
    String image = (outlinePath + ".jpg");
    if (ImageManager.isImage(image)) {
        return image;
    }
    image = (outlinePath.replace("_" + outlineImage.toString(), "") + ".jpg");
    if (ImageManager.isImage(image)) {
        return image;
    }
    image = (outlinePath.replace(INFO, "").replace(TARGET, "") + ".jpg");
    if (ImageManager.isImage(image)) {
        return image;
    }
    return null;
// DIFFERENTIATE BETWEEN RANGE, CONCEALMENT, ILL AND STEALTH
}
Also used : OUTLINE_TYPE(main.content.enums.rules.VisionEnums.OUTLINE_TYPE) DC_Cell(eidolons.entity.obj.DC_Cell) OUTLINE_IMAGE(main.content.enums.rules.VisionEnums.OUTLINE_IMAGE) 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