This commit is contained in:
aozhiwei 2021-04-07 17:18:31 +08:00
parent 5c5f1a49b5
commit ed3c30052e
2 changed files with 7 additions and 3 deletions

View File

@ -273,19 +273,22 @@ void RoomObstacle::SpecExplosion()
grid_list_ = new std::set<GridCell*>();
room->grid_service->GetAllCellsByXy(room, GetPos().x, GetPos().y, *grid_list_);
}
a8::Vec2 bomb_born_offset = a8::Vec2::UP;
bomb_born_offset.Rotate(a8::RandAngle());
bomb_born_offset = bomb_born_offset * a8::RandEx(1, std::max(2, meta->i->explosion_float()));
a8::Vec2 bomb_pos = GetPos() + bomb_born_offset;
std::set<Entity*> objects;
room->grid_service->TouchAllLayerHumanList
(
room->GetRoomIdx(),
*grid_list_,
[this, &objects] (Human* hum, bool& stop)
[this, &objects, &bomb_pos] (Human* hum, bool& stop)
{
float distance = (hum->GetPos() - GetPos()).Norm();
float distance = (hum->GetPos() - bomb_pos).Norm();
if (master.Get()->team_id != hum->team_id && distance < meta->i->damage_dia()) {
objects.insert(hum);
}
});
a8::Vec2 bomb_pos = GetPos();
room->frame_event.AddExplosionEx(master,
meta->i->thing_id(),
bomb_pos,

View File

@ -57,6 +57,7 @@ message MapThing
optional int32 explosion_effect = 15;
optional int32 explosion_interval = 18;
optional int32 explosion_times = 19;
optional int32 explosion_float = 20;
}
message SafeArea