# for city tasks, every file represents a single city type

TASKS_TYPE: ORC_CITY

defend_items
{
    type: DefendItems
    task_class: PROTECT_CITY
}

# Only creatures standing in the village are taken as targets, but once a guard is after one it
# keeps after it, so an intruder does not escape by stepping back over the edge of the village
defend_from_intruders
{
    type: HuntCreatures
    task_class: PROTECT_CITY
    creature_list: orc_intruder_list
    only_in_city: true
}

manage_furniture
{
    type: ManageRoomFurniture
    task_class: CITY_UPKEEP_TASK
}

manage_chests
{
    type: ManageChests
    task_class: CITY_UPKEEP_TASK
    item_list: orc_room_container_list
}

# A stock tile with no slot left in any of its containers gets a spare crate or bag nested inside
# them, instead of the hauls piling up on the ground around it
nest_containers
{
    type: NestContainers
    task_class: CITY_UPKEEP_TASK
    item_list: orc_nestable_container_list
}

########### Farming #############################

# The village floor is bare cave dirt, so the plots grow out of the garden the tribe was
# built around rather than being fenced off from anything
manage_farm_plots
{
    type: ManageFarmPlots
    plot_type: orc_farm_plot
    tile_list: orc_city_farm_tiles
    max_area: 150
    max_distance: 50
}

diet_condition
{
    type: StockLessThanList
    item_list: orc_diet
    amount: 500
}

clear_farm_grass
{
    type: UseTiles
    task_class: FARMING_TASK_II
    tile_list: grass_plant_tile_list
    ability: cut_grass
    farm_plot_type: orc_farm_plot

    condition: diet_condition
}

plow_farm_tiles
{
    type: UseTiles
    task_class: FARMING_TASK_II
    tile_list: plowable_tiles
    ability: stone_hoe_transform
    farm_plot_type: orc_farm_plot

    condition: diet_condition
}

plant_food_seeds
{
    type: PlantSeeds
    task_class: FARMING_TASK_II
    item_list: orc_seed_list
    tile_type: plowed_dirt
    plot_type: orc_farm_plot

    condition: diet_condition
}

harvest
{
    type: UseTiles
    task_class: FARMING_TASK_I
    tile_list: harvest_tiles
}

forage
{
    type: UseTiles
    task_class: WOODCUTTING_TASK
    tile_list: forage_tiles
}

cut_bushes
{
    type: UseTiles
    task_class: WOODCUTTING_TASK
    tile_list: bush_tile_list
    ability: cut_bush
}

########### Hunting #############################

hunt_leather
{
    type: HuntCreatures
    task_class: HUNTING_TASK
    creature_list: orc_leather_hunt_list
    ability: skin_corpses
    condition: no_leather_stock_condition
    condition: hunt_leather_population_condition
}

hunt_leather_population_condition
{
    type: CreatureCountMoreThan
    creature_list: orc_leather_hunt_list
    amount: 10
}

no_leather_stock_condition
{
    type: StockLessThanItem
    item: leather
    amount: 50
}

hunt_meat
{
    type: HuntCreatures
    task_class: HUNTING_TASK
    creature_list: orc_leather_hunt_list
    ability: butcher_corpses
    condition: meat_stock_condition
    condition: hunt_leather_population_condition
}

hunt_wool
{
    type: HuntCreatures
    task_class: HUNTING_TASK
    creature_list: orc_wool_hunt_list
    ability: cut_corpses
    condition: wool_stock_condition
}

hunt_snake_skin
{
    type: HuntCreatures
    task_class: HUNTING_TASK
    creature_list: orc_snake_skin_hunt_list
    ability: skin_corpses
    condition: snake_skin_stock_condition
}

snake_skin_stock_condition
{
    type: StockLessThanItem
    item: snake_skin
    amount: 20
}

