Start incorporating Warrior ability properties into config file.

Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
pull/28/head
Nic0Nic0Nii 1 year ago
parent 44281bac19
commit eb1ceb31dd
  1. 4
      Crawler/Player.cpp
  2. 5
      Crawler/Player.h
  3. 12
      Crawler/Warrior.cpp
  4. 44
      Crawler/assets/config/classes/Warrior.txt

@ -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;

@ -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_ptr<DamageNumber>damageNumberPtr;
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<std::string,float> 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);

@ -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<Effect>(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<Effect>(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<float>(p->GetPos(),12*3.5),geom2d::circle<float>(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<float>(p->GetPos(),12*"Warrior.Ability 1.Range"_I/100.f),geom2d::circle<float>(m.GetPos(),m.GetSizeMult()*12))){
m.AddBuff(BuffType::SLOWDOWN,"Warrior.Ability 1.SlowdownDuration"_F,"Warrior.Ability 1.SlowdownAmt"_F);
}
}
return true;

@ -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
{

Loading…
Cancel
Save