diff --git a/Adventures in Lestoria/AdventuresInLestoria.cpp b/Adventures in Lestoria/AdventuresInLestoria.cpp index b972e1ea..39d1fc92 100644 --- a/Adventures in Lestoria/AdventuresInLestoria.cpp +++ b/Adventures in Lestoria/AdventuresInLestoria.cpp @@ -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); diff --git a/Adventures in Lestoria/Monster.cpp b/Adventures in Lestoria/Monster.cpp index 8ba0a782..a008269b 100644 --- a/Adventures in Lestoria/Monster.cpp +++ b/Adventures in Lestoria/Monster.cpp @@ -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; diff --git a/Adventures in Lestoria/Monster.h b/Adventures in Lestoria/Monster.h index 60d69dd4..a7943f98 100644 --- a/Adventures in Lestoria/Monster.h +++ b/Adventures in Lestoria/Monster.h @@ -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); diff --git a/Adventures in Lestoria/Player.cpp b/Adventures in Lestoria/Player.cpp index c7744e51..70247585 100644 --- a/Adventures in Lestoria/Player.cpp +++ b/Adventures in Lestoria/Player.cpp @@ -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(GetPos(),monsterPtr->GetPos()).length()<=0.001f){ + knockbackDir=util::random(2*PI); + knockbackAmt="Warrior.Ability 2.KnockbackAmt"_F; + }else{ + knockbackDir=geom2d::line(GetPos(),monsterPtr->GetPos()).vector().norm().polar().y; + knockbackAmt=std::clamp("Warrior.Ability 2.KnockbackAmt"_F-geom2d::line(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(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(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); } diff --git a/Adventures in Lestoria/Version.h b/Adventures in Lestoria/Version.h index 5c1f817d..4d2a0534 100644 --- a/Adventures in Lestoria/Version.h +++ b/Adventures in Lestoria/Version.h @@ -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 diff --git a/Adventures in Lestoria/assets/config/classes/Warrior.txt b/Adventures in Lestoria/assets/config/classes/Warrior.txt index 86ef33b6..cf6353c9 100644 --- a/Adventures in Lestoria/assets/config/classes/Warrior.txt +++ b/Adventures in Lestoria/assets/config/classes/Warrior.txt @@ -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 { diff --git a/x64/Release/Adventures in Lestoria.exe b/x64/Release/Adventures in Lestoria.exe index 908c52b6..9a20e3d3 100644 Binary files a/x64/Release/Adventures in Lestoria.exe and b/x64/Release/Adventures in Lestoria.exe differ