Add a proximity knockback overload function that handles hurt list target types instead. Make large stone toss knockback only apply to targets actually hit. Release Build 9837.

mac-build
sigonasr2 7 months ago
parent c879cafe1e
commit dba8ee124d
  1. 16
      Adventures in Lestoria/AdventuresInLestoria.cpp
  2. 7
      Adventures in Lestoria/AdventuresInLestoria.h
  3. 4
      Adventures in Lestoria/LargeStone.cpp
  4. 2
      Adventures in Lestoria/Monster.cpp
  5. 2
      Adventures in Lestoria/Player.cpp
  6. 2
      Adventures in Lestoria/Version.h
  7. BIN
      x64/Release/Adventures in Lestoria.exe

@ -794,6 +794,22 @@ void AiL::ProximityKnockback(const vf2d pos,const float radius,const float knock
}
}
void AiL::ProximityKnockback(const vf2d pos,const float radius,const float knockbackAmt,const HurtList&knockbackTargets,const KnockbackCondition condition)const{
using enum KnockbackCondition;
for(auto&[target,wasHurt]:knockbackTargets){
if(condition==KNOCKBACK_HURT_TARGETS&&!wasHurt||
condition==KNOCKBACK_UNHURT_TARGETS&&wasHurt)continue;
if(std::holds_alternative<Player*>(target)){
Player*player{std::get<Player*>(target)};
player->ProximityKnockback(pos,knockbackAmt);
}else
if(std::holds_alternative<Monster*>(target)){
Monster*monster{std::get<Monster*>(target)};
monster->ProximityKnockback(pos,knockbackAmt);
}else ERR("WARNING! Target list was holding an unknown type??? THIS SHOULD NOT BE HAPPENING!")
}
}
const HurtList AiL::HurtNotHit(vf2d pos,float radius,int damage,HitList&hitList,bool upperLevel,float z,const HurtType hurtTargets)const{
HurtList affectedList;
const bool CheckForMonsterCollisions=hurtTargets&HurtType::MONSTER;

@ -75,6 +75,12 @@ enum class HurtType{
MONSTER=0b10,
};
enum class KnockbackCondition{
KNOCKBACK_HURT_TARGETS, //Knockback only targets that took damage.
KNOCKBACK_ALL_TARGETS, //Knockback all targets, even if they were invulnerable or immovable.
KNOCKBACK_UNHURT_TARGETS, //Knockback only targets that did not get hit.
};
namespace PlayerTests{
class PlayerTest;
}
@ -246,6 +252,7 @@ public:
void AddEffect(std::unique_ptr<Effect>foreground,bool back=false);
const HurtList Hurt(vf2d pos,float radius,int damage,bool upperLevel,float z,const HurtType hurtTargets)const;
void ProximityKnockback(const vf2d pos,const float radius,const float knockbackAmt,const HurtType knockbackTargets)const;
void ProximityKnockback(const vf2d pos,const float radius,const float knockbackAmt,const HurtList&knockbackTargets,const KnockbackCondition condition=KnockbackCondition::KNOCKBACK_HURT_TARGETS)const;
//NOTE: This function will also add any enemies that were hit into the hit list!
const HurtList HurtNotHit(vf2d pos,float radius,int damage,HitList&hitList,bool upperLevel,float z,const HurtType hurtTargets)const;
// angle: The central angle where the arc will extend from.

@ -73,8 +73,8 @@ void LargeStone::Update(float fElapsedTime){
if(wasHurt)ERR(std::format("WARNING! Somehow a {} has taken non-true damage! THIS SHOULD NOT BE HAPPENING!",monsterPtr->GetDisplayName()));
monsterPtr->_DealTrueDamage(3);
}
game->ProximityKnockback(pos,radius,knockbackAmt,HurtType::MONSTER|HurtType::PLAYER);
game->ProximityKnockback(pos,radius,knockbackAmt,list);
fadeOutTime=0.5f;

@ -932,7 +932,7 @@ geom2d::circle<float>Monster::BulletCollisionHitbox(){
}
void Monster::Knockback(const vf2d&vel){
if(IsSolid()||GetZ()>=1.f)return;
if(IsSolid())return;
//A new angle will be applied, but will be constrained by whichever applied velocity is strongest (either the current velocity, or the new one). This prevents continuous uncapped velocities to knockbacks applied.
if(vel==vf2d{})return;
float maxVelThreshold;

@ -307,7 +307,7 @@ State::State Player::GetState(){
void Player::Knockback(vf2d vel){
//A new angle will be applied, but will be constrained by whichever applied velocity is strongest (either the current velocity, or the new one). This prevents continuous uncapped velocities to knockbacks applied.
if(vel==vf2d{}||GetZ()>=1.f)return;
if(vel==vf2d{})return;
float maxVelThreshold;
if(GetState()==State::BLOCK)vel*=1-("Warrior.Right Click Ability.Knockback Reduction"_I/100.f);
if(this->vel==vf2d{})maxVelThreshold=vel.mag();

@ -39,7 +39,7 @@ All rights reserved.
#define VERSION_MAJOR 1
#define VERSION_MINOR 2
#define VERSION_PATCH 3
#define VERSION_BUILD 9835
#define VERSION_BUILD 9837
#define stringify(a) stringify_(a)
#define stringify_(a) #a

Loading…
Cancel
Save