use of eidolons.entity.active.DC_ActiveObj in project Eidolons by IDemiurge.
the class TaskManager method getTasks.
public List<Task> getTasks(GOAL_TYPE goal, UnitAI ai, boolean forced, DC_ActiveObj action) {
List<Task> list = new XList<>();
if (ai.getCurrentOrder() != null)
if (ai.getCurrentOrder().getArg() != null)
return new ArrayList<>(Arrays.asList(new Task(ai, goal, ai.getCurrentOrder().getArg())));
List<Integer> ids = new ArrayList<>();
List<? extends DC_Obj> targets = new ArrayList<>();
List<? extends DC_Obj> targets2 = new ArrayList<>();
BEHAVIOR_MODE behaviorMode = ai.getBehaviorMode();
// ai.getGroup().getKnownEnemyCoordinatesMap();
switch(goal) {
case STAND_GUARD:
case AMBUSH:
// preCheck engagement level, default prefs
case SELF:
case STEALTH:
list.add(new Task(forced, ai, goal, ai.getUnit().getId()));
break;
// SPEC MODE - KIND OF ON ALERT...
case PATROL:
targets = Analyzer.getWanderCells(ai);
break;
case // RANDOM DESTINATION MOVEMENT, BLOCK SPECIAL MOVES
WANDER:
// limit max distance from original spawning position
// TODO sometimes in chosen direction
targets = Analyzer.getWanderCells(ai);
break;
case STALK:
// ai.getGroup().getKnownEnemies
break;
case APPROACH:
targets = getCellPrioritizer().getApproachCells(ai);
break;
case SEARCH:
// or maybe the last-seen enemies?
if (!forced) {
if (ai.getUnit().getBuff("Search Mode") == null) {
list.add(new Task(forced, ai, goal, ai.getUnit().getId()));
break;
}
}
targets = Analyzer.getSearchCells(ai);
break;
case RETREAT:
if (ai.getBehaviorMode() == AiEnums.BEHAVIOR_MODE.PANIC) {
// only border cells => flee
}
targets = Analyzer.getSafeCells(ai);
break;
case MOVE:
targets = Analyzer.getMoveTargetCells(ai);
break;
case CUSTOM_HOSTILE:
targets = Analyzer.getVisibleEnemies(ai);
checkPrune(targets, goal, ai, action);
break;
case CUSTOM_SUPPORT:
targets = Analyzer.getAllies(ai);
checkPrune(targets, goal, ai, action);
break;
case ZONE_DAMAGE:
targets = Analyzer.getZoneDamageCells(ai.getUnit());
targets2 = Analyzer.getAdjacentEnemies(ai.getUnit(), false);
checkPrune(targets, goal, ai, action);
break;
case SUMMONING:
targets = Analyzer.getSummonCells(ai, action);
break;
case DEBILITATE:
case DEBUFF:
case ATTACK:
if (behaviorMode == AiEnums.BEHAVIOR_MODE.BERSERK || behaviorMode == AiEnums.BEHAVIOR_MODE.CONFUSED) {
targets = (Analyzer.getUnits(ai, true, true, true, false));
} else {
// if (forced)
// targets = (Analyzer.getUnits(ai, false, true, true,
// false, true));
// else
// TODO detected!
targets = Analyzer.getVisibleEnemies(ai);
}
checkPrune(targets, goal, ai, action);
break;
case AUTO_DAMAGE:
case AUTO_DEBUFF:
case AUTO_BUFF:
// list.add(new Task(ai, goal, null));
case RESTORE:
case BUFF:
targets = Analyzer.getAllies(ai);
checkPrune(targets, goal, ai, action);
break;
case WAIT:
if (!DC_Engine.isAtbMode())
targets = Analyzer.getWaitUnits(ai);
break;
case PROTECT:
if (RuleMaster.isRuleOn(RULE.GUARD))
if (GuardRule.on)
targets = Analyzer.getProtectCells(ai);
break;
case COATING:
Set<Obj> objects = action.getTargeting().getFilter().getObjects(action.getRef());
for (Obj q : objects) {
if (q.getRef().getSourceObj() == getUnit()) {
// q.isOwnedBy(ai.getUnit().getOwner())
ids.add(q.getId());
}
}
break;
default:
list.add(new Task(forced, ai, goal, null));
break;
}
if (targets.isEmpty()) {
return new ArrayList<>();
}
if (behaviorMode == AiEnums.BEHAVIOR_MODE.CONFUSED) {
DC_Obj target = targets.get(new RandomWizard<>().getRandomListIndex(targets));
List<Task> tasks = new ArrayList<>();
tasks.add(new Task(forced, ai, goal, target.getId()));
return tasks;
}
if (list.isEmpty()) {
for (DC_Obj obj : targets) {
list.add(new Task(forced, ai, goal, obj.getId()));
}
for (DC_Obj obj : targets2) {
list.add(new Task(forced, ai, goal, obj.getId()));
}
for (Integer id : ids) {
list.add(new Task(forced, ai, goal, id));
}
}
return list;
}
use of eidolons.entity.active.DC_ActiveObj in project Eidolons by IDemiurge.
the class DC_UnitModel method getToolTip.
@Override
public String getToolTip() {
if (!game.isSimulation())
return super.getToolTip();
else {
if (checkSelectHighlighted()) {
String actionTargetingTooltip = "";
DC_ActiveObj action = (DC_ActiveObj) getGame().getManager().getActivatingAction();
try {
actionTargetingTooltip = ToolTipMaster.getActionTargetingTooltip(this, action);
} catch (Exception e) {
if (!action.isBroken()) {
main.system.ExceptionMaster.printStackTrace(e);
} else {
action.setBroken(true);
}
}
if (!StringMaster.isEmpty(actionTargetingTooltip)) {
return actionTargetingTooltip;
}
}
}
// }
return getNameIfKnown();
}
use of eidolons.entity.active.DC_ActiveObj in project Eidolons by IDemiurge.
the class DoorMaster method getActions.
public List<DC_ActiveObj> getActions(DungeonObj door, Unit unit) {
if (!(door instanceof Door))
return new ArrayList<>();
if (!checkUnitCanHandleActions(unit)) {
return new ArrayList<>();
}
// check intelligence, mastery
List<DC_ActiveObj> list = new ArrayList<>();
DC_UnitAction action = null;
for (DOOR_ACTION sub : DOOR_ACTION.values()) {
if (checkAction(unit, (Door) door, sub)) {
action = createAction(sub, unit, door);
if (action != null) {
list.add(action);
}
}
}
return list;
}
use of eidolons.entity.active.DC_ActiveObj in project Eidolons by IDemiurge.
the class HungItemMaster method getActions.
public List<DC_ActiveObj> getActions(DungeonObj obj, Unit unit) {
if (!(obj instanceof HungItem))
return new ArrayList<>();
// check intelligence, mastery
List<DC_ActiveObj> list = new ArrayList<>();
DC_UnitAction action = null;
for (HUNG_ITEM_ACTION sub : HUNG_ITEM_ACTION.values()) {
if (checkAction(unit, (HungItem) obj, sub)) {
String name = StringMaster.getWellFormattedString(sub.name()) + " Door";
action = unit.getAction(name);
if (action == null)
action = createAction(sub, unit, name, obj);
if (action != null) {
list.add(action);
}
}
}
return list;
}
use of eidolons.entity.active.DC_ActiveObj 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