diff --git a/Adventures in Lestoria/AdventuresInLestoria.cpp b/Adventures in Lestoria/AdventuresInLestoria.cpp index ae5ca20d..64568dc5 100644 --- a/Adventures in Lestoria/AdventuresInLestoria.cpp +++ b/Adventures in Lestoria/AdventuresInLestoria.cpp @@ -3712,7 +3712,6 @@ void AiL::ResetGame(bool changeToMainMenu){ for(int i=0;iClearLoadoutItem(i); } - Unlock::unlocks.clear(); Unlock::Initialize(); State_OverworldMap::SetStageMarker("Story I"); State_OverworldMap::UpdateCurrentConnectionPoint(*State_OverworldMap::currentConnectionPoint); diff --git a/Adventures in Lestoria/Monster.cpp b/Adventures in Lestoria/Monster.cpp index a008269b..4ed9fde9 100644 --- a/Adventures in Lestoria/Monster.cpp +++ b/Adventures in Lestoria/Monster.cpp @@ -47,6 +47,7 @@ All rights reserved. #include "MonsterAttribute.h" #include "ItemDrop.h" #include "SoundEffect.h" +#include "Unlock.h" INCLUDE_ANIMATION_DATA INCLUDE_MONSTER_DATA @@ -723,6 +724,8 @@ void Monster::OnDeath(){ } } + Unlock::IncreaseKillCount(); + if(hasStrategyDeathFunction){ GameEvent::AddEvent(std::make_unique(strategyDeathFunc,*this,MONSTER_DATA[name].GetAIStrategy())); } diff --git a/Adventures in Lestoria/SaveFile.cpp b/Adventures in Lestoria/SaveFile.cpp index 708477fd..cdd49cf1 100644 --- a/Adventures in Lestoria/SaveFile.cpp +++ b/Adventures in Lestoria/SaveFile.cpp @@ -134,6 +134,8 @@ const void SaveFile::SaveGame(){ saveFile["Game Time"].SetReal(game->GetRuntime()); saveFile["TravelingMerchant"].SetString(std::string(Merchant::GetCurrentTravelingMerchant().GetKeyName())); + saveFile["Achievement"]["KillCount"].SetInt(Unlock::GetKillCount()); + #pragma region Save Keyboard/Controller mappings //NOTE: We are shadowing code from InputKeyboardWindow! If at some point the retrival method for getting input displays changes, we likely will be changing the code here as well! //ALSO NOTE: The menu inputs are saved to the system file while gameplay inputs are per-character and saved to the character settings file! @@ -390,6 +392,12 @@ void SaveFile::LoadFile(){ } } + #pragma region Achievement-related loading + if(loadFile.HasProperty("Achievement.KillCount")){ + Unlock::SetKillCount(loadFile.GetProperty("Achievement.KillCount").GetInt()); + } + #pragma endregion + GameState::ChangeState(States::OVERWORLD_MAP,0.5f); }else{ LOG(std::format("WARNING! File {} does not exist for loading!","save_file_path"_S+std::format("save.{:04}",saveFileID))); diff --git a/Adventures in Lestoria/TODO.txt b/Adventures in Lestoria/TODO.txt index 4e6e3810..2bd4a06c 100644 --- a/Adventures in Lestoria/TODO.txt +++ b/Adventures in Lestoria/TODO.txt @@ -55,6 +55,8 @@ FULLY_DECKED_OUT Include a Reset Achievements button in Settings -============================================ + +============================================ +Consider a "killed by player" / "marked by player" flag for monsters to determine if a player gets credit for a monster kill (for achievements) Make another actions config file for the main build (The app # is different) \ No newline at end of file diff --git a/Adventures in Lestoria/Unlock.cpp b/Adventures in Lestoria/Unlock.cpp index 18275044..82f9f75a 100644 --- a/Adventures in Lestoria/Unlock.cpp +++ b/Adventures in Lestoria/Unlock.cpp @@ -47,8 +47,11 @@ All rights reserved. INCLUDE_DATA std::setUnlock::unlocks; +int Unlock::monsterKillCount=0; void Unlock::Initialize(){ + unlocks.clear(); + monsterKillCount=0; UnlockArea("WORLD_MAP"); } @@ -74,4 +77,29 @@ bool Unlock::IsUnlocked(ConnectionPoint&cp){ void Unlock::UnlockCurrentMap(){ UnlockArea(State_OverworldMap::GetCurrentConnectionPoint().map); +} + +void Unlock::IncreaseKillCount(){ + monsterKillCount++; + if(SteamUserStats()){ + datafile&killUnlocks=DATA.GetProperty("Achievement.Kill Unlocks"); + for(auto&[key,size]:killUnlocks){ + if(key.starts_with("Kill Monsters")){ + int killRequirement=killUnlocks[key]["Monster Kill Count"].GetInt(); + if(monsterKillCount-1SetAchievement(killUnlocks[key]["API Name"].GetString().c_str()); + SteamUserStats()->StoreStats(); + } + } + } + } +} + +const int Unlock::GetKillCount(){ + return monsterKillCount; +} + +void Unlock::SetKillCount(int newKillCount){ + monsterKillCount=newKillCount; } \ No newline at end of file diff --git a/Adventures in Lestoria/Unlock.h b/Adventures in Lestoria/Unlock.h index ced8fafb..7c947eea 100644 --- a/Adventures in Lestoria/Unlock.h +++ b/Adventures in Lestoria/Unlock.h @@ -45,6 +45,8 @@ class Unlock{ friend class SaveFile; static std::setunlocks; static void Initialize(); + static int monsterKillCount; + static void SetKillCount(int newKillCount); public: //Provide a map's actual name to trigger unlocks for all connected areas. You can get the current map you are on via State_OverworldMap::GetCurrentConnectionPoint().map static void UnlockArea(std::string mapName); @@ -52,4 +54,6 @@ public: static void UnlockCurrentMap(); static bool IsUnlocked(std::string mapName); static bool IsUnlocked(ConnectionPoint&cp); + static void IncreaseKillCount(); + static const int GetKillCount(); }; \ No newline at end of file diff --git a/Adventures in Lestoria/Version.h b/Adventures in Lestoria/Version.h index b6f42bd3..308ecb30 100644 --- a/Adventures in Lestoria/Version.h +++ b/Adventures in Lestoria/Version.h @@ -39,7 +39,7 @@ All rights reserved. #define VERSION_MAJOR 1 #define VERSION_MINOR 0 #define VERSION_PATCH 0 -#define VERSION_BUILD 8524 +#define VERSION_BUILD 8530 #define stringify(a) stringify_(a) #define stringify_(a) #a diff --git a/Adventures in Lestoria/assets/Campaigns/1_1_v2.tmx b/Adventures in Lestoria/assets/Campaigns/1_1_v2.tmx index 4d4f76f9..ac6d137c 100644 --- a/Adventures in Lestoria/assets/Campaigns/1_1_v2.tmx +++ b/Adventures in Lestoria/assets/Campaigns/1_1_v2.tmx @@ -1,5 +1,5 @@ - + diff --git a/Adventures in Lestoria/assets/config/Achievements.txt b/Adventures in Lestoria/assets/config/Achievements.txt index a379869f..80efcb5f 100644 --- a/Adventures in Lestoria/assets/config/Achievements.txt +++ b/Adventures in Lestoria/assets/config/Achievements.txt @@ -21,6 +21,7 @@ Achievement } Kill Unlocks { + # Achievements that start with "Kill Monsters" will be checked when a monster is killed. Kill Monsters 1 { API Name = "KILL_SLIME_1" @@ -36,6 +37,10 @@ Achievement API Name = "KILL_SLIME_3" Monster Kill Count = 1000 } + + ################################## + + Slime King { API Name = "SLIME_KING" diff --git a/Adventures in Lestoria/assets/config/items/Equipment.txt b/Adventures in Lestoria/assets/config/items/Equipment.txt index 8a1cbca7..46e3739b 100644 --- a/Adventures in Lestoria/assets/config/items/Equipment.txt +++ b/Adventures in Lestoria/assets/config/items/Equipment.txt @@ -151,78 +151,99 @@ Equipment { # When this crafting recipe is available. AvailableChapter = 1 + Item[0] = Green Slime Remains,5 - Gold = 1 + Gold = 5 Level[1] { # When this enhancement is available. AvailableChapter = 1 + Item[0] = Green Slime Remains,7 - Gold = 1 + Gold = 12 } Level[2] { # When this enhancement is available. AvailableChapter = 1 + Item[0] = Wolf Skin,1 + Item[1] = Red Slime Remains,1 + Item[2] = Blue Slime Remains,1 - Gold = 1 + Gold = 18 } Level[3] { # When this enhancement is available. AvailableChapter = 1 + Item[0] = Red Slime Remains,3 + Item[1] = Green Slime Remains,6 - Gold = 1 + Gold = 24 } Level[4] { # When this enhancement is available. AvailableChapter = 1 + Item[0] = Blue Slime Remains,3 + Item[1] = Green Slime Remains,7 - Gold = 1 + Gold = 32 } Level[5] { # When this enhancement is available. AvailableChapter = 1 + Item[0] = Wolf Skin,1 + Item[1] = Red Slime Remains,4 - Gold = 1 + Gold = 40 } Level[6] { # When this enhancement is available. AvailableChapter = 1 + Item[0] = Yellow Slime Remains,1 + Item[1] = Red Slime Remains,6 - Gold = 1 + Gold = 50 } Level[7] { # When this enhancement is available. AvailableChapter = 1 + Item[0] = Wolf Skin,1 + Item[1] = Yellow Slime Remains,2 - Gold = 1 + Gold = 65 } Level[8] { # When this enhancement is available. AvailableChapter = 1 + Item[0] = Red Slime Remains,8 + Item[1] = Green Slime Remains,4 - Gold = 1 + Gold = 80 } Level[9] { # When this enhancement is available. AvailableChapter = 1 + Item[0] = Wolf Skin,2 + Item[1] = Yellow Slime Remains,3 - Gold = 1 + Gold = 100 } Level[10] { # When this enhancement is available. AvailableChapter = 1 + Item[0] = Green Gemstone,1 + Item[1] = Wolf Skin,1 - Gold = 1 + Gold = 150 } } } diff --git a/x64/Release/Adventures in Lestoria.exe b/x64/Release/Adventures in Lestoria.exe index d3b6afff..1663fd39 100644 Binary files a/x64/Release/Adventures in Lestoria.exe and b/x64/Release/Adventures in Lestoria.exe differ