
# Orcs hunt on sight wherever they are, and an orc that belongs to a village also works it.
# A wild orc is never assigned a city or a job, so the city and loadout behaviors simply never
# score and it falls through to the same hunting and idling it always did.
# A village orc returns to its room and a wild orc to its spawn; each of the two sleeps for the
# orcs that have no room or no spawn, so only one of them ever does anything for a given orc.

orc_brain
{
    subBrain: conditionAlways(), orc_combat

    subBrain: conditionPropertyRange(CURRENT_NUTRITION, 0, 5000), orc_eat

    executeSelfTasks
    executeCityTasks

    subBrain: conditionPropertyRange(CURRENT_NUTRITION, 0, 2000), orc_desperate_wander
    goToRoom
    goToSpawn
    idle: 300

    # self task creators
    manageLoadout
}

orc_combat
{
    setTargetWhenBlocked: humans_list
    setTarget: humans_list
    setTargetWhenAttackedNTimesWithException: 1, orc_friend_list
    setTargetWhenFriendIsAttacked: orc_friend_list
    subBrain: conditionHasPathToTarget(), orc_combat_abilities
    fleeOnLowHealth: 25
    moveOnTarget: 300
    followTarget
    fleeWhenAttacked
}

orc_combat_abilities
{
    useAbilitiesSmartly: 300
    faceTarget: 300
}

orc_eat
{
    useItem: orc_diet
    subBrain: conditionPropertyRatioRange(CURRENT_NUTRITION, 0.0, 0.05), orc_eat_from_ground
}

# a starving orc is not fussy, so this one reaches for the whole omnivore diet, corpses included
orc_eat_from_ground
{
    setItemGrabTarget: FOOD_TARGET, omnivore_diet
    useItemTarget: FOOD_TARGET
    goToItemTarget: FOOD_TARGET
}

orc_desperate_wander
{
    idleOnCity
}

