This commit is contained in:
aozhiwei 2024-04-10 14:58:52 +08:00
parent e0a8ea8b03
commit d8b1d6484d
2 changed files with 20 additions and 0 deletions

View File

@ -4182,3 +4182,22 @@ bool Creature::IsOb()
{ {
return a8::HasBitFlag(status, CS_IsOb); return a8::HasBitFlag(status, CS_IsOb);
} }
bool Creature::HaveBallingEnemy()
{
bool have = false;
TraverseCreatures
(
[this, &have] (Creature* c, bool& stop)
{
if (c->team_id != team_id && !c->HasBuffEffect(kBET_Hide) && !c->IsCar()) {
float distance = c->GetPos().Distance2D2(GetPos());
if (distance <= mt::Param::s().battling_detection_range) {
have = true;
stop = true;
}
}
}
);
return have;
}

View File

@ -411,6 +411,7 @@ class Creature : public MoveableEntity
void AdjustMobaBornDir(); void AdjustMobaBornDir();
int GetBattleStartTime(); int GetBattleStartTime();
bool IsOb(); bool IsOb();
bool HaveBallingEnemy();
protected: protected:
virtual void OnBuffRemove(Buff& buff); virtual void OnBuffRemove(Buff& buff);