#script_update_villages_infested_by_bandits
# INPUT: none
# OUTPUT: none
("update_villages_infested_by_bandits",
[(try_for_range, ":village_no", villages_begin, villages_end),
(try_begin),
(check_quest_active, "qst_eliminate_bandits_infesting_village"),
(quest_slot_eq, "qst_eliminate_bandits_infesting_village", slot_quest_target_center, ":village_no"),
(quest_get_slot, ":cur_state", "qst_eliminate_bandits_infesting_village", slot_quest_current_state),
(val_add, ":cur_state", 1),
(try_begin),
(lt, ":cur_state", 3),
(quest_set_slot, "qst_eliminate_bandits_infesting_village", slot_quest_current_state, ":cur_state"),
(else_try),
(party_set_slot, ":village_no", slot_village_infested_by_bandits, 0),
(call_script, "script_abort_quest", "qst_eliminate_bandits_infesting_village", 2),
(try_end),
(else_try),
(check_quest_active, "qst_deal_with_bandits_at_lords_village"),
(quest_slot_eq, "qst_deal_with_bandits_at_lords_village", slot_quest_target_center, ":village_no"),
(quest_get_slot, ":cur_state", "qst_deal_with_bandits_at_lords_village", slot_quest_current_state),
(val_add, ":cur_state", 1),
(try_begin),
(lt, ":cur_state", 3),
(quest_set_slot, "qst_deal_with_bandits_at_lords_village", slot_quest_current_state, ":cur_state"),
(else_try),
(party_set_slot, ":village_no", slot_village_infested_by_bandits, 0),
(call_script, "script_abort_quest", "qst_deal_with_bandits_at_lords_village", 2),
(try_end),
(else_try),
(party_set_slot, ":village_no", slot_village_infested_by_bandits, 0),
(store_random_in_range, ":random_no", 0, 100),
(lt, ":random_no", 3),
(store_random_in_range, ":random_no", 0, 3),
(try_begin),
(eq, ":random_no", 0),
(assign, ":bandit_troop", "trp_bandit"),
(else_try),
(eq, ":random_no", 1),
(assign, ":bandit_troop", "trp_mountain_bandit"),
(else_try),
(assign, ":bandit_troop", "trp_forest_bandit"),
(try_end),
(party_set_slot, ":village_no", slot_village_infested_by_bandits, ":bandit_troop"),
#Reduce prosperity of the village by 3
(call_script, "script_change_center_prosperity", ":village_no", -3),
(try_begin),
(eq, "$cheat_mode", 1),
(str_store_party_name, s1, ":village_no"),
(display_message, "@{s1} is infested by bandits."),
(try_end),
(try_end),
(try_end),
]),