Search in sources :

Example 11 with DC_Obj

use of eidolons.entity.obj.DC_Obj 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 12 with DC_Obj

use of eidolons.entity.obj.DC_Obj in project Eidolons by IDemiurge.

the class DamageCalculator method getBonusDamageList.

public static List<Damage> getBonusDamageList(Ref ref, DAMAGE_CASE CASE) {
    List<Damage> list = new ArrayList<>();
    // TODO make BonusDamage all add to source?
    DC_Obj obj = (DC_Obj) ref.getSourceObj();
    for (DAMAGE_CASE e : obj.getBonusDamage().keySet()) {
        if (e == CASE) {
            list.addAll(obj.getBonusDamage().get(e));
        }
    }
    obj = (DC_Obj) ref.getObj(KEYS.ACTIVE);
    for (DAMAGE_CASE e : obj.getBonusDamage().keySet()) {
        if (e == CASE) {
            list.addAll(obj.getBonusDamage().get(e));
        }
    }
    if (obj instanceof DC_ActiveObj) {
        obj = ((DC_ActiveObj) obj).getActiveWeapon();
        if (obj != null) {
            for (DAMAGE_CASE e : obj.getBonusDamage().keySet()) {
                if (e == CASE) {
                    list.addAll(obj.getBonusDamage().get(e));
                }
            }
        }
    }
    return list;
}
Also used : DC_Obj(eidolons.entity.obj.DC_Obj) ArrayList(java.util.ArrayList) DAMAGE_CASE(main.content.enums.GenericEnums.DAMAGE_CASE) DC_ActiveObj(eidolons.entity.active.DC_ActiveObj)

Example 13 with DC_Obj

use of eidolons.entity.obj.DC_Obj in project Eidolons by IDemiurge.

the class TimeRule method checkTime.

public boolean checkTime(DC_ActiveObj action, int time_used) {
    DC_Obj unitObj = action.getOwnerObj();
    Integer prevTime = timeMap.get(unitObj);
    if (prevTime == null) {
        prevTime = 0;
    }
    int time = prevTime + time_used;
    timeMap.put(unitObj, time);
    if (time > maxTime) {
        maxTime = time;
        int delta = getTimeRemaining() - (baseTime - time);
        float percent = new Float(delta) / baseTime;
        if (game.getDungeonMaster().getExplorationMaster() != null)
            game.getDungeonMaster().getExplorationMaster().getAiMaster().tryMoveAiTurnBased(percent);
        // % of time spent...
        timeRemaining = baseTime - time;
        game.getLogManager().log(LOG.GAME_INFO, "*** Time remaining for this round: " + timeRemaining, ENTRY_TYPE.ACTION);
    }
    return timeRemaining <= 0;
}
Also used : DC_Obj(eidolons.entity.obj.DC_Obj)

Example 14 with DC_Obj

use of eidolons.entity.obj.DC_Obj in project Eidolons by IDemiurge.

the class LE_MouseMaster method mouseClicked.

public void mouseClicked(MouseEvent e) {
    // info click!
    DC_Obj obj;
    coordinates = null;
    boolean right = SwingUtilities.isRightMouseButton(e);
    CellComp cellComp = getGrid().getCompByPoint(e.getPoint());
    previousCoordinate = coordinates;
    coordinates = cellComp.getCoordinates();
    obj = cellComp.getTopObjOrCell();
    obj.setCoordinates(coordinates);
    lastClicked = obj;
    if (!right) {
        selectedObj = obj;
    }
    if (right) {
        setMode(null);
    }
    if (checkEventConsumed(obj, right)) {
        getGrid().getPanel().repaint();
        return;
    }
    LevelEditor.getGrid().setDirty(true);
    handleClick(e, right);
    if (LevelEditor.getGrid().isDirty()) {
        LevelEditor.getGrid().refresh();
    }
}
Also used : CellComp(eidolons.swing.components.obj.CellComp) DC_Obj(eidolons.entity.obj.DC_Obj)

Example 15 with DC_Obj

use of eidolons.entity.obj.DC_Obj in project Eidolons by IDemiurge.

the class Level method addObj.

public void addObj(Unit obj, Coordinates c, boolean stack) {
    Chronos.mark("adding " + obj);
    obj.setZ(location.getZ());
    if (stack) {
        if (obj.isLandscape()) {
            stack = false;
        }
    }
    // if (!obj.isOverlaying())
    // getTopObjMap().put(c, obj);
    // if (obj instanceof Entrance) {
    // if (location.getMainEntrance() == null) {
    // location.setMainEntrance((Entrance) obj);
    // location.getPlan().setEntranceLayout(
    // DungeonLevelMaster.getLayout(location.getPlan(), c));
    // LogMaster.log(1, "Main Entrance: " + obj + "; initComps = "
    // + location.getPlan().getEntranceLayout());
    // } else if (location.getMainExit() == null) {
    // location.setMainExit((Entrance) obj);
    // location.getPlan().setExitLayout(DungeonLevelMaster.getLayout(location.getPlan(), c));
    // LogMaster.log(1, "Main Exit: " + obj + "; initComps = "
    // + location.getPlan().getExitLayout());
    // }
    // location.getEntrances().add((Entrance) obj);
    // 
    // }
    cache();
    // overwrite
    if (!obj.isOverlaying() && !stack && initialized) {
        // for (DC_Obj o : mapObjects)
        // if (o.getCoordinates().equals(obj.getCoordinates())) {
        List<DC_Obj> objects = getObjects(null, c);
        objects.remove(obj);
        removeObjects(objects);
    }
    MapBlock b = getBlockForCoordinate(c, false);
    if (b != null) {
        if (obj.isLandscape() && obj.getType().getName().equalsIgnoreCase(b.getZone().getFillerType())) {
            b.getCoordinates().remove(c);
        } else if (initialized) {
            b.addObject(obj, c);
        }
    // TODO
    } else {
        if (!obj.isLandscape()) {
            getWallObjects().add(obj);
        }
    }
    Chronos.logTimeElapsedForMark("adding " + obj);
}
Also used : DC_Obj(eidolons.entity.obj.DC_Obj) MapBlock(eidolons.game.battlecraft.logic.dungeon.location.building.MapBlock)

Aggregations

DC_Obj (eidolons.entity.obj.DC_Obj)49 Unit (eidolons.entity.obj.unit.Unit)13 Obj (main.entity.obj.Obj)13 Coordinates (main.game.bf.Coordinates)12 ArrayList (java.util.ArrayList)11 DC_ActiveObj (eidolons.entity.active.DC_ActiveObj)9 DIRECTION (main.game.bf.Coordinates.DIRECTION)7 BattleFieldObject (eidolons.entity.obj.BattleFieldObject)5 DC_Cell (eidolons.entity.obj.DC_Cell)4 BufferedImage (java.awt.image.BufferedImage)4 List (java.util.List)3 ModifyCounterEffect (eidolons.ability.effects.oneshot.mechanic.ModifyCounterEffect)2 DC_UnitAction (eidolons.entity.active.DC_UnitAction)2 HashMap (java.util.HashMap)2 PARAMETER (main.content.values.parameters.PARAMETER)2 Ref (main.entity.Ref)2 BuffObj (main.entity.obj.BuffObj)2 Pair (org.apache.commons.lang3.tuple.Pair)2 InputEvent (com.badlogic.gdx.scenes.scene2d.InputEvent)1 Image (com.badlogic.gdx.scenes.scene2d.ui.Image)1