Search in sources :

Example 1 with PLAYER_VISION

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;
}
Also used : DC_Obj(eidolons.entity.obj.DC_Obj) PLAYER_VISION(main.content.enums.rules.VisionEnums.PLAYER_VISION) UNIT_VISION(main.content.enums.rules.VisionEnums.UNIT_VISION) BfObj(main.entity.obj.BfObj) DC_Game(eidolons.game.core.game.DC_Game) Unit(eidolons.entity.obj.unit.Unit)

Example 2 with PLAYER_VISION

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);
}
Also used : PLAYER_VISION(main.content.enums.rules.VisionEnums.PLAYER_VISION) VISIBILITY_LEVEL(main.content.enums.rules.VisionEnums.VISIBILITY_LEVEL) BufferedImage(java.awt.image.BufferedImage)

Example 3 with PLAYER_VISION

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) {
    // 
    // }
    }
}
Also used : PLAYER_VISION(main.content.enums.rules.VisionEnums.PLAYER_VISION) UNIT_VISION(main.content.enums.rules.VisionEnums.UNIT_VISION) VISIBILITY_LEVEL(main.content.enums.rules.VisionEnums.VISIBILITY_LEVEL) DC_Cell(eidolons.entity.obj.DC_Cell)

Aggregations

PLAYER_VISION (main.content.enums.rules.VisionEnums.PLAYER_VISION)3 UNIT_VISION (main.content.enums.rules.VisionEnums.UNIT_VISION)2 VISIBILITY_LEVEL (main.content.enums.rules.VisionEnums.VISIBILITY_LEVEL)2 DC_Cell (eidolons.entity.obj.DC_Cell)1 DC_Obj (eidolons.entity.obj.DC_Obj)1 Unit (eidolons.entity.obj.unit.Unit)1 DC_Game (eidolons.game.core.game.DC_Game)1 BufferedImage (java.awt.image.BufferedImage)1 BfObj (main.entity.obj.BfObj)1