diff --git a/Crawler/CharacterMenuWindow.cpp b/Crawler/CharacterMenuWindow.cpp index 928b8e53..77b1dc0a 100644 --- a/Crawler/CharacterMenuWindow.cpp +++ b/Crawler/CharacterMenuWindow.cpp @@ -165,7 +165,7 @@ void Menu::InitializeCharacterMenuWindow(){ RowItemDisplay*button=dynamic_cast(data.component); if(button!=nullptr){ const std::weak_ptrbuttonItem=button->GetItem(); - std::vectorstatsBeforeEquip; + std::vectorstatsBeforeEquip; EquipSlot slot=EquipSlot(button->I(Attribute::EQUIP_TYPE)); for(const std::string&attribute:displayAttrs){ statsBeforeEquip.push_back(game->GetPlayer()->GetStat(attribute)); diff --git a/Crawler/Crawler.cpp b/Crawler/Crawler.cpp index 93434df6..fd33c472 100644 --- a/Crawler/Crawler.cpp +++ b/Crawler/Crawler.cpp @@ -175,6 +175,8 @@ bool Crawler::OnUserCreate(){ player=std::make_unique(); + InitializePlayerLevelCap(); + InitializeGraphics(); InitializeClasses(); @@ -475,6 +477,9 @@ void Crawler::HandleUserInput(float fElapsedTime){ if(GetKey(O).bPressed){ ItemDrop::SpawnItem(&ITEM_DATA.at("Green Slime Remains"),player->GetPos(),player->OnUpperLevel()); } + if(GetKey(L).bHeld){ + game->GetPlayer()->AddXP(1); + } } void Crawler::UpdateCamera(float fElapsedTime){ @@ -1538,6 +1543,7 @@ void Crawler::LoadLevel(MapName map){ GetPlayer()->mana=GetPlayer()->GetMaxMana(); GetPlayer()->SetState(State::NORMAL); GetPlayer()->GetCastInfo()={}; + GetPlayer()->ResetAccumulatedXP(); #pragma region Monster Spawn Data Setup for(auto&[key,value]:MAP_DATA[map].SpawnerData){ @@ -1852,6 +1858,10 @@ void Crawler::ChangePlayerClass(Class cl){ Ability itemAbility2=player->useItem2; Ability itemAbility3=player->useItem3; uint32_t oldMoney=player->money; + uint8_t level=player->level; + uint8_t levelCap=player->levelCap; + uint32_t totalXPEarned=player->totalXPEarned; + uint32_t currentLevelXP=player->currentLevelXP; std::setmoneyListeners=Player::moneyListeners; EntityStats previousStats=player->stats; switch(cl){ @@ -1874,6 +1884,10 @@ void Crawler::ChangePlayerClass(Class cl){ player.reset(NEW Witch(player.get())); }break; } + player->level=level; + player->levelCap=levelCap; + player->totalXPEarned=totalXPEarned; + player->currentLevelXP=currentLevelXP; player->stats=previousStats; player->SetBaseStat("Health",DATA.GetProperty(player->GetClassName()+".BaseHealth").GetInt()); player->hp=player->GetBaseStat("Health"); @@ -2501,4 +2515,12 @@ void Crawler::UpdateDiscordStatus(std::string levelName,std::string className){ } } #endif +} + +void Crawler::InitializePlayerLevelCap(){ + while(DATA["PlayerXP"].HasProperty(std::format("LEVEL[{}]",player->levelCap+1))){ + player->levelCap++; + } + if(player->levelCap<=1)ERR("Could not detect level cap properly!") + std::cout<<"Level cap detected as "<levelCap)<GetPlayer()->AddAccumulatedXP(MONSTER_DATA.at(name).GetXP()); } const ItemAttributable&Monster::GetStats()const{ @@ -482,4 +484,8 @@ const ItemAttributable&Monster::GetStats()const{ ItemAttribute&Monster::Get(std::string_view attr){ return ItemAttribute::Get(attr,this); +} + +const uint32_t MonsterData::GetXP()const{ + return xp; } \ No newline at end of file diff --git a/Crawler/Monster.h b/Crawler/Monster.h index 2bbd776c..028b0fcc 100644 --- a/Crawler/Monster.h +++ b/Crawler/Monster.h @@ -75,6 +75,7 @@ struct MonsterData{ std::string name; int hp; int atk; + uint32_t xp; float moveSpd;//1.0=100% float size; std::vector animations; @@ -86,9 +87,10 @@ struct MonsterData{ std::vector dropData; public: MonsterData(); - MonsterData(std::string name,int hp,int atk,std::vectoranimations,std::vectordrops,float moveSpd=1.0f,float size=1.0f,std::string strategy="Run Towards",int collisionDmg=0); + MonsterData(std::string name,int hp,int atk,const uint32_t xp,std::vectoranimations,std::vectordrops,float moveSpd=1.0f,float size=1.0f,std::string strategy="Run Towards",int collisionDmg=0); int GetHealth(); int GetAttack(); + const uint32_t GetXP()const; float GetMoveSpdMult(); float GetSizeMult(); std::string GetAIStrategy(); diff --git a/Crawler/MonsterData.cpp b/Crawler/MonsterData.cpp index 5966dc54..1b9a53b3 100644 --- a/Crawler/MonsterData.cpp +++ b/Crawler/MonsterData.cpp @@ -52,8 +52,8 @@ std::mapMONSTER_DATA; MonsterData::MonsterData() :atk(0),collisionDmg(0),hp(0),moveSpd(0),size(0),strategy("Run Towards"){} -MonsterData::MonsterData(std::string name,int hp,int atk,std::vectoranimations,std::vectordrops,float moveSpd,float size,std::string strategy,int collisionDmg): - name(name),hp(hp),atk(atk),moveSpd(moveSpd),size(size),strategy(strategy),animations(animations),dropData(drops),collisionDmg(collisionDmg){} +MonsterData::MonsterData(std::string name,int hp,int atk,const uint32_t xp,std::vectoranimations,std::vectordrops,float moveSpd,float size,std::string strategy,int collisionDmg): + name(name),hp(hp),atk(atk),xp(xp),moveSpd(moveSpd),size(size),strategy(strategy),animations(animations),dropData(drops),collisionDmg(collisionDmg){} void MonsterData::InitializeMonsterData(){ for(auto&[key,size]:DATA["Monsters"].GetKeys()){ @@ -148,6 +148,7 @@ void MonsterData::InitializeMonsterData(){ MonsterName, DATA["Monsters"][MonsterName]["Health"].GetInt(), DATA["Monsters"][MonsterName]["Attack"].GetInt(), + DATA["Monsters"][MonsterName]["XP"].GetInt(), animations, drops, float(DATA["Monsters"][MonsterName]["MoveSpd"].GetReal())/100, diff --git a/Crawler/Player.cpp b/Crawler/Player.cpp index 209cf268..a8b0afae 100644 --- a/Crawler/Player.cpp +++ b/Crawler/Player.cpp @@ -51,7 +51,6 @@ All rights reserved. #include "config.h" #include - INCLUDE_MONSTER_DATA INCLUDE_MONSTER_LIST INCLUDE_ANIMATION_DATA @@ -958,6 +957,9 @@ void EntityStats::SetBaseStat(ItemAttribute stat,float val){ baseStats.A(stat)=val; RecalculateEquipStats(); } +void EntityStats::SetBaseStat(std::string_view stat,float val){ + SetBaseStat(ItemAttribute::Get(stat),val); +} void Player::SetBaseStat(std::string_view a,float val){ stats.SetBaseStat(ItemAttribute::Get(a),val); } @@ -1089,4 +1091,54 @@ const float Player::GetDamageReductionPct()const{ float modDmgReductionPct=0; modDmgReductionPct+=GetStat("Damage Reduction")/100; return modDmgReductionPct; +} + +void Player::AddXP(const uint32_t xpGain){ + currentLevelXP+=xpGain; + totalXPEarned+=xpGain; + uint32_t nextLevelXP=NextLevelXPRequired(); + if(Level()nextLevelXP){ + currentLevelXP-=nextLevelXP; + level++; + OnLevelUp(); + } + } +} + +void Player::OnLevelUp(){ + stats.SetBaseStat("Health",GetBaseStat("Health")+hpGrowthRate); + stats.SetBaseStat("Attack",GetBaseStat("Attack")+atkGrowthRate); + Heal(GetBaseStat("Health")); +} +const uint8_t Player::LevelCap()const{ + return levelCap; +} +const uint8_t Player::Level()const{ + return level; +} +const uint32_t Player::CurrentXP()const{ + return currentLevelXP; +} +const uint32_t Player::TotalXP()const{ + return totalXPEarned; +} + +const uint32_t Player::NextLevelXPRequired()const{ + if(Level()(MenuType::LEVEL_COMPLETE,"Level EXP Gain Outline")->SetLabel(std::format("+{} Exp",game->GetPlayer()->GetAccumulatedXP())); + game->GetPlayer()->AddXP(game->GetPlayer()->GetAccumulatedXP()); game->GetPlayer()->SetState(State::NORMAL); Menu::OpenMenu(LEVEL_COMPLETE); }; diff --git a/Crawler/Version.h b/Crawler/Version.h index 7675c87a..872fda03 100644 --- a/Crawler/Version.h +++ b/Crawler/Version.h @@ -39,7 +39,7 @@ All rights reserved. #define VERSION_MAJOR 0 #define VERSION_MINOR 2 #define VERSION_PATCH 1 -#define VERSION_BUILD 4771 +#define VERSION_BUILD 4787 #define stringify(a) stringify_(a) #define stringify_(a) #a diff --git a/Crawler/assets/Campaigns/1_1_v2.tmx b/Crawler/assets/Campaigns/1_1_v2.tmx index 0a9ab3c2..2d6de9ef 100644 --- a/Crawler/assets/Campaigns/1_1_v2.tmx +++ b/Crawler/assets/Campaigns/1_1_v2.tmx @@ -1,5 +1,5 @@ - + @@ -1280,13 +1280,6 @@ - - - - - - - @@ -1294,13 +1287,6 @@ - - - - - - - @@ -1970,21 +1956,6 @@ - - - - - - - - - - - - - - - @@ -1992,27 +1963,6 @@ - - - - - - - - - - - - - - - - - - - - - @@ -2020,54 +1970,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + diff --git a/Crawler/assets/config/Monsters.txt b/Crawler/assets/config/Monsters.txt index f72d86de..2c730255 100644 --- a/Crawler/assets/config/Monsters.txt +++ b/Crawler/assets/config/Monsters.txt @@ -10,6 +10,8 @@ Monsters MoveSpd = 110 Size = 80 + XP = 5 + Strategy = Run Towards BumpStopChance = 2 @@ -40,6 +42,8 @@ Monsters MoveSpd = 80 Size = 100 + XP = 7 + Strategy = Shoot Afar #Size of each animation frame @@ -68,6 +72,8 @@ Monsters MoveSpd = 95 Size = 120 + XP = 7 + Strategy = Run Towards #Size of each animation frame @@ -96,6 +102,8 @@ Monsters MoveSpd = 40 Size = 160 + XP = 20 + Strategy = Run Towards #Size of each animation frame @@ -123,6 +131,8 @@ Monsters MoveSpd = 0 Size = 100 + XP = 8 + Strategy = Turret #Size of each animation frame @@ -151,6 +161,8 @@ Monsters MoveSpd = 100 Size = 800 + XP = 250 + Strategy = Slime King StartPhase = 1 diff --git a/Crawler/assets/config/Player.txt b/Crawler/assets/config/Player.txt index de8e2fd2..70bf550a 100644 --- a/Crawler/assets/config/Player.txt +++ b/Crawler/assets/config/Player.txt @@ -39,4 +39,109 @@ Player PLAYER_ANIMATION[9] = WIZARD_ATTACK PLAYER_ANIMATION[10] = WIZARD_CAST PLAYER_ANIMATION[11] = WIZARD_IDLE -} \ No newline at end of file + +} + +PlayerXP +{ + LEVEL[1] = 100xp + LEVEL[2] = 200xp + LEVEL[3] = 300xp + LEVEL[4] = 400xp + LEVEL[5] = 500xp + LEVEL[6] = 600xp + LEVEL[7] = 700xp + LEVEL[8] = 800xp + LEVEL[9] = 900xp + LEVEL[10] = 1000xp + LEVEL[11] = 1100xp + LEVEL[12] = 1200xp + LEVEL[13] = 1300xp + LEVEL[14] = 1400xp + LEVEL[15] = 1500xp + LEVEL[16] = 1600xp + LEVEL[17] = 1700xp + LEVEL[18] = 1800xp + LEVEL[19] = 1900xp + LEVEL[20] = 2000xp + LEVEL[21] = 2100xp + LEVEL[22] = 2200xp + LEVEL[23] = 2300xp + LEVEL[24] = 2400xp + LEVEL[25] = 2500xp + LEVEL[26] = 2600xp + LEVEL[27] = 2700xp + LEVEL[28] = 2800xp + LEVEL[29] = 2900xp + LEVEL[30] = 3000xp + LEVEL[31] = 3100xp + LEVEL[32] = 3200xp + LEVEL[33] = 3300xp + LEVEL[34] = 3400xp + LEVEL[35] = 3500xp + LEVEL[36] = 3600xp + LEVEL[37] = 3700xp + LEVEL[38] = 3800xp + LEVEL[39] = 3900xp + LEVEL[40] = 4000xp + LEVEL[41] = 4100xp + LEVEL[42] = 4200xp + LEVEL[43] = 4300xp + LEVEL[44] = 4400xp + LEVEL[45] = 4500xp + LEVEL[46] = 4600xp + LEVEL[47] = 4700xp + LEVEL[48] = 4800xp + LEVEL[49] = 4900xp + LEVEL[50] = 5000xp + LEVEL[51] = 5100xp + LEVEL[52] = 5200xp + LEVEL[53] = 5300xp + LEVEL[54] = 5400xp + LEVEL[55] = 5500xp + LEVEL[56] = 5600xp + LEVEL[57] = 5700xp + LEVEL[58] = 5800xp + LEVEL[59] = 5900xp + LEVEL[60] = 6000xp + LEVEL[61] = 6100xp + LEVEL[62] = 6200xp + LEVEL[63] = 6300xp + LEVEL[64] = 6400xp + LEVEL[65] = 6500xp + LEVEL[66] = 6600xp + LEVEL[67] = 6700xp + LEVEL[68] = 6800xp + LEVEL[69] = 6900xp + LEVEL[70] = 7000xp + LEVEL[71] = 7100xp + LEVEL[72] = 7200xp + LEVEL[73] = 7300xp + LEVEL[74] = 7400xp + LEVEL[75] = 7500xp + LEVEL[76] = 7600xp + LEVEL[77] = 7700xp + LEVEL[78] = 7800xp + LEVEL[79] = 7900xp + LEVEL[80] = 8000xp + LEVEL[81] = 8100xp + LEVEL[82] = 8200xp + LEVEL[83] = 8300xp + LEVEL[84] = 8400xp + LEVEL[85] = 8500xp + LEVEL[86] = 8600xp + LEVEL[87] = 8700xp + LEVEL[88] = 8800xp + LEVEL[89] = 8900xp + LEVEL[90] = 9000xp + LEVEL[91] = 9100xp + LEVEL[92] = 9200xp + LEVEL[93] = 9300xp + LEVEL[94] = 9400xp + LEVEL[95] = 9500xp + LEVEL[96] = 9600xp + LEVEL[97] = 9700xp + LEVEL[98] = 9800xp + LEVEL[99] = 9900xp + LEVEL[100] = 10000xp +} diff --git a/Crawler/assets/config/classes/Ranger.txt b/Crawler/assets/config/classes/Ranger.txt index f9a3291e..81a634da 100644 --- a/Crawler/assets/config/classes/Ranger.txt +++ b/Crawler/assets/config/classes/Ranger.txt @@ -6,9 +6,9 @@ Ranger BaseAtk = 13 # Amount of health gained per level. - HealthGrowthRate = 3 + HealthGrowthRate = 7 # Amount of attack gained per level. - AtkGrowthRate = 0.8 + AtkGrowthRate = 3 FullRender = unknown_full_render.png diff --git a/Crawler/assets/config/classes/Warrior.txt b/Crawler/assets/config/classes/Warrior.txt index c40364c1..6395e9d0 100644 --- a/Crawler/assets/config/classes/Warrior.txt +++ b/Crawler/assets/config/classes/Warrior.txt @@ -6,9 +6,9 @@ Warrior BaseAtk = 10 # Amount of health gained per level. - HealthGrowthRate = 5 + HealthGrowthRate = 9 # Amount of attack gained per level. - AtkGrowthRate = 0.2 + AtkGrowthRate = 2 FullRender = knight_full_render1.png diff --git a/Crawler/assets/config/classes/Wizard.txt b/Crawler/assets/config/classes/Wizard.txt index 084ecb73..de42f474 100644 --- a/Crawler/assets/config/classes/Wizard.txt +++ b/Crawler/assets/config/classes/Wizard.txt @@ -6,9 +6,9 @@ Wizard BaseAtk = 15 # Amount of health gained per level. - HealthGrowthRate = 1 + HealthGrowthRate = 5 # Amount of attack gained per level. - AtkGrowthRate = 0.5 + AtkGrowthRate = 4 FullRender = wizard_full_render.png diff --git a/x64/Release/Crawler.exe b/x64/Release/Crawler.exe index 3ca5888e..61a88d6a 100644 Binary files a/x64/Release/Crawler.exe and b/x64/Release/Crawler.exe differ