This commit is contained in:
aozhiwei 2021-03-11 17:42:00 +08:00
parent 627b32badf
commit f81d20b4b7

View File

@ -169,32 +169,43 @@ void Bullet::ProcBomb()
} }
}); });
switch (meta->i->_inventory_slot()) { if (objects.empty()) {
case 4: float bullet_range = gun_meta->i->range();
{ if (gun_upgrade_meta && gun_upgrade_meta->GetAttrValue(gun_lv, kHAT_ShotRange) > 0) {
//榴弹炮 bullet_range += gun_upgrade_meta->GetAttrValue(gun_lv, kHAT_ShotRange);
a8::Vec2 bomb_pos = GetPos();
room->frame_event.AddExplosionEx(player, meta->i->id(), bomb_pos,
gun_meta->i->explosion_effect());
OnHit(objects);
} }
break; float distance = (GetPos() - born_pos).Norm();
case 5: if (distance >= bullet_range) {
{ player->SummonObstacle(0, GetPos());
//手雷
a8::Vec2 bomb_pos = GetPos();
room->frame_event.AddExplosion(this, meta->i->id(), bomb_pos);
OnHit(objects);
} }
break; } else {
case 6: switch (meta->i->_inventory_slot()) {
{ case 4:
//烟雾弹 {
a8::Vec2 bomb_pos = GetPos(); //榴弹炮
room->frame_event.AddSmoke(this, meta->i->id(), bomb_pos); a8::Vec2 bomb_pos = GetPos();
ProcSmokeBomb(); room->frame_event.AddExplosionEx(player, meta->i->id(), bomb_pos,
gun_meta->i->explosion_effect());
OnHit(objects);
}
break;
case 5:
{
//手雷
a8::Vec2 bomb_pos = GetPos();
room->frame_event.AddExplosion(this, meta->i->id(), bomb_pos);
OnHit(objects);
}
break;
case 6:
{
//烟雾弹
a8::Vec2 bomb_pos = GetPos();
room->frame_event.AddSmoke(this, meta->i->id(), bomb_pos);
ProcSmokeBomb();
}
break;
} }
break;
} }
room->RemoveObjectLater(this); room->RemoveObjectLater(this);
} }