Add class-specific level up achievements. Fix bug with recalculating next levelXP when obtaining multiple levels at once upon stage completion. Release Build 8534.
This commit is contained in:
parent
3840b28468
commit
5742c03c4f
@ -57,6 +57,9 @@ All rights reserved.
|
||||
#include "GameSettings.h"
|
||||
#include "Unlock.h"
|
||||
#include "Tutorial.h"
|
||||
#ifndef __EMSCRIPTEN__
|
||||
#include <isteamuserstats.h>
|
||||
#endif
|
||||
|
||||
INCLUDE_MONSTER_DATA
|
||||
INCLUDE_MONSTER_LIST
|
||||
@ -1301,9 +1304,8 @@ void Player::AddXP(const uint32_t xpGain){
|
||||
currentLevelXP+=xpGain;
|
||||
totalXPEarned+=xpGain;
|
||||
if(Level()<LevelCap()){
|
||||
uint32_t nextLevelXP=NextLevelXPRequired();
|
||||
while(currentLevelXP>=nextLevelXP){
|
||||
currentLevelXP-=nextLevelXP;
|
||||
while(currentLevelXP>=NextLevelXPRequired()){
|
||||
currentLevelXP-=NextLevelXPRequired();
|
||||
SetLevel(Level()+1);
|
||||
OnLevelUp();
|
||||
}
|
||||
@ -1324,6 +1326,18 @@ void Player::OnLevelUp(){
|
||||
stats.SetBaseStat("Health",GetBaseStat("Health")+hpGrowthRate);
|
||||
stats.SetBaseStat("Attack",GetBaseStat("Attack")+atkGrowthRate);
|
||||
Heal(GetBaseStat("Health"));
|
||||
|
||||
if(SteamUserStats()){
|
||||
for(auto&[key,size]:DATA.GetProperty("Achievement.Class Unlocks")){
|
||||
datafile&unlock=DATA.GetProperty(std::format("Achievement.Class Unlocks.{}",key));
|
||||
if(classutils::StringToClass(unlock["Class Requirement"].GetString())==GetClass()&&
|
||||
Level()-1<unlock["Level Requirement"].GetInt()&&
|
||||
Level()==unlock["Level Requirement"].GetInt()){
|
||||
SteamUserStats()->SetAchievement(unlock["API Name"].GetString().c_str());
|
||||
SteamUserStats()->StoreStats();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
const uint8_t Player::LevelCap()const{
|
||||
return levelCap;
|
||||
|
@ -39,7 +39,7 @@ All rights reserved.
|
||||
#define VERSION_MAJOR 1
|
||||
#define VERSION_MINOR 0
|
||||
#define VERSION_PATCH 0
|
||||
#define VERSION_BUILD 8532
|
||||
#define VERSION_BUILD 8534
|
||||
|
||||
#define stringify(a) stringify_(a)
|
||||
#define stringify_(a) #a
|
||||
|
@ -70,16 +70,19 @@ Achievement
|
||||
Warrior Lv5
|
||||
{
|
||||
API Name = "WARRIOR_LV5"
|
||||
Class Requirement = Warrior
|
||||
Level Requirement = 5
|
||||
}
|
||||
Ranger Lv5
|
||||
{
|
||||
API Name = "RANGER_LV5"
|
||||
Class Requirement = Ranger
|
||||
Level Requirement = 5
|
||||
}
|
||||
Wizard Lv5
|
||||
{
|
||||
API Name = "WIZARD_LV5"
|
||||
Class Requirement = Wizard
|
||||
Level Requirement = 5
|
||||
}
|
||||
}
|
||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user