hunt_bones
{
    type: HuntCreatures
    task_class: HUNTING_TASK
    creature_list: orc_bone_hunt_list
    ability: butcher_corpses
    condition: bones_stock_condition
}

bones_stock_condition
{
    type: StockLessThanItem
    item: skull
    item: femour
    amount: 3
}

hunt_spiders_for_silk
{
    type: HuntCreatures
    task_class: HUNTING_TASK
    creature_list: orc_spider_hunt_list
    ability: cut_corpses
    condition: spider_silk_stock_condition
}

hunt_spiders_for_carapace
{
    type: HuntCreatures
    task_class: HUNTING_TASK
    creature_list: orc_spider_hunt_list
    ability: skin_corpses
    condition: spider_carapace_stock_condition
}

########### Extracting #############################

extract_leather
{
    type: ExtractFromItems
    task_class: HUNTING_TASK
    item_list: skinnable_list
    ability: skin_corpses
    condition: no_leather_stock_condition
}

extract_meat
{
    type: ExtractFromItems
    task_class: HUNTING_TASK
    item_list: orc_meat_corpse_list
    ability: butcher_corpses
    condition: meat_stock_condition
}

meat_stock_condition
{
    type: StockLessThanItem
    item: meat
    amount: 50
}

extract_wool
{
    type: ExtractFromItems
    task_class: HUNTING_TASK
    item_list: wool_corpse_list
    ability: cut_corpses
    condition: wool_stock_condition
}

extract_dark_wool
{
    type: ExtractFromItems
    task_class: HUNTING_TASK
    item_list: dark_wool_corpse_list
    ability: cut_corpses
    condition: dark_wool_stock_condition
}

wool_stock_condition
{
    type: StockLessThanItem
    item: wool
    amount: 50
}

dark_wool_stock_condition
{
    type: StockLessThanItem
    item: dark_wool
    amount: 50
}

extract_bones
{
    type: ExtractFromItems
    task_class: HUNTING_TASK
    item_list: bones_corpse_list
    ability: butcher_corpses
    condition: bones_stock_condition
}

extract_rotting_guts
{
    type: ExtractFromItems
    task_class: HUNTING_TASK
    item_list: rotting_guts_corpse_list
    ability: butcher_corpses
    condition: rotting_guts_stock_condition
}

rotting_guts_stock_condition
{
    type: StockLessThanItem
    item: rotting_guts
    amount: 20
}

extract_spider_carapace
{
    type: ExtractFromItems
    task_class: HUNTING_TASK
    item_list: spider_corpse_list
    ability: skin_corpses
    condition: spider_carapace_stock_condition
}

spider_carapace_stock_condition
{
    type: StockLessThanItem
    item: spider_carapace
    amount: 20
}

extract_spider_silk
{
    type: ExtractFromItems
    task_class: HUNTING_TASK
    item_list: spider_corpse_list
    ability: cut_corpses
    condition: spider_silk_stock_condition
}

spider_silk_stock_condition
{
    type: StockLessThanItem
    item: silk
    amount: 30
}

extract_dragon_scale
{
    type: ExtractFromItems
    task_class: HUNTING_TASK
    item_list: dragon_corpse_list
    ability: skin_corpses
    condition: dragon_scale_stock_condition
}

dragon_scale_stock_condition
{
    type: StockLessThanItem
    item: dragon_scale
    amount: 200
}

########### Woodcutting and mining #############################

# A cave village lives off what it can break, so most of its timber comes from the crates and
# tables it tears back apart rather than from trees
extract_wood_no_tool
{
    type: UseTiles
    task_class: WOODCUTTING_TASK
    tile_list: no_tool_tree_list
    condition: wood_stock_condition
}

extract_wood_with_tool
{
    type: UseTiles
    task_class: WOODCUTTING_TASK
    tile_list: tree_tile_list
    ability: cut_wood
    condition: wood_stock_condition
}

wood_stock_condition
{
    type: StockLessThanItem
    item: wood_log
    amount: 20
}

