From e77972510601362fe28b6a021f72cb4e68d51baa Mon Sep 17 00:00:00 2001 From: sigonasr2 Date: Sat, 21 Oct 2023 00:33:46 -0500 Subject: [PATCH] Define health and growth rates of each class. --- Crawler/CharacterInfoWindow.cpp | 8 ++++++-- Crawler/CharacterRotatingDisplay.h | 9 ++++----- Crawler/Menu.cpp | 10 +++++----- Crawler/MenuLabel.h | 2 +- Crawler/Version.h | 2 +- Crawler/assets/config/Player.txt | 3 --- Crawler/assets/config/classes/Ranger.txt | 8 ++++++++ Crawler/assets/config/classes/Thief.txt | 8 ++++++++ Crawler/assets/config/classes/Trapper.txt | 8 ++++++++ Crawler/assets/config/classes/Warrior.txt | 8 ++++++++ Crawler/assets/config/classes/Witch.txt | 8 ++++++++ Crawler/assets/config/classes/Wizard.txt | 8 ++++++++ 12 files changed, 65 insertions(+), 17 deletions(-) diff --git a/Crawler/CharacterInfoWindow.cpp b/Crawler/CharacterInfoWindow.cpp index fe7e878c..1e7e5b67 100644 --- a/Crawler/CharacterInfoWindow.cpp +++ b/Crawler/CharacterInfoWindow.cpp @@ -12,11 +12,15 @@ typedef Attribute A; void Menu::InitializeClassInfoWindow(){ Menu*classInfoWindow=CreateMenu(CLASS_INFO,CENTERED,game->GetScreenSize()-vi2d{64,64}); - MenuLabel*label=new MenuLabel(CLASS_INFO,{{classInfoWindow->pos.x,classInfoWindow->pos.y+8},{classInfoWindow->size.x,16}},"Warrior",2,true,true); + MenuLabel*label=new MenuLabel(CLASS_INFO,{{0,8},{classInfoWindow->size.x,16}},"Warrior",2,true,true); classInfoWindow->AddComponent("Class Name",label); - CharacterRotatingDisplay*classDisplay=new CharacterRotatingDisplay(CLASS_INFO,{classInfoWindow->center()-vf2d{classInfoWindow->size.x/4,0},{72,120}},GFX["knight_full_render1.png"].Decal()); + CharacterRotatingDisplay*classDisplay=new CharacterRotatingDisplay(CLASS_INFO,{{0,0},{72,120}},GFX["knight_full_render1.png"].Decal()); classInfoWindow->AddComponent("Rotating Character Display",classDisplay); + + MenuLabel*baseStatsLabel=new MenuLabel(CLASS_INFO,{{2*classInfoWindow->size.x/3,classInfoWindow->pos.y+20},{classInfoWindow->size.x/3,16}},"Base Stats",1,true,true); + + classInfoWindow->AddComponent("Base Stats Text",baseStatsLabel); } \ No newline at end of file diff --git a/Crawler/CharacterRotatingDisplay.h b/Crawler/CharacterRotatingDisplay.h index 4e21e0e2..2099af2d 100644 --- a/Crawler/CharacterRotatingDisplay.h +++ b/Crawler/CharacterRotatingDisplay.h @@ -27,12 +27,11 @@ protected: } virtual inline void DrawDecal(Crawler*game,vf2d parentPos,bool focused)override{ //MenuComponent::DrawDecal(game,parentPos,focused); - std::cout<DrawWarpedDecal(icon,std::array{ - rect.pos-icon->sprite->Size()/2+vf2d{abs(sin(timer)),sin(float(timer+PI))}*vf2d{rotatingFactor,perspectiveFactor}, - rect.pos+vf2d{0,rect.size.y}-icon->sprite->Size()/2+vf2d{abs(sin(timer)),sin(timer)}*vf2d{rotatingFactor,perspectiveFactor}, - rect.pos+rect.size-icon->sprite->Size()/2+vf2d{-abs(sin(float(timer+PI))),sin(float(timer+PI))}*vf2d{rotatingFactor,perspectiveFactor}, - rect.pos+vf2d{rect.size.x,0}-icon->sprite->Size()/2+vf2d{-abs(sin(float(timer+PI))),sin(timer)}*vf2d{rotatingFactor,perspectiveFactor}, + parentPos+rect.middle()+vf2d{abs(sin(timer)),sin(float(timer+PI))}*vf2d{rotatingFactor,perspectiveFactor}, + parentPos+rect.middle()+vf2d{0,rect.size.y}+vf2d{abs(sin(timer)),sin(timer)}*vf2d{rotatingFactor,perspectiveFactor}, + parentPos+rect.middle()+rect.size+vf2d{-abs(sin(float(timer+PI))),sin(float(timer+PI))}*vf2d{rotatingFactor,perspectiveFactor}, + parentPos+rect.middle()+vf2d{rect.size.x,0}+vf2d{-abs(sin(float(timer+PI))),sin(timer)}*vf2d{rotatingFactor,perspectiveFactor}, }); } }; \ No newline at end of file diff --git a/Crawler/Menu.cpp b/Crawler/Menu.cpp index 81db78a6..8314c59a 100644 --- a/Crawler/Menu.cpp +++ b/Crawler/Menu.cpp @@ -239,13 +239,13 @@ void Menu::Draw(Crawler*game){ game->Clear(BLANK); for(auto&component:displayComponents){ if(component->renderInMain){ - component->_Draw(game,pos,this==Menu::stack.back()); + component->_Draw(game,{0,0},this==Menu::stack.back()); } } for(auto&key:buttons){ for(auto&button:key.second){ if(button->renderInMain){ - button->_Draw(game,pos,this==Menu::stack.back()); + button->_Draw(game,{0,0},this==Menu::stack.back()); } } } @@ -255,13 +255,13 @@ void Menu::Draw(Crawler*game){ game->DrawDecal(pos,r.Decal()); for(auto&component:displayComponents){ if(component->renderInMain){ - component->_DrawDecal(game,pos,this==Menu::stack.back()); + component->_DrawDecal(game,{0,0},this==Menu::stack.back()); } } for(auto&key:buttons){ for(auto&button:key.second){ if(button->renderInMain){ - button->_DrawDecal(game,pos,this==Menu::stack.back()); + button->_DrawDecal(game,{0,0},this==Menu::stack.back()); } } } @@ -588,5 +588,5 @@ void Menu::AddInventoryListener(MenuComponent*component,ITCategory category){ } vf2d Menu::center(){ - return pos+size/2; + return size/2; } \ No newline at end of file diff --git a/Crawler/MenuLabel.h b/Crawler/MenuLabel.h index 655cc80f..1f22f101 100644 --- a/Crawler/MenuLabel.h +++ b/Crawler/MenuLabel.h @@ -24,7 +24,7 @@ protected: } virtual void inline Draw(Crawler*game,vf2d parentPos,bool focused)override{ std::string wrappedText=util::WrapText(game,label,rect.size.x,true,{float(scale),float(scale)}); - vf2d drawPos=-parentPos+rect.middle()-game->GetTextSizeProp(wrappedText)*float(scale)/2; //Assume centered. + vf2d drawPos=parentPos+rect.middle()-vf2d{game->GetTextSizeProp(wrappedText)}*float(scale)/2; //Assume centered. if(!centered){ drawPos=rect.pos+parentPos; } diff --git a/Crawler/Version.h b/Crawler/Version.h index a151bdad..d974c186 100644 --- a/Crawler/Version.h +++ b/Crawler/Version.h @@ -2,7 +2,7 @@ #define VERSION_MAJOR 0 #define VERSION_MINOR 2 #define VERSION_PATCH 0 -#define VERSION_BUILD 2196 +#define VERSION_BUILD 2225 #define stringify(a) stringify_(a) #define stringify_(a) #a diff --git a/Crawler/assets/config/Player.txt b/Crawler/assets/config/Player.txt index f687aa33..1ae9697e 100644 --- a/Crawler/assets/config/Player.txt +++ b/Crawler/assets/config/Player.txt @@ -1,11 +1,8 @@ Player { - BaseHealth = 100 BaseMana = 100 MoveSpd = 100 - BaseAtk = 10 - # Amount of spd to increase/decrease vertically as you climb staircases StaircaseClimbSpd = 45 diff --git a/Crawler/assets/config/classes/Ranger.txt b/Crawler/assets/config/classes/Ranger.txt index 2d8cd734..aa2f0adf 100644 --- a/Crawler/assets/config/classes/Ranger.txt +++ b/Crawler/assets/config/classes/Ranger.txt @@ -2,6 +2,14 @@ Ranger { ClassName = Ranger + BaseHealth = 90 + BaseAtk = 13 + + # Amount of health gained per level. + HealthGrowthRate = 3 + # Amount of attack gained per level. + AtkGrowthRate = 0.8 + Auto Attack { DamageMult = 1 diff --git a/Crawler/assets/config/classes/Thief.txt b/Crawler/assets/config/classes/Thief.txt index bddf9f92..83c95f5e 100644 --- a/Crawler/assets/config/classes/Thief.txt +++ b/Crawler/assets/config/classes/Thief.txt @@ -2,6 +2,14 @@ Thief { ClassName = Thief + BaseHealth = 100 + BaseAtk = 10 + + # Amount of health gained per level. + HealthGrowthRate = 5 + # Amount of attack gained per level. + AtkGrowthRate = 0.2 + Right Click Ability { Name = ??? diff --git a/Crawler/assets/config/classes/Trapper.txt b/Crawler/assets/config/classes/Trapper.txt index a58068fa..a9124d1f 100644 --- a/Crawler/assets/config/classes/Trapper.txt +++ b/Crawler/assets/config/classes/Trapper.txt @@ -2,6 +2,14 @@ Trapper { ClassName = Trapper + BaseHealth = 100 + BaseAtk = 10 + + # Amount of health gained per level. + HealthGrowthRate = 5 + # Amount of attack gained per level. + AtkGrowthRate = 0.2 + Right Click Ability { Name = ??? diff --git a/Crawler/assets/config/classes/Warrior.txt b/Crawler/assets/config/classes/Warrior.txt index 3761fad9..9e969110 100644 --- a/Crawler/assets/config/classes/Warrior.txt +++ b/Crawler/assets/config/classes/Warrior.txt @@ -2,6 +2,14 @@ Warrior { ClassName = Warrior + BaseHealth = 100 + BaseAtk = 10 + + # Amount of health gained per level. + HealthGrowthRate = 5 + # Amount of attack gained per level. + AtkGrowthRate = 0.2 + Auto Attack { DamageMult = 1 diff --git a/Crawler/assets/config/classes/Witch.txt b/Crawler/assets/config/classes/Witch.txt index c3a900b4..2a9d1513 100644 --- a/Crawler/assets/config/classes/Witch.txt +++ b/Crawler/assets/config/classes/Witch.txt @@ -2,6 +2,14 @@ Witch { ClassName = Witch + BaseHealth = 100 + BaseAtk = 10 + + # Amount of health gained per level. + HealthGrowthRate = 5 + # Amount of attack gained per level. + AtkGrowthRate = 0.2 + Right Click Ability { Name = ??? diff --git a/Crawler/assets/config/classes/Wizard.txt b/Crawler/assets/config/classes/Wizard.txt index 88a3a97e..5ed0558b 100644 --- a/Crawler/assets/config/classes/Wizard.txt +++ b/Crawler/assets/config/classes/Wizard.txt @@ -2,6 +2,14 @@ Wizard { ClassName = Wizard + BaseHealth = 80 + BaseAtk = 15 + + # Amount of health gained per level. + HealthGrowthRate = 1 + # Amount of attack gained per level. + AtkGrowthRate = 0.5 + Auto Attack { DamageMult = 1