Search in sources :

Example 6 with ActionInput

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

the class ExplorationAiMaster method aiMoves.

private void aiMoves(UnitAI ai) {
    ActionInput input = new ActionInput(ai.getStandingOrders().getCurrentAction().getActive(), new Context(ai.getStandingOrders().getCurrentAction().getRef()));
    queueAiAction(input);
    ai.setExplorationTimeOfLastAction(master.getTimeMaster().getTime());
    if (ai.getStandingOrders().getCurrentAction() == ai.getStandingOrders().getLastAction())
        ai.setStandingOrders(null);
}
Also used : Context(main.game.logic.action.context.Context) ActionInput(eidolons.game.core.ActionInput)

Example 7 with ActionInput

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

the class DC_MovementManager method moveTo.

public void moveTo(Coordinates coordinates) {
    Unit unit = game.getManager().getActiveObj();
    List<ActionPath> paths = pathCache.get(unit);
    if (paths == null) {
        paths = buildPath(unit, coordinates);
        // Coordinates adjacentCoordinate = coordinates.getAdjacentCoordinate(DirectionMaster
        // .getRelativeDirection(unit.getCoordinates(), coordinates));
        // if (DialogMaster.confirm("No path could be built to " + coordinates
        // + "; proceed to the closest cell? - " + adjacentCoordinate)) {
        // moveTo(adjacentCoordinate);
        // } else {
        // return;
        // }
        pathCache.put(unit, paths);
    }
    if (paths == null) {
        return;
    }
    Action action = null;
    for (ActionPath path : paths) {
        // if (DialogMaster.confirm("Path built to : " + path + "\nExecute "
        // + path.getActions().get(0).toString() + "?")) {
        // action = path.getActions().get(0);
        // break;
        // }
        // just check if still passible
        // if (path.getActions().get(0))
        action = path.getActions().get(0);
        break;
    }
    if (action == null) {
        pathCache.remove(unit);
        return;
    }
    // ActionAnimation anim = new ActionAnimation(action);
    // anim.start();
    Context context = new Context(unit.getRef());
    if (action.getActive().isMove()) {
        context.setTarget(game.getCellByCoordinate(coordinates).getId());
    }
    unit.getGame().getGameLoop().actionInput(new ActionInput(action.getActive(), context));
}
Also used : Context(main.game.logic.action.context.Context) Action(eidolons.game.battlecraft.ai.elements.actions.Action) DC_UnitAction(eidolons.entity.active.DC_UnitAction) ActionInput(eidolons.game.core.ActionInput) ActionPath(eidolons.game.battlecraft.ai.tools.path.ActionPath) Unit(eidolons.entity.obj.unit.Unit)

Example 8 with ActionInput

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

the class AttackTest method attackTest.

@Test
public void attackTest() {
    assertTrue(source != null);
    assertTrue(target != null);
    int origToughness = target.getIntParam(PARAMS.C_TOUGHNESS);
    int origEndurance = target.getIntParam(PARAMS.C_ENDURANCE);
    assertTrue(source.getNaturalWeapon() != null);
    DC_UnitAction attackAction = source.getAction("punch");
    assertTrue(attackAction != null);
    Eidolons.getGame().getGameLoop().actionInput(new ActionInput(attackAction, new Context(source, target)));
    // old! attackAction.activateOn(target);
    Boolean result = (Boolean) WaitMaster.waitForInput(WAIT_OPERATIONS.ACTION_COMPLETE);
    assertTrue(result);
    Integer newToughness = target.getIntParam(PARAMS.C_TOUGHNESS);
    Integer newEndurance = target.getIntParam(PARAMS.C_ENDURANCE);
    assertTrue(newToughness < origToughness);
    assertTrue(newEndurance < origEndurance);
}
Also used : Context(main.game.logic.action.context.Context) ActionInput(eidolons.game.core.ActionInput) DC_UnitAction(eidolons.entity.active.DC_UnitAction) Test(org.junit.Test)

Example 9 with ActionInput

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

the class DcHelper method doAction.

private void doAction(DC_ActiveObj action, Context context, boolean waitForCompletion) {
    WaitMaster.receiveInput(WAIT_OPERATIONS.ACTION_INPUT, new ActionInput(action, context));
    if (waitForCompletion) {
        Object result = WaitMaster.waitForInput(WAIT_OPERATIONS.ACTION_COMPLETE);
        assertTrue(result == new Boolean(true));
    }
}
Also used : ActionInput(eidolons.game.core.ActionInput) BattleFieldObject(eidolons.entity.obj.BattleFieldObject)

Example 10 with ActionInput

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

the class FacingPanel method getGearListener.

private EventListener getGearListener(boolean clockwise) {
    return new ClickListener() {

        @Override
        public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
            // GuiEventManager
            WaitMaster.receiveInput(WAIT_OPERATIONS.ACTION_INPUT, new ActionInput(dataSource.getTurnAction(clockwise), new Context(dataSource.getEntity().getRef())));
            GearCluster gear = clockwise ? gearsClockwise : gearsAntiClockwise;
            gear.activeWork(0.25f, 0.5f);
            return super.touchDown(event, x, y, pointer, button);
        }
    };
}
Also used : Context(main.game.logic.action.context.Context) ActionInput(eidolons.game.core.ActionInput) GearCluster(eidolons.libgdx.gui.generic.GearCluster) InputEvent(com.badlogic.gdx.scenes.scene2d.InputEvent) ClickListener(com.badlogic.gdx.scenes.scene2d.utils.ClickListener)

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