extract_stone_no_tool
{
    type: UseTiles
    task_class: MINING_TASK
    tile_list: no_tool_stone_tile_list
    condition: stone_stock_condition
}

extract_stone_with_tool
{
    type: UseTiles
    task_class: MINING_TASK
    tile_list: stone_tool_stone_tile_list
    ability: break_stone
    condition: stone_stock_condition
}

stone_stock_condition
{
    type: StockLessThanItem
    item: loose_stone
    amount: 30
}

extract_copper_with_tool
{
    type: UseTiles
    task_class: MINING_TASK
    tile_list: stone_tool_copper_ore_tile_list
    ability: break_stone
    condition: copper_ore_stock_condition
}

copper_ore_stock_condition
{
    type: StockLessThanItem
    item: copper_ore
    amount: 20
}

extract_tin_with_tool
{
    type: UseTiles
    task_class: MINING_TASK
    tile_list: stone_tool_tin_ore_tile_list
    ability: break_stone
    condition: tin_ore_stock_condition
}

tin_ore_stock_condition
{
    type: StockLessThanItem
    item: tin_ore
    amount: 20
}

########### Feeding #############################

# The tribe only shares food with starving orcs outside the village once its own larder is full
feed_wild_orcs_condition
{
    type: StockMoreThanItem
    item: cave_carrot
    amount: 100
}

feed_wild_orcs
{
    type: FeedCreatures
    targets: wild
    task_class: CITY_UPKEEP_TASK
    creature_list: orc_feed_list
    item_list: orc_diet
    food_amount: 10
    condition: feed_wild_orcs_condition
    max_task_queue_size: 10
}

# The tribe's own orcs are fed whenever there is food to spare
feed_citizens
{
    type: FeedCreatures
    targets: citizens
    task_class: CITY_UPKEEP_TASK
    creature_list: orc_feed_list
    item_list: orc_diet
    food_amount: 10
    max_task_queue_size: 10
}

########### Stocking #############################

stock_food
{
    type: StockList
    task_class: FARMING_TASK_I
    item_list: orc_diet
}

stock_forage
{
    type: StockList
    task_class: WOODCUTTING_TASK
    item_list: forage_list
}

stock_seeds
{
    type: StockList
    task_class: FARMING_TASK_II
    item_list: orc_seed_list
}

stock_containers
{
    type: StockList
    task_class: CARRY_TASK
    item_list: dweller_container_list
}

stock_clothes
{
    type: StockList
    task_class: CARRY_TASK
    item_list: orc_clothes_list
}

stock_accesories
{
    type: StockList
    task_class: CARRY_TASK
    item_list: orc_accessory_list
}

stock_shaman_accessories
{
    type: StockList
    task_class: CARRY_TASK
    item_list: orc_shaman_accessory_list
}

stock_weapons
{
    type: StockList
    task_class: CARRY_TASK
    item_list: orc_weapons_list
}

stock_tools
{
    type: StockList
    task_class: CARRY_TASK
    item_list: orc_tool_list
}

stock_ropes
{
    type: StockList
    task_class: CARRY_TASK
    item_list: orc_rope_list
}

stock_health_potions
{
    type: StockList
    task_class: CARRY_TASK
    item_list: orc_health_potions
}

stock_mana_potions
{
    type: StockList
    task_class: CARRY_TASK
    item_list: orc_mana_potions
}

stock_furniture
{
    type: StockList
    task_class: CARRY_TASK
    item_list: furniture_list
    furniture: true
}

stock_city_resources
{
    type: StockList
    task_class: CARRY_TASK
    item_list: city_resource_list
}

stock_woodcutting_loot
{
    type: StockList
    task_class: WOODCUTTING_TASK
    item_list: woodcutting_loot_list
}

stock_mining_loot
{
    type: StockList
    task_class: MINING_TASK
    item_list: mining_loot_list
}

stock_hunting_loot
{
    type: StockList
    task_class: HUNTING_TASK
    item_list: hunting_loot_list
}

# The crystals lie loose on the cave floor, so any orc hauling goods can pick them up on the way
stock_refracting_crystals
{
    type: StockItem
    task_class: CARRY_TASK
    item: refracting_crystal
}

########### Crafting #############################

craft_sharp_stone
{
    type: CraftItems
    task_class: CRAFTING_TASK
    item: sharp_stone
    condition: craft_sharp_stone_condition
}

craft_sharp_stone_condition
{
    type: StockLessThanItem
    item: sharp_stone
    amount: 2
}

craft_stone_club
{
    type: CraftItems
    task_class: CRAFTING_TASK
    item: stone_club
    condition: craft_stone_club_condition
}

craft_stone_club_condition
{
    type: StockLessThanItem
    item: stone_club
    amount: 4
}

craft_stone_hoe
{
    type: CraftItems
    task_class: CRAFTING_TASK
    item: stone_hoe
    condition: craft_stone_hoe_condition
}

craft_stone_hoe_condition
{
    type: StockLessThanItem
    item: stone_hoe
    amount: 2
}

craft_stone_spear
{
    type: CraftItems
    task_class: CRAFTING_TASK
    item: stone_spear
    condition: craft_stone_spear_condition
}

craft_stone_spear_condition
{
    type: StockLessThanItem
    item: stone_spear
    amount: 2
}

craft_silk_rope
{
    type: CraftItems
    task_class: CRAFTING_TASK
    item: rope
    craft: rope_from_silk
    condition: craft_silk_rope_condition
}

craft_silk_rope_condition
{
    type: StockLessThanItem
    item: rope
    amount: 6
}

craft_leather_bag
{
    type: CraftItems
    task_class: CRAFTING_TASK
    item: leather_bag
    condition: craft_leather_bag_condition
}

craft_leather_bag_condition
{
    type: StockLessThanList
    item_list: dweller_container_list
    amount: 10
}

leather_bag_stock_condition
{
    type: StockMoreThanList
    item_list: dweller_container_list
    amount: 2
}

craft_crate
{
    type: CraftItems
    task_class: CRAFTING_TASK
    item: crate
    condition: craft_crate_condition
}

craft_crate_condition
{
    type: StockLessThanList
    item_list: orc_room_container_list
    amount: 3
}

craft_short_bow
{
    type: CraftItems
    task_class: CRAFTING_TASK
    item: short_bow
    condition: craft_short_bow_condition
    condition: leather_bag_stock_condition
}

craft_short_bow_condition
{
    type: StockLessThanItem
    item: short_bow
    amount: 2
}

craft_composite_short_bow
{
    type: CraftItems
    task_class: CRAFTING_TASK
    item: composite_short_bow
    condition: craft_composite_short_bow_condition
    condition: leather_bag_stock_condition
}

craft_composite_short_bow_condition
{
    type: StockLessThanItem
    item: composite_short_bow
    amount: 2
}

craft_snakerang
{
    type: CraftItems
    task_class: CRAFTING_TASK
    item: snakerang
    condition: craft_snakerang_condition
}

craft_snakerang_condition
{
    type: StockLessThanItem
    item: snakerang
    amount: 2
}

craft_spiderang
{
    type: CraftItems
    task_class: CRAFTING_TASK
    item: spiderang
    condition: craft_spiderang_condition
}

craft_spiderang_condition
{
    type: StockLessThanItem
    item: spiderang
    amount: 2
}

craft_wooden_shield
{
    type: CraftItems
    task_class: CRAFTING_TASK
    item: wooden_shield
    condition: craft_wooden_shield_condition
}

craft_wooden_shield_condition
{
    type: StockLessThanItem
    item: wooden_shield
    amount: 2
}

craft_reinforced_shield
{
    type: CraftItems
    task_class: CRAFTING_TASK
    item: reinforced_shield
    condition: craft_reinforced_shield_condition
}

craft_reinforced_shield_condition
{
    type: StockLessThanItem
    item: reinforced_shield
    amount: 1
}

craft_bronze_shield
{
    type: CraftItems
    task_class: CRAFTING_TASK
    item: bronze_shield
    condition: craft_bronze_shield_condition
}

craft_bronze_shield_condition
{
    type: StockLessThanItem
    item: bronze_shield
    amount: 1
}

craft_leather_helmet
{
    type: CraftItems
    task_class: CRAFTING_TASK
    item: leather_helmet
    condition: craft_leather_helmet_condition
    condition: leather_bag_stock_condition
}

craft_leather_helmet_condition
{
    type: StockLessThanItem
    item: leather_helmet
    amount: 2
}

craft_leather_armor
{
    type: CraftItems
    task_class: CRAFTING_TASK
    item: leather_armor
    condition: craft_leather_armor_condition
    condition: leather_bag_stock_condition
}

craft_leather_armor_condition
{
    type: StockLessThanItem
    item: leather_armor
    amount: 2
}

craft_leather_pants
{
    type: CraftItems
    task_class: CRAFTING_TASK
    item: leather_pants
    condition: craft_leather_pants_condition
    condition: leather_bag_stock_condition
}

craft_leather_pants_condition
{
    type: StockLessThanItem
    item: leather_pants
    amount: 2
}

craft_leather_boots
{
    type: CraftItems
    task_class: CRAFTING_TASK
    item: leather_boots
    condition: craft_leather_boots_condition
    condition: leather_bag_stock_condition
}

craft_leather_boots_condition
{
    type: StockLessThanItem
    item: leather_boots
    amount: 2
}

craft_boots_of_haste
{
    type: CraftItems
    task_class: CRAFTING_TASK
    item: boots_of_haste
    condition: craft_boots_of_haste_condition
}

craft_boots_of_haste_condition
{
    type: StockLessThanItem
    item: boots_of_haste
    amount: 1
}

craft_leather_belt
{
    type: CraftItems
    task_class: CRAFTING_TASK
    item: leather_belt
    condition: craft_leather_belt_condition
    condition: leather_bag_stock_condition
}

craft_leather_belt_condition
{
    type: StockLessThanItem
    item: leather_belt
    amount: 2
}

craft_straw_hat
{
    type: CraftItems
    task_class: CRAFTING_TASK
    item: straw_hat
    condition: craft_straw_hat_condition
}

craft_straw_hat_condition
{
    type: StockLessThanItem
    item: straw_hat
    amount: 2
}

craft_wool_shirt
{
    type: CraftItems
    task_class: CRAFTING_TASK
    item: wool_shirt
    condition: craft_wool_shirt_condition
}

craft_wool_shirt_condition
{
    type: StockLessThanItem
    item: wool_shirt
    amount: 2
}

craft_wool_pants
{
    type: CraftItems
    task_class: CRAFTING_TASK
    item: wool_pants
    condition: craft_wool_pants_condition
}

craft_wool_pants_condition
{
    type: StockLessThanItem
    item: wool_pants
    amount: 2
}

craft_copper_bar
{
    type: CraftItems
    task_class: CRAFTING_TASK
    item: copper_bar
    condition: craft_copper_bar_condition
}

craft_copper_bar_condition
{
    type: StockLessThanItem
    item: copper_bar
    amount: 20
}

craft_tin_bar
{
    type: CraftItems
    task_class: CRAFTING_TASK
    item: tin_bar
    condition: craft_tin_bar_condition
}

craft_tin_bar_condition
{
    type: StockLessThanItem
    item: tin_bar
    amount: 20
}

craft_bronze_bar
{
    type: CraftItems
    task_class: CRAFTING_TASK
    item: bronze_bar
    condition: craft_bronze_bar_condition
}

craft_bronze_bar_condition
{
    type: StockLessThanItem
    item: bronze_bar
    amount: 20
}

craft_tin_nails
{
    type: CraftItems
    task_class: CRAFTING_TASK
    item: tin_nail
    condition: craft_tin_nails_condition
}

craft_tin_nails_condition
{
    type: StockLessThanItem
    item: tin_nail
    amount: 20
}

craft_meat_cleaver
{
    type: CraftItems
    task_class: CRAFTING_TASK
    item: meat_cleaver
    condition: craft_meat_cleaver_condition
}

craft_meat_cleaver_condition
{
    type: StockLessThanItem
    item: meat_cleaver
    amount: 2
}

craft_copper_scissors
{
    type: CraftItems
    task_class: CRAFTING_TASK
    item: copper_scissors
    condition: craft_copper_scissors_condition
}

craft_copper_scissors_condition
{
    type: StockLessThanItem
    item: copper_scissors
    amount: 1
}

craft_copper_pickaxe
{
    type: CraftItems
    task_class: CRAFTING_TASK
    item: copper_pickaxe
    condition: craft_copper_pickaxe_condition
}

craft_copper_pickaxe_condition
{
    type: StockLessThanItem
    item: copper_pickaxe
    amount: 2
}

craft_copper_hatchet
{
    type: CraftItems
    task_class: CRAFTING_TASK
    item: copper_hatchet
    condition: craft_copper_hatchet_condition
}

craft_copper_hatchet_condition
{
    type: StockLessThanItem
    item: copper_hatchet
    amount: 2
}

craft_copper_machete
{
    type: CraftItems
    task_class: CRAFTING_TASK
    item: copper_machete
    condition: craft_copper_machete_condition
}

craft_copper_machete_condition
{
    type: StockLessThanItem
    item: copper_machete
    amount: 2
}

craft_bronze_pickaxe
{
    type: CraftItems
    task_class: CRAFTING_TASK
    item: bronze_pickaxe
    condition: craft_bronze_pickaxe_condition
}

craft_bronze_pickaxe_condition
{
    type: StockLessThanItem
    item: bronze_pickaxe
    amount: 2
}

craft_bronze_hatchet
{
    type: CraftItems
    task_class: CRAFTING_TASK
    item: bronze_hatchet
    condition: craft_bronze_hatchet_condition
}

craft_bronze_hatchet_condition
{
    type: StockLessThanItem
    item: bronze_hatchet
    amount: 2
}

craft_bronze_dagger
{
    type: CraftItems
    task_class: CRAFTING_TASK
    item: bronze_dagger
    condition: craft_bronze_dagger_condition
}

craft_bronze_dagger_condition
{
    type: StockLessThanItem
    item: bronze_dagger
    amount: 2
}

craft_bronze_gladius
{
    type: CraftItems
    task_class: CRAFTING_TASK
    item: bronze_gladius
    condition: craft_bronze_gladius_condition
}

craft_bronze_gladius_condition
{
    type: StockLessThanItem
    item: bronze_gladius
    amount: 2
}

craft_bronze_longsword
{
    type: CraftItems
    task_class: CRAFTING_TASK
    item: bronze_longsword
    condition: craft_bronze_longsword_condition
}

craft_bronze_longsword_condition
{
    type: StockLessThanItem
    item: bronze_longsword
    amount: 2
}

craft_bronze_helmet
{
    type: CraftItems
    task_class: CRAFTING_TASK
    item: bronze_helmet
    condition: craft_bronze_helmet_condition
}

craft_bronze_helmet_condition
{
    type: StockLessThanItem
    item: bronze_helmet
    amount: 2
}

craft_bronze_chestplate
{
    type: CraftItems
    task_class: CRAFTING_TASK
    item: bronze_chestplate
    condition: craft_bronze_chestplate_condition
}

craft_bronze_chestplate_condition
{
    type: StockLessThanItem
    item: bronze_chestplate
    amount: 2
}

craft_bronze_leggings
{
    type: CraftItems
    task_class: CRAFTING_TASK
    item: bronze_leggings
    condition: craft_bronze_leggings_condition
}

craft_bronze_leggings_condition
{
    type: StockLessThanItem
    item: bronze_leggings
    amount: 2
}

craft_bronze_boots
{
    type: CraftItems
    task_class: CRAFTING_TASK
    item: bronze_boots
    condition: craft_bronze_boots_condition
}

craft_bronze_boots_condition
{
    type: StockLessThanItem
    item: bronze_boots
    amount: 2
}

craft_spider_pants
{
    type: CraftItems
    task_class: CRAFTING_TASK
    item: spider_pants
    condition: craft_spider_pants_condition
}

craft_spider_pants_condition
{
    type: StockLessThanItem
    item: spider_pants
    amount: 1
}

craft_spider_boots
{
    type: CraftItems
    task_class: CRAFTING_TASK
    item: spider_boots
    condition: craft_spider_boots_condition
}

craft_spider_boots_condition
{
    type: StockLessThanItem
    item: spider_boots
    amount: 1
}

craft_berserker_armor
{
    type: CraftItems
    task_class: CRAFTING_TASK
    item: berserker_armor
    condition: craft_berserker_armor_condition
    condition: leather_bag_stock_condition
}

craft_berserker_armor_condition
{
    type: StockLessThanItem
    item: berserker_armor
    amount: 2
}

craft_dragon_scale_helmet
{
    type: CraftItems
    task_class: CRAFTING_TASK
    item: dragon_scale_helmet
    condition: craft_dragon_scale_helmet_condition
}

craft_dragon_scale_helmet_condition
{
    type: StockLessThanItem
    item: dragon_scale_helmet
    amount: 2
}

craft_dragon_scale_mail
{
    type: CraftItems
    task_class: CRAFTING_TASK
    item: dragon_scale_mail
    condition: craft_dragon_scale_mail_condition
}

craft_dragon_scale_mail_condition
{
    type: StockLessThanItem
    item: dragon_scale_mail
    amount: 2
}

craft_dragon_scale_leggings
{
    type: CraftItems
    task_class: CRAFTING_TASK
    item: dragon_scale_leggings
    condition: craft_dragon_scale_leggings_condition
}

craft_dragon_scale_leggings_condition
{
    type: StockLessThanItem
    item: dragon_scale_leggings
    amount: 2
}

craft_dragon_scale_boots
{
    type: CraftItems
    task_class: CRAFTING_TASK
    item: dragon_scale_boots
    condition: craft_dragon_scale_boots_condition
}

craft_dragon_scale_boots_condition
{
    type: StockLessThanItem
    item: dragon_scale_boots
    amount: 2
}

craft_rage_bell
{
    type: CraftItems
    task_class: CRAFTING_TASK
    item: rage_bell
    condition: craft_rage_bell_condition
}

craft_rage_bell_condition
{
    type: StockLessThanItem
    item: rage_bell
    amount: 1
}

craft_ring_of_healing
{
    type: CraftItems
    task_class: CRAFTING_TASK
    item: ring_of_healing
    condition: craft_ring_of_healing_condition
}

craft_ring_of_healing_condition
{
    type: StockLessThanItem
    item: ring_of_healing
    amount: 2
}

cook_stew
{
    type: CraftItems
    task_class: COOKING_TASK
    item: stew
    craft: stew
    condition: cook_stew_condition
}

cook_cave_carrot_stew
{
    type: CraftItems
    task_class: COOKING_TASK
    item: stew
    craft: stew_from_cave_carrot
    condition: cook_stew_condition
}

cook_stew_condition
{
    type: StockLessThanItem
    item: stew
    amount: 50
}

cook_sausages
{
    type: CraftItems
    task_class: COOKING_TASK
    item: sausages
    condition: cook_sausages_condition
}

