vb horseback archery (#102)

* vb horseback archery

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

---------

Co-authored-by: Garrett Cox <garrettjcox@gmail.com>
This commit is contained in:
briaguya 2024-04-08 11:59:48 -04:00 committed by GitHub
parent 6d77bbd4a9
commit 9c9fc49d32
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 33 additions and 54 deletions

View File

@ -296,6 +296,8 @@ typedef enum {
GI_VB_GIVE_ITEM_FROM_TALONS_CHICKENS,
// Opt: *EnDivingGame
GI_VB_GIVE_ITEM_FROM_DIVING_MINIGAME,
// Opt: *EnGe1
GI_VB_GIVE_ITEM_FROM_HORSEBACK_ARCHERY,
// Opt: *EnSth
GI_VB_GIVE_ITEM_FROM_SKULLTULA_REWARD,

View File

@ -764,6 +764,14 @@ void RandomizerOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, void
*should = eligible;
break;
}
case GI_VB_GIVE_ITEM_FROM_HORSEBACK_ARCHERY: {
// give both rewards at the same time
if (gSaveContext.minigameScore >= 1500) {
Flags_SetItemGetInf(ITEMGETINF_0F);
}
*should = false;
break;
}
case GI_VB_GIVE_ITEM_FROM_SKULLTULA_REWARD: {
// In z_en_sth.c the rewards are stored in sGetItemIds, the first entry
// in that array is GI_RUPEE_GOLD, and the reward is picked in EnSth_GivePlayerItem

View File

@ -8,6 +8,7 @@
#include "vt.h"
#include "objects/object_ge1/object_ge1.h"
#include "soh/Enhancements/randomizer/randomizer_entrance.h"
#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h"
#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY)
@ -531,16 +532,8 @@ void EnGe1_WaitTillItemGiven_Archery(EnGe1* this, PlayState* play) {
GetItemEntry getItemEntry = (GetItemEntry)GET_ITEM_NONE;
s32 getItemId;
if (Actor_HasParent(&this->actor, play)) {
if (IS_RANDO && gSaveContext.minigameScore >= 1500 && !Flags_GetInfTable(INFTABLE_190)) {
Flags_SetItemGetInf(ITEMGETINF_0F);
Flags_SetInfTable(INFTABLE_190);
this->stateFlags |= GE1_STATE_GIVE_QUIVER;
this->actor.parent = NULL;
return;
} else {
this->actionFunc = EnGe1_SetupWait_Archery;
}
if (Actor_HasParent(&this->actor, play) || !GameInteractor_Should(GI_VB_GIVE_ITEM_FROM_HORSEBACK_ARCHERY, true, this)) {
this->actionFunc = EnGe1_SetupWait_Archery;
if (this->stateFlags & GE1_STATE_GIVE_QUIVER) {
Flags_SetItemGetInf(ITEMGETINF_0F);
@ -549,33 +542,21 @@ void EnGe1_WaitTillItemGiven_Archery(EnGe1* this, PlayState* play) {
}
} else {
if (this->stateFlags & GE1_STATE_GIVE_QUIVER) {
if (!IS_RANDO) {
switch (CUR_UPG_VALUE(UPG_QUIVER)) {
//! @bug Asschest. See next function for details
case 1:
getItemId = GI_QUIVER_40;
break;
case 2:
getItemId = GI_QUIVER_50;
break;
}
} else {
getItemEntry = Randomizer_GetItemFromKnownCheck(RC_GF_HBA_1500_POINTS, CUR_UPG_VALUE(UPG_QUIVER) == 1 ? GI_QUIVER_40 : GI_QUIVER_50);
getItemId = getItemEntry.getItemId;
switch (CUR_UPG_VALUE(UPG_QUIVER)) {
//! @bug Asschest. See next function for details
case 1:
getItemId = GI_QUIVER_40;
break;
case 2:
getItemId = GI_QUIVER_50;
break;
}
} else {
if (!IS_RANDO) {
getItemId = GI_HEART_PIECE;
} else {
getItemEntry = Randomizer_GetItemFromKnownCheck(RC_GF_HBA_1000_POINTS, GI_HEART_PIECE);
getItemId = getItemEntry.getItemId;
}
getItemId = GI_HEART_PIECE;
}
if (!IS_RANDO || getItemEntry.getItemId == GI_NONE) {
if (GameInteractor_Should(GI_VB_GIVE_ITEM_FROM_HORSEBACK_ARCHERY, true, this)) {
Actor_OfferGetItem(&this->actor, play, getItemId, 10000.0f, 50.0f);
} else {
GiveItemEntryFromActor(&this->actor, play, getItemEntry, 10000.0f, 50.0f);
}
}
}
@ -590,33 +571,21 @@ void EnGe1_BeginGiveItem_Archery(EnGe1* this, PlayState* play) {
}
if (this->stateFlags & GE1_STATE_GIVE_QUIVER) {
if (!IS_RANDO) {
switch (CUR_UPG_VALUE(UPG_QUIVER)) {
//! @bug Asschest. See next function for details
case 1:
getItemId = GI_QUIVER_40;
break;
case 2:
getItemId = GI_QUIVER_50;
break;
}
} else {
getItemEntry = Randomizer_GetItemFromKnownCheck(RC_GF_HBA_1500_POINTS, CUR_UPG_VALUE(UPG_QUIVER) == 1 ? GI_QUIVER_40 : GI_QUIVER_50);
getItemId = getItemEntry.getItemId;
switch (CUR_UPG_VALUE(UPG_QUIVER)) {
//! @bug Asschest. See next function for details
case 1:
getItemId = GI_QUIVER_40;
break;
case 2:
getItemId = GI_QUIVER_50;
break;
}
} else {
if (!IS_RANDO) {
getItemId = GI_HEART_PIECE;
} else {
getItemEntry = Randomizer_GetItemFromKnownCheck(RC_GF_HBA_1000_POINTS, GI_HEART_PIECE);
getItemId = getItemEntry.getItemId;
}
getItemId = GI_HEART_PIECE;
}
if (!IS_RANDO || getItemEntry.getItemId == GI_NONE) {
if (GameInteractor_Should(GI_VB_GIVE_ITEM_FROM_HORSEBACK_ARCHERY, true, this)) {
Actor_OfferGetItem(&this->actor, play, getItemId, 10000.0f, 50.0f);
} else {
GiveItemEntryFromActor(&this->actor, play, getItemEntry, 10000.0f, 50.0f);
}
}