mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2024-11-01 08:05:07 -04:00
Fix Multiple Foolish hints from an area being generated. (#4190)
* Fix Multiple Foolish hints for the same location * remove debug comment
This commit is contained in:
parent
510b655e5e
commit
db5e9cbc11
@ -129,9 +129,9 @@ bool FilterWotHLocations(RandomizerCheck loc){
|
|||||||
return ctx->GetItemLocation(loc)->IsWothCandidate();
|
return ctx->GetItemLocation(loc)->IsWothCandidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FilterBarrenLocations(RandomizerCheck loc){
|
bool FilterFoolishLocations(RandomizerCheck loc){
|
||||||
auto ctx = Rando::Context::GetInstance();
|
auto ctx = Rando::Context::GetInstance();
|
||||||
return ctx->GetItemLocation(loc)->IsBarrenCandidate();
|
return ctx->GetItemLocation(loc)->IsFoolishCandidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FilterSongLocations(RandomizerCheck loc){
|
bool FilterSongLocations(RandomizerCheck loc){
|
||||||
@ -176,7 +176,7 @@ const std::array<HintSetting, 4> hintSettingTable{{
|
|||||||
.junkWeight = 6,
|
.junkWeight = 6,
|
||||||
.distTable = {
|
.distTable = {
|
||||||
{"WotH", HINT_TYPE_WOTH, 7, 0, 1, FilterWotHLocations, 2},
|
{"WotH", HINT_TYPE_WOTH, 7, 0, 1, FilterWotHLocations, 2},
|
||||||
{"Barren", HINT_TYPE_FOOLISH, 4, 0, 1, FilterBarrenLocations, 1},
|
{"Foolish", HINT_TYPE_FOOLISH, 4, 0, 1, FilterFoolishLocations, 1},
|
||||||
//("Entrance", HINT_TYPE_ENTRANCE, 6, 0, 1), //not yet implemented
|
//("Entrance", HINT_TYPE_ENTRANCE, 6, 0, 1), //not yet implemented
|
||||||
{"Song", HINT_TYPE_ITEM, 2, 0, 1, FilterSongLocations},
|
{"Song", HINT_TYPE_ITEM, 2, 0, 1, FilterSongLocations},
|
||||||
{"Overworld", HINT_TYPE_ITEM, 4, 0, 1, FilterOverworldLocations},
|
{"Overworld", HINT_TYPE_ITEM, 4, 0, 1, FilterOverworldLocations},
|
||||||
@ -192,7 +192,7 @@ const std::array<HintSetting, 4> hintSettingTable{{
|
|||||||
.junkWeight = 0,
|
.junkWeight = 0,
|
||||||
.distTable = {
|
.distTable = {
|
||||||
{"WotH", HINT_TYPE_WOTH, 12, 0, 2, FilterWotHLocations, 2},
|
{"WotH", HINT_TYPE_WOTH, 12, 0, 2, FilterWotHLocations, 2},
|
||||||
{"Barren", HINT_TYPE_FOOLISH, 12, 0, 1, FilterBarrenLocations, 1},
|
{"Foolish", HINT_TYPE_FOOLISH, 12, 0, 1, FilterFoolishLocations, 1},
|
||||||
//{"Entrance", HINT_TYPE_ENTRANCE, 4, 0, 1}, //not yet implemented
|
//{"Entrance", HINT_TYPE_ENTRANCE, 4, 0, 1}, //not yet implemented
|
||||||
{"Song", HINT_TYPE_ITEM, 4, 0, 1, FilterSongLocations},
|
{"Song", HINT_TYPE_ITEM, 4, 0, 1, FilterSongLocations},
|
||||||
{"Overworld", HINT_TYPE_ITEM, 6, 0, 1, FilterOverworldLocations},
|
{"Overworld", HINT_TYPE_ITEM, 6, 0, 1, FilterOverworldLocations},
|
||||||
@ -208,7 +208,7 @@ const std::array<HintSetting, 4> hintSettingTable{{
|
|||||||
.junkWeight = 0,
|
.junkWeight = 0,
|
||||||
.distTable = {
|
.distTable = {
|
||||||
{"WotH", HINT_TYPE_WOTH, 15, 0, 2, FilterWotHLocations},
|
{"WotH", HINT_TYPE_WOTH, 15, 0, 2, FilterWotHLocations},
|
||||||
{"Barren", HINT_TYPE_FOOLISH, 15, 0, 1, FilterBarrenLocations},
|
{"Foolish", HINT_TYPE_FOOLISH, 15, 0, 1, FilterFoolishLocations},
|
||||||
//{"Entrance", HINT_TYPE_ENTRANCE, 10, 0, 1}, //not yet implemented
|
//{"Entrance", HINT_TYPE_ENTRANCE, 10, 0, 1}, //not yet implemented
|
||||||
{"Song", HINT_TYPE_ITEM, 2, 0, 1, FilterSongLocations},
|
{"Song", HINT_TYPE_ITEM, 2, 0, 1, FilterSongLocations},
|
||||||
{"Overworld", HINT_TYPE_ITEM, 7, 0, 1, FilterOverworldLocations},
|
{"Overworld", HINT_TYPE_ITEM, 7, 0, 1, FilterOverworldLocations},
|
||||||
@ -448,9 +448,6 @@ static RandomizerCheck CreateRandomHint(std::vector<RandomizerCheck>& possibleHi
|
|||||||
|
|
||||||
placed = CreateHint(hintedLocation, copies, type, distributionName);
|
placed = CreateHint(hintedLocation, copies, type, distributionName);
|
||||||
}
|
}
|
||||||
if (type == HINT_TYPE_FOOLISH){
|
|
||||||
SetAllInRegionAsHinted(ctx->GetItemLocation(hintedLocation)->GetArea(), possibleHintLocations);
|
|
||||||
}
|
|
||||||
return hintedLocation;
|
return hintedLocation;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -582,6 +579,10 @@ uint8_t PlaceHints(std::vector<uint8_t>& selectedHints,
|
|||||||
RandomizerCheck hintedLocation = RC_UNKNOWN_CHECK;
|
RandomizerCheck hintedLocation = RC_UNKNOWN_CHECK;
|
||||||
|
|
||||||
hintedLocation = CreateRandomHint(hintTypePool, distribution.copies, distribution.type, distribution.name);
|
hintedLocation = CreateRandomHint(hintTypePool, distribution.copies, distribution.type, distribution.name);
|
||||||
|
if (distribution.type == HINT_TYPE_FOOLISH){
|
||||||
|
SetAllInRegionAsHinted(ctx->GetItemLocation(hintedLocation)->GetArea(), hintTypePool);
|
||||||
|
hintTypePool = FilterHintability(hintTypePool);
|
||||||
|
}
|
||||||
if (hintedLocation == RC_UNKNOWN_CHECK){ //if hint failed to place, remove all wieght and copies then return the number of stones to redistribute
|
if (hintedLocation == RC_UNKNOWN_CHECK){ //if hint failed to place, remove all wieght and copies then return the number of stones to redistribute
|
||||||
uint8_t hintsToRemove = (selectedHints[curSlot] - numHint) * distribution.copies;
|
uint8_t hintsToRemove = (selectedHints[curSlot] - numHint) * distribution.copies;
|
||||||
selectedHints[curSlot] = 0; //as distTable is passed by refernce here, these changes stick for the rest of this seed generation
|
selectedHints[curSlot] = 0; //as distTable is passed by refernce here, these changes stick for the rest of this seed generation
|
||||||
|
@ -192,7 +192,7 @@ void ItemLocation::SetWothCandidate() {
|
|||||||
wothCandidate = true;
|
wothCandidate = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ItemLocation::IsBarrenCandidate() const {
|
bool ItemLocation::IsFoolishCandidate() const {
|
||||||
return barrenCandidate;
|
return barrenCandidate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ class ItemLocation {
|
|||||||
void SetVisible(bool visibleInImGui_);
|
void SetVisible(bool visibleInImGui_);
|
||||||
bool IsWothCandidate() const;
|
bool IsWothCandidate() const;
|
||||||
void SetWothCandidate();
|
void SetWothCandidate();
|
||||||
bool IsBarrenCandidate() const;
|
bool IsFoolishCandidate() const;
|
||||||
void SetBarrenCandidate();
|
void SetBarrenCandidate();
|
||||||
void ResetVariables();
|
void ResetVariables();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user