diff options
| author | Garrett Cox <garrettjcox@gmail.com> | 2025-01-05 15:39:35 -0600 |
|---|---|---|
| committer | Garrett Cox <garrettjcox@gmail.com> | 2025-01-05 15:39:35 -0600 |
| commit | 83dbf7e6ea3cebd267e2c6f5e4dc9d8999a9a232 (patch) | |
| tree | b7b3aa2f8333cd5ac5d5533864029b39e2595bf4 /mm/2s2h/Rando/ActorBehavior/EnGs.cpp | |
| parent | 0583764e7a30c09e871d24f65a11718400a3ffcd (diff) | |
Balance purchase-able hint cost
Diffstat (limited to 'mm/2s2h/Rando/ActorBehavior/EnGs.cpp')
| -rw-r--r-- | mm/2s2h/Rando/ActorBehavior/EnGs.cpp | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/mm/2s2h/Rando/ActorBehavior/EnGs.cpp b/mm/2s2h/Rando/ActorBehavior/EnGs.cpp index c84bca68e..cc48ced39 100644 --- a/mm/2s2h/Rando/ActorBehavior/EnGs.cpp +++ b/mm/2s2h/Rando/ActorBehavior/EnGs.cpp @@ -16,15 +16,20 @@ std::unordered_map<RandoCheckId, std::string> readableCheckNamesForGs; #define FIRST_GS_MESSAGE 0x20D1 #define SECOND_GS_MESSAGE 0x20C0 -s32 GetObtainedChecksAmount() { +s32 GetNormalizedCost() { s32 obtainedChecks = 0; + s32 maxChecks = 0; for (auto& [randoCheckId, _] : Rando::StaticData::Checks) { RandoSaveCheck saveCheck = RANDO_SAVE_CHECKS[randoCheckId]; - if (saveCheck.shuffled && saveCheck.obtained) { - obtainedChecks++; + if (saveCheck.shuffled) { + maxChecks++; + if (saveCheck.obtained) { + obtainedChecks++; + } } } - return obtainedChecks; + + return MAX(10, MIN(500, 10 + (obtainedChecks * (500 - 10)) / (maxChecks))); } RandoCheckId GetRandomCheck(bool repeatableOnlyObtained = false) { @@ -93,8 +98,8 @@ void Rando::ActorBehavior::InitEnGsBehavior() { CustomMessage::AddLineBreaks(&entry.msg); // Eventually this part should be opt-in, but for now it's always on - entry.msg += "\x13\x12...\x13\x12Trade %r{{rupees}} Rupees%w for another hint?\x11\xC2Yes\x11No"; - s32 cost = MAX(10, MIN(500, GetObtainedChecksAmount() * 2)); + entry.msg += "\x13\x12...\x13\x12Trade %r{{rupees}} Rupees%w for another hint?\x11\xC2No\x11Yes"; + s32 cost = GetNormalizedCost(); CustomMessage::Replace(&entry.msg, "{{rupees}}", std::to_string(cost)); CustomMessage::ReplaceColorChars(&entry.msg); @@ -109,8 +114,8 @@ void Rando::ActorBehavior::InitEnGsBehavior() { auto entry = CustomMessage::LoadVanillaMessageTableEntry(*textId); - if (msgCtx->choiceIndex == 0) { - s32 cost = MAX(10, MIN(500, GetObtainedChecksAmount() * 2)); + if (msgCtx->choiceIndex == 1) { + s32 cost = GetNormalizedCost(); RandoCheckId randoCheckId = GetRandomCheck(true); if (gSaveContext.save.saveInfo.playerData.rupees < cost) { |
