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;
}
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;
}
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;
}
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;
}
}
}
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
}
Aggregations