Search in sources :

Example 26 with Action

use of eidolons.game.battlecraft.ai.elements.actions.Action in project Eidolons by IDemiurge.

the class ActionSequenceConstructor method getSequencesFromPaths.

public List<ActionSequence> getSequencesFromPaths(List<ActionPath> paths, Task task, Action action) {
    List<ActionSequence> list = new ArrayList<>();
    for (ActionPath path : paths) {
        if (!TimeLimitMaster.checkTimeLimitForAi(getUnitAI()))
            break;
        ActionSequence sequence = new ActionSequence(path.getActions(), task, task.getAI());
        if (action.getActive().isRanged()) {
            List<Action> rangedAttackSequence = constructSingleAttackSequence(action, task);
            if (rangedAttackSequence.isEmpty()) {
                return list;
            }
            // TODO
            sequence.getActions().addAll(rangedAttackSequence);
        } else {
            sequence.getActions().add(action);
        }
        list.add(sequence);
    }
    return list;
}
Also used : AiQuickItemAction(eidolons.game.battlecraft.ai.elements.actions.AiQuickItemAction) Action(eidolons.game.battlecraft.ai.elements.actions.Action) ArrayList(java.util.ArrayList) ActionPath(eidolons.game.battlecraft.ai.tools.path.ActionPath)

Example 27 with Action

use of eidolons.game.battlecraft.ai.elements.actions.Action in project Eidolons by IDemiurge.

the class PathSequenceConstructor method getOptimalPathSequence.

public ActionPath getOptimalPathSequence(UnitAI ai, Coordinates targetCell) {
    List<DC_ActiveObj> moves = AiUnitActionMaster.getMoveActions(ai.getUnit());
    Action action = AiActionFactory.newAction("Move", ai);
    List<Coordinates> coordinates = new ArrayList<>();
    coordinates.add(targetCell);
    List<ActionPath> paths = getPathSequences(moves, action, coordinates);
    // });
    return paths.get(0);
}
Also used : Action(eidolons.game.battlecraft.ai.elements.actions.Action) Coordinates(main.game.bf.Coordinates) ArrayList(java.util.ArrayList) ActionPath(eidolons.game.battlecraft.ai.tools.path.ActionPath) DC_ActiveObj(eidolons.entity.active.DC_ActiveObj)

Example 28 with Action

use of eidolons.game.battlecraft.ai.elements.actions.Action in project Eidolons by IDemiurge.

the class AtomicAi method getAtomicActionMove.

public Action getAtomicActionMove(UnitAI ai, Boolean approach_retreat_search) {
    Coordinates pick = null;
    boolean b = isHotzoneMode();
    if (b) {
        pick = getHotZoneCell(ai, approach_retreat_search);
    } else {
        pick = getApproachCoordinate(ai);
    }
    if (pick == null)
        pick = b ? getApproachCoordinate(ai) : getHotZoneCell(ai, approach_retreat_search);
    if (pick == null)
        return null;
    Action a = getAtomicMove(pick, ai.getUnit());
    return a;
}
Also used : Action(eidolons.game.battlecraft.ai.elements.actions.Action) DC_UnitAction(eidolons.entity.active.DC_UnitAction) Coordinates(main.game.bf.Coordinates)

Example 29 with Action

use of eidolons.game.battlecraft.ai.elements.actions.Action in project Eidolons by IDemiurge.

the class AtomicAi method getAtomicActionForced.

public Action getAtomicActionForced(UnitAI ai) {
    Action action = null;
    action = getAtomicActionDoor(ai);
    if (action != null)
        action.setTaskDescription("Door");
    return action;
}
Also used : Action(eidolons.game.battlecraft.ai.elements.actions.Action) DC_UnitAction(eidolons.entity.active.DC_UnitAction)

Example 30 with Action

use of eidolons.game.battlecraft.ai.elements.actions.Action in project Eidolons by IDemiurge.

the class AtomicAi method getAtomicActionTurn.

public Action getAtomicActionTurn(UnitAI ai) {
    Coordinates pick = getApproachCoordinate(ai);
    if (pick == null)
        return null;
    List<Action> sequence = getTurnSequenceConstructor().getTurnSequence(FACING_SINGLE.IN_FRONT, getUnit(), pick);
    if (ListMaster.isNotEmpty(sequence))
        return sequence.get(0);
    return null;
}
Also used : Action(eidolons.game.battlecraft.ai.elements.actions.Action) DC_UnitAction(eidolons.entity.active.DC_UnitAction) Coordinates(main.game.bf.Coordinates)

Aggregations

Action (eidolons.game.battlecraft.ai.elements.actions.Action)32 DC_UnitAction (eidolons.entity.active.DC_UnitAction)16 Coordinates (main.game.bf.Coordinates)11 Unit (eidolons.entity.obj.unit.Unit)9 ArrayList (java.util.ArrayList)9 DC_ActiveObj (eidolons.entity.active.DC_ActiveObj)8 AiQuickItemAction (eidolons.game.battlecraft.ai.elements.actions.AiQuickItemAction)7 ActionSequence (eidolons.game.battlecraft.ai.elements.actions.sequence.ActionSequence)7 ActionPath (eidolons.game.battlecraft.ai.tools.path.ActionPath)7 Ref (main.entity.Ref)6 DC_QuickItemAction (eidolons.entity.active.DC_QuickItemAction)4 FACING_SINGLE (main.content.enums.entity.UnitEnums.FACING_SINGLE)3 GOAL_TYPE (main.content.enums.system.AiEnums.GOAL_TYPE)3 Obj (main.entity.obj.Obj)3 DC_Cell (eidolons.entity.obj.DC_Cell)2 DC_Obj (eidolons.entity.obj.DC_Obj)2 UnitAI (eidolons.game.battlecraft.ai.UnitAI)2 Task (eidolons.game.battlecraft.ai.elements.task.Task)2 Effect (main.ability.effects.Effect)2 Context (main.game.logic.action.context.Context)2