Fix distance check mismatch with actual hurt range of the large stone toss. Knockback collisions now match the Hurt collisions. Add a universal knockback function. Release Build 9659.
This commit is contained in:
parent
a740d6eb01
commit
c8e74cb647
@ -759,6 +759,23 @@ const HurtList AiL::Hurt(vf2d pos,float radius,int damage,bool upperLevel,float
|
|||||||
return hitList;
|
return hitList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AiL::ProximityKnockback(const vf2d pos,const float radius,const float knockbackAmt,const HurtType knockbackTargets)const{
|
||||||
|
const bool CheckForMonsterCollisions=knockbackTargets&HurtType::MONSTER;
|
||||||
|
const bool CheckForPlayerCollisions=knockbackTargets&HurtType::PLAYER;
|
||||||
|
if(CheckForMonsterCollisions){
|
||||||
|
for(std::unique_ptr<Monster>&m:MONSTER_LIST){
|
||||||
|
if(geom2d::overlaps(geom2d::circle(pos,radius),geom2d::circle(m->GetPos(),12*m->GetSizeMult()))){
|
||||||
|
m->ProximityKnockback(pos,knockbackAmt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(CheckForPlayerCollisions){
|
||||||
|
if(geom2d::overlaps(geom2d::circle(pos,radius),geom2d::circle(GetPlayer()->GetPos(),12*GetPlayer()->GetSizeMult()))){
|
||||||
|
GetPlayer()->ProximityKnockback(pos,knockbackAmt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const HurtList AiL::HurtNotHit(vf2d pos,float radius,int damage,HitList&hitList,bool upperLevel,float z,const HurtType hurtTargets)const{
|
const HurtList AiL::HurtNotHit(vf2d pos,float radius,int damage,HitList&hitList,bool upperLevel,float z,const HurtType hurtTargets)const{
|
||||||
HurtList affectedList;
|
HurtList affectedList;
|
||||||
const bool CheckForMonsterCollisions=hurtTargets&HurtType::MONSTER;
|
const bool CheckForMonsterCollisions=hurtTargets&HurtType::MONSTER;
|
||||||
|
@ -239,6 +239,7 @@ public:
|
|||||||
//If back is true, places the effect in the background
|
//If back is true, places the effect in the background
|
||||||
void AddEffect(std::unique_ptr<Effect>foreground,bool back=false);
|
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;
|
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;
|
||||||
//NOTE: This function will also add any enemies that were hit into the hit list!
|
//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;
|
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.
|
// angle: The central angle where the arc will extend from.
|
||||||
|
@ -65,22 +65,8 @@ void LargeStone::Update(float fElapsedTime){
|
|||||||
|
|
||||||
game->AddEffect(std::make_unique<FallingDebris>(pos+vf2d{radius,randomDir}.cart(),0.f,"circle.png",OnUpperLevel(),vf2d{1.5f,1.5f}*util::random(2.f),util::random(1.f),vf2d{vf2d{radius,randomDir}.cart().x,-util::random(30.f)-20.f},BLACK));
|
game->AddEffect(std::make_unique<FallingDebris>(pos+vf2d{radius,randomDir}.cart(),0.f,"circle.png",OnUpperLevel(),vf2d{1.5f,1.5f}*util::random(2.f),util::random(1.f),vf2d{vf2d{radius,randomDir}.cart().x,-util::random(30.f)-20.f},BLACK));
|
||||||
}
|
}
|
||||||
#pragma region Knockback Effect
|
|
||||||
#pragma region Check for player knockback
|
game->ProximityKnockback(pos,radius,knockbackAmt,HurtType::MONSTER|HurtType::PLAYER);
|
||||||
float distToPlayer=geom2d::line<float>(pos,game->GetPlayer()->GetPos()).length();
|
|
||||||
if(distToPlayer<=radius){
|
|
||||||
game->GetPlayer()->ProximityKnockback(pos,knockbackAmt);
|
|
||||||
}
|
|
||||||
#pragma endregion
|
|
||||||
#pragma region Check for monster knockback
|
|
||||||
for(auto&monsterPtr:MONSTER_LIST){
|
|
||||||
float distToMonster=geom2d::line<float>(pos,monsterPtr->GetPos()).length();
|
|
||||||
if(distToMonster<=radius){
|
|
||||||
monsterPtr->ProximityKnockback(pos,knockbackAmt);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#pragma endregion
|
|
||||||
#pragma endregion
|
|
||||||
|
|
||||||
fadeOutTime=0.5f;
|
fadeOutTime=0.5f;
|
||||||
|
|
||||||
|
@ -122,6 +122,6 @@ enum class Attribute{
|
|||||||
WIND_STRENGTH,
|
WIND_STRENGTH,
|
||||||
WIND_PHASE_TIMER,
|
WIND_PHASE_TIMER,
|
||||||
MARKED_DEAD,
|
MARKED_DEAD,
|
||||||
LOOPING_SOUND_ID,
|
LOOPING_SOUND_ID, //Store looping sound IDs temporarily with this value. The game automatically cleans this up in Monster::OnDestroy() if you don't, since a monster that dies should not have their looping sound still playing.
|
||||||
PLAYED_FLAG,
|
PLAYED_FLAG,
|
||||||
};
|
};
|
@ -39,7 +39,7 @@ All rights reserved.
|
|||||||
#define VERSION_MAJOR 1
|
#define VERSION_MAJOR 1
|
||||||
#define VERSION_MINOR 2
|
#define VERSION_MINOR 2
|
||||||
#define VERSION_PATCH 3
|
#define VERSION_PATCH 3
|
||||||
#define VERSION_BUILD 9656
|
#define VERSION_BUILD 9659
|
||||||
|
|
||||||
#define stringify(a) stringify_(a)
|
#define stringify(a) stringify_(a)
|
||||||
#define stringify_(a) #a
|
#define stringify_(a) #a
|
||||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user