#Hiring men with hero wealths (once a day)
#Hiring men with center wealths (once a day)
(24,
[
(try_for_range, ":troop_no", active_npcs_begin, active_npcs_end),
(troop_slot_eq, ":troop_no", slot_troop_occupation, slto_kingdom_hero),
(troop_get_slot, ":party_no", ":troop_no", slot_troop_leaded_party),
(ge, ":party_no", 1),
(party_is_active, ":party_no"),
(party_get_attached_to, ":cur_attached_party", ":party_no"),
(is_between, ":cur_attached_party", centers_begin, centers_end),
(party_slot_eq, ":cur_attached_party", slot_center_is_besieged_by, -1), #center not under siege
(store_faction_of_party, ":party_faction", ":party_no"),
(try_begin),
(this_or_next|eq, ":party_faction", "fac_player_supporters_faction"),
(eq, ":party_faction", "$players_kingdom"),
(assign, ":num_hiring_rounds", 1),
(store_random_in_range, ":random_value", 0, 2),
(val_add, ":num_hiring_rounds", ":random_value"),
(else_try),
(game_get_reduce_campaign_ai, ":reduce_campaign_ai"),
(try_begin),
(eq, ":reduce_campaign_ai", 0), #hard (2x reinforcing)
(assign, ":num_hiring_rounds", 2),
(else_try),
(eq, ":reduce_campaign_ai", 1), #medium (1x or 2x reinforcing)
(assign, ":num_hiring_rounds", 1),
(store_random_in_range, ":random_value", 0, 2),
(val_add, ":num_hiring_rounds", ":random_value"),
(else_try),
(eq, ":reduce_campaign_ai", 2), #easy (1x reinforcing)
(assign, ":num_hiring_rounds", 1),
(try_end),
(try_end),
(try_begin),
(faction_slot_eq, ":party_faction", slot_faction_marshall, ":troop_no"),
(val_add, ":num_hiring_rounds", 1),
(try_end),
(try_for_range, ":unused", 0, ":num_hiring_rounds"),
(call_script, "script_hire_men_to_kingdom_hero_party", ":troop_no"), #Hiring men with current wealth
(try_end),
(try_end),
(try_for_range, ":center_no", walled_centers_begin, walled_centers_end),
(neg|party_slot_eq, ":center_no", slot_town_lord, "trp_player"), #center does not belong to player.
(party_slot_ge, ":center_no", slot_town_lord, 1), #center belongs to someone.
(party_slot_eq, ":center_no", slot_center_is_besieged_by, -1), #center not under siege
(store_faction_of_party, ":center_faction", ":center_no"),
(try_begin),
(this_or_next|eq, ":center_faction", "fac_player_supporters_faction"),
(eq, ":center_faction", "$players_kingdom"),
(assign, ":reinforcement_cost", reinforcement_cost_moderate),
(else_try),
(game_get_reduce_campaign_ai, ":reduce_campaign_ai"),
(assign, ":reinforcement_cost", reinforcement_cost_moderate),
(try_begin),
(eq, ":reduce_campaign_ai", 0), #hard (1x or 2x reinforcing)
(assign, ":reinforcement_cost", reinforcement_cost_hard),
(store_random_in_range, ":num_hiring_rounds", 0, 2),
(val_add, ":num_hiring_rounds", 1),
(else_try),
(eq, ":reduce_campaign_ai", 1), #moderate (1x reinforcing)
(assign, ":reinforcement_cost", reinforcement_cost_moderate),
(assign, ":num_hiring_rounds", 1),
(else_try),
(eq, ":reduce_campaign_ai", 2), #easy (none or 1x reinforcing)
(assign, ":reinforcement_cost", reinforcement_cost_easy),
(store_random_in_range, ":num_hiring_rounds", 0, 2),
(try_end),
(try_end),
(try_for_range, ":unused", 0, ":num_hiring_rounds"),
(party_get_slot, ":cur_wealth", ":center_no", slot_town_wealth),
(assign, ":hiring_budget", ":cur_wealth"),
(val_div, ":hiring_budget", 2),
(gt, ":hiring_budget", ":reinforcement_cost"),
(call_script, "script_cf_reinforce_party", ":center_no"),
(val_sub, ":cur_wealth", ":reinforcement_cost"),
(party_set_slot, ":center_no", slot_town_wealth, ":cur_wealth"),
(try_end),
(try_end),