From 5170898a770a1701645ab8867247e740364199b5 Mon Sep 17 00:00:00 2001 From: Scipio Wright Date: Sun, 4 Aug 2024 18:46:11 -0400 Subject: [PATCH] Making the fix better (thanks medic) --- worlds/tunic/combat_logic.py | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/worlds/tunic/combat_logic.py b/worlds/tunic/combat_logic.py index 3f21f88872..7872645801 100644 --- a/worlds/tunic/combat_logic.py +++ b/worlds/tunic/combat_logic.py @@ -77,6 +77,11 @@ def has_combat_reqs(area_name: str, state: CollectionState, player: int) -> bool return state.tunic_area_combat_state[player][area_name] == CombatState.succeeded met_combat_reqs = check_combat_reqs(area_name, state, player) + + # we want to skip the "none area" since we don't record its results + if area_name not in area_data.keys(): + return met_combat_reqs + # loop through the lists and set the easier/harder area states accordingly if area_name in boss_areas: area_list = boss_areas @@ -85,22 +90,20 @@ def has_combat_reqs(area_name: str, state: CollectionState, player: int) -> bool else: area_list = [area_name] - # we want to skip the "none area" - if area_name in area_data.keys(): - if met_combat_reqs: - # set the state as true for each area until you get to the area we're looking at - for name in area_list: - state.tunic_area_combat_state[player][name] = CombatState.succeeded - if name == area_name: - break - else: - # set the state as false for the area we're looking at and each area after that - reached_name = False - for name in area_list: - if name == area_name: - reached_name = True - if reached_name: - state.tunic_area_combat_state[player][name] = CombatState.failed + if met_combat_reqs: + # set the state as true for each area until you get to the area we're looking at + for name in area_list: + state.tunic_area_combat_state[player][name] = CombatState.succeeded + if name == area_name: + break + else: + # set the state as false for the area we're looking at and each area after that + reached_name = False + for name in area_list: + if name == area_name: + reached_name = True + if reached_name: + state.tunic_area_combat_state[player][name] = CombatState.failed return met_combat_reqs