Extracted base health, base attack,and growth rates from being tied to the player directly. Values update on class changes.

pull/28/head
sigonasr2 1 year ago
parent e779725106
commit 0fdfa65ddf
  1. 4
      Crawler/Crawler.cpp
  2. 2
      Crawler/GameState.cpp
  3. 1
      Crawler/Player.cpp
  4. 10
      Crawler/Player.h
  5. 2
      Crawler/Version.h
  6. 2
      Crawler/assets/config/configuration.txt

@ -1486,6 +1486,10 @@ void Crawler::ChangePlayerClass(Class cl){
player.reset(new Witch(player.get()));
}break;
}
player->hp=player->maxhp=DATA.GetProperty(player->GetClassName()+".BaseHealth").GetInt();
player->atk=DATA.GetProperty(player->GetClassName()+".BaseAtk").GetInt();
player->hpGrowthRate=DATA.GetProperty(player->GetClassName()+".HealthGrowthRate").GetReal();
player->atkGrowthRate=DATA.GetProperty(player->GetClassName()+".AtkGrowthRate").GetReal();
sig::Animation::SetupPlayerAnimations();
GetPlayer()->UpdateIdleAnimation(DOWN);
}

@ -6,5 +6,5 @@ void GameState::Initialize(){
NEW_STATE(States::GAME_RUN,State_GameRun);
NEW_STATE(States::MAIN_MENU,State_MainMenu);
GameState::ChangeState(States::MAIN_MENU);
GameState::ChangeState(States::GAME_RUN);
}

@ -17,6 +17,7 @@ INCLUDE_SPAWNER_LIST
INCLUDE_BULLET_LIST
INCLUDE_DAMAGENUMBER_LIST
INCLUDE_game
INCLUDE_DATA
float Player::GROUND_SLAM_SPIN_TIME=0.6f;

@ -11,6 +11,8 @@
#include "config.h"
#include "Key.h"
#undef GetClassName
struct CastInfo{
std::string name;
float castTimer;
@ -29,9 +31,11 @@ struct Player{
friend struct Witch;
friend class State_GameRun;
private:
int hp="Player.BaseHealth"_I,maxhp=hp;
int hp="Warrior.BaseHealth"_I,maxhp=hp;
int mana="Player.BaseMana"_I,maxmana=mana;
int atk="Player.BaseAtk"_I;
int atk="Warrior.BaseAtk"_I;
float hpGrowthRate="Warrior.HealthGrowthRate"_F;
float atkGrowthRate="Warrior.AtkGrowthRate"_F;
vf2d pos;
float z=0;
float moveSpd=1.0f;
@ -404,4 +408,4 @@ struct Witch:Player{
{#class".Ability 3.Precast Time"_F,#class".Ability 3.Casting Range"_I/100.f*24,#class".Ability 3.Casting Size"_I/100.f*24}, \
bool(#class".Ability 3.CancelCast"_I) \
}; \
class::ability4;
class::ability4;

@ -2,7 +2,7 @@
#define VERSION_MAJOR 0
#define VERSION_MINOR 2
#define VERSION_PATCH 0
#define VERSION_BUILD 2225
#define VERSION_BUILD 2231
#define stringify(a) stringify_(a)
#define stringify_(a) #a

@ -55,7 +55,7 @@ debug_access_options = 0
debug_map_load_info = 0
# Shows extra info about the player on the HUD
debug_player_info = 1
debug_player_info = 0
# Shows collision boxes of tiles.
debug_collision_boxes = 0

Loading…
Cancel
Save