修复rpg问题
This commit is contained in:
parent
e250768911
commit
b97746dd84
@ -259,7 +259,7 @@ void Bullet::Check(float distance)
|
|||||||
bullet_range += gun_upgrade_meta->GetAttrValue(gun_lv, kHAT_ShotRange);
|
bullet_range += gun_upgrade_meta->GetAttrValue(gun_lv, kHAT_ShotRange);
|
||||||
}
|
}
|
||||||
if (!objects.empty() || distance > bullet_range ||
|
if (!objects.empty() || distance > bullet_range ||
|
||||||
(IsBomb() && distance >= fly_distance)
|
(IsBomb() && meta->i->_inventory_slot() != IS_RPG && distance >= fly_distance)
|
||||||
) {
|
) {
|
||||||
if (IsBomb()) {
|
if (IsBomb()) {
|
||||||
ProcBomb();
|
ProcBomb();
|
||||||
|
@ -275,5 +275,23 @@ void Hero::DetachFromMaster()
|
|||||||
|
|
||||||
void Hero::DecHP(float dec_hp, int killer_id, const std::string& killer_name, int weapon_id)
|
void Hero::DecHP(float dec_hp, int killer_id, const std::string& killer_name, int weapon_id)
|
||||||
{
|
{
|
||||||
|
if (dec_hp < 0.001f) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
float old_health = GetHP();
|
||||||
|
float new_health = std::max(0.0f, GetHP() - dec_hp);
|
||||||
|
ability.hp = std::max(0.0f, new_health);
|
||||||
|
if (GetHP() <= 0.0001f && !IsDead(room)) {
|
||||||
|
BeKill(killer_id, killer_name, weapon_id);
|
||||||
|
}
|
||||||
|
room->frame_event.AddHpChg(GetWeakPtrRef());
|
||||||
|
}
|
||||||
|
|
||||||
|
void Hero::BeKill(int killer_id, const std::string& killer_name, int weapon_id)
|
||||||
|
{
|
||||||
|
dead = true;
|
||||||
|
BroadcastDeleteState(room);
|
||||||
|
RemoveFromAroundPlayers(room);
|
||||||
|
room->grid_service->RemoveCreature(this);
|
||||||
|
room->RemoveObjectLater(this);
|
||||||
}
|
}
|
||||||
|
@ -43,6 +43,7 @@ protected:
|
|||||||
void InternalUpdateMove(float speed);
|
void InternalUpdateMove(float speed);
|
||||||
bool IsCollisionInMapService();
|
bool IsCollisionInMapService();
|
||||||
virtual void RecalcSelfCollider() override;
|
virtual void RecalcSelfCollider() override;
|
||||||
|
void BeKill(int killer_id, const std::string& killer_name, int weapon_id);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool later_removed_ = false;
|
bool later_removed_ = false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user