Search in sources :

Example 6 with DC_Obj

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

the class DrawMasterStatic method drawWatchInfo.

public static void drawWatchInfo(int zoom, Graphics g) {
    DC_Obj info = DC_Game.game.getManager().getInfoObj();
    if (info instanceof Unit) {
        java.util.List<DC_Obj> watchedObjects = WatchRule.getWatchersMap().get(info);
        if (watchedObjects != null) {
            drawWatchVisuals(watchedObjects, (Unit) info, g, zoom, watchedObjects, false, true);
            drawWatchVisuals(watchedObjects, (Unit) info, g, zoom, watchedObjects, false, false);
        }
    } else {
        Unit active = DC_Game.game.getManager().getActiveObj();
        if (active.isMine()) {
            java.util.List<DC_Obj> watchedObjects = WatchRule.getWatchersMap().get(active);
            if (watchedObjects != null) {
                drawWatchVisuals(watchedObjects, active, g, zoom, watchedObjects, true, true);
                drawWatchVisuals(watchedObjects, active, g, zoom, watchedObjects, true, false);
            }
        }
    }
}
Also used : DC_Obj(eidolons.entity.obj.DC_Obj) Unit(eidolons.entity.obj.unit.Unit)

Example 7 with DC_Obj

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

the class BfMouseListener method mouseClicked.

@Override
public void mouseClicked(MouseEvent e) {
    if (checkAnimationClick(e)) {
        return;
    }
    if (checkDynamicButtonClick(e)) {
        return;
    }
    point = e.getPoint();
    cellComp = gridComp.getCompByPoint(e.getPoint());
    Point relativePoint = new Point(point.x % gridComp.getCellWidth(), point.y % gridComp.getCellHeight());
    objClicked = null;
    for (Rectangle rect : cellComp.getMouseMap().keySet()) {
        if (rect.contains(relativePoint)) {
            Object object = cellComp.getMouseMap().get(rect);
            if (object instanceof INTERACTIVE_ELEMENT) {
                INTERACTIVE_ELEMENT element = (INTERACTIVE_ELEMENT) object;
                switch(element) {
                    case STACK:
                        // if (CoreEngine.isLevelEditor())
                        objClicked = DialogMaster.objChoice("Which object?", cellComp.getObjects().toArray(new DC_Obj[cellComp.getObjects().size()]));
                        break;
                    case AP:
                        break;
                    case COUNTERS:
                        break;
                    case ITEMS:
                        Collection<? extends Obj> droppedItems = cellComp.getGame().getDroppedItemManager().getDroppedItems(cellComp.getTerrainObj());
                        break;
                    case LOCKS:
                        break;
                    case TRAPS:
                        break;
                }
            // break ;
            } else if (object instanceof Obj) {
                if (object instanceof Unit) {
                    if (objClicked != null) {
                        int index = cellComp.getObjects().indexOf(objClicked);
                        int index2 = cellComp.getObjects().indexOf(object);
                        LogMaster.log(1, objClicked + "'s " + index + " vs " + object + "'s " + index2);
                        if (index > index2) // TODO so we need to keep this always sorted...
                        {
                            continue;
                        }
                    }
                    Unit unit = (Unit) object;
                    if (unit.isOverlaying()) {
                        // corpseClicked(unit);
                        if (unit.getVisibilityLevel() == VisionEnums.VISIBILITY_LEVEL.CONCEALED) {
                            continue;
                        }
                        objClicked = unit;
                        break;
                    } else {
                        objClicked = unit;
                        continue;
                    }
                } else if (object instanceof DC_Cell) {
                    if (e.isAltDown()) {
                        objClicked = (DC_Obj) object;
                        break;
                    } else if (objClicked == null) {
                        objClicked = (DC_Obj) object;
                    }
                    // ?
                    continue;
                }
            }
        // if (objClicked == null)
        // return; // ??
        }
    }
    if (objClicked == null) {
        objClicked = cellComp.getTopObjOrCell();
    }
    if (CoreEngine.isLevelEditor()) {
        if (objClicked instanceof DC_Cell) {
            return;
        }
    }
    boolean right = SwingUtilities.isRightMouseButton(e);
    if (right) {
        objClicked.invokeRightClicked();
    // gridComp.getGame().getManager().rightClicked(objClicked);
    } else {
        gridComp.getGame().getManager().objClicked(objClicked);
    }
    boolean debugMode = gridComp.getGame().isDebugMode();
    if (debugMode) {
        gridComp.getGame().getDebugMaster().setArg(objClicked);
    }
    if (e.isAltDown()) {
        if (debugMode) {
            invokeAltClick(right);
        } else {
            new Thread(new Runnable() {

                public void run() {
                    gridComp.getGame().getMovementManager().moveTo(objClicked);
                }
            }, "moveTo thread").start();
        }
    }
    if (e.isShiftDown()) {
        invokeShiftClick(right);
    }
    if (e.isControlDown()) {
        invokeControlClick(right);
    }
}
Also used : DC_Obj(eidolons.entity.obj.DC_Obj) DC_Cell(eidolons.entity.obj.DC_Cell) DC_Obj(eidolons.entity.obj.DC_Obj) Obj(main.entity.obj.Obj) INTERACTIVE_ELEMENT(eidolons.swing.components.obj.drawing.DrawMaster.INTERACTIVE_ELEMENT) Unit(eidolons.entity.obj.unit.Unit)

