use of main.content.enums.rules.VisionEnums.UNIT_VISION in project Eidolons by IDemiurge.
the class VisibilityCondition method check.
@Override
public boolean check(Ref ref) {
if (!(ref.getObj(KEYS.MATCH) instanceof BfObj)) {
return false;
}
DC_Obj match = (DC_Obj) ref.getObj(KEYS.MATCH);
boolean result = false;
if (this.match == null && this.source == null) {
if (p_vision != null) {
PLAYER_VISION playerVision = match.getActivePlayerVisionStatus();
if (game.getManager().getActiveObj().isMine() != ref.getSourceObj().isMine()) {
if (ref.getSourceObj().isMine()) {
playerVision = match.getPlayerVisionStatus(false);
} else {
// TODO for enemy unit on player's unit...
}
}
if (playerVision == p_vision) {
return true;
}
}
UNIT_VISION visionStatus = match.getUnitVisionStatus();
if (!ref.getSourceObj().isActiveSelected()) {
visionStatus = match.getGame().getVisionMaster().getSightMaster().getUnitVisibilityStatus(match, (Unit) ref.getSourceObj());
}
return visionStatus.isSufficient(u_vision);
}
if (p_vision != null) {
Unit unit = (Unit) ref.getObj(source);
result = unit.getActivePlayerVisionStatus() == p_vision;
} else if (u_vision != null) {
match = (DC_Obj) ref.getObj(this.match);
// if (((DC_Game) game).getManager().isAI_Turn()) { what's the idea?
Unit activeObj = (Unit) ref.getObj(source);
result = ((DC_Game) game).getVisionMaster().getUnitVisibilityStatus(match, activeObj).isSufficient(u_vision);
// }
}
return result;
}
use of main.content.enums.rules.VisionEnums.UNIT_VISION 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 main.content.enums.rules.VisionEnums.UNIT_VISION in project Eidolons by IDemiurge.
the class SightMaster method resetUnitVision.
public void resetUnitVision(BattleFieldObject observer, DC_Obj unit) {
UNIT_VISION status = getUnitVisionStatusPrivate(unit, (Unit) observer);
master.getVisionController().getUnitVisionMapper().set(observer, unit, status);
}
use of main.content.enums.rules.VisionEnums.UNIT_VISION in project Eidolons by IDemiurge.
the class SightMaster method resetUnitVision.
private void resetUnitVision(BattleFieldObject observer, Collection<? extends Obj> units) {
int maxDistance = observer.getIntParam(PARAMS.SIGHT_RANGE) * 2 + 1;
for (Obj obj : units) {
DC_Obj unit = (DC_Obj) obj;
if (PositionMaster.getDistance(observer, obj) > maxDistance) {
master.getVisionController().getUnitVisionMapper().set(observer, unit, null);
continue;
}
UNIT_VISION status = getUnitVisionStatusPrivate(unit, (Unit) observer);
master.getVisionController().getUnitVisionMapper().set(observer, unit, status);
}
}
use of main.content.enums.rules.VisionEnums.UNIT_VISION in project Eidolons by IDemiurge.
the class VisionRule method visibility.
public VISIBILITY_LEVEL visibility(Unit source, DC_Obj object) {
UNIT_VISION sight = controller.getUnitVisionMapper().get(source, object);
boolean landmark = object instanceof Structure;
switch(sight) {
case IN_PLAIN_SIGHT:
return VISIBILITY_LEVEL.CLEAR_SIGHT;
case BLOCKED:
// if
return VISIBILITY_LEVEL.BLOCKED;
case IN_SIGHT:
if (landmark)
if (controller.getDetectionMapper().get(source.getOwner(), object)) {
return VISIBILITY_LEVEL.CONCEALED;
}
return VISIBILITY_LEVEL.OUTLINE;
case BEYOND_SIGHT:
if (landmark) {
if (controller.getDetectionMapper().get(source.getOwner(), object)) {
return VISIBILITY_LEVEL.CONCEALED;
}
}
}
return VISIBILITY_LEVEL.UNSEEN;
// TODO case CONCEALED:
// break;
}
Aggregations