mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2024-11-22 09:22:18 -05:00
vb skull rewards (#101)
This commit is contained in:
parent
307e106038
commit
6d77bbd4a9
@ -296,6 +296,8 @@ typedef enum {
|
||||
GI_VB_GIVE_ITEM_FROM_TALONS_CHICKENS,
|
||||
// Opt: *EnDivingGame
|
||||
GI_VB_GIVE_ITEM_FROM_DIVING_MINIGAME,
|
||||
// Opt: *EnSth
|
||||
GI_VB_GIVE_ITEM_FROM_SKULLTULA_REWARD,
|
||||
|
||||
GI_VB_GIVE_ITEM_FAIRY_OCARINA,
|
||||
GI_VB_GIVE_ITEM_WEIRD_EGG,
|
||||
|
@ -24,6 +24,7 @@ extern "C" {
|
||||
#include "src/overlays/actors/ovl_En_Ms/z_en_ms.h"
|
||||
#include "src/overlays/actors/ovl_En_Fr/z_en_fr.h"
|
||||
#include "src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.h"
|
||||
#include "src/overlays/actors/ovl_En_Sth/z_en_sth.h"
|
||||
#include "adult_trade_shuffle.h"
|
||||
extern SaveContext gSaveContext;
|
||||
extern PlayState* gPlayState;
|
||||
@ -763,6 +764,33 @@ void RandomizerOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, void
|
||||
*should = eligible;
|
||||
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
|
||||
// via sGetItemIds[this->actor.params]. This means if actor.params == 0 we're looking
|
||||
// at the 100 GS reward
|
||||
EnSth* enSth = static_cast<EnSth*>(optionalArg);
|
||||
if (enSth->actor.params == 0) {
|
||||
// if nothing is shuffled onto 100 GS,
|
||||
// or we already got the 100 GS reward,
|
||||
// let the player farm
|
||||
if (!RAND_GET_OPTION(RSK_SHUFFLE_100_GS_REWARD) ||
|
||||
Flags_GetRandomizerInf(RAND_INF_KAK_100_GOLD_SKULLTULA_REWARD)) {
|
||||
*should = true;
|
||||
break;
|
||||
}
|
||||
|
||||
// we're giving the 100 GS rando reward! set the rando inf
|
||||
Flags_SetRandomizerInf(RAND_INF_KAK_100_GOLD_SKULLTULA_REWARD);
|
||||
|
||||
// also set the actionfunc so this doesn't immediately get
|
||||
// called again (and lead to a vanilla+rando item give
|
||||
// because the flag check will pass next time)
|
||||
enSth->actionFunc = (EnSthActionFunc)EnSth_RewardObtainedTalk;
|
||||
}
|
||||
*should = false;
|
||||
break;
|
||||
}
|
||||
case GI_VB_TRADE_TIMER_ODD_MUSHROOM:
|
||||
case GI_VB_TRADE_TIMER_EYEDROPS:
|
||||
case GI_VB_TRADE_TIMER_FROG:
|
||||
|
@ -257,66 +257,34 @@ void EnSth_ParentRewardObtainedWait(EnSth* this, PlayState* play) {
|
||||
|
||||
void EnSth_GivePlayerItem(EnSth* this, PlayState* play) {
|
||||
u16 getItemId = sGetItemIds[this->actor.params];
|
||||
GetItemEntry getItemEntry = (GetItemEntry)GET_ITEM_NONE;
|
||||
|
||||
if (IS_RANDO) {
|
||||
switch (getItemId) {
|
||||
case GI_RUPEE_GOLD:
|
||||
if (!Flags_GetRandomizerInf(RAND_INF_KAK_100_GOLD_SKULLTULA_REWARD)) {
|
||||
getItemEntry = Randomizer_GetItemFromKnownCheck(RC_KAK_100_GOLD_SKULLTULA_REWARD, GI_RUPEE_GOLD);
|
||||
Flags_SetRandomizerInf(RAND_INF_KAK_100_GOLD_SKULLTULA_REWARD);
|
||||
}
|
||||
break;
|
||||
case GI_WALLET_ADULT:
|
||||
getItemEntry = Randomizer_GetItemFromKnownCheck(RC_KAK_10_GOLD_SKULLTULA_REWARD, GI_WALLET_ADULT);
|
||||
break;
|
||||
case GI_STONE_OF_AGONY:
|
||||
getItemEntry = Randomizer_GetItemFromKnownCheck(RC_KAK_20_GOLD_SKULLTULA_REWARD, GI_STONE_OF_AGONY);
|
||||
break;
|
||||
case GI_WALLET_GIANT:
|
||||
getItemEntry = Randomizer_GetItemFromKnownCheck(RC_KAK_30_GOLD_SKULLTULA_REWARD, GI_WALLET_GIANT);
|
||||
break;
|
||||
case GI_BOMBCHUS_10:
|
||||
getItemEntry = Randomizer_GetItemFromKnownCheck(RC_KAK_40_GOLD_SKULLTULA_REWARD, GI_BOMBCHUS_10);
|
||||
break;
|
||||
case GI_HEART_PIECE:
|
||||
getItemEntry = Randomizer_GetItemFromKnownCheck(RC_KAK_50_GOLD_SKULLTULA_REWARD, GI_HEART_PIECE);
|
||||
break;
|
||||
}
|
||||
getItemId = getItemEntry.getItemId;
|
||||
} else {
|
||||
switch (this->actor.params) {
|
||||
case 1:
|
||||
case 3:
|
||||
switch (CUR_UPG_VALUE(UPG_WALLET)) {
|
||||
case 0:
|
||||
getItemId = GI_WALLET_ADULT;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
getItemId = GI_WALLET_GIANT;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
switch (this->actor.params) {
|
||||
case 1:
|
||||
case 3:
|
||||
switch (CUR_UPG_VALUE(UPG_WALLET)) {
|
||||
case 0:
|
||||
getItemId = GI_WALLET_ADULT;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
getItemId = GI_WALLET_GIANT;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (!IS_RANDO || getItemEntry.getItemId == GI_NONE) {
|
||||
Actor_OfferGetItem(&this->actor, play, getItemId, 10000.0f, 50.0f);
|
||||
} else {
|
||||
GiveItemEntryFromActor(&this->actor, play, getItemEntry, 10000.0f, 50.0f);
|
||||
}
|
||||
Actor_OfferGetItem(&this->actor, play, getItemId, 10000.0f, 50.0f);
|
||||
}
|
||||
|
||||
void EnSth_GiveReward(EnSth* this, PlayState* play) {
|
||||
if (Actor_HasParent(&this->actor, play)) {
|
||||
if (Actor_HasParent(&this->actor, play) || !GameInteractor_Should(GI_VB_GIVE_ITEM_FROM_SKULLTULA_REWARD, true, this)) {
|
||||
this->actor.parent = NULL;
|
||||
EnSth_SetupAction(this, EnSth_RewardObtainedTalk);
|
||||
gSaveContext.eventChkInf[EVENTCHKINF_SKULLTULA_REWARD_INDEX] |= this->eventFlag;
|
||||
if (this->eventFlag != 0) {
|
||||
GameInteractor_ExecuteOnFlagSet(FLAG_EVENT_CHECK_INF, (EVENTCHKINF_SKULLTULA_REWARD_INDEX << 4) + sEventFlagsShift[this->actor.params]);
|
||||
}
|
||||
} else {
|
||||
} else if (GameInteractor_Should(GI_VB_GIVE_ITEM_FROM_SKULLTULA_REWARD, true, this)) {
|
||||
EnSth_GivePlayerItem(this, play);
|
||||
}
|
||||
EnSth_FacePlayer(this, play);
|
||||
@ -326,7 +294,9 @@ void EnSth_RewardUnobtainedTalk(EnSth* this, PlayState* play) {
|
||||
if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) {
|
||||
Message_CloseTextbox(play);
|
||||
EnSth_SetupAction(this, EnSth_GiveReward);
|
||||
EnSth_GivePlayerItem(this, play);
|
||||
if (GameInteractor_Should(GI_VB_GIVE_ITEM_FROM_SKULLTULA_REWARD, true, this)) {
|
||||
EnSth_GivePlayerItem(this, play);
|
||||
}
|
||||
}
|
||||
EnSth_FacePlayer(this, play);
|
||||
}
|
||||
|
@ -25,4 +25,6 @@ typedef struct EnSth {
|
||||
/* 0x02B8 */ EnSthActionFunc actionFunc;
|
||||
} EnSth; // size = 0x02BC
|
||||
|
||||
void EnSth_RewardObtainedTalk(EnSth* enSth, PlayState* play);
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user