use of eidolons.game.battlecraft.ai.advanced.companion.Order in project Eidolons by IDemiurge.
the class AiScriptExecutor method executeCommand.
private void executeCommand(Unit unit, COMBAT_SCRIPT_FUNCTION function, String arg, boolean free, boolean immediate, String... args) {
ActionSequence sequence = null;
GOAL_TYPE goal = getGoalType(function);
Task task = new Task(true, unit.getAI(), goal, arg);
UnitAI ai = unit.getAI();
switch(function) {
case MOVE_TO:
// via a path!
ActionPath path = getPathSequenceConstructor().getOptimalPathSequence(unit.getAI(), new Coordinates(arg.toString()));
sequence = new ActionSequence(path.getActions(), task, unit.getAI());
break;
case TURN_TO:
// cell id
sequence = new ActionSequence(getTurnSequenceConstructor().getTurnSequence(FACING_SINGLE.IN_FRONT, unit, new Coordinates(arg.toString())), task, unit.getAI());
break;
case ACTION:
Action action = AiActionFactory.newAction(arg.toString(), ai);
// new ActionSequence();
sequence = getActionSequenceConstructor().constructSingleActionSequence(action, new Task(ai, goal, args[0]));
break;
case ATTACK:
break;
case FREEZE:
break;
case UNFREEZE:
break;
case ORDER:
// OrderFactory.getOrder();
Order a = new Order(arg.toString());
unit.getAI().setCurrentOrder(a);
return;
}
if (immediate) {
unit.getAI().setStandingOrders(sequence);
unit.getAI().setFree(free);
} else
sequence.getActions().forEach(// TODO wait?
action -> getExecutor().execute(action, free));
}
use of eidolons.game.battlecraft.ai.advanced.companion.Order in project Eidolons by IDemiurge.
the class OrderEffect method applyThis.
@Override
public boolean applyThis() {
boolean partyTargeting = getTarget() == getSource();
Order order = cancel ? null : OrderFactory.getOrder(partyTargeting, ref.getActive(), strictPriority);
if (partyTargeting) {
getSource().getAI().getGroup().getMembers().forEach(hero -> trySetOrder(hero, order, partyTargeting));
} else {
Unit unit = (Unit) ref.getTargetObj();
trySetOrder(unit, order, partyTargeting);
}
if (customTarget) {
// OrderMaster.selectCustomTarget(order, active, getSource());
}
return true;
}
Aggregations