From bd407aca830ef22ea894e3bb45492e9bb43f5747 Mon Sep 17 00:00:00 2001 From: Nic0Nic0Nii Date: Fri, 28 Jul 2023 20:17:09 +0000 Subject: [PATCH] Implement a few more properties Co-authored-by: sigonasr2 --- Crawler/Crawler.cpp | 7 +++++ Crawler/EnergyBolt.cpp | 12 ++++----- Crawler/Warrior.cpp | 2 +- Crawler/Wizard.cpp | 6 ++--- Crawler/assets/config/classes/Warrior.txt | 3 +-- Crawler/assets/config/classes/Wizard.txt | 31 +++++++++++++++++++++++ Crawler/config.h | 3 ++- 7 files changed, 51 insertions(+), 13 deletions(-) diff --git a/Crawler/Crawler.cpp b/Crawler/Crawler.cpp index 2829b527..b82bca51 100644 --- a/Crawler/Crawler.cpp +++ b/Crawler/Crawler.cpp @@ -1218,6 +1218,13 @@ float operator ""_F(const char*key,std::size_t len){ return DATA.GetProperty(std::string(key,len)).GetReal(); } +float operator ""_FRange(const char*key,std::size_t len){ + if(utils::datafile::DEBUG_ACCESS_OPTIONS){ + std::cout<<"Reading "<AddEffect(std::make_unique(pos,util::random(1),AnimationState::ENERGY_PARTICLE,upperLevel,util::random(2),0.5f,vf2d{util::random(60)-30,util::random(60)-30})); + lastParticleSpawn="Wizard.Auto Attack.ParticleFrequency"_F; + game->AddEffect(std::make_unique(pos,"Wizard.Auto Attack.ParticleLifetimeRange"_FRange,AnimationState::ENERGY_PARTICLE,upperLevel,"Wizard.Auto Attack.ParticleSizeRange"_FRange,"Wizard.Auto Attack.ParticleFadeoutTime"_F,vf2d{"Wizard.Auto Attack.ParicleSpeedRange"_FRange,"Wizard.Auto Attack.ParicleSpeedRange"_FRange})); } } bool EnergyBolt::PlayerHit(Player*player) { deactivated=true; - fadeOutTime=0.2f; - game->AddEffect(std::make_unique(player->GetPos(),0,AnimationState::SPLASH_EFFECT,upperLevel,player->GetSizeMult(),0.25)); + fadeOutTime="Wizard.Auto Attack.BulletHitFadeoutTime"_F; + game->AddEffect(std::make_unique(player->GetPos(),0,AnimationState::SPLASH_EFFECT,upperLevel,player->GetSizeMult(),"Wizard.Auto Attack.SplashEffectFadeoutTime"_F)); return false; } bool EnergyBolt::MonsterHit(Monster& monster) { deactivated=true; - fadeOutTime=0.2f; - game->AddEffect(std::make_unique(monster.GetPos(),0,AnimationState::SPLASH_EFFECT,upperLevel,monster.GetSizeMult(),0.25)); + fadeOutTime="Wizard.Auto Attack.BulletHitFadeoutTime"_F; + game->AddEffect(std::make_unique(monster.GetPos(),0,AnimationState::SPLASH_EFFECT,upperLevel,monster.GetSizeMult(),"Wizard.Auto Attack.SplashEffectFadeoutTime"_F)); return false; } diff --git a/Crawler/Warrior.cpp b/Crawler/Warrior.cpp index 47c3db63..7764ff1e 100644 --- a/Crawler/Warrior.cpp +++ b/Crawler/Warrior.cpp @@ -84,7 +84,7 @@ void Warrior::InitializeClassAbilities(){ 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()>="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))){ + if(m.GetSizeMult()>="Warrior.Ability 1.AffectedSizeRange"_f[0]&&m.GetSizeMult()<="Warrior.Ability 1.AffectedSizeRange"_f[1]&&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); } } diff --git a/Crawler/Wizard.cpp b/Crawler/Wizard.cpp index ef4fc71f..2a543894 100644 --- a/Crawler/Wizard.cpp +++ b/Crawler/Wizard.cpp @@ -67,7 +67,7 @@ void Wizard::OnUpdate(float fElapsedTime){ bool Wizard::AutoAttack(){ attack_cooldown_timer=MAGIC_ATTACK_COOLDOWN; 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,GetAttack(),upperLevel,true,WHITE))); + 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,GetAttack()*"Wizard.Auto Attack.DamageMult"_F,upperLevel,true,WHITE))); return true; } void Wizard::InitializeClassAbilities(){ @@ -104,7 +104,7 @@ void Wizard::InitializeClassAbilities(){ Wizard::ability1.action= [](Player*p,vf2d pos={}){ float angleToCursor=atan2(game->GetWorldMousePos().y-p->GetPos().y,game->GetWorldMousePos().x-p->GetPos().x); - BULLET_LIST.push_back(std::make_unique(FireBolt(p->GetPos(),{cos(angleToCursor)*275,sin(angleToCursor)*275},12,p->GetAttack(),p->upperLevel,true,{240,120,60}))); + BULLET_LIST.push_back(std::make_unique(FireBolt(p->GetPos(),{cos(angleToCursor)*"Wizard.Ability 1.BulletSpeed"_F,sin(angleToCursor)*"Wizard.Ability 1.BulletSpeed"_F},"Wizard.Ability 1.Radius"_F/100*12,p->GetAttack()*"Wizard.Ability 1.InitialDamageMult"_F,p->upperLevel,true,"Wizard.Ability 1.BulletColor"_Pixel))); return true; }; #pragma endregion @@ -112,7 +112,7 @@ void Wizard::InitializeClassAbilities(){ Wizard::ability2.action= [](Player*p,vf2d pos={}){ float angleToCursor=atan2(game->GetWorldMousePos().y-p->GetPos().y,game->GetWorldMousePos().x-p->GetPos().x); - BULLET_LIST.push_back(std::make_unique(LightningBolt(p->GetPos(),{cos(angleToCursor)*230,sin(angleToCursor)*230},12,p->GetAttack()*4,p->upperLevel,true,WHITE))); + BULLET_LIST.push_back(std::make_unique(LightningBolt(p->GetPos(),{cos(angleToCursor)*"Wizard.Ability 2.BulletSpeed"_F,sin(angleToCursor)*"Wizard.Ability 2.BulletSpeed"_F},"Wizard.Ability 2.Radius"_F/100*12,p->GetAttack()*"Wizard.Ability 2.DamageMult"_F,p->upperLevel,true,"Wizard.Ability 2.BulletColor"_Pixel))); return true; }; #pragma endregion diff --git a/Crawler/assets/config/classes/Warrior.txt b/Crawler/assets/config/classes/Warrior.txt index 1c6b0f0b..eb76785c 100644 --- a/Crawler/assets/config/classes/Warrior.txt +++ b/Crawler/assets/config/classes/Warrior.txt @@ -59,8 +59,7 @@ Warrior DamageReduction = 0.1 # The smallest and largest size of enemies this ability affects (inclusive). - AffectedSizeMin = 0 - AffectedSizeMax = 1 + AffectedSizeRange = 0,1 # How long the applied slow debuff lasts in seconds. SlowdownDuration = 5 diff --git a/Crawler/assets/config/classes/Wizard.txt b/Crawler/assets/config/classes/Wizard.txt index 82b0127e..33467fd1 100644 --- a/Crawler/assets/config/classes/Wizard.txt +++ b/Crawler/assets/config/classes/Wizard.txt @@ -8,6 +8,19 @@ Wizard Radius = 100 Speed = 200 Cooldown = 0.85 + + # When bullet makes contact, how fast the bullet will fade out. + BulletHitFadeoutTime = 0.2 + + # How much time passes before another particle spawns from the bullet. + ParticleFrequency = 0.03 + # Specify a minimum and maximum range + ParticleLifetimeRange = 0,1 + ParticleSizeRange = 0,2 + ParticleFadeoutTime = 0.5 + ParticleSpeedRange = -30,30 + + SplashEffectFadeoutTime = 0.25 } Right Click Ability @@ -59,6 +72,15 @@ Wizard Precast Time = 0 Casting Range = 0 Casting Size = 0 + + # Damage multiplier of the initial hit. + InitialDamageMult = 1 + + BulletSpeed = 275 + Radius = 100 + + #Coloring of the bullet. + BulletColor = 240, 120, 60, 255 } Ability 2 { @@ -73,6 +95,15 @@ Wizard Precast Time = 0 Casting Range = 0 Casting Size = 0 + + # Damage multiplier of the initial hit. + DamageMult = 4 + + BulletSpeed = 230 + Radius = 100 + + #Coloring of the bullet. + BulletColor = 255, 255, 255, 255 } Ability 3 { diff --git a/Crawler/config.h b/Crawler/config.h index 11806fbf..9845fe08 100644 --- a/Crawler/config.h +++ b/Crawler/config.h @@ -20,4 +20,5 @@ float operator ""_F(const char*key,std::size_t len); //Read a double key from the config. double operator ""_D(const char*key,std::size_t len); -Pixel operator ""_Pixel(const char*key,std::size_t len); \ No newline at end of file +Pixel operator ""_Pixel(const char*key,std::size_t len); +float operator ""_FRange(const char*key,std::size_t len); \ No newline at end of file