diff --git a/Adventures in Lestoria/AdventuresInLestoria.cpp b/Adventures in Lestoria/AdventuresInLestoria.cpp index 7e5d1abd..f4082515 100644 --- a/Adventures in Lestoria/AdventuresInLestoria.cpp +++ b/Adventures in Lestoria/AdventuresInLestoria.cpp @@ -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(target)){ + Player*player{std::get(target)}; + player->ProximityKnockback(pos,knockbackAmt); + }else + if(std::holds_alternative(target)){ + Monster*monster{std::get(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; diff --git a/Adventures in Lestoria/AdventuresInLestoria.h b/Adventures in Lestoria/AdventuresInLestoria.h index 49ee012a..7e8b2e8f 100644 --- a/Adventures in Lestoria/AdventuresInLestoria.h +++ b/Adventures in Lestoria/AdventuresInLestoria.h @@ -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_ptrforeground,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. diff --git a/Adventures in Lestoria/LargeStone.cpp b/Adventures in Lestoria/LargeStone.cpp index c0aaede7..8cc864b2 100644 --- a/Adventures in Lestoria/LargeStone.cpp +++ b/Adventures in Lestoria/LargeStone.cpp @@ -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; diff --git a/Adventures in Lestoria/Monster.cpp b/Adventures in Lestoria/Monster.cpp index 0bfb73ae..df9f7e25 100644 --- a/Adventures in Lestoria/Monster.cpp +++ b/Adventures in Lestoria/Monster.cpp @@ -932,7 +932,7 @@ geom2d::circleMonster::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; diff --git a/Adventures in Lestoria/Player.cpp b/Adventures in Lestoria/Player.cpp index 67655d4f..f21b5df4 100644 --- a/Adventures in Lestoria/Player.cpp +++ b/Adventures in Lestoria/Player.cpp @@ -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(); diff --git a/Adventures in Lestoria/Version.h b/Adventures in Lestoria/Version.h index 39c84122..c5c82e63 100644 --- a/Adventures in Lestoria/Version.h +++ b/Adventures in Lestoria/Version.h @@ -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 diff --git a/x64/Release/Adventures in Lestoria.exe b/x64/Release/Adventures in Lestoria.exe index 305dab80..4b4be76f 100644 Binary files a/x64/Release/Adventures in Lestoria.exe and b/x64/Release/Adventures in Lestoria.exe differ