use of eidolons.game.battlecraft.ai.elements.goal.Goal in project Eidolons by IDemiurge.
the class ActionManager method getForcedAction.
public Action getForcedAction(UnitAI ai) {
BEHAVIOR_MODE behaviorMode = ai.getBehaviorMode();
GOAL_TYPE goal = AiEnums.GOAL_TYPE.PREPARE;
Action action = null;
if (behaviorMode != null) {
if (behaviorMode == AiEnums.BEHAVIOR_MODE.PANIC) {
action = new Action(ai.getUnit().getAction("Cower"));
}
if (behaviorMode == AiEnums.BEHAVIOR_MODE.CONFUSED) {
action = new Action(ai.getUnit().getAction("Stumble"));
}
if (behaviorMode == AiEnums.BEHAVIOR_MODE.BERSERK) {
action = new Action(ai.getUnit().getAction("Rage"));
}
action.setTaskDescription("Forced Behavior");
}
action = getAtomicAi().getAtomicActionForced(ai);
if (action != null)
return action;
try {
action = getAtomicAi().getAtomicActionPrepare(getUnit().getAI());
} catch (Exception e) {
main.system.ExceptionMaster.printStackTrace(e);
}
if (action != null) {
return action;
}
List<ActionSequence> actions = getActionSequenceConstructor().createActionSequencesForGoal(new Goal(goal, ai, true), ai);
if (ai.checkMod(AI_MODIFIERS.TRUE_BRUTE)) {
goal = AiEnums.GOAL_TYPE.ATTACK;
actions.addAll(getActionSequenceConstructor().createActionSequencesForGoal(new Goal(goal, ai, true), ai));
}
if (behaviorMode == null) {
if (ParamAnalyzer.isFatigued(getUnit())) {
actions.add(new ActionSequence(AiEnums.GOAL_TYPE.PREPARE, getAction(getUnit(), STD_MODE_ACTIONS.Rest.name())));
}
if (ParamAnalyzer.isHazed(getUnit())) {
// when is that used?
actions.add(new ActionSequence(AiEnums.GOAL_TYPE.PREPARE, getAction(getUnit(), STD_MODE_ACTIONS.Concentrate.name())));
}
}
if (actions.isEmpty()) {
return getAction(getUnit(), STD_MODE_ACTIONS.Defend.name(), null);
}
ActionSequence sequence = getPriorityManager().chooseByPriority(actions);
LogMaster.log(1, getUnit() + " has been Forced to choose " + "" + sequence + " with priorioty of " + sequence.getPriority());
getMaster().getMessageBuilder().append("Forced Task: " + sequence.getTask().toShortString());
action = sequence.nextAction();
if (action == null) {
return getAction(getUnit(), STD_MODE_ACTIONS.Defend.name(), null);
}
return action;
}
use of eidolons.game.battlecraft.ai.elements.goal.Goal in project Eidolons by IDemiurge.
the class ActionSequenceConstructor method createActionSequences.
public List<ActionSequence> createActionSequences(UnitAI ai) {
TimeLimitMaster.markTimeForAI(ai);
List<ActionSequence> list = new ArrayList<>();
getActionSequenceConstructor().setPrioritizedCells(null);
boolean forced = false;
if (ai.getCurrentOrder() != null)
forced = true;
for (GOAL_TYPE type : GoalManager.getGoalsForUnit(ai)) {
List<ActionSequence> sequences = null;
try {
Goal goal = new // ???
Goal(// ???
type, // ???
null, ai);
goal.setForced(forced);
sequences = createActionSequencesForGoal(goal, ai);
list.addAll(sequences);
} catch (Exception e) {
main.system.ExceptionMaster.printStackTrace(e);
}
if (!TimeLimitMaster.checkTimeLimitForAi(ai)) {
break;
}
}
return list;
}
use of eidolons.game.battlecraft.ai.elements.goal.Goal in project Eidolons by IDemiurge.
the class ExplorePartyMaster method checkNewGoal.
public void checkNewGoal(Unit unit) {
DC_ActiveObj active = lastAction.getAction();
if (active.getActionGroup() == ACTION_TYPE_GROUPS.MODE) {
Goal goal = getNewGoal(active, unit.getAI());
if (goal != null) {
master.getGame().getAiManager().setUnit(unit);
List<ActionSequence> sequences = master.getGame().getAiManager().getActionSequenceConstructor().createActionSequencesForGoal(goal, unit.getAI());
if (!sequences.isEmpty()) {
ActionSequence sequence = master.getGame().getAiManager().getPriorityManager().chooseByPriority(sequences);
unit.getAI().setStandingOrders(sequence);
}
}
}
// if (mainHero.getMode()!=null ){
// }
}
Aggregations