From 00929789a1133bae30017dbe5bff225775acf996 Mon Sep 17 00:00:00 2001 From: gymnast86 Date: Sat, 25 Apr 2026 21:43:59 -0700 Subject: [PATCH] add master sword and shadow crystal checks --- src/d/actor/d_a_obj_master_sword.cpp | 22 +++++++++++++++++++ .../randomizer/generator/data/locations.yaml | 10 ++++----- 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/src/d/actor/d_a_obj_master_sword.cpp b/src/d/actor/d_a_obj_master_sword.cpp index cc00bc91f4..43bc4e545b 100644 --- a/src/d/actor/d_a_obj_master_sword.cpp +++ b/src/d/actor/d_a_obj_master_sword.cpp @@ -45,6 +45,21 @@ void daObjMasterSword_c::executeWait() { } if (fopAcM_checkCarryNow(this)) { +#if TARGET_PC + // In rando, give the master sword and shadow crystal location items + if (randomizer_IsActive()) { + u8 itemToGive = randomizer_getItemAtLocation("Sacred Grove Pedestal Master Sword"); + g_randomizerState.addItemToEventQueue(itemToGive); + + itemToGive = randomizer_getItemAtLocation("Sacred Grove Pedestal Shadow Crystal"); + g_randomizerState.addItemToEventQueue(itemToGive); + + // Set the necessary flags to de-spawn the MS and set the save file event flag. + dComIfGs_onTmpBit(0x820); + dComIfGs_onEventBit(0x2120); + return; + } +#endif dMeter2Info_setCloth(dItemNo_WEAR_KOKIRI_e, false); fopAcM_orderMapToolEvent(this, getEventID(), 0xFF, 0xFFFF, 1, 0); } @@ -186,6 +201,13 @@ int daObjMasterSword_c::execute() { mBrk.play(); if (dComIfGs_isTmpBit(dSv_event_tmp_flag_c::tempBitLabels[73])) { +#if TARGET_PC + // Don't automatically give the master sword in randomizer + if (randomizer_IsActive()) { + fopAcM_delete(this); + return 1; + } +#endif dComIfGs_onItemFirstBit(dItemNo_MASTER_SWORD_e); dMeter2Info_setSword(dItemNo_MASTER_SWORD_e, false); dComIfGs_setSelectEquipSword(dItemNo_MASTER_SWORD_e); diff --git a/src/dusk/randomizer/generator/data/locations.yaml b/src/dusk/randomizer/generator/data/locations.yaml index 94f8a3f763..6e4f924107 100644 --- a/src/dusk/randomizer/generator/data/locations.yaml +++ b/src/dusk/randomizer/generator/data/locations.yaml @@ -749,25 +749,23 @@ - Tbox ID: 2 Stage: F_SP117 -# TODO - Name: Sacred Grove Pedestal Master Sword Original Item: Progressive Sword Categories: - Overworld - Sacred Grove - Event - Metadata: - - None + - Location Name Lookup + Metadata: Sacred Grove Pedestal Master Sword -# TODO - Name: Sacred Grove Pedestal Shadow Crystal Original Item: Shadow Crystal Categories: - Overworld - Sacred Grove - Event - Metadata: - - None + - Location Name Lookup + Metadata: Sacred Grove Pedestal Shadow Crystal - Name: Sacred Grove Master Sword Poe Original Item: Poe Soul