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);
}
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));
}
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);
}
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));
}
}
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);
}
};
}
Aggregations