Add slight knockback effect to Warrior's ground slam. Release Build 7885.

mac-build
sigonasr2 11 months ago
parent 030b16db3f
commit 9afff3a8e5
  1. 14
      Adventures in Lestoria/AdventuresInLestoria.cpp
  2. 28
      Adventures in Lestoria/Monster.cpp
  3. 1
      Adventures in Lestoria/Monster.h
  4. 17
      Adventures in Lestoria/Player.cpp
  5. 2
      Adventures in Lestoria/Version.h
  6. 9
      Adventures in Lestoria/assets/config/classes/Warrior.txt
  7. BIN
      x64/Release/Adventures in Lestoria.exe

@ -383,16 +383,16 @@ bool AiL::DownHeld(){
return KEY_DOWN.Held()||KEY_SCROLLVERT_L.Analog()>=0.2f;
}
bool AiL::LeftReleased(){
return KEY_LEFT.Released();
return KEY_LEFT.Released()||Input::UsingGamepad()&&player->movementVelocity.x<0&&KEY_SCROLLHORZ_L.Analog()>-0.2f;
}
bool AiL::RightReleased(){
return KEY_RIGHT.Released();
return KEY_RIGHT.Released()||Input::UsingGamepad()&&player->movementVelocity.x>0&&KEY_SCROLLHORZ_L.Analog()<0.2f;
}
bool AiL::UpReleased(){
return KEY_UP.Released();
return KEY_UP.Released()||Input::UsingGamepad()&&player->movementVelocity.y<0&&KEY_SCROLLVERT_L.Analog()>-0.2f;
}
bool AiL::DownReleased(){
return KEY_DOWN.Released();
return KEY_DOWN.Released()||Input::UsingGamepad()&&player->movementVelocity.y>0&&KEY_SCROLLVERT_L.Analog()<0.2f;
}
bool AiL::LeftPressed(){
return KEY_LEFT.Pressed();
@ -485,9 +485,9 @@ void AiL::HandleUserInput(float fElapsedTime){
player->SetY(player->GetY()+"Player.StaircaseClimbSpd"_F*fElapsedTime*player->GetMoveSpdMult());
player->movementVelocity.y="Player.StaircaseClimbSpd"_F;
} else
if(staircaseDirection=="LEFT"){
player->SetY(player->GetY()-"Player.StaircaseClimbSpd"_F*fElapsedTime*player->GetMoveSpdMult());
player->movementVelocity.y=-"Player.StaircaseClimbSpd"_F;
if(staircaseDirection=="LEFT"){
player->SetY(player->GetY()-"Player.StaircaseClimbSpd"_F*fElapsedTime*player->GetMoveSpdMult());
player->movementVelocity.y=-"Player.StaircaseClimbSpd"_F;
}
if(setIdleAnimation){
player->SetFacingDirection(LEFT);

@ -292,20 +292,20 @@ bool Monster::Update(float fElapsedTime){
}
}
Monster::STRATEGY::RUN_STRATEGY(*this,fElapsedTime);
if(vel.x>0){
vel.x=std::max(0.f,vel.x-friction*fElapsedTime);
} else {
vel.x=std::min(0.f,vel.x+friction*fElapsedTime);
}
if(vel.y>0){
vel.y=std::max(0.f,vel.y-friction*fElapsedTime);
} else {
vel.y=std::min(0.f,vel.y+friction*fElapsedTime);
}
if(vel!=vf2d{0,0}){
SetX(pos.x+vel.x*fElapsedTime);
SetY(pos.y+vel.y*fElapsedTime);
}
}
if(vel.x>0){
vel.x=std::max(0.f,vel.x-friction*fElapsedTime);
} else {
vel.x=std::min(0.f,vel.x+friction*fElapsedTime);
}
if(vel.y>0){
vel.y=std::max(0.f,vel.y-friction*fElapsedTime);
} else {
vel.y=std::min(0.f,vel.y+friction*fElapsedTime);
}
if(vel!=vf2d{0,0}){
SetX(pos.x+vel.x*fElapsedTime);
SetY(pos.y+vel.y*fElapsedTime);
}
if(!IsAlive()){
deathTimer+=fElapsedTime;

@ -133,6 +133,7 @@ public:
const float GetRemainingHPPct()const;
int GetAttack();
float GetMoveSpdMult();
//Obtains the size multiplier (from 0.f-1.f).
float GetSizeMult()const;
Animate2D::Frame GetFrame()const;
bool Update(float fElapsedTime);

@ -378,7 +378,22 @@ void Player::Update(float fElapsedTime){
spin_angle=0;
z=0;
float numb=4;
game->HurtEnemies(pos,"Warrior.Ability 2.Range"_F/100*12,int(GetAttack()*"Warrior.Ability 2.DamageMult"_F),OnUpperLevel(),0);
const MonsterHurtList&hitEnemies=game->HurtEnemies(pos,"Warrior.Ability 2.Range"_F/100*12,int(GetAttack()*"Warrior.Ability 2.DamageMult"_F),OnUpperLevel(),0);
#pragma region Knockback effect
for(auto&[monsterPtr,wasHurt]:hitEnemies){
float knockbackDir=0;
float knockbackAmt=0;
if(geom2d::line<float>(GetPos(),monsterPtr->GetPos()).length()<=0.001f){
knockbackDir=util::random(2*PI);
knockbackAmt="Warrior.Ability 2.KnockbackAmt"_F;
}else{
knockbackDir=geom2d::line<float>(GetPos(),monsterPtr->GetPos()).vector().norm().polar().y;
knockbackAmt=std::clamp("Warrior.Ability 2.KnockbackAmt"_F-geom2d::line<float>(GetPos(),monsterPtr->GetPos()).length()*"Warrior.Ability 2.KnockbackReduction"_F,1.f,"Warrior.Ability 2.KnockbackAmt"_F);
}
knockbackAmt=std::max(1.f,knockbackAmt-"Warrior.Ability 2.KnockbackWeightFactor"_F*(monsterPtr->GetSizeMult()-1.f));
monsterPtr->Knockback(vf2d{knockbackAmt,knockbackDir}.cart());
}
#pragma endregion
game->AddEffect(std::make_unique<Effect>(GetPos(),"Warrior.Ability 2.EffectLifetime"_F,"ground-slam-attack-front.png",upperLevel,"Warrior.Ability 2.Range"_F/300*1.33f,"Warrior.Ability 2.EffectFadetime"_F),std::make_unique<Effect>(GetPos(),"Warrior.Ability 2.EffectLifetime"_F,"ground-slam-attack-back.png",upperLevel,"Warrior.Ability 2.Range"_F/300*1.33f,"Warrior.Ability 2.EffectFadetime"_F));
SoundEffect::PlaySFX("Warrior Ground Slam",SoundEffect::CENTERED);
}

@ -39,7 +39,7 @@ All rights reserved.
#define VERSION_MAJOR 0
#define VERSION_MINOR 4
#define VERSION_PATCH 3
#define VERSION_BUILD 7878
#define VERSION_BUILD 7885
#define stringify(a) stringify_(a)
#define stringify_(a) #a

@ -105,7 +105,7 @@ Warrior
# Whether or not this ability cancels casts.
CancelCast = 0
Description = Leaps into the air and then dives into the ground, destroying everything around the Warrior in the process.
Description = Leaps and then dives into the ground, knocking back and destroying everything nearby in the process.
#RGB Values. Color 1 is the circle at full cooldown, Color 2 is the color at empty cooldown.
Cooldown Bar Color 1 = 64, 0, 0, 192
@ -128,6 +128,13 @@ Warrior
EffectLifetime = 0.5
# Amount of time the effect fades out.
EffectFadetime = 0.6
# Max knockback effect amount
KnockbackAmt = 100
# Knockback Dropoff per pixel of distance
KnockbackReduction = 0.45
# How much knockback is reduced per 100% larger size.
KnockbackWeightFactor = 25
}
Ability 3
{

Loading…
Cancel
Save