mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-07-28 06:57:02 -04:00
add required dungeons to Midna hint text
This commit is contained in:
@@ -2200,4 +2200,14 @@ Return to Spawn Dungeon No Choice Text:
|
||||
Standard:
|
||||
Text: |-
|
||||
<2 way choice 1>Nevermind
|
||||
<2 way choice 2>Spawn
|
||||
<2 way choice 2>Spawn
|
||||
|
||||
Midna Hints Required Dungeons Intro Zero Dungeons:
|
||||
Standard:
|
||||
Text: |-
|
||||
There are <red>0<white> required dungeons.
|
||||
|
||||
Midna Hints Required Dungeons Intro At Least One Dungeon:
|
||||
Standard:
|
||||
Text: |-
|
||||
There are <red><required dungeon count><white> required dungeons:
|
||||
@@ -2200,4 +2200,14 @@ Return to Spawn Dungeon No Choice Text:
|
||||
Standard:
|
||||
Text: |-
|
||||
<2 way choice 1>Nevermind
|
||||
<2 way choice 2>Spawn
|
||||
<2 way choice 2>Spawn
|
||||
|
||||
Midna Hints Required Dungeons Intro Zero Dungeons:
|
||||
Standard:
|
||||
Text: |-
|
||||
There are <red>0<white> required dungeons.
|
||||
|
||||
Midna Hints Required Dungeons Intro At Least One Dungeon:
|
||||
Standard:
|
||||
Text: |-
|
||||
There are <red><required dungeon count><white> required dungeons:
|
||||
@@ -2200,4 +2200,14 @@ Return to Spawn Dungeon No Choice Text:
|
||||
Standard:
|
||||
Text: |-
|
||||
<2 way choice 1>Nevermind
|
||||
<2 way choice 2>Spawn
|
||||
<2 way choice 2>Spawn
|
||||
|
||||
Midna Hints Required Dungeons Intro Zero Dungeons:
|
||||
Standard:
|
||||
Text: |-
|
||||
There are <red>0<white> required dungeons.
|
||||
|
||||
Midna Hints Required Dungeons Intro At Least One Dungeon:
|
||||
Standard:
|
||||
Text: |-
|
||||
There are <red><required dungeon count><white> required dungeons:
|
||||
@@ -2200,4 +2200,14 @@ Return to Spawn Dungeon No Choice Text:
|
||||
Standard:
|
||||
Text: |-
|
||||
<2 way choice 1>Nevermind
|
||||
<2 way choice 2>Spawn
|
||||
<2 way choice 2>Spawn
|
||||
|
||||
Midna Hints Required Dungeons Intro Zero Dungeons:
|
||||
Standard:
|
||||
Text: |-
|
||||
There are <red>0<white> required dungeons.
|
||||
|
||||
Midna Hints Required Dungeons Intro At Least One Dungeon:
|
||||
Standard:
|
||||
Text: |-
|
||||
There are <red><required dungeon count><white> required dungeons:
|
||||
@@ -2200,4 +2200,14 @@ Return to Spawn Dungeon No Choice Text:
|
||||
Standard:
|
||||
Text: |-
|
||||
<2 way choice 1>Nevermind
|
||||
<2 way choice 2>Spawn
|
||||
<2 way choice 2>Spawn
|
||||
|
||||
Midna Hints Required Dungeons Intro Zero Dungeons:
|
||||
Standard:
|
||||
Text: |-
|
||||
There are <red>0<white> required dungeons.
|
||||
|
||||
Midna Hints Required Dungeons Intro At Least One Dungeon:
|
||||
Standard:
|
||||
Text: |-
|
||||
There are <red><required dungeon count><white> required dungeons:
|
||||
@@ -3,27 +3,31 @@
|
||||
#include "dusk/randomizer/generator/utility/text.hpp"
|
||||
#include "world.hpp"
|
||||
|
||||
#include <ranges>
|
||||
|
||||
namespace randomizer::logic::hints {
|
||||
|
||||
static const std::list<std::pair<std::string, std::string>> dungeonColors = {
|
||||
{"Forest Temple", "<green>"},
|
||||
{"Goron Mines", "<red>"},
|
||||
{"Lakebed Temple", "<blue>"},
|
||||
{"Arbiters Grounds", "<orange>"},
|
||||
{"Snowpeak Ruins", "<light blue>"},
|
||||
{"Temple of Time", "<dark green>"},
|
||||
{"City in the Sky", "<yellow>"},
|
||||
{"Palace of Twilight", "<purple>"},
|
||||
// {"Hyrule Castle", "<silver>"}
|
||||
};
|
||||
|
||||
// Tell the player which dungeons are required on the sign in front of Link's House
|
||||
static void GenerateRequiredDungeonsHint(world::WorldPool& worlds) {
|
||||
static const std::unordered_map<std::string, std::string> dungeonColors = {
|
||||
{"Forest Temple", "<green>"},
|
||||
{"Goron Mines", "<red>"},
|
||||
{"Lakebed Temple", "<blue>"},
|
||||
{"Arbiters Grounds", "<orange>"},
|
||||
{"Snowpeak Ruins", "<light blue>"},
|
||||
{"Temple of Time", "<dark green>"},
|
||||
{"City in the Sky", "<yellow>"},
|
||||
{"Palace of Twilight", "<purple>"},
|
||||
// {"Hyrule Castle", "<silver>"}
|
||||
};
|
||||
|
||||
for (const auto& world : worlds) {
|
||||
auto& requiredDungeonText = world->AddNewText("Links House Sign");
|
||||
for (const auto& [dungeonName, dungeon] : world->GetDungeonTable()) {
|
||||
// Use dungeonColors to loop through in base game dungeon order
|
||||
for (const auto& [dungeonName, color] : dungeonColors) {
|
||||
auto dungeon = world->GetDungeon(dungeonName);
|
||||
if (dungeon->IsRequired()) {
|
||||
requiredDungeonText += dungeonColors.at(dungeonName) + getTextObject(dungeonName) + "\n";
|
||||
requiredDungeonText += color + getTextObject(dungeonName) + "\n";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,8 +86,51 @@ namespace randomizer::logic::hints {
|
||||
}
|
||||
}
|
||||
|
||||
void GenerateMidnaHintsText(world::WorldPool& worlds) {
|
||||
for (const auto& world : worlds) {
|
||||
auto& midnaHintText = world->AddNewText("Custom Midna Call Hints Text");
|
||||
|
||||
// Put required dungeons on Midna.
|
||||
// First loop through to get required number
|
||||
int numRequiredDungeons = 0;
|
||||
for (const auto& dungeon : world->GetDungeonTable() | std::views::values) {
|
||||
if (dungeon->IsRequired()) {
|
||||
++numRequiredDungeons;
|
||||
}
|
||||
}
|
||||
|
||||
// Set the text for the number of required dungeons
|
||||
if (numRequiredDungeons > 0) {
|
||||
midnaHintText += getTextObject("Midna Hints Required Dungeons Intro At Least One Dungeon");
|
||||
midnaHintText.Replace("<required dungeon count>", std::to_string(numRequiredDungeons));
|
||||
// Add newlines to begin listing dungeons on the next textbox
|
||||
midnaHintText += "\n\n\n\n";
|
||||
|
||||
// Then loop through again to add the dungeon names.
|
||||
// Use dungeonColors to loop through in base game dungeon order
|
||||
int displayedRequiredDungeons = 0;
|
||||
for (const auto& [dungeonName, color] : dungeonColors) {
|
||||
auto dungeon = world->GetDungeon(dungeonName);
|
||||
if (dungeon->IsRequired()) {
|
||||
++displayedRequiredDungeons;
|
||||
midnaHintText += color + getTextObject(dungeonName) + "<white>";
|
||||
// Add newline after every dungeon except the last one
|
||||
if (displayedRequiredDungeons < numRequiredDungeons) {
|
||||
midnaHintText += "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
midnaHintText += getTextObject("Midna Hints Required Dungeons Intro Zero Dungeons");
|
||||
}
|
||||
|
||||
midnaHintText.BreakLines(Text::MAX_LINE_WIDTH_NORMAL_TEXTBOX);
|
||||
}
|
||||
}
|
||||
|
||||
void GenerateAllHints(world::WorldPool& worlds) {
|
||||
GenerateRequiredDungeonsHint(worlds);
|
||||
GenerateItemTextReplacements(worlds);
|
||||
GenerateMidnaHintsText(worlds);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -872,8 +872,17 @@ namespace randomizer::logic::world
|
||||
// For no logic, we're purely going to base whether the dungeon is required on the Hyrule Castle
|
||||
// Barrier requirements and Hyrule Castle Big Key chest requirements
|
||||
bool World::IsNoLogicRequiredDungeon(const std::unique_ptr<dungeon::Dungeon>& dungeon) {
|
||||
auto barrierRequirements = this->Setting("Hyrule Barrier Requirements");
|
||||
auto bigKeyRequirements = this->Setting("Hyrule Castle Big Key Requirements");
|
||||
auto& barrierRequirements = this->Setting("Hyrule Barrier Requirements");
|
||||
auto& bigKeyRequirements = this->Setting("Hyrule Castle Big Key Requirements");
|
||||
auto barrierDungeonCount = this->Setting("Hyrule Barrier Dungeons").GetCurrentOptionAsNumber();
|
||||
auto bigkeyDungeonCount = this->Setting("Hyrule Castle Big Key Dungeons").GetCurrentOptionAsNumber();
|
||||
|
||||
// If all dungeons are required, then always return true
|
||||
if ((barrierRequirements == "Dungeons" && barrierDungeonCount == 8) ||
|
||||
(bigKeyRequirements == "Dungeons" && bigkeyDungeonCount == 8))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool dungeonHasFusedShadow = std::ranges::any_of(dungeon->GetLocations(), [](const auto& location) {
|
||||
return location->GetCurrentItem()->GetName() == "Progressive Fused Shadow";
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace randomizer {
|
||||
}
|
||||
}
|
||||
|
||||
void Text::BreakLines(int maxLineWidth /*= MAX_LINE_WIDTH*/) {
|
||||
void Text::BreakLines(int maxLineWidth /*= MAX_LINE_WIDTH_ITEM_TEXTBOX*/) {
|
||||
for (auto& text : mText) {
|
||||
breakLines(text, maxLineWidth);
|
||||
}
|
||||
|
||||
@@ -57,7 +57,8 @@ namespace randomizer {
|
||||
PLURALITY_MAX,
|
||||
};
|
||||
|
||||
static constexpr size_t MAX_LINE_WIDTH = 441;
|
||||
static constexpr size_t MAX_LINE_WIDTH_ITEM_TEXTBOX = 441;
|
||||
static constexpr size_t MAX_LINE_WIDTH_NORMAL_TEXTBOX = 750;
|
||||
|
||||
Text() = default;
|
||||
explicit Text(const std::string& str);
|
||||
@@ -74,7 +75,7 @@ namespace randomizer {
|
||||
*/
|
||||
void Replace(const std::string& oldStr, const Text& replacementText, int count = 1);
|
||||
void Replace(const std::string& oldStr, const std::string& replacementText, int count = 1);
|
||||
void BreakLines(int maxLineWidth = MAX_LINE_WIDTH);
|
||||
void BreakLines(int maxLineWidth = MAX_LINE_WIDTH_ITEM_TEXTBOX);
|
||||
void Capitalize();
|
||||
bool Empty() const;
|
||||
Text& operator+=(const Text& rhs);
|
||||
|
||||
Reference in New Issue
Block a user