mirror of
https://github.com/HarbourMasters/Shipwright
synced 2026-06-10 05:03:29 -04:00
Allow all 8 items in shop to be randomized in No Logic (#6688)
This commit is contained in:
@@ -200,9 +200,11 @@ uint16_t GetCheapBalancedPrice() {
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Get 0 to 7, or a random number from 1-7 depending on shopsanity setting
|
||||
// Get 0 to 8, or a random number, depending on shopsanity setting. The 8th item is only allowed with No Logic,
|
||||
// since logic otherwise requires at least one buyable refill to remain reachable in each shop.
|
||||
int GetShopsanityReplaceAmount() {
|
||||
auto ctx = Rando::Context::GetInstance();
|
||||
const int maxReplace = ctx->GetOption(RSK_LOGIC_RULES).Is(RO_LOGIC_NO_LOGIC) ? 8 : 7;
|
||||
if (ctx->GetOption(RSK_SHOPSANITY).Is(RO_SHOPSANITY_OFF)) {
|
||||
return 0;
|
||||
} else if (ctx->GetOption(RSK_SHOPSANITY).Is(RO_SHOPSANITY_SPECIFIC_COUNT)) {
|
||||
@@ -223,12 +225,12 @@ int GetShopsanityReplaceAmount() {
|
||||
} else if (ctx->GetOption(RSK_SHOPSANITY_COUNT).Is(RO_SHOPSANITY_COUNT_SEVEN_ITEMS)) {
|
||||
return 7;
|
||||
} else if (ctx->GetOption(RSK_SHOPSANITY_COUNT).Is(RO_SHOPSANITY_COUNT_EIGHT_ITEMS)) {
|
||||
return 8; // temporarily unreachable due to logic limitations
|
||||
return maxReplace; // Clamped to 7 unless No Logic
|
||||
} else {
|
||||
assert(false);
|
||||
return 0;
|
||||
}
|
||||
} else { // Random, get number in [1, 7]
|
||||
return Random(1, 8);
|
||||
} else { // Random, get number in [1, maxReplace]
|
||||
return Random(1, maxReplace + 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -321,7 +321,13 @@ void Option::AddWidget(WidgetPath& path) {
|
||||
UIWidgets::IntSliderOptions* sliderOpts =
|
||||
(UIWidgets::IntSliderOptions*)info.options.get();
|
||||
sliderOpts->Format(this->GetOptionText(this->GetOptionIndex()).c_str());
|
||||
sliderOpts->Max(this->options.size() - 1);
|
||||
size_t maxIndex = this->options.size() - 1;
|
||||
if (this->GetKey() == RSK_SHOPSANITY_COUNT && maxIndex > 7 &&
|
||||
CVarGetInteger(CVAR_RANDOMIZER_SETTING("LogicRules"), RO_LOGIC_GLITCHLESS) !=
|
||||
RO_LOGIC_NO_LOGIC) {
|
||||
maxIndex = 7;
|
||||
}
|
||||
sliderOpts->Max(maxIndex);
|
||||
}
|
||||
})
|
||||
.CVar(cvarName.c_str())
|
||||
|
||||
@@ -369,11 +369,9 @@ void Settings::CreateOptionDescriptions() {
|
||||
"\n"
|
||||
"1-7 Items - Vanilla shop items will be shuffled among different shops, and "
|
||||
"each shop will contain 1-7 non-vanilla shop items.\n"
|
||||
/*
|
||||
"\n"
|
||||
"8 Items - All shops will contain 8 non-vanilla shop items.\n"
|
||||
*/
|
||||
;
|
||||
"8 Items - All shops will contain 8 non-vanilla shop items. "
|
||||
"Only available with No Logic, since logic otherwise requires at least one buyable refill per shop.\n";
|
||||
mOptionDescriptions[RSK_SHOPSANITY_PRICES] =
|
||||
"Vanilla - The same price as the item it replaced.\n"
|
||||
"Cheap Balanced - Prices will range between 0 to 95 rupees, favoring lower numbers.\n"
|
||||
|
||||
@@ -636,7 +636,7 @@ void Settings::CreateOptions() {
|
||||
break;
|
||||
}
|
||||
});
|
||||
OPT_U8(RSK_SHOPSANITY_COUNT, "Shops Item Count", {NumOpts(0, 7/*8*/)}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("ShopsanityCount"), mOptionDescriptions[RSK_SHOPSANITY_COUNT], WIDGET_CVAR_SLIDER_INT, 0, false, nullptr, IMFLAG_NONE);
|
||||
OPT_U8(RSK_SHOPSANITY_COUNT, "Shops Item Count", {NumOpts(0, 8)}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("ShopsanityCount"), mOptionDescriptions[RSK_SHOPSANITY_COUNT], WIDGET_CVAR_SLIDER_INT, 0, false, nullptr, IMFLAG_NONE);
|
||||
OPT_U8(RSK_SHOPSANITY_PRICES, "Shops Prices", {"Vanilla", "Cheap Balanced", "Balanced", "Fixed", "Range", "Set By Wallet"}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("ShopsanityPrices"), mOptionDescriptions[RSK_SHOPSANITY_PRICES], WIDGET_CVAR_COMBOBOX, RO_PRICE_VANILLA, false, nullptr, IMFLAG_NONE);
|
||||
OPT_CALLBACK(RSK_SHOPSANITY_PRICES, {
|
||||
HandleShopsanityPriceUI();
|
||||
@@ -1336,6 +1336,10 @@ void Settings::CreateOptions() {
|
||||
OPT_U8(RSK_LOGIC_RULES, "Logic", {"Glitchless", "No Logic"}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("LogicRules"), mOptionDescriptions[RSK_LOGIC_RULES], WIDGET_CVAR_COMBOBOX, RO_LOGIC_GLITCHLESS, false, nullptr, IMFLAG_LABEL_INLINE);
|
||||
OPT_CALLBACK(RSK_LOGIC_RULES, {
|
||||
HandleStartingAgeUI();
|
||||
if (CVarGetInteger(CVAR_RANDOMIZER_SETTING("LogicRules"), RO_LOGIC_GLITCHLESS) != RO_LOGIC_NO_LOGIC &&
|
||||
CVarGetInteger(CVAR_RANDOMIZER_SETTING("ShopsanityCount"), 0) > 7) {
|
||||
CVarSetInteger(CVAR_RANDOMIZER_SETTING("ShopsanityCount"), 7);
|
||||
}
|
||||
});
|
||||
OPT_BOOL(RSK_ALL_LOCATIONS_REACHABLE, "All Locations Reachable", {"Off", "On"}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("AllLocationsReachable"), mOptionDescriptions[RSK_ALL_LOCATIONS_REACHABLE], WIDGET_CVAR_CHECKBOX, RO_GENERIC_ON, false, nullptr, IMFLAG_SAME_LINE);
|
||||
OPT_BOOL(RSK_SKULLS_SUNS_SONG, "Night Skulltula's Expect Sun's Song", CVAR_RANDOMIZER_SETTING("GsExpectSunsSong"), mOptionDescriptions[RSK_SKULLS_SUNS_SONG]);
|
||||
|
||||
Reference in New Issue
Block a user