(store_script_param, ":horse_chance", 1),
(store_script_param, ":lance_chance", 2),
(store_script_param, ":sword_chance", 3),
(store_script_param, ":axe_chance", 4),
(store_script_param, ":bow_chance", 5),
(store_script_param, ":javelin_chance", 6),
(store_script_param, ":mounted_bow_chance", 7),
(store_script_param, ":crossbow_sword_chance", 8),
(store_script_param, ":armor_item_begin", 9),
(store_script_param, ":helm_item_begin", 10),
(store_script_param, ":shield_item", 11),
(store_script_param, ":horse_item", 12),
(store_add, ":total_chance", ":sword_chance", ":axe_chance"),
(val_add, ":total_chance", ":crossbow_sword_chance"),
#we pull some items out of a hat.
(party_get_slot, ":town_original_faction", "$current_town", slot_center_original_faction),
(item_get_slot, ":sword_item", itp_type_one_handed_wpn, ":town_original_faction"),
(item_get_slot, ":twohand_item", itp_type_two_handed_wpn, ":town_original_faction"),
# (try_begin),
# (eq, ":two_handed_item", -1),
# (assign, ":two_handed_item", "itm_arena_sword_two_handed"),
# (try_end),
(item_get_slot, ":polearm_item", itp_type_polearm, ":town_original_faction"),
(try_begin),
(item_get_slot, ":polearm_alt", ":polearm_item", slot_item_positions_begin),
(try_begin),
(gt, ":polearm_alt", 0),
(assign, ":polearm_item", ":polearm_alt"),
(try_end),
(try_end),
(assign, "$g_attacker_drawn_weapon", ":polearm_item"),
(item_get_slot, ":bow_item", itp_type_bow, ":town_original_faction"),#no crossbow
(try_begin),
(eq, ":bow_item", -1),
(assign, ":bow_item", "itm_practice_bow"),
(try_end),
(item_get_slot, ":thrown_item", itp_type_thrown, ":town_original_faction"),
(try_begin),
(eq, ":thrown_item", -1),
(assign, ":thrown_item", "itm_practice_javelin"),
(try_end),
(item_get_slot, ":gun_item", itp_type_musket, ":town_original_faction"),
(try_begin),
(eq, ":gun_item", -1),
(assign, ":gun_item", "itm_practice_firearm"),
(try_end),
#got all items
(try_for_range, ":i_ep", 0, 32),
(mission_tpl_entry_clear_override_items, "mt_arena_melee_fight", ":i_ep"),
(assign, ":has_horse", 0),
(store_div, ":cur_team", ":i_ep", 8),
(try_begin),
(store_random_in_range, ":random_no", 0, 100),
(lt, ":random_no", ":horse_chance"),
(assign, ":has_horse", 1),
(mission_tpl_entry_add_override_item, "mt_arena_melee_fight", ":i_ep", ":horse_item"),
(try_end),
(try_begin),
(eq, ":has_horse", 1),
(store_add, ":cur_total_chance", ":total_chance", ":lance_chance"),
(val_add, ":cur_total_chance", ":javelin_chance"),
(val_add, ":cur_total_chance", ":mounted_bow_chance"),
#(mission_tpl_entry_add_override_item, "mt_arena_melee_fight", ":i_ep", "itm_mail_mittens"),
(else_try),
(store_add, ":cur_total_chance", ":total_chance", ":bow_chance"),
#(mission_tpl_entry_add_override_item, "mt_arena_melee_fight", ":i_ep", "itm_leather_gloves"),
(try_end),
#arbitrary gloves are no longer necessary since they are no longer overriden
(store_random_in_range, ":random_no", 0, ":cur_total_chance"),
#(store_add, ":cur_shield_item", "itm_arena_shield_red", ":cur_team"),
(try_begin),
(val_sub, ":random_no", ":sword_chance"),
(lt, ":random_no", 0),
(try_begin),
(store_random_in_range, ":sub_random_no", 0, 100),
(lt, ":sub_random_no", 50),
(mission_tpl_entry_add_override_item, "mt_arena_melee_fight", ":i_ep", ":sword_item"),
(mission_tpl_entry_add_override_item, "mt_arena_melee_fight", ":i_ep", ":shield_item"),
(else_try),
(mission_tpl_entry_add_override_item, "mt_arena_melee_fight", ":i_ep", ":twohand_item"),
(try_end),
(else_try),
(val_sub, ":random_no", ":axe_chance"),
(lt, ":random_no", 0),
(mission_tpl_entry_add_override_item, "mt_arena_melee_fight", ":i_ep", "itm_arena_axe"),
(mission_tpl_entry_add_override_item, "mt_arena_melee_fight", ":i_ep", ":shield_item"),
(else_try),
(val_sub, ":random_no", ":crossbow_sword_chance"),
(lt, ":random_no", 0),
(mission_tpl_entry_add_override_item, "mt_arena_melee_fight", ":i_ep", ":sword_item"),
(mission_tpl_entry_add_override_item, "mt_arena_melee_fight", ":i_ep", ":gun_item"),
(mission_tpl_entry_add_override_item, "mt_arena_melee_fight", ":i_ep", "itm_cartridges"),
(else_try),
(eq, ":has_horse", 0),
(val_sub, ":random_no", ":bow_chance"),
(lt, ":random_no", 0),
(mission_tpl_entry_add_override_item, "mt_arena_melee_fight", ":i_ep", ":bow_item"),
(mission_tpl_entry_add_override_item, "mt_arena_melee_fight", ":i_ep", "itm_practice_arrows"),
(mission_tpl_entry_add_override_item, "mt_arena_melee_fight", ":i_ep", "itm_dagger"),
(else_try),
(eq, ":has_horse", 1),
(val_sub, ":random_no", ":lance_chance"),
(lt, ":random_no", 0),
(mission_tpl_entry_add_override_item, "mt_arena_melee_fight", ":i_ep", ":polearm_item"),
(mission_tpl_entry_add_override_item, "mt_arena_melee_fight", ":i_ep", "itm_practice_mace"),
(mission_tpl_entry_add_override_item, "mt_arena_melee_fight", ":i_ep", ":shield_item"),
(else_try),
(eq, ":has_horse", 1),
(val_sub, ":random_no", ":javelin_chance"),
(lt, ":random_no", 0),
(mission_tpl_entry_add_override_item, "mt_arena_melee_fight", ":i_ep", ":thrown_item"),
(mission_tpl_entry_add_override_item, "mt_arena_melee_fight", ":i_ep", ":thrown_item"),
(mission_tpl_entry_add_override_item, "mt_arena_melee_fight", ":i_ep", ":shield_item"),
(mission_tpl_entry_add_override_item, "mt_arena_melee_fight", ":i_ep", "itm_arena_sword"),
(else_try),
(eq, ":has_horse", 1),
(val_sub, ":random_no", ":mounted_bow_chance"),
(lt, ":random_no", 0),
(mission_tpl_entry_add_override_item, "mt_arena_melee_fight", ":i_ep", ":bow_item"),
(mission_tpl_entry_add_override_item, "mt_arena_melee_fight", ":i_ep", "itm_practice_arrows"),
(mission_tpl_entry_add_override_item, "mt_arena_melee_fight", ":i_ep", ":sword_item"),
(try_end),
(try_begin),
(ge, ":armor_item_begin", 0),
(store_add, ":cur_armor_item", ":armor_item_begin", ":cur_team"),
(mission_tpl_entry_add_override_item, "mt_arena_melee_fight", ":i_ep", ":cur_armor_item"),
(try_end),
(try_begin),
(ge, ":helm_item_begin", 0),
(store_add, ":cur_helm_item", ":helm_item_begin", ":cur_team"),
(mission_tpl_entry_add_override_item, "mt_arena_melee_fight", ":i_ep", ":cur_helm_item"),
(try_end),
(try_end),
]),