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