1
This commit is contained in:
parent
e73cc99198
commit
ab2f33eafd
@ -232,14 +232,17 @@ float Bullet::GetAtk()
|
|||||||
void Bullet::Check(float distance)
|
void Bullet::Check(float distance)
|
||||||
{
|
{
|
||||||
std::set<Entity*> objects;
|
std::set<Entity*> objects;
|
||||||
TouchAllLayerHumanList
|
room->grid_service->TouchCreatures
|
||||||
(
|
(room->GetRoomIdx(),
|
||||||
[this, &objects] (Human* hum, bool& stop)
|
GetGridList(),
|
||||||
|
[this, &objects] (Creature* c, bool& stop)
|
||||||
{
|
{
|
||||||
AabbCollider aabb_box;
|
if (sender.Get()->IsProperTarget(c)) {
|
||||||
hum->GetHitAabbBox(aabb_box);
|
AabbCollider aabb_box;
|
||||||
if (hum != sender.Get() && !hum->dead && TestCollision(room, &aabb_box)) {
|
c->GetHitAabbBox(aabb_box);
|
||||||
objects.insert(hum);
|
if (c != sender.Get() && !c->dead && TestCollision(room, &aabb_box)) {
|
||||||
|
objects.insert(c);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
{
|
{
|
||||||
|
@ -231,6 +231,9 @@ void Car::OnBulletHit(Bullet* bullet)
|
|||||||
|
|
||||||
void Car::DecHP(float dec_hp, int killer_id, const std::string& killer_name, int weapon_id)
|
void Car::DecHP(float dec_hp, int killer_id, const std::string& killer_name, int weapon_id)
|
||||||
{
|
{
|
||||||
|
#ifdef DEBUG
|
||||||
|
dec_hp *= 5;
|
||||||
|
#endif
|
||||||
float old_health = GetHP();
|
float old_health = GetHP();
|
||||||
float new_health = std::max(0.0f, GetHP() - dec_hp);
|
float new_health = std::max(0.0f, GetHP() - dec_hp);
|
||||||
ability.hp = std::max(0.0f, new_health);
|
ability.hp = std::max(0.0f, new_health);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user