use of main.game.logic.action.context.Context 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 main.game.logic.action.context.Context 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);
}
use of main.game.logic.action.context.Context in project Eidolons by IDemiurge.
the class DefaultActionHandler method turnToMotion.
private static boolean turnToMotion(Unit source, Coordinates coordinates) {
DC_ActiveObj action = getTurnToAction(source, coordinates);
Context context = new Context(source, null);
return activate(context, action);
}
use of main.game.logic.action.context.Context in project Eidolons by IDemiurge.
the class DefaultActionHandler method leftClickUnit.
public static boolean leftClickUnit(boolean shift, boolean control, BattleFieldObject target) {
if (shift) {
return leftClickCell(true, false, target.getX(), target.getY());
}
if (control) {
return leftClickCell(false, true, target.getX(), target.getY());
}
if (!OptionsMaster.getGameplayOptions().getBooleanValue(GAMEPLAY_OPTION.DEFAULT_ACTIONS))
return false;
Unit source = Eidolons.getGame().getManager().getActiveObj();
if (source.getGame().isDebugMode()) {
return doDebugStuff(source, target);
}
if (target.isMine())
return false;
DC_ActiveObj action = null;
if (target instanceof DungeonObj)
action = getDungeonObjAction(source, (DungeonObj) target);
else
action = getPreferredAttackAction(source, target);
if (action == null)
return false;
Context context = new Context(source, target);
return activate(context, action);
}
Aggregations