This commit is contained in:
aozhiwei 2022-08-24 11:30:07 +08:00
parent 984d045305
commit 8f954597b5
5 changed files with 32 additions and 0 deletions

View File

@ -292,6 +292,7 @@ void Hero::BeKill(int killer_id, const std::string& killer_name, int weapon_id)
if (room->IsPveRoom()) {
--room->pve_data.mon_num;
++room->pve_data.killed_num;
room->pve_data.OnBeKill(this);
room->NotifyUiUpdate();
}
GetTrigger()->Die();

View File

@ -4220,3 +4220,8 @@ float Human::GetBaseDef()
{
return meta->i->defence();
}
void Human::WinPveScore(int score)
{
stats.pve_score += score;
}

View File

@ -349,6 +349,7 @@ class Human : public Creature
void DecOxygen(int val);
virtual float GetBaseAtk() override;
virtual float GetBaseDef() override;
void WinPveScore(int score);
protected:
void _InternalUpdateMove(float speed);

View File

@ -1,4 +1,7 @@
#include "precompile.h"
#include "hero.h"
#include "room.h"
#include "human.h"
#include "pvedata.h"
@ -10,3 +13,23 @@ void PveData::AddDamageInfo(int sender_id, int receiver_id, float dmg)
}
itr = damage_hash_.find(receiver_id);
}
void PveData::OnBeKill(Hero* hero)
{
Room* room = hero->room;
auto itr = damage_hash_.find(hero->GetUniId());
if (itr != damage_hash_.end()) {
float total_dmg = 0;
for (auto& pair : itr->second) {
total_dmg += pair.second;
}
if (total_dmg > 0) {
for (auto& pair : itr->second) {
Human* hum = room->GetHumanByUniId(pair.first);
if (hum) {
}
}
}
}
}

View File

@ -1,5 +1,6 @@
#pragma once
class Hero;
struct PveData
{
int wave = 0;
@ -11,6 +12,7 @@ struct PveData
int killed_num = 0;
void AddDamageInfo(int sender_id, int receiver_id, float dmg);
void OnBeKill(Hero* hero);
private: