#Big prey are hunted by groups, small prey by individuals

#Input variables
#prey_type (1 = big game, 2 = runts, 3 = predators)
#party_health (total hit points for the group)
#party_size (number of hunters)
#carried_food (how much food the party is currently carrying)
#hunt_tool_level (level of the hunt tool)
#defense_tool_level (level of the defense tool)
#gather_tool_level (level of the gather tool)

#Output variables
#creature_sprint_distance = how close the creature needs to get to the herd before it starts sprinting
#creature_sprint_multiplier = how fast the creature sprints relative to its normal speed

#total_catch (the amount of food to be added to the tribe)
#damage_share (the amount of damage to be applied to each hunter)
#keep_hunting (set to 1 to keep hunting bunnies)
#total_damage (the total amount of damage to be applied)
#hunt_time (the time in seconds required to complete the hunt)

#Temp variables
#success (do they kill the beast?)

creature_sprint_distance = 5
creature_sprint_multiplier = 2

keep_hunting = 0

if (prey_type == 2) # runts
   hunt_time = 14 - (4 * hunt_tool_level)
   hunt_energy_cost = (hunt_time / 2) + (20 * RAND)
   total_damage = RAND * 5
   total_catch = 9   
 
else # if not runts
   damage_share = 65 + RAND * 70
   success = 7 * party_size + 14 * hunt_tool_level
   if (RAND * 100 <= success)
      total_catch = 30 * (party_size^0.5)
      total_damage = RAND * 180 - defense_tool_level * 20
      hunt_time = 55 - 5 * (party_size^0.5) - 5 * hunt_tool_level
   else
      total_catch = 0
      total_damage = RAND * 240 - defense_tool_level * 60
      # if you are going to fail, you should find this out relatively fast
      hunt_time = 5 * (party_size^0.5)
   endif

   hunt_energy_cost = (hunt_time / 2) + (10 * RAND)
endif
