1
This commit is contained in:
parent
e6abb61885
commit
aa7309819c
@ -361,8 +361,11 @@ void Buff::ProcSprint()
|
|||||||
Buff* buff = (Buff*)param.sender.GetUserData();
|
Buff* buff = (Buff*)param.sender.GetUserData();
|
||||||
std::set<int>* hited_objects = (std::set<int>*)param.param1.GetUserData();
|
std::set<int>* hited_objects = (std::set<int>*)param.param1.GetUserData();
|
||||||
std::set<Creature*> enemys;
|
std::set<Creature*> enemys;
|
||||||
buff->owner->GetHitEnemys(enemys);
|
buff->owner->GetHitEnemys(enemys, buff->meta->param2);
|
||||||
for (auto& enemy : enemys) {
|
for (auto& enemy : enemys) {
|
||||||
|
if (enemy->IsEntityType(ET_Car)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (hited_objects->find(enemy->GetUniId()) != hited_objects->end()) {
|
if (hited_objects->find(enemy->GetUniId()) != hited_objects->end()) {
|
||||||
hited_objects->insert(enemy->GetUniId());
|
hited_objects->insert(enemy->GetUniId());
|
||||||
for (int buff_id : buff->meta->param3_int_list) {
|
for (int buff_id : buff->meta->param3_int_list) {
|
||||||
|
@ -2259,17 +2259,15 @@ void Creature::SetDef(float def)
|
|||||||
ability.def = def;
|
ability.def = def;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Creature::GetHitEnemys(std::set<Creature*>& enemys)
|
void Creature::GetHitEnemys(std::set<Creature*>& enemys, float radius)
|
||||||
{
|
{
|
||||||
room->grid_service->TraverseCreatures
|
room->grid_service->TraverseCreatures
|
||||||
(room->GetRoomIdx(),
|
(room->GetRoomIdx(),
|
||||||
GetGridList(),
|
GetGridList(),
|
||||||
[this, &enemys] (Creature* c, bool& stop)
|
[this, &enemys, radius] (Creature* c, bool& stop)
|
||||||
{
|
{
|
||||||
if (IsProperTarget(c)) {
|
if (IsProperTarget(c)) {
|
||||||
AabbCollider aabb_box;
|
if (!c->dead && GetPos().Distance(c->GetPos()) < radius) {
|
||||||
c->GetHitAabbBox(aabb_box);
|
|
||||||
if (!c->dead && TestCollision(room, &aabb_box)) {
|
|
||||||
enemys.insert(c);
|
enemys.insert(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -224,7 +224,7 @@ class Creature : public MoveableEntity
|
|||||||
float GetMaxHP();
|
float GetMaxHP();
|
||||||
float GetDef();
|
float GetDef();
|
||||||
void SetDef(float def);
|
void SetDef(float def);
|
||||||
void GetHitEnemys(std::set<Creature*>& enemys);
|
void GetHitEnemys(std::set<Creature*>& enemys, float radius);
|
||||||
bool TryMove(const a8::Vec2& target_pos, a8::Vec2& out_pos);
|
bool TryMove(const a8::Vec2& target_pos, a8::Vec2& out_pos);
|
||||||
void SetInfiniteBulletMode();
|
void SetInfiniteBulletMode();
|
||||||
void FindLocation();
|
void FindLocation();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user