cook_sausages_condition
{
    type: StockLessThanItem
    item: sausages
    amount: 50
}

brew_health_potion
{
    type: CraftItems
    task_class: COOKING_TASK
    item: feeble_health_potion
    condition: brew_health_potion_condition
}

brew_health_potion_condition
{
    type: StockLessThanList
    item_list: orc_health_potions
    amount: 20
}

########### Shaman crafting #############################

# Everything here costs mana, so it is left to the shaman rather than the smiths

craft_orcish_master_bow
{
    type: CraftItems
    task_class: SHAMAN_CRAFTING_TASK
    item: orcish_master_bow
    condition: craft_orcish_master_bow_condition
}

craft_orcish_master_bow_condition
{
    type: StockLessThanItem
    item: orcish_master_bow
    amount: 2
}

craft_runerang
{
    type: CraftItems
    task_class: SHAMAN_CRAFTING_TASK
    item: runerang
    condition: craft_runerang_condition
}

craft_runerang_condition
{
    type: StockLessThanItem
    item: runerang
    amount: 2
}

craft_nurture_staff
{
    type: CraftItems
    task_class: SHAMAN_CRAFTING_TASK
    item: nurture_staff
    condition: craft_nurture_staff_condition
}

craft_nurture_staff_condition
{
    type: StockLessThanItem
    item: nurture_staff
    amount: 1
}

craft_skull_staff
{
    type: CraftItems
    task_class: SHAMAN_CRAFTING_TASK
    item: skull_staff
    condition: craft_skull_staff_condition
}

craft_skull_staff_condition
{
    type: StockLessThanItem
    item: skull_staff
    amount: 1
}

# Each stronger potion is brewed from three of the one below, so it is only brewed once there
# is a good stock of the weaker one to spare

brew_lesser_mana_potion
{
    type: CraftItems
    task_class: SHAMAN_CRAFTING_TASK
    item: lesser_mana_potion
    condition: brew_lesser_mana_potion_condition
}

brew_lesser_mana_potion_condition
{
    type: StockLessThanItem
    item: lesser_mana_potion
    amount: 20
}

brew_mana_potion
{
    type: CraftItems
    task_class: SHAMAN_CRAFTING_TASK
    item: mana_potion
    condition: brew_mana_potion_condition
    condition: lesser_mana_potion_plenty_condition
}

brew_mana_potion_condition
{
    type: StockLessThanItem
    item: mana_potion
    amount: 10
}

lesser_mana_potion_plenty_condition
{
    type: StockMoreThanItem
    item: lesser_mana_potion
    amount: 12
}

brew_refined_mana_potion
{
    type: CraftItems
    task_class: SHAMAN_CRAFTING_TASK
    item: refined_mana_potion
    condition: brew_refined_mana_potion_condition
    condition: mana_potion_plenty_condition
}

brew_refined_mana_potion_condition
{
    type: StockLessThanItem
    item: refined_mana_potion
    amount: 5
}

mana_potion_plenty_condition
{
    type: StockMoreThanItem
    item: mana_potion
    amount: 6
}

########### Upkeep #############################

# Crates and tables are the tribe's timber reserve, so a surplus of either goes straight back
# to being wood logs
destroy_crate
{
    type: ExtractFromItems
    task_class: CITY_UPKEEP_TASK
    item_list: crate_list
    furniture: true
    ability: break_furniture
    condition: destroy_crate_stock_condition
}

destroy_crate_stock_condition
{
    type: StockMoreThanItem
    item: crate
    amount: 10
}

destroy_table
{
    type: ExtractFromItems
    task_class: CITY_UPKEEP_TASK
    item_list: table_list
    furniture: true
    ability: break_furniture
    condition: destroy_table_stock_condition
}

destroy_table_stock_condition
{
    type: StockMoreThanItem
    item: table
    amount: 3
}
