Skip to content

Commit

Permalink
Merge pull request #3 from Archez/fix-chaos-rando-chu-give
Browse files Browse the repository at this point in the history
fix givechus when in chus in logic
  • Loading branch information
CDi-Fails authored Nov 17, 2022
2 parents 6e5981f + 29064f8 commit 2e49416
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions soh/soh/Enhancements/chaos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <variables.h>
#undef Polygon

#include "../OTRGlobals.h"
#include "debugconsole.h"

#include <algorithm>
Expand Down Expand Up @@ -180,10 +181,15 @@ static std::map<uint8_t, CommandCreator> kCommands {
CMD_TAKE_AMMO(0x84, ITEM_BOW),
CMD_TAKE_AMMO(0x85, ITEM_SLINGSHOT),

// You can carry 50 chus if you can carry bombs, 0 otherwise
CMD_ONE_SHOT(0xC0, PL_BYTES(sizeof(uint32_t)), {
// You can carry 50 chus if you have bomb bag when chus are not in logic, or have found chus previously with chus in logic
CMD_ONE_SHOT(0xC0, PL_BYTES(sizeof(uint32_t)), {
uint32_t amt = Read<uint32_t>(payload, 0);
auto cap = CUR_CAPACITY(UPG_BOMB_BAG) > 0 ? 50 : 0;
size_t cap = 50;
bool bombchusInLogic = OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_BOMBCHUS_IN_LOGIC);
if ((bombchusInLogic && INV_CONTENT(ITEM_BOMBCHU) == ITEM_NONE) ||
(!bombchusInLogic && CUR_CAPACITY(UPG_BOMB_BAG) == 0)) {
cap = 0;
}
AMMO(ITEM_BOMBCHU) = s_add(AMMO(ITEM_BOMBCHU), amt, cap);
}),
CMD_GIVE_AMMO(0xC1, ITEM_STICK, UPG_STICKS),
Expand Down

0 comments on commit 2e49416

Please sign in to comment.