Search in sources :

Example 46 with DC_Obj

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

the class MiniGrid method refreshComp.

public void refreshComp(Integer index, Coordinates c, MiniObjComp objComp) {
    if (index != null) {
        this.comp.setComponentZOrder(objComp.getComp(), index);
    }
    DC_Obj obj = objComp.getObj();
    if (c == null) {
        c = obj.getCoordinates();
    }
    List<? extends DC_Obj> objects = getGame().getObjectsOnCoordinate(c);
    ArrayList<Unit> overlaying = new ArrayList<>();
    for (Unit o : map.getDungeon().getGame().getObjectsOnCoordinate(c)) {
        if (o.isOverlaying()) {
            overlaying.add(o);
        }
    }
    // TODO WHAT IF THERE ARE STACKED OBJECT + OVERLAYING??? FUTURE...
    // for non-Level Editor
    objComp.setObjects(new DequeImpl(objects).getRemoveAll(overlaying));
    // sort top?
    objComp.setObj(obj);
    // TODO WHAT ABOUT OVERLAYING OBJECTS?
    objComp.initSize(getSize());
    // Chronos.mark(obj + " objComp refresh");
    objComp.refresh();
// Chronos.logTimeElapsedForMark(obj + " objComp refresh");
}
Also used : DC_Obj(eidolons.entity.obj.DC_Obj) Unit(eidolons.entity.obj.unit.Unit) DequeImpl(main.system.datatypes.DequeImpl)

Example 47 with DC_Obj

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

the class CoordinateTargeting method select.

public boolean select(Ref ref) {
    DC_Obj obj = (DC_Obj) ref.getObj(key);
    DIRECTION used_direction = direction;
    if (unitDirection != null) {
        Unit unit = (Unit) obj;
        used_direction = DirectionMaster.getDirectionByFacing(unit.getFacing(), unitDirection);
    }
    Coordinates coordinate = obj.getCoordinates().getAdjacentCoordinate(used_direction);
    List<BattleFieldObject> objects = obj.getGame().getMaster().getObjectsOnCoordinate(coordinate, false);
    if (objects.size() == 0) {
        ref.setTarget(obj.getGame().getCellByCoordinate(coordinate).getId());
    } else if (objects.size() == 1) {
        ref.setTarget(objects.get(0).getId());
    } else {
        ref.setGroup(new GroupImpl(new ArrayList<>(objects)));
    }
    return true;
}
Also used : DC_Obj(eidolons.entity.obj.DC_Obj) BattleFieldObject(eidolons.entity.obj.BattleFieldObject) UNIT_DIRECTION(main.game.bf.Coordinates.UNIT_DIRECTION) DIRECTION(main.game.bf.Coordinates.DIRECTION) Coordinates(main.game.bf.Coordinates) GroupImpl(main.entity.group.GroupImpl) Unit(eidolons.entity.obj.unit.Unit)

Example 48 with DC_Obj

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

the class AddSpecialEffects method applyThis.

@Override
public boolean applyThis() {
    if (case_type == null) {
        case_type = new EnumMaster<SPECIAL_EFFECTS_CASE>().retrieveEnumConst(SPECIAL_EFFECTS_CASE.class, caseName);
    }
    if (effects == null) {
        effects = new AbilityEffect(abilName).getEffects();
    }
    if (!(ref.getTargetObj() instanceof DC_Obj)) {
        return false;
    }
    DC_Obj targetObj = (DC_Obj) ref.getTargetObj();
    targetObj.addSpecialEffect(case_type, effects);
    if (triggerEffect == null) {
        triggerEffect = getTriggerEffect();
        if (triggerEffect != null) {
            triggerEffect.apply(ref);
        }
    }
    return true;
}
Also used : DC_Obj(eidolons.entity.obj.DC_Obj) EnumMaster(main.system.auxiliary.EnumMaster) AbilityEffect(eidolons.ability.effects.containers.AbilityEffect)

Example 49 with DC_Obj

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

the class GridCell method init.

public GridCell init() {
    backImage = new Image(backTexture);
    backImage.setFillParent(true);
    addActor(backImage);
    setSize(GridMaster.CELL_W, GridMaster.CELL_H);
    cordsText = new Label(getGridX() + ":" + getGridY(), StyleHolder.getAVQLabelStyle());
    cordsText.setPosition(getWidth() / 2 - cordsText.getWidth() / 2, getHeight() / 2 - cordsText.getHeight() / 2);
    cordsText.setVisible(false);
    addActor(cordsText);
    addListener(new BattleClickListener() {

        @Override
        public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
            return true;
        }

        @Override
        public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
            DC_Obj dc_cell = Eidolons.gameMaster.getCellByCoordinate(new Coordinates(getGridX(), getGridY()));
            if (button == Input.Buttons.RIGHT && !event.isHandled()) {
                event.handle();
                GuiEventManager.trigger(CREATE_RADIAL_MENU, dc_cell);
            }
            if (button == Input.Buttons.LEFT) {
                event.handle();
                if (isEmpty())
                    if (isAlt() || isShift() || isControl())
                        try {
                            if (DefaultActionHandler.leftClickCell(isShift(), isControl(), getGridX(), getGridY()))
                                return;
                        } catch (Exception e) {
                            main.system.ExceptionMaster.printStackTrace(e);
                        }
                GuiEventManager.trigger(CALL_BLUE_BORDER_ACTION, GridCell.this);
                GuiEventManager.trigger(RADIAL_MENU_CLOSE);
            }
        }
    });
    return this;
}
Also used : DC_Obj(eidolons.entity.obj.DC_Obj) Coordinates(main.game.bf.Coordinates) Label(com.badlogic.gdx.scenes.scene2d.ui.Label) InputEvent(com.badlogic.gdx.scenes.scene2d.InputEvent) Image(com.badlogic.gdx.scenes.scene2d.ui.Image) BattleClickListener(eidolons.libgdx.bf.mouse.BattleClickListener)

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