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