diff --git a/Adventures in Lestoria/AdventuresInLestoria.cpp b/Adventures in Lestoria/AdventuresInLestoria.cpp index 64568dc5..fd783417 100644 --- a/Adventures in Lestoria/AdventuresInLestoria.cpp +++ b/Adventures in Lestoria/AdventuresInLestoria.cpp @@ -3891,4 +3891,8 @@ void AiL::ActivateActionSetForAllControllers(InputActionSetHandle_t actionSetHan SteamInput()->ActivateActionSet(Input::steamControllers[i],actionSetHandle); } ) +} + +const float AiL::GetEncounterDuration()const{ + return encounterDuration; } \ No newline at end of file diff --git a/Adventures in Lestoria/AdventuresInLestoria.h b/Adventures in Lestoria/AdventuresInLestoria.h index 9ee0fd58..e79af930 100644 --- a/Adventures in Lestoria/AdventuresInLestoria.h +++ b/Adventures in Lestoria/AdventuresInLestoria.h @@ -316,6 +316,7 @@ public: rcode LoadResource(Renderable&renderable,std::string_view imgPath,bool filter=false,bool clamp=true); void UpdateMonsters(); void ActivateActionSetForAllControllers(InputActionSetHandle_t actionSetHandle); + const float GetEncounterDuration()const; struct TileGroupData{ vi2d tilePos; diff --git a/Adventures in Lestoria/Monster.cpp b/Adventures in Lestoria/Monster.cpp index 4ed9fde9..e7be0f10 100644 --- a/Adventures in Lestoria/Monster.cpp +++ b/Adventures in Lestoria/Monster.cpp @@ -48,6 +48,9 @@ All rights reserved. #include "ItemDrop.h" #include "SoundEffect.h" #include "Unlock.h" +#ifndef __EMSCRIPTEN__ + #include +#endif INCLUDE_ANIMATION_DATA INCLUDE_MONSTER_DATA @@ -726,6 +729,25 @@ void Monster::OnDeath(){ Unlock::IncreaseKillCount(); + if(SteamUserStats()){ + for(auto&[key,size]:DATA.GetProperty("Achievement.Kill Unlocks")){ + //Monster-specific achievement unlocks. + datafile&unlock=DATA.GetProperty(std::format("Achievement.Kill Unlocks.{}",key)); + if(unlock.HasProperty("Monster Name")){ + if(unlock["Monster Name"].GetString()!=GetName())continue; + if(unlock.HasProperty("Time Limit")&&isBoss){ + if(game->GetEncounterDuration()<=unlock["Time Limit"].GetReal()){ + SteamUserStats()->SetAchievement(unlock["API Name"].GetString().c_str()); + SteamUserStats()->StoreStats(); + } + }else{ + SteamUserStats()->SetAchievement(unlock["API Name"].GetString().c_str()); + SteamUserStats()->StoreStats(); + } + } + } + } + if(hasStrategyDeathFunction){ GameEvent::AddEvent(std::make_unique(strategyDeathFunc,*this,MONSTER_DATA[name].GetAIStrategy())); } diff --git a/Adventures in Lestoria/Version.h b/Adventures in Lestoria/Version.h index 308ecb30..61dce457 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 8530 +#define VERSION_BUILD 8532 #define stringify(a) stringify_(a) #define stringify_(a) #a diff --git a/Adventures in Lestoria/assets/config/Achievements.txt b/Adventures in Lestoria/assets/config/Achievements.txt index 80efcb5f..7cea9c6a 100644 --- a/Adventures in Lestoria/assets/config/Achievements.txt +++ b/Adventures in Lestoria/assets/config/Achievements.txt @@ -40,24 +40,29 @@ Achievement ################################## - + # For other Kill Encounter achievements, if they have a Monster Name the game looks for the name when a monster is killed and if it matches, you get awarded that achievement. + # If a Time Limit is included, the encounter must be a boss encounter and Slime King { API Name = "SLIME_KING" + Monster Name = "Slime King" } Slime King Destroyer { API Name = "SLIME_KING_DESTROYER" Time Limit = 60s + Monster Name = "Slime King" } Ursule { API Name = "URSULE" + Monster Name = "Ursule, Mother of Bears" } Ursule Destroyer { API Name = "URSULE_DESTROYER" Time Limit = 60s + Monster Name = "Ursule, Mother of Bears" } } Class Unlocks diff --git a/x64/Release/Adventures in Lestoria.exe b/x64/Release/Adventures in Lestoria.exe index 1663fd39..82a13019 100644 Binary files a/x64/Release/Adventures in Lestoria.exe and b/x64/Release/Adventures in Lestoria.exe differ