Fix for LACS awarding everywhere (#4348)

* Fix for LACS awarding everywhere

* Update soh/soh/Enhancements/randomizer/hook_handlers.cpp

Co-authored-by: Pepe20129 <72659707+Pepe20129@users.noreply.github.com>

---------

Co-authored-by: Pepe20129 <72659707+Pepe20129@users.noreply.github.com>
This commit is contained in:
Garrett Cox 2024-09-19 11:16:31 -05:00 committed by GitHub
parent ee02e503fc
commit 2434eb82bf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -637,7 +637,11 @@ void RandomizerOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, void
*should = !Flags_GetRandomizerInf(RAND_INF_DARUNIAS_JOY);
break;
case VB_BE_ELIGIBLE_FOR_LIGHT_ARROWS:
*should = !Flags_GetEventChkInf(EVENTCHKINF_RETURNED_TO_TEMPLE_OF_TIME_WITH_ALL_MEDALLIONS) && MeetsLACSRequirements();
*should =
LINK_IS_ADULT &&
(gEntranceTable[gSaveContext.entranceIndex].scene == SCENE_TEMPLE_OF_TIME) &&
!Flags_GetEventChkInf(EVENTCHKINF_RETURNED_TO_TEMPLE_OF_TIME_WITH_ALL_MEDALLIONS) &&
MeetsLACSRequirements();
break;
case VB_BE_ELIGIBLE_FOR_NOCTURNE_OF_SHADOW:
*should =
@ -1212,6 +1216,7 @@ void RandomizerOnSceneInitHandler(int16_t sceneNum) {
updateHook = 0;
}
// If we're not in the Temple of Time or we've already learned the Prelude of Light and received LACs, we don't need to do anything
if (
sceneNum != SCENE_TEMPLE_OF_TIME ||
(
@ -1225,15 +1230,18 @@ void RandomizerOnSceneInitHandler(int16_t sceneNum) {
Flags_SetEventChkInf(EVENTCHKINF_LEARNED_PRELUDE_OF_LIGHT);
}
if (!Flags_GetEventChkInf(EVENTCHKINF_RETURNED_TO_TEMPLE_OF_TIME_WITH_ALL_MEDALLIONS) && MeetsLACSRequirements()) {
// We're always in rando here, and rando always overrides this should so we can just pass false
if (GameInteractor_Should(VB_BE_ELIGIBLE_FOR_LIGHT_ARROWS, false, NULL)) {
Flags_SetEventChkInf(EVENTCHKINF_RETURNED_TO_TEMPLE_OF_TIME_WITH_ALL_MEDALLIONS);
}
// If both awards have been given, we can unregister the hook, otherwise it will get unregistered when the player leaves the area
if (
Flags_GetEventChkInf(EVENTCHKINF_LEARNED_PRELUDE_OF_LIGHT) &&
Flags_GetEventChkInf(EVENTCHKINF_RETURNED_TO_TEMPLE_OF_TIME_WITH_ALL_MEDALLIONS)
) {
GameInteractor::Instance->UnregisterGameHook<GameInteractor::OnPlayerUpdate>(updateHook);
updateHook = 0;
}
});
}