Search in sources :

Example 11 with ActionInput

use of eidolons.game.core.ActionInput in project Eidolons by IDemiurge.

the class QuickWeaponPanel method getListener.

private EventListener getListener() {
    return new ClickListener() {

        @Override
        public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
            if (button == 1) {
                GuiEventManager.trigger(GuiEventType.RADIAL_MENU_CLOSE);
                GuiEventManager.trigger(GuiEventType.CREATE_RADIAL_MENU, dataSource.getWeapon());
            } else {
                WaitMaster.receiveInput(WAIT_OPERATIONS.ACTION_INPUT, new ActionInput(getDataSource().getOwnerObj().getAttackAction(offhand), new Context(getDataSource().getOwnerObj(), null)));
            }
            return false;
        }

        @Override
        public boolean mouseMoved(InputEvent event, float x, float y) {
            return super.mouseMoved(event, x, y);
        }

        @Override
        public void enter(InputEvent event, float x, float y, int pointer, Actor fromActor) {
            super.enter(event, x, y, pointer, fromActor);
            weapon.setZIndex(getChildren().size - 2);
        }

        @Override
        public void exit(InputEvent event, float x, float y, int pointer, Actor toActor) {
            super.exit(event, x, y, pointer, toActor);
            weapon.setZIndex(1);
        }
    };
}
Also used : Context(main.game.logic.action.context.Context) ActionInput(eidolons.game.core.ActionInput) Actor(com.badlogic.gdx.scenes.scene2d.Actor) InputEvent(com.badlogic.gdx.scenes.scene2d.InputEvent) ClickListener(com.badlogic.gdx.scenes.scene2d.utils.ClickListener)

Example 12 with ActionInput

use of eidolons.game.core.ActionInput in project Eidolons by IDemiurge.

the class ExplorationAiMaster method tryMoveAiTurnBased.

private boolean tryMoveAiTurnBased(UnitAI ai, float timePercentage) {
    if (ai.getStandingOrders() == null) {
        try {
            ai.setStandingOrders(getOrders(ai));
        } catch (Exception e) {
            main.system.ExceptionMaster.printStackTrace(e);
            return false;
        }
    }
    if (ai.getStandingOrders() == null) {
        return false;
    }
    Double cost = ai.getStandingOrders().getCurrentAction().getActive().getParamDouble(PARAMS.AP_COST) / ai.getUnit().getIntParam(PARAMS.N_OF_ACTIONS);
    if (timePercentage >= cost) {
        ActionInput input = new ActionInput(ai.getStandingOrders().getCurrentAction().getActive(), new Context(ai.getStandingOrders().getCurrentAction().getRef()));
        master.getGame().getGameLoop().actionInput(input);
        return true;
    }
    return false;
}
Also used : Context(main.game.logic.action.context.Context) ActionInput(eidolons.game.core.ActionInput)

Example 13 with ActionInput

use of eidolons.game.core.ActionInput in project Eidolons by IDemiurge.

the class ExploreGameLoop method makeAction.

@Override
protected Boolean makeAction() {
    if (exited)
        return true;
    if (actionQueue.isEmpty()) {
        if (!master.getAiMaster().isAiActs()) {
            lock.lock();
            try {
                waiting.await();
            } catch (Exception e1) {
                e1.printStackTrace();
            } finally {
                lock.unlock();
            }
        }
    }
    if (master.getAiMaster().isAiActs()) {
        while (!master.getAiMaster().getAiActionQueue().isEmpty()) {
            // active unit?
            try {
                ActionInput input = master.getAiMaster().getAiActionQueue().removeLast();
                activateAction(input);
                master.getTimeMaster().aiActionActivated(input.getAction().getOwnerObj().getAI(), input.getAction());
                master.getPartyMaster().reset();
                if (input.getAction().getOwnerObj().getAI().isLeader()) {
                    // master.getEnemyPartyMaster().setGroupAI();
                    master.getEnemyPartyMaster().leaderActionDone(input);
                }
                if (master.getResetter().isAggroCheckNeeded(input)) {
                    getGame().getDungeonMaster().getExplorationMaster().getCrawler().checkStatusUpdate();
                    if (!ExplorationMaster.isExplorationOn()) {
                        return true;
                    }
                    game.getManager().reset();
                }
            } catch (Exception e) {
                main.system.ExceptionMaster.printStackTrace(e);
            }
        }
        master.getAiMaster().setAiActs(false);
    }
    // }
    if (actionQueue.isEmpty()) {
        game.getMovementManager().promptContinuePath(activeUnit);
        return null;
    }
    master.getAiMaster().reset();
    master.getResetter().setResetNeeded(true);
    // recheck?!
    ActionInput playerAction = actionQueue.removeLast();
    if (checkActionInputValid(playerAction)) {
        game.getMovementManager().cancelAutomove(activeUnit);
        activateAction(playerAction);
        master.getActionHandler().playerActionActivated(playerAction.getAction());
        master.getTimeMaster().setGuiDirtyFlag(true);
        master.getPartyMaster().leaderActionDone(playerAction);
        waitForAnimations();
    }
    waitForPause();
    return exited;
}
Also used : ActionInput(eidolons.game.core.ActionInput)

Example 14 with ActionInput

use of eidolons.game.core.ActionInput in project Eidolons by IDemiurge.

the class UnitHandler method initChannelingSpellData.

public void initChannelingSpellData(DC_SpellObj spell) {
    Context context = new Context(spell.getOwnerObj().getRef());
    if (ChannelingRule.isPreTargetingNeeded(spell)) {
        spell.getTargeter().initTarget();
        // context.setTarget(target); // group?
        if (spell.getTargetGroup() != null)
            context.setGroup(spell.getTargetGroup());
        else
            context.setTarget(spell.getTargetObj().getId());
    }
    channelingSpellData = new ActionInput(spell, context);
}
Also used : Context(main.game.logic.action.context.Context) ActionInput(eidolons.game.core.ActionInput)

Aggregations

ActionInput (eidolons.game.core.ActionInput)14 Context (main.game.logic.action.context.Context)9 InputEvent (com.badlogic.gdx.scenes.scene2d.InputEvent)2 ClickListener (com.badlogic.gdx.scenes.scene2d.utils.ClickListener)2 DC_UnitAction (eidolons.entity.active.DC_UnitAction)2 Unit (eidolons.entity.obj.unit.Unit)2 AnimContext (eidolons.libgdx.anims.AnimContext)2 TextureRegion (com.badlogic.gdx.graphics.g2d.TextureRegion)1 Actor (com.badlogic.gdx.scenes.scene2d.Actor)1 DC_ActiveObj (eidolons.entity.active.DC_ActiveObj)1 DC_QuickItemObj (eidolons.entity.item.DC_QuickItemObj)1 BattleFieldObject (eidolons.entity.obj.BattleFieldObject)1 DC_Obj (eidolons.entity.obj.DC_Obj)1 Action (eidolons.game.battlecraft.ai.elements.actions.Action)1 ActionPath (eidolons.game.battlecraft.ai.tools.path.ActionPath)1 FloatingText (eidolons.libgdx.anims.text.FloatingText)1 GearCluster (eidolons.libgdx.gui.generic.GearCluster)1 Obj (main.entity.obj.Obj)1 Test (org.junit.Test)1