1
This commit is contained in:
parent
984d045305
commit
8f954597b5
@ -292,6 +292,7 @@ void Hero::BeKill(int killer_id, const std::string& killer_name, int weapon_id)
|
|||||||
if (room->IsPveRoom()) {
|
if (room->IsPveRoom()) {
|
||||||
--room->pve_data.mon_num;
|
--room->pve_data.mon_num;
|
||||||
++room->pve_data.killed_num;
|
++room->pve_data.killed_num;
|
||||||
|
room->pve_data.OnBeKill(this);
|
||||||
room->NotifyUiUpdate();
|
room->NotifyUiUpdate();
|
||||||
}
|
}
|
||||||
GetTrigger()->Die();
|
GetTrigger()->Die();
|
||||||
|
@ -4220,3 +4220,8 @@ float Human::GetBaseDef()
|
|||||||
{
|
{
|
||||||
return meta->i->defence();
|
return meta->i->defence();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Human::WinPveScore(int score)
|
||||||
|
{
|
||||||
|
stats.pve_score += score;
|
||||||
|
}
|
||||||
|
@ -349,6 +349,7 @@ class Human : public Creature
|
|||||||
void DecOxygen(int val);
|
void DecOxygen(int val);
|
||||||
virtual float GetBaseAtk() override;
|
virtual float GetBaseAtk() override;
|
||||||
virtual float GetBaseDef() override;
|
virtual float GetBaseDef() override;
|
||||||
|
void WinPveScore(int score);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void _InternalUpdateMove(float speed);
|
void _InternalUpdateMove(float speed);
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
#include "precompile.h"
|
#include "precompile.h"
|
||||||
|
#include "hero.h"
|
||||||
|
#include "room.h"
|
||||||
|
#include "human.h"
|
||||||
|
|
||||||
#include "pvedata.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);
|
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) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
class Hero;
|
||||||
struct PveData
|
struct PveData
|
||||||
{
|
{
|
||||||
int wave = 0;
|
int wave = 0;
|
||||||
@ -11,6 +12,7 @@ struct PveData
|
|||||||
int killed_num = 0;
|
int killed_num = 0;
|
||||||
|
|
||||||
void AddDamageInfo(int sender_id, int receiver_id, float dmg);
|
void AddDamageInfo(int sender_id, int receiver_id, float dmg);
|
||||||
|
void OnBeKill(Hero* hero);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user