diff --git a/Crawler/AttributableStat.cpp b/Crawler/AttributableStat.cpp index de976848..0b2b868a 100644 --- a/Crawler/AttributableStat.cpp +++ b/Crawler/AttributableStat.cpp @@ -58,8 +58,8 @@ ItemAttributable&ItemAttributable::operator+=(ItemAttributable&rhs){ return *this; }; -ItemAttribute::ItemAttribute(std::string_view name,bool isPct,std::string_view modifies) - :name(std::string(name)),isPct(isPct),modifies(std::string(modifies)){} +ItemAttribute::ItemAttribute(std::string_view name,bool isPct,bool showDecimal,std::string_view modifies) + :name(std::string(name)),isPct(isPct),showDecimal(showDecimal),modifies(std::string(modifies)){} void ItemAttribute::Initialize(){ for(auto&[key,size]:DATA["Stats"]){ @@ -67,7 +67,11 @@ void ItemAttribute::Initialize(){ if(DATA["Stats"][key].HasProperty("Modifies")){ modifies=DATA["Stats"][key]["Modifies"].GetString(); } - attributes.insert(key,ItemAttribute(DATA["Stats"][key]["Display Name"].GetString(),DATA["Stats"][key]["Percentage"].GetBool(),modifies)); + bool showDecimal=false; + if(DATA["Stats"][key].HasProperty("Show Decimal")){ + showDecimal=DATA["Stats"][key]["Show Decimal"].GetBool(); + } + attributes.insert(key,ItemAttribute(DATA["Stats"][key]["Display Name"].GetString(),DATA["Stats"][key]["Percentage"].GetBool(),showDecimal,modifies)); } attributes.SetInitialized(); } @@ -164,4 +168,9 @@ float&operator-=(float&lhs,const ItemAttribute&rhs){ const bool ItemAttribute::operator==(const ItemAttribute&rhs)const{ return name==rhs.name; -}; \ No newline at end of file +}; + + +const bool ItemAttribute::ShowAsDecimal()const{ + return showDecimal; +} \ No newline at end of file diff --git a/Crawler/AttributableStat.h b/Crawler/AttributableStat.h index 3932df61..150da16d 100644 --- a/Crawler/AttributableStat.h +++ b/Crawler/AttributableStat.h @@ -52,16 +52,18 @@ class ItemAttribute{ friend class Crawler; std::string name; bool isPct; + bool showDecimal=false; std::string modifies=""; std::optional>target; static void Initialize(); public: inline static safemapattributes; - ItemAttribute(std::string_view name,bool isPct,std::string_view modifies=""sv); + ItemAttribute(std::string_view name,bool isPct,bool showDecimal,std::string_view modifies=""sv); static ItemAttribute&Get(const std::string_view name,const std::optional>target={}); const std::string_view Name()const; const std::string_view Modifies()const; const bool DisplayAsPercent()const; + const bool ShowAsDecimal()const; const bool operator<(const ItemAttribute&rhs)const; //WARNING! Implemented for map sorting!!! friend float&operator+=(float&lhs,const ItemAttribute&rhs); friend float&operator-=(float&lhs,const ItemAttribute&rhs); diff --git a/Crawler/Crawler.cpp b/Crawler/Crawler.cpp index 111266df..38525bde 100644 --- a/Crawler/Crawler.cpp +++ b/Crawler/Crawler.cpp @@ -210,6 +210,8 @@ bool Crawler::OnUserCreate(){ Inventory::AddItem("Leather Gloves"); Inventory::AddItem("Leather Shoes"); Inventory::AddItem("Wooden Sword"); + Inventory::AddItem("Laser Sword"); + Inventory::AddItem("Shell Sword"); LoadLevel(LEVEL_NAMES["starting_map"_S]); ChangePlayerClass(WARRIOR); @@ -1540,7 +1542,7 @@ void Crawler::LoadLevel(MapName map){ totalBossEncounterMobs=0; Inventory::Clear("Monster Loot"); Inventory::Clear("Stage Loot"); - GetPlayer()->hp=GetPlayer()->GetStat("Health"); + GetPlayer()->hp=GetPlayer()->GetMaxHealth(); GetPlayer()->mana=GetPlayer()->GetMaxMana(); GetPlayer()->SetState(State::NORMAL); GetPlayer()->GetCastInfo()={}; @@ -1892,6 +1894,8 @@ void Crawler::ChangePlayerClass(Class cl){ player->stats=previousStats; player->SetBaseStat("Health",DATA.GetProperty(player->GetClassName()+".BaseHealth").GetInt()); player->hp=player->GetBaseStat("Health"); + player->SetBaseStat("Mana",DATA.GetProperty("Player.BaseMana").GetInt()); + player->mana=player->GetBaseStat("Mana"); player->SetBaseStat("Attack",DATA.GetProperty(player->GetClassName()+".BaseAtk").GetInt()); player->hpGrowthRate=float(DATA.GetProperty(player->GetClassName()+".HealthGrowthRate").GetReal()); player->atkGrowthRate=float(DATA.GetProperty(player->GetClassName()+".AtkGrowthRate").GetReal()); diff --git a/Crawler/Item.cpp b/Crawler/Item.cpp index 9f51fbde..a508f75a 100644 --- a/Crawler/Item.cpp +++ b/Crawler/Item.cpp @@ -150,7 +150,7 @@ void ItemInfo::InitializeItems(){ datafile&dat=data[key]["StatValues["+std::to_string(enhancementLevel)+"]"]; int attrIndex=0; for(ItemAttribute&attr:statValueList){ - enhancementStats.SetAttribute(enhancementLevel,attr,dat.GetInt(attrIndex)); + enhancementStats.SetAttribute(enhancementLevel,attr,dat.GetReal(attrIndex)); attrIndex++; } } @@ -645,7 +645,7 @@ const EquipSlot ItemInfo::Slot()const{ return slot; } -void EnhancementInfo::SetAttribute(int enhanceLevel,ItemAttribute attribute,int value){ +void EnhancementInfo::SetAttribute(int enhanceLevel,ItemAttribute attribute,float value){ while(enhancementStats.size()<=enhanceLevel){ enhancementStats.push_back({}); } @@ -726,7 +726,11 @@ const std::string Stats::GetStatsString(CompactText compact)const{ description+="\n"; } } - description+=std::string(attr.Name())+": "+std::to_string(int(val))+(attr.DisplayAsPercent()?"%":""); + std::string statNumber=std::to_string(int(val)); + if(attr.ShowAsDecimal()){ + statNumber=std::format("{:.2f}",val); + } + description+=std::string(attr.Name())+": "+statNumber+(attr.DisplayAsPercent()?"%":""); first=false; } return description; diff --git a/Crawler/Item.h b/Crawler/Item.h index f09f7e49..c798ae89 100644 --- a/Crawler/Item.h +++ b/Crawler/Item.h @@ -106,7 +106,7 @@ struct EnhancementInfo{ private: std::vectorenhancementStats; public: - void SetAttribute(int enhanceLevel,ItemAttribute attribute,int value); + void SetAttribute(int enhanceLevel,ItemAttribute attribute,float value); const Stats&operator[](int level)const; const size_t size()const; }; diff --git a/Crawler/Player.cpp b/Crawler/Player.cpp index 54632736..44a23b52 100644 --- a/Crawler/Player.cpp +++ b/Crawler/Player.cpp @@ -87,6 +87,7 @@ Player::Player(Player*player) void Player::Initialize(){ Player::GROUND_SLAM_SPIN_TIME="Warrior.Ability 2.SpinTime"_F; SetBaseStat("Health",hp); + SetBaseStat("Mana",mana); SetBaseStat("Defense",0); SetBaseStat("Attack","Warrior.BaseAtk"_I); SetBaseStat("Move Spd %",100); @@ -191,7 +192,7 @@ const int Player::GetMana()const{ } const int Player::GetMaxMana()const{ - return maxmana; + return GetStat("Mana"); } const int Player::GetAttack(){ @@ -850,14 +851,14 @@ bool Player::Heal(int damage){ } void Player::RestoreMana(int amt,bool suppressDamageNumber){ - mana=std::clamp(mana+amt,0,maxmana); + mana=std::clamp(mana+amt,0,GetMaxMana()); if(amt>0&&!suppressDamageNumber){ DAMAGENUMBER_LIST.push_back(std::make_shared(GetPos(),amt,true,MANA_GAIN)); } } void Player::ConsumeMana(int amt){ - mana=std::clamp(mana-amt,0,maxmana); + mana=std::clamp(mana-amt,0,GetMaxMana()); } void Player::SetSizeMult(float size){ @@ -1147,4 +1148,8 @@ void Player::AddAccumulatedXP(const uint32_t xpGain){ const uint32_t Player::GetAccumulatedXP()const{ return accumulatedXP; +} + +const float Player::GetAttackRecoveryRateReduction()const{ + return GetStat("Attack Spd"); } \ No newline at end of file diff --git a/Crawler/Player.h b/Crawler/Player.h index d538f117..8aad377a 100644 --- a/Crawler/Player.h +++ b/Crawler/Player.h @@ -121,6 +121,7 @@ public: const float GetHP6RecoveryPct()const; const float GetHP4RecoveryPct()const; const float GetDamageReductionPct()const; + const float GetAttackRecoveryRateReduction()const; void SetSizeMult(float size); float GetAttackRangeMult(); float GetSpinAngle(); @@ -225,7 +226,7 @@ public: void AddAccumulatedXP(const uint32_t xpGain); private: int hp="Warrior.BaseHealth"_I; - int mana="Player.BaseMana"_I,maxmana=mana; + int mana="Player.BaseMana"_I; float hpGrowthRate="Warrior.HealthGrowthRate"_F; float atkGrowthRate="Warrior.AtkGrowthRate"_F; vf2d pos; diff --git a/Crawler/Ranger.cpp b/Crawler/Ranger.cpp index 787f93d1..51c0c3c4 100644 --- a/Crawler/Ranger.cpp +++ b/Crawler/Ranger.cpp @@ -70,7 +70,7 @@ bool Ranger::AutoAttack(){ geom2d::line pointTowardsCursor(GetPos(),game->GetWorldMousePos()); vf2d extendedLine=pointTowardsCursor.upoint(1.1f); float angleToCursor=atan2(extendedLine.y-GetPos().y,extendedLine.x-GetPos().x); - attack_cooldown_timer=ARROW_ATTACK_COOLDOWN; + attack_cooldown_timer=ARROW_ATTACK_COOLDOWN-GetAttackRecoveryRateReduction(); BULLET_LIST.push_back(std::make_unique(Arrow(GetPos(),extendedLine,vf2d{cos(angleToCursor)*"Ranger.Auto Attack.ArrowSpd"_F,float(sin(angleToCursor)*"Ranger.Auto Attack.ArrowSpd"_F-PI/8*"Ranger.Auto Attack.ArrowSpd"_F)}+movementVelocity,"Ranger.Auto Attack.Radius"_F/100*12,int(GetAttack()*"Ranger.Auto Attack.DamageMult"_F),OnUpperLevel(),true))); SetState(State::SHOOT_ARROW); SetAnimationBasedOnTargetingDirection(angleToCursor); diff --git a/Crawler/Version.h b/Crawler/Version.h index b24320e5..f07ae609 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 4867 +#define VERSION_BUILD 4874 #define stringify(a) stringify_(a) #define stringify_(a) #a diff --git a/Crawler/Warrior.cpp b/Crawler/Warrior.cpp index 02cc48e5..ad7e0514 100644 --- a/Crawler/Warrior.cpp +++ b/Crawler/Warrior.cpp @@ -79,7 +79,7 @@ bool Warrior::AutoAttack(){ } } if(closest!=nullptr&&closest->Hurt(int(GetAttack()*"Warrior.Auto Attack.DamageMult"_F),OnUpperLevel(),GetZ())){ - attack_cooldown_timer=ATTACK_COOLDOWN; + attack_cooldown_timer=ATTACK_COOLDOWN-GetAttackRecoveryRateReduction(); swordSwingTimer="Warrior.Auto Attack.SwordSwingTime"_F; SetState(State::SWING_SWORD); switch(facingDirection){ diff --git a/Crawler/Wizard.cpp b/Crawler/Wizard.cpp index 115b5e46..bd59cb89 100644 --- a/Crawler/Wizard.cpp +++ b/Crawler/Wizard.cpp @@ -102,7 +102,7 @@ void Wizard::OnUpdate(float fElapsedTime){ } bool Wizard::AutoAttack(){ - attack_cooldown_timer=MAGIC_ATTACK_COOLDOWN; + attack_cooldown_timer=MAGIC_ATTACK_COOLDOWN-GetAttackRecoveryRateReduction(); float angleToCursor=atan2(game->GetWorldMousePos().y-GetPos().y,game->GetWorldMousePos().x-GetPos().x); BULLET_LIST.push_back(std::make_unique(EnergyBolt(GetPos(),{cos(angleToCursor)*"Wizard.Auto Attack.Speed"_F,sin(angleToCursor)*"Wizard.Auto Attack.Speed"_F},"Wizard.Auto Attack.Radius"_F/100*12,int(GetAttack()*"Wizard.Auto Attack.DamageMult"_F),upperLevel,true,WHITE))); return true; diff --git a/Crawler/assets/config/items/ItemStats.txt b/Crawler/assets/config/items/ItemStats.txt index 0f0db8c5..0f970305 100644 --- a/Crawler/assets/config/items/ItemStats.txt +++ b/Crawler/assets/config/items/ItemStats.txt @@ -76,6 +76,7 @@ Stats Attack Spd { Display Name = Attack Spd + Show Decimal = True Percentage = False } Mana