From eb1ceb31dd16d32e8c0c9bddf5c9062203c26b97 Mon Sep 17 00:00:00 2001 From: Nic0Nic0Nii Date: Thu, 27 Jul 2023 21:21:39 +0000 Subject: [PATCH] Start incorporating Warrior ability properties into config file. Co-authored-by: sigonasr2 --- Crawler/Player.cpp | 4 +-- Crawler/Player.h | 5 +-- Crawler/Warrior.cpp | 12 +++---- Crawler/assets/config/classes/Warrior.txt | 44 ++++++++++++++++++++++- 4 files changed, 54 insertions(+), 11 deletions(-) diff --git a/Crawler/Player.cpp b/Crawler/Player.cpp index 7889d580..c83736ab 100644 --- a/Crawler/Player.cpp +++ b/Crawler/Player.cpp @@ -229,7 +229,7 @@ void Player::Update(float fElapsedTime){ animation.UpdateState(internal_animState,fElapsedTime); }break; case BLOCK:{ - if(rightClickAbility.COOLDOWN_TIME-rightClickAbility.cooldown>3){ + if(rightClickAbility.COOLDOWN_TIME-rightClickAbility.cooldown>"Warrior.Right Click Ability.Duration"_F){ SetState(NORMAL); } }break; @@ -466,7 +466,7 @@ bool Player::HasIframes(){ bool Player::Hurt(int damage,bool onUpperLevel){ if(hp<=0||iframe_time!=0||OnUpperLevel()!=onUpperLevel) return false; - if(state==State::BLOCK)damage=0; + if(state==State::BLOCK)damage*=1-"Warrior.Right Click Ability.DamageReduction"_F; float mod_dmg=damage; for(Buff&b:GetBuffs(BuffType::DAMAGE_REDUCTION)){ mod_dmg-=damage*b.intensity; diff --git a/Crawler/Player.h b/Crawler/Player.h index 6c6d0e2c..a18322c2 100644 --- a/Crawler/Player.h +++ b/Crawler/Player.h @@ -8,6 +8,7 @@ #include "Buff.h" #include "Pathfinding.h" #include "DamageNumber.h" +#include "config.h" struct CastInfo{ std::string name; @@ -52,7 +53,7 @@ struct Player{ float lastHitTimer=0; //When this is greater than zero, if we get hit again it adds to our displayed combo number. std::shared_ptrdamageNumberPtr; protected: - const float ATTACK_COOLDOWN=0.35f; + const float ATTACK_COOLDOWN="Warrior.Auto Attack.Cooldown"_F; const float MAGIC_ATTACK_COOLDOWN=0.85f; const float ARROW_ATTACK_COOLDOWN=0.6f; void SetSwordSwingTimer(float val); @@ -76,7 +77,7 @@ protected: std::pair notificationDisplay={"",0}; bool upperLevel=false; vf2d vel={0,0}; - float attack_range=1.5f; + float attack_range="Warrior.Auto Attack.Range"_F/100.f; Key facingDirection=DOWN; float swordSwingTimer=0; void CastSpell(Ability&ability); diff --git a/Crawler/Warrior.cpp b/Crawler/Warrior.cpp index f25531a9..be882472 100644 --- a/Crawler/Warrior.cpp +++ b/Crawler/Warrior.cpp @@ -71,7 +71,7 @@ void Warrior::InitializeClassAbilities(){ if(p->GetState()==State::NORMAL){ rightClickAbility.cooldown=rightClickAbility.COOLDOWN_TIME; p->SetState(State::BLOCK); - p->AddBuff(BuffType::SLOWDOWN,3,0.3); + p->AddBuff(BuffType::SLOWDOWN,"Warrior.Right Click Ability.Duration"_F,"Warrior.Right Click Ability.SlowAmt"_F); return true; } return false; @@ -80,12 +80,12 @@ void Warrior::InitializeClassAbilities(){ #pragma region Warrior Ability 1 (Battlecry) Warrior::ability1.action= [](Player*p,vf2d pos={}){ - game->AddEffect(std::make_unique(p->GetPos(),0.1,AnimationState::BATTLECRY_EFFECT,p->upperLevel,1,0.3)); - p->AddBuff(BuffType::ATTACK_UP,10,0.1); - p->AddBuff(BuffType::DAMAGE_REDUCTION,10,0.1); + game->AddEffect(std::make_unique(p->GetPos(),"Warrior.Ability 1.EffectLifetime"_F,AnimationState::BATTLECRY_EFFECT,p->upperLevel,"Warrior.Ability 1.Range"_F/350,"Warrior.Ability 1.EffectFadetime"_F)); + p->AddBuff(BuffType::ATTACK_UP,"Warrior.Ability 1.AttackUpDuration"_F,"Warrior.Ability 1.AttackIncrease"_F); + p->AddBuff(BuffType::DAMAGE_REDUCTION,"Warrior.Ability 1.DamageReductionDuration"_F,"Warrior.Ability 1.DamageReduction"_F); for(Monster&m:MONSTER_LIST){ - if(m.GetSizeMult()<=1&&geom2d::overlaps(geom2d::circle(p->GetPos(),12*3.5),geom2d::circle(m.GetPos(),m.GetSizeMult()*12))){ - m.AddBuff(BuffType::SLOWDOWN,5,0.3); + if(m.GetSizeMult()>="Warrior.Ability 1.AffectedSizeMin"_F&&m.GetSizeMult()<="Warrior.Ability 1.AffectedSizeMax"_F&&geom2d::overlaps(geom2d::circle(p->GetPos(),12*"Warrior.Ability 1.Range"_I/100.f),geom2d::circle(m.GetPos(),m.GetSizeMult()*12))){ + m.AddBuff(BuffType::SLOWDOWN,"Warrior.Ability 1.SlowdownDuration"_F,"Warrior.Ability 1.SlowdownAmt"_F); } } return true; diff --git a/Crawler/assets/config/classes/Warrior.txt b/Crawler/assets/config/classes/Warrior.txt index 3d90f57e..4d4a50a1 100644 --- a/Crawler/assets/config/classes/Warrior.txt +++ b/Crawler/assets/config/classes/Warrior.txt @@ -1,7 +1,12 @@ Warrior { ClassName = Warrior - + Auto Attack + { + DamageMult = 1 + Range = 150 + Cooldown = 0.35 + } Right Click Ability { Name = Block @@ -15,6 +20,14 @@ Warrior Precast Time = 0 Casting Range = 0 Casting Size = 0 + + Duration = 3 + + # Percentage of player's normal movement speed while block is active. + SlowAmt = 0.3 + + # Percentage of damage to reduce by. (1.0 = 100%) + DamageReduction = 1.00 } Ability 1 { @@ -29,6 +42,35 @@ Warrior Precast Time = 0 Casting Range = 0 Casting Size = 0 + + Range = 350 + + # Amount of time in seconds the attack damage increase lasts. + AttackUpDuration = 10 + + # Percentage of attack damage to increase by. + AttackIncrease = 0.1 + + # Amount of time in seconds the damage reduction increase lasts. + DamageReductionDuration = 10 + + # Percentage of damage reduction to increase by. + DamageReduction = 0.1 + + # The smallest and largest size of enemies this ability affects (inclusive). + AffectedSizeMin = 0 + AffectedSizeMax = 1 + + # How long the applied slow debuff lasts in seconds. + SlowdownDuration = 5 + + # Percentage of speed down applied to affected enemies. + SlowdownAmt = 0.3 + + # Amount of time the effect lives for on-screen before fading begins. + EffectLifetime = 0.1 + # Amount of time the effect fades out. + EffectFadetime = 0.3 } Ability 2 {