use of main.content.enums.rules.VisionEnums.PLAYER_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.PLAYER_VISION in project Eidolons by IDemiurge.
the class DrawMaster method drawCellImage.
private void drawCellImage(Graphics g) {
Image img = cellComp.getGame().getVisionMaster().getVisibilityMaster().getDisplayImageForUnit(cellComp.getTerrainObj());
if (img == null) {
if (cellComp.getTerrainObj().isTargetHighlighted()) {
img = ImageManager.getHighlightedCellIcon().getImage();
} else {
VISIBILITY_LEVEL vl = cellComp.getTerrainObj().getVisibilityLevel(false);
PLAYER_VISION ds = cellComp.getTerrainObj().getPlayerVisionStatus(false);
// + cellComp.getTerrainObj().getNameAndCoordinate());
if (cellComp.getGame().getVisionMaster().getVisibilityMaster().isZeroVisibility(cellComp.getTerrainObj())) {
if (ds == PLAYER_VISION.KNOWN || ds == PLAYER_VISION.DETECTED) {
img = (ImageManager.getHiddenCellIcon().getImage());
} else {
img = ImageManager.getUnknownCellIcon().getImage();
}
} else if (vl == VISIBILITY_LEVEL.CLEAR_SIGHT) // TODO darken image based on CvsIl
// if (cellComp.getTerrainObj().getUnitVisionStatus() ==
// UNIT_TO_UNIT_VISION.BEYOND_SIGHT) {
// if (ds == UNIT_TO_PLAYER_VISION.DETECTED) {
// img = (ImageManager.getHiddenCellIcon().getEmitterPath());
// } else
// img = ImageManager.getUnknownCellIcon().getEmitterPath();
// } else
{
img = ImageManager.getEmptyCellIcon().getImage();
} else {
img = ImageManager.getHiddenCellIcon().getImage();
}
if (zoom != 100 || !isFramePaintZoom()) {
img = ImageManager.getSizedVersion(img, new Dimension(getObjCompWidth(), getObjCompHeight()), true);
}
if (vl == VISIBILITY_LEVEL.VAGUE_OUTLINE) {
// g.drawImage(img, 0, 0, null);
}
}
}
g.drawImage(img, 0, 0, null);
}
use of main.content.enums.rules.VisionEnums.PLAYER_VISION in project Eidolons by IDemiurge.
the class MiniObjComp method applyVisibility.
private void applyVisibility() {
// TODO inter-dependence of the four...?
PLAYER_VISION detection = obj.getActivePlayerVisionStatus();
UNIT_VISION vision = obj.getUnitVisionStatus();
VISIBILITY_LEVEL visibility = obj.getVisibilityLevel();
// PERCEPTION_STATUS perception = obj.getPerceptionStatus();
// ++ TARGETING HL
// draw image / info icons
boolean hidden = false;
if (detection == PLAYER_VISION.UNKNOWN) {
image = (ImageManager.getHiddenCellIcon()).getImage();
obj.setImage("UI//cells//Hidden Cell v" + 1 + ".png");
return;
}
// ImageManager.getOutlineImage(obj);
// ImageTransformer.getTransparent(image, trasparency);
// // ImageManager.STD_IMAGES.DEEPER_DARKNESS
// PerceptionRule.getHints(obj, perception, visibility);
// TO BE USED WHEN UNIT ACTS -
// "something huge/monstrous/humanoid/mechanical/ghostly/demonic..." etc
// if (vision == UNIT_TO_UNIT_VISION.IN_SIGHT) -> negate other effects?
// which status has priority? -> VISIBILITY!
/*
* perception:
*
*
*
*/
boolean terrain = (obj instanceof DC_Cell);
if (vision != UNIT_VISION.IN_PLAIN_SIGHT) {
if (detection == PLAYER_VISION.DETECTED) {
image = !terrain ? ImageManager.applyBorder(image, ImageManager.BORDER_BEYOND_SIGHT) : (ImageManager.getHiddenCellIcon()).getImage();
} else {
image = !terrain ? ImageManager.applyBorder(image, ImageManager.BORDER_UNKNOWN) : (ImageManager.getUnknownCellIcon()).getImage();
}
} else {
// if (visibility == VISIBILITY_LEVEL.DEEPER_DARKNESS) {
//
// }
}
}
Aggregations