Search in sources :

Example 1 with AiBehavior

use of eidolons.game.module.dungeoncrawl.ai.AiBehavior in project Eidolons by IDemiurge.

the class BehaviorMaster method getBehavior.

private AiBehavior getBehavior(UnitAI ai, AI_BEHAVIOR_MODE type) {
    AiBehavior behavior = behaviorMap.get(type);
    if (behavior != null) {
        return behavior;
    }
    switch(type) {
        case WANDER:
            behavior = new WanderAi();
            break;
        case AMBUSH:
            break;
        case AGGRO:
            break;
        case STALK:
            break;
        case PATROL:
            break;
        case GUARD:
            behavior = new GuardAi();
            break;
    }
    behaviorMap.put(type, behavior);
    // preCheck unit is viable?
    return behavior;
}
Also used : GuardAi(eidolons.game.module.dungeoncrawl.ai.GuardAi) AiBehavior(eidolons.game.module.dungeoncrawl.ai.AiBehavior) WanderAi(eidolons.game.module.dungeoncrawl.ai.WanderAi)

Example 2 with AiBehavior

use of eidolons.game.module.dungeoncrawl.ai.AiBehavior in project Eidolons by IDemiurge.

the class ExplorationAiMaster method getOrders.

private ActionSequence getOrders(UnitAI ai) {
    if (// TODO
    ai.getUnit().isMine())
        if (master.getPartyMaster().isFollowOn(ai.getUnit())) {
            // isFollow
            Action move = master.getPartyMaster().getFollowMove(ai.getUnit());
            if (move == null) {
                return null;
            // return getIdleOrders(ai);
            } else {
                return new ActionSequence(GOAL_TYPE.MOVE, move);
            }
        }
    // get orders?
    AiBehavior behavior = getAiBehavior(ai);
    ActionSequence orders = behavior.getOrders(ai);
    if (orders == null) {
    // orders= getIdleOrders(ai);
    }
    return orders;
}
Also used : Action(eidolons.game.battlecraft.ai.elements.actions.Action) ActionSequence(eidolons.game.battlecraft.ai.elements.actions.sequence.ActionSequence) AiBehavior(eidolons.game.module.dungeoncrawl.ai.AiBehavior)

Aggregations

AiBehavior (eidolons.game.module.dungeoncrawl.ai.AiBehavior)2 Action (eidolons.game.battlecraft.ai.elements.actions.Action)1 ActionSequence (eidolons.game.battlecraft.ai.elements.actions.sequence.ActionSequence)1 GuardAi (eidolons.game.module.dungeoncrawl.ai.GuardAi)1 WanderAi (eidolons.game.module.dungeoncrawl.ai.WanderAi)1