1
This commit is contained in:
parent
56d3623171
commit
4ec90b2ed7
@ -253,12 +253,12 @@ void Hero::DecHP(float dec_hp, int killer_id, const std::string& killer_name, in
|
||||
float old_health = GetHP();
|
||||
float new_health = std::max(0.0f, GetHP() - dec_hp);
|
||||
SetHP(std::max(0.0f, new_health));
|
||||
if (new_health < old_health && room->IsPveRoom()) {
|
||||
room->pve_data.AddDamageInfo(killer_id, GetUniId(), old_health - new_health);
|
||||
}
|
||||
if (GetHP() <= 0.0001f && !IsDead(room)) {
|
||||
BeKill(killer_id, killer_name, weapon_id);
|
||||
}
|
||||
if (new_health > old_health && room->IsPveRoom()) {
|
||||
room->pve_data.AddDamageInfo(killer_id, GetUniId(), new_health - old_health);
|
||||
}
|
||||
room->frame_event.AddHpChg(GetWeakPtrRef());
|
||||
}
|
||||
|
||||
|
@ -13,6 +13,12 @@ void PveData::AddDamageInfo(int sender_id, int receiver_id, float dmg)
|
||||
damage_hash_[receiver_id] = std::map<int, float>();
|
||||
}
|
||||
itr = damage_hash_.find(receiver_id);
|
||||
auto itr2 = itr->second.find(sender_id);
|
||||
if (itr2 != itr->second.end()) {
|
||||
itr2->second += dmg;
|
||||
} else {
|
||||
itr->second[sender_id] = dmg;
|
||||
}
|
||||
}
|
||||
|
||||
void PveData::OnBeKill(Hero* hero)
|
||||
|
Loading…
x
Reference in New Issue
Block a user