Search in sources :

Example 6 with UnitAI

use of eidolons.game.battlecraft.ai.UnitAI in project Eidolons by IDemiurge.

the class OrderMaster method checkOrderCompleted.

public static boolean checkOrderCompleted(Action action) {
    UnitAI ai = action.getSource().getAI();
    Order order = ai.getCurrentOrder();
    Task task = action.getTask();
    return false;
}
Also used : Task(eidolons.game.battlecraft.ai.elements.task.Task) UnitAI(eidolons.game.battlecraft.ai.UnitAI)

Example 7 with UnitAI

use of eidolons.game.battlecraft.ai.UnitAI in project Eidolons by IDemiurge.

the class WanderAi method checkWanderDirectionChange.

public static Boolean checkWanderDirectionChange(GroupAI group, GOAL_TYPE type) {
    boolean change = false;
    if (checkUnitArrived(group.getLeader().getUnitAI(), type)) {
        change = true;
    } else {
        List<UnitAI> forwards = new ArrayList<>();
        for (Unit unit : group.getMembers()) {
            UnitAI ai = unit.getUnitAI();
            boolean done = checkUnitArrived(ai, type);
            if (!done) {
                done = checkProgressObstructed(group.getWanderDirection(), ai, type);
            }
            if (done) // if (PositionMaster.getDistance(c,
            // m.getUnit().getCoordinates()) > max)
            {
                forwards.add(ai);
                if (forwards.size() > Math.round(group.getMembers().size() * getCatchUpFactor(group, type))) {
                    // if (group.isCatchUp())
                    // change = null;
                    // if units are too far
                    // laggers.add(ai);
                    // cannot be a lagger if obstructed?
                    change = true;
                    break;
                }
            }
        }
    // need to have most units far enough?
    // distance from each other? don't forget the leader... he is
    // special
    }
    return change;
}
Also used : UnitAI(eidolons.game.battlecraft.ai.UnitAI) ArrayList(java.util.ArrayList) Unit(eidolons.entity.obj.unit.Unit)

Example 8 with UnitAI

use of eidolons.game.battlecraft.ai.UnitAI in project Eidolons by IDemiurge.

the class DebugMaster method editAi.

public void editAi(Unit unit) {
    UnitAI ai = unit.getUnitAI();
    GroupAI group = ai.getGroup();
    DialogMaster.confirm("What to do with " + group);
    String TRUE = "Info";
    String FALSE = "Set Behavior";
    String NULL = "Set Parameter";
    String string = "What to do with " + group + "?";
    Boolean result = DialogMaster.askAndWait(string, TRUE, FALSE, NULL);
    LogMaster.log(1, " ");
    DIRECTION info = group.getWanderDirection();
    // TODO GLOBAL AI LOG LEVEL
    if (result == null) {
        AI_PARAM param = new EnumMaster<AI_PARAM>().retrieveEnumConst(AI_PARAM.class, ListChooser.chooseEnum(AI_PARAM.class));
        if (param != null) {
            switch(param) {
                case LOG_LEVEL:
                    ai.setLogLevel(DialogMaster.inputInt(ai.getLogLevel()));
                    break;
            }
        }
    }
    /*
         * display on BF: >> Direction >> Target coordinate for each unit or
		 * patrol >> Maybe even path... >>
		 *
		 *
		 */
    group.getPatrol();
}
Also used : GroupAI(eidolons.game.battlecraft.ai.GroupAI) UnitAI(eidolons.game.battlecraft.ai.UnitAI) DIRECTION(main.game.bf.Coordinates.DIRECTION)

Aggregations

UnitAI (eidolons.game.battlecraft.ai.UnitAI)8 Unit (eidolons.entity.obj.unit.Unit)3 Action (eidolons.game.battlecraft.ai.elements.actions.Action)3 ArrayList (java.util.ArrayList)3 Coordinates (main.game.bf.Coordinates)3 DC_UnitAction (eidolons.entity.active.DC_UnitAction)2 AiActionFactory (eidolons.game.battlecraft.ai.elements.actions.AiActionFactory)2 ActionSequence (eidolons.game.battlecraft.ai.elements.actions.sequence.ActionSequence)2 AiHandler (eidolons.game.battlecraft.ai.elements.generic.AiHandler)2 AiMaster (eidolons.game.battlecraft.ai.elements.generic.AiMaster)2 Task (eidolons.game.battlecraft.ai.elements.task.Task)2 FACING_SINGLE (main.content.enums.entity.UnitEnums.FACING_SINGLE)2 Ref (main.entity.Ref)2 FACING_DIRECTION (main.game.bf.Coordinates.FACING_DIRECTION)2 PARAMS (eidolons.content.PARAMS)1 STD_MODE_ACTIONS (eidolons.entity.active.DC_ActionManager.STD_MODE_ACTIONS)1 STD_SPEC_ACTIONS (eidolons.entity.active.DC_ActionManager.STD_SPEC_ACTIONS)1 DC_QuickItemObj (eidolons.entity.item.DC_QuickItemObj)1 BattleFieldObject (eidolons.entity.obj.BattleFieldObject)1 GroupAI (eidolons.game.battlecraft.ai.GroupAI)1