Make the final Magic Bean cost 99 rupees in randomiser when it is not shuffled (#3392)

* Make rando final eban cost 99 and clean up Text IDs

* Remove Text ID changes

* Add french translation, All credit to Purple hato

Co-authored-by: Purple Hato <linkvssangoku.jr@gmail.com>

---------

Co-authored-by: Purple Hato <linkvssangoku.jr@gmail.com>
This commit is contained in:
Pepper0ni
2024-02-16 01:20:12 +00:00
committed by GitHub
parent 46aea3aa7c
commit 0932e1e504
4 changed files with 70 additions and 25 deletions
+41 -18
View File
@@ -18,6 +18,7 @@ void EnMs_SetOfferText(EnMs* this, PlayState* play);
void EnMs_Wait(EnMs* this, PlayState* play);
void EnMs_Talk(EnMs* this, PlayState* play);
void EnMs_Sell(EnMs* this, PlayState* play);
void EnMs_Sell_Rando(EnMs* this, PlayState* play);
void EnMs_TalkAfterPurchase(EnMs* this, PlayState* play);
const ActorInit En_Ms_InitVars = {
@@ -49,6 +50,10 @@ static s16 sPrices[] = {
10, 20, 30, 40, 50, 60, 70, 80, 90, 100,
};
static s16 sRandoPrices[] = {
10, 20, 30, 40, 50, 60, 70, 80, 90, 99,
};
static u16 sOfferTextIDs[] = {
0x405E, 0x405F, 0x4060, 0x4061, 0x4062, 0x4063, 0x4064, 0x4065, 0x4066, 0x4067,
};
@@ -127,21 +132,30 @@ void EnMs_Talk(EnMs* this, PlayState* play) {
} else if (Message_ShouldAdvance(play)) {
switch (play->msgCtx.choiceIndex) {
case 0: // yes
if (gSaveContext.rupees <
((IS_RANDO && Randomizer_GetSettingValue(RSK_SHUFFLE_MAGIC_BEANS))
? 60
: sPrices[BEANS_BOUGHT])) {
Message_ContinueTextbox(play, 0x4069); // not enough rupees text
//Randomizer Mechanic: Magic bean salesman
if (IS_RANDO){
if (gSaveContext.rupees < ((Randomizer_GetSettingValue(RSK_SHUFFLE_MAGIC_BEANS)) ? 60 : sRandoPrices[BEANS_BOUGHT])) {
Message_ContinueTextbox(play, 0x4069); // TEXT_BEAN_SALESMAN_NOT_ENOUGH_MONEY
return;
}
if (Randomizer_GetSettingValue(RSK_SHUFFLE_MAGIC_BEANS)){
GiveItemEntryFromActor(&this->actor, play,
Randomizer_GetItemFromKnownCheck(RC_ZR_MAGIC_BEAN_SALESMAN, GI_BEAN), 90.0f, 10.0f);
} else {
func_8002F434(&this->actor, play, GI_BEAN, 90.0f, 10.0f);
}
this->actionFunc = EnMs_Sell_Rando;
return;
} else { // vanilla code
if(gSaveContext.rupees < sPrices[BEANS_BOUGHT]){
Message_ContinueTextbox(play, 0x4069); // TEXT_BEAN_SALESMAN_NOT_ENOUGH_MONEY
return;
}
func_8002F434(&this->actor, play, GI_BEAN, 90.0f, 10.0f);
this->actionFunc = EnMs_Sell;
return;
}
if (IS_RANDO && Randomizer_GetSettingValue(RSK_SHUFFLE_MAGIC_BEANS)) {
GiveItemEntryFromActor(&this->actor, play,
Randomizer_GetItemFromKnownCheck(RC_ZR_MAGIC_BEAN_SALESMAN, GI_BEAN), 90.0f, 10.0f);
} else {
func_8002F434(&this->actor, play, GI_BEAN, 90.0f, 10.0f);
}
this->actionFunc = EnMs_Sell;
return;
//Randomizer Mechanic end
case 1: // no
Message_ContinueTextbox(play, 0x4068);
default:
@@ -150,14 +164,13 @@ void EnMs_Talk(EnMs* this, PlayState* play) {
}
}
void EnMs_Sell(EnMs* this, PlayState* play) {
void EnMs_Sell_Rando(EnMs* this, PlayState* play) {
if (Actor_HasParent(&this->actor, play)) {
Rupees_ChangeBy((IS_RANDO && Randomizer_GetSettingValue(RSK_SHUFFLE_MAGIC_BEANS)) ? -60 : -sPrices[BEANS_BOUGHT]);
Rupees_ChangeBy((Randomizer_GetSettingValue(RSK_SHUFFLE_MAGIC_BEANS)) ? -60 : -sRandoPrices[BEANS_BOUGHT]);
this->actor.parent = NULL;
this->actionFunc =
(IS_RANDO && Randomizer_GetSettingValue(RSK_SHUFFLE_MAGIC_BEANS)) ? EnMs_Wait : EnMs_TalkAfterPurchase;
this->actionFunc = (Randomizer_GetSettingValue(RSK_SHUFFLE_MAGIC_BEANS)) ? EnMs_Wait : EnMs_TalkAfterPurchase;
} else {
if (IS_RANDO && Randomizer_GetSettingValue(RSK_SHUFFLE_MAGIC_BEANS)) {
if (Randomizer_GetSettingValue(RSK_SHUFFLE_MAGIC_BEANS)) {
GetItemEntry itemEntry = Randomizer_GetItemFromKnownCheck(RC_ZR_MAGIC_BEAN_SALESMAN, GI_BEAN);
gSaveContext.pendingSale = itemEntry.itemId;
gSaveContext.pendingSaleMod = itemEntry.modIndex;
@@ -172,6 +185,16 @@ void EnMs_Sell(EnMs* this, PlayState* play) {
}
}
void EnMs_Sell(EnMs* this, PlayState* play) {
if (Actor_HasParent(&this->actor, play)) {
Rupees_ChangeBy(-sPrices[BEANS_BOUGHT]);
this->actor.parent = NULL;
this->actionFunc = EnMs_TalkAfterPurchase;
} else {
func_8002F434(&this->actor, play, GI_BEAN, 90.0f, 10.0f);
}
}
void EnMs_TalkAfterPurchase(EnMs* this, PlayState* play) {
// if dialog state is 6 and player responded to textbox
if ((Message_GetState(&play->msgCtx)) == TEXT_STATE_DONE && Message_ShouldAdvance(play)) {