This commit is contained in:
aozhiwei 2024-01-12 15:25:54 +08:00
parent c0740d18ea
commit 6b470c5fd3
3 changed files with 14 additions and 0 deletions

View File

@ -396,6 +396,9 @@ void Car::DecHP(float dec_hp, int killer_id, const std::string killer_name, int
float old_health = GetHP();
float new_health = std::max(0.0f, GetHP() - dec_hp);
SetHP(std::max(0.0f, new_health));
if (old_health - GetHP() > 0.001f) {
real_dmg_out = old_health - GetHP();
}
if (GetHP() <= 0.0001f && !IsDead(room)) {
BeKill(killer_id, killer_name, weapon_id);
}

View File

@ -287,6 +287,9 @@ void Hero::DecHP(float dec_hp, int killer_id, const std::string killer_name, int
float old_health = GetHP();
float new_health = std::max(0.0f, GetHP() - dec_hp);
SetHP(std::max(0.0f, new_health));
if (old_health - GetHP() > 0.001f) {
real_dmg_out = old_health - GetHP();
}
if (new_health < old_health && room->IsPveRoom()) {
room->pve_data.AddDamageInfo(killer_id, GetUniId(), old_health - new_health);
}

View File

@ -269,7 +269,11 @@ void Human::DecHP(float dec_hp, int killer_id, const std::string killer_name, in
last_receive_dmg_frameno = room->GetFrameNo();
float old_hp = GetHP();
if (armor_shield > 0.0001f){
float old_armor_shield = armor_shield;
armor_shield = std::max(0.0f, armor_shield - dec_hp);
if (old_armor_shield - armor_shield > 0.001f) {
real_dmg_out = old_armor_shield - armor_shield;
}
room->frame_event.AddPropChg
(
GetWeakPtrRef(),
@ -279,7 +283,11 @@ void Human::DecHP(float dec_hp, int killer_id, const std::string killer_name, in
false);
GetTrigger()->ReceiveDmg();
} else if (energy_shield > 0.001f) {
float old_energy_shield = energy_shield;
energy_shield = std::max(0.0f, energy_shield - dec_hp);
if (old_energy_shield - energy_shield > 0.001f) {
real_dmg_out = old_energy_shield - energy_shield;
}
room->frame_event.AddPropChg
(
GetWeakPtrRef(),