Example 8 with DC_Obj

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

the class BonusDamageEffect method applyThis.

@Override
public boolean applyThis() {
    DC_Obj target = (DC_Obj) ref.getTargetObj();
    target.addBonusDamage(CASE, getDamage());
    return false;
}
Also used : DC_Obj(eidolons.entity.obj.DC_Obj)

Example 9 with DC_Obj

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

the class WatchRule method updateWatchStatus.

public void updateWatchStatus(Unit watcher) {
    List<DC_Obj> list = getWatchersMap().get(watcher);
    boolean invalid = false;
    if (list != null) {
        if (!checkValidWatcher(watcher)) {
            invalid = true;
            removeWatcher(watcher);
        } else {
            for (DC_Obj watched : list) {
                if (!checkValidWatchTarget(watched)) {
                    breakWatch(watcher, watched);
                    break;
                } else if (!checkValidWatchPairTarget(watcher, watched)) {
                    breakWatch(watcher, watched);
                    break;
                }
            }
        }
    }
    BuffObj buff = watcher.getBuff("Watching", false);
    if (buff != null) {
        watcher.getGame().getManager().buffRemoved(buff);
    }
    if (!invalid) {
        if (watcher.getMode().equals(STD_MODES.ALERT)) {
            Ref ref = watcher.getRef().getCopy();
            try {
                SpectrumEffect spectrumEffect = new SpectrumEffect(new OwnershipCondition(true, "match", "source"), new WatchActionEffect(true));
                spectrumEffect.setRangeFormula(StringMaster.getValueRef(KEYS.SOURCE, PARAMS.SIGHT_RANGE));
                // for now...
                spectrumEffect.setApplyThrough(false);
                spectrumEffect.apply(ref);
                watcher.getBuff(STD_MODES.ALERT.getBuffName(), false).setOnDispelEffects(new RemoveBuffEffect("Watching ", false));
            } catch (Exception e) {
                main.system.ExceptionMaster.printStackTrace(e);
            }
        }
    }
    list = getWatchersMap().get(watcher);
    if (ListMaster.isNotEmpty(list)) // TODO alert???
    {
        getWatchBuffEffect(watcher, list).apply(Ref.getSelfTargetingRefCopy(watcher));
    }
}
Also used : DC_Obj(eidolons.entity.obj.DC_Obj) Ref(main.entity.Ref) OwnershipCondition(main.elements.conditions.standard.OwnershipCondition) RemoveBuffEffect(eidolons.ability.effects.oneshot.buff.RemoveBuffEffect) BuffObj(main.entity.obj.BuffObj) SpectrumEffect(eidolons.ability.effects.common.SpectrumEffect) WatchActionEffect(eidolons.ability.effects.oneshot.rule.WatchActionEffect)

Example 10 with DC_Obj

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

the class HitAnim method getAction.

@Override
protected Action getAction() {
    if (!OptionsMaster.getAnimOptions().getBooleanValue(ANIMATION_OPTION.HIT_ANIM_DISPLACEMENT))
        return null;
    if (getRef() == null)
        return null;
    if (getRef().getSourceObj() == null)
        return null;
    if (getRef().getTargetObj() == null)
        return null;
    DIRECTION d = DirectionMaster.getRelativeDirection(getRef().getSourceObj(), getRef().getTargetObj());
    int dx = d.isVertical() ? 5 : 30;
    int dy = !d.isVertical() ? 5 : 30;
    if (BooleanMaster.isFalse(d.growX)) {
        dx = -dx;
    }
    if (BooleanMaster.isTrue(d.growY)) {
        dy = -dy;
    }
    originalActorX = getActor().getX();
    originalActorY = getActor().getY();
    float x = originalActorX;
    float y = originalActorY;
    MoveByAction move = (MoveByAction) ActorMaster.getAction(MoveByAction.class);
    move.setAmount(dx, dy);
    move.setDuration(getDuration() / 2);
    MoveToAction moveBack = (MoveToAction) ActorMaster.getAction(MoveToAction.class);
    if (getRef().getSourceObj() instanceof DC_Obj) {
        if (((DC_Obj) getRef().getSourceObj()).isOverlaying()) {
            moveBack.setPosition(x, y);
        }
    }
    moveBack.setPosition(x, y);
    moveBack.setDuration(getDuration() / 2);
    SequenceAction sequence = new SequenceAction(move, moveBack);
    if (isDelayed()) {
        DelayAction delayed = new DelayAction(getDuration() / 3);
        delayed.setAction(sequence);
        return delayed;
    }
    return sequence;
}
Also used : DC_Obj(eidolons.entity.obj.DC_Obj) DIRECTION(main.game.bf.Coordinates.DIRECTION)

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