From b6628ef515a57e5ba22aefb3ec5e6f7f60554e41 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Fri, 5 May 2023 12:56:06 -0400 Subject: Added support for variable THE MASTER --- ap_state.cpp | 5 +++++ ap_state.h | 2 ++ assets/areas.yaml | 2 ++ game_data.cpp | 8 ++++++++ game_data.h | 7 +++++++ tracker_state.cpp | 16 ++++++++++++++++ 6 files changed, 40 insertions(+) diff --git a/ap_state.cpp b/ap_state.cpp index c13b87c..70f183e 100644 --- a/ap_state.cpp +++ b/ap_state.cpp @@ -52,6 +52,7 @@ std::map progressive_item_by_ap_id; DoorShuffleMode door_shuffle_mode = kNO_DOORS; bool color_shuffle = false; bool painting_shuffle = false; +int mastery_requirement = 21; std::map painting_mapping; @@ -116,6 +117,7 @@ void AP_Connect(std::string server, std::string player, std::string password) { color_shuffle = false; painting_shuffle = false; painting_mapping.clear(); + mastery_requirement = 21; connected = false; has_connection_result = false; @@ -166,6 +168,7 @@ void AP_Connect(std::string server, std::string player, std::string password) { door_shuffle_mode = slot_data["shuffle_doors"].get(); color_shuffle = slot_data["shuffle_colors"].get(); painting_shuffle = slot_data["shuffle_paintings"].get(); + mastery_requirement = slot_data["mastery_achievements"].get(); if (painting_shuffle && slot_data.contains("painting_entrance_to_exit")) { painting_mapping.clear(); @@ -321,3 +324,5 @@ bool AP_IsPaintingShuffle() { return painting_shuffle; } const std::map AP_GetPaintingMapping() { return painting_mapping; } + +int AP_GetMasteryRequirement() { return mastery_requirement; } diff --git a/ap_state.h b/ap_state.h index 434b7b2..d880c71 100644 --- a/ap_state.h +++ b/ap_state.h @@ -28,4 +28,6 @@ bool AP_IsPaintingShuffle(); const std::map AP_GetPaintingMapping(); +int AP_GetMasteryRequirement(); + #endif /* end of include guard: AP_STATE_H_664A4180 */ diff --git a/assets/areas.yaml b/assets/areas.yaml index fea1529..b2aa69f 100755 --- a/assets/areas.yaml +++ b/assets/areas.yaml @@ -105,6 +105,8 @@ map: [908, 1632] The Wanderer: map: [1587, 1765] + Outside The Wanderer: + fold_into: The Wanderer Rhyme Room (Smiley): fold_into: Rhyme Room Rhyme Room (Cross): diff --git a/game_data.cpp b/game_data.cpp index 9b31f89..e15847e 100644 --- a/game_data.cpp +++ b/game_data.cpp @@ -157,6 +157,14 @@ GameData::GameData() { panel_obj.check = panel_it.second["check"].as(); } + if (panel_it.second["achievement"]) { + panel_obj.achievement = panel_it.second["achievement"].as(); + + if (panel_obj.achievement) { + achievement_panels_.push_back(panel_id); + } + } + if (panel_it.second["exclude_reduce"]) { panel_obj.exclude_reduce = panel_it.second["exclude_reduce"].as(); diff --git a/game_data.h b/game_data.h index 2df8bc5..0cc7a7b 100644 --- a/game_data.h +++ b/game_data.h @@ -28,6 +28,7 @@ struct Panel { std::vector required_doors; bool check = false; bool exclude_reduce = false; + bool achievement = false; }; struct ProgressiveRequirement { @@ -104,6 +105,10 @@ class GameData { return room_by_painting_.at(painting_id); } + const std::vector& GetAchievementPanels() const { + return achievement_panels_; + } + private: int AddOrGetRoom(std::string room); int AddOrGetDoor(std::string room, std::string door); @@ -121,6 +126,8 @@ class GameData { std::map area_by_id_; std::map room_by_painting_; + + std::vector achievement_panels_; }; const GameData& GetGameData(); diff --git a/tracker_state.cpp b/tracker_state.cpp index 6eaf87a..858ec3e 100644 --- a/tracker_state.cpp +++ b/tracker_state.cpp @@ -16,6 +16,22 @@ bool IsPanelReachable_Helper(int panel_id, return false; } + if (panel_obj.name == "THE MASTER") { + int achievements_accessible = 0; + + for (int achieve_id : GetGameData().GetAchievementPanels()) { + if (IsPanelReachable_Helper(achieve_id, reachable_rooms)) { + achievements_accessible++; + + if (achievements_accessible >= AP_GetMasteryRequirement()) { + break; + } + } + } + + return (achievements_accessible >= AP_GetMasteryRequirement()); + } + for (int room_id : panel_obj.required_rooms) { if (!reachable_rooms.count(room_id)) { return false; -- cgit 1.4.1