This commit is contained in:
aozhiwei 2021-08-31 19:58:50 +08:00
parent dfb4042a86
commit c900e1537b
3 changed files with 29 additions and 23 deletions

View File

@ -684,6 +684,12 @@ void Human::BeKill(int killer_id, const std::string& killer_name, int weapon_id)
stats.killer_name = killer_name; stats.killer_name = killer_name;
stats.weapon_id = weapon_id; stats.weapon_id = weapon_id;
} }
{
Entity* killer = room->GetEntityByUniId(killer_id);
if (killer && killer->IsCreature(room)) {
((Creature*)killer)->GetTrigger()->Kill(this);
}
}
{ {
GetTrigger()->Die(); GetTrigger()->Die();
dead = true; dead = true;

View File

@ -20,39 +20,32 @@ void KillMgr::UnInit()
void KillMgr::OnHumanDead(Human* dead_hum, KillInfo* info) void KillMgr::OnHumanDead(Human* dead_hum, KillInfo* info)
{ {
#if 0
{ {
Entity* hum = room->GetEntityByUniId(killer_id); Entity* hum = dead_hum->room->GetEntityByUniId(info->killer_id);
if (hum && hum->IsEntityType(ET_Player)) { if (hum && hum->IsEntityType(ET_Player)) {
Creature* killer = (Creature*)hum; Creature* killer = (Creature*)hum;
if (killer_id == GetUniId()) { if (info->killer_id == dead_hum->GetUniId()) {
info.killer_id = killer->GetUniId(); #if 0
info.killer_team_id = killer->team_id;
SendRollMsgEx(info, SendRollMsgEx(info,
TEXT("battle_server_dead_specate", "%s 自杀").c_str(), TEXT("battle_server_dead_specate", "%s 自杀").c_str(),
{ {
killer_name killer_name
}); });
#endif
} else { } else {
((Human*)hum)->stats.kills++; #if 0
((Human*)hum)->stats.last_kill_frameno = room->GetFrameNo(); SendRollMsgEx
((Human*)hum)->kill_humans.insert(this); (info,
((Human*)hum)->SyncAroundPlayers(__FILE__, __LINE__, __func__); TEXT("battle_server_dead_weapon", "%s 使用 ${weapon_text_icon} 干掉了 %s").c_str(),
((Human*)hum)->GetTrigger()->Kill(this); {
{ killer_name,
info.killer_id = killer->GetUniId(); name
info.killer_team_id = killer->team_id; }
SendRollMsgEx );
(info, #endif
TEXT("battle_server_dead_weapon", "%s 使用 ${weapon_text_icon} 干掉了 %s").c_str(),
{
killer_name,
name
}
);
}
} }
} else { } else {
#if 0
switch (weapon_id) { switch (weapon_id) {
case VW_SafeArea: case VW_SafeArea:
{ {
@ -69,9 +62,9 @@ void KillMgr::OnHumanDead(Human* dead_hum, KillInfo* info)
} }
break; break;
} }
#endif
} }
} }
#endif
} }
void KillMgr::PreprocessRollMsg(cs::SMRollMsg* pb_msg, void KillMgr::PreprocessRollMsg(cs::SMRollMsg* pb_msg,

View File

@ -7,6 +7,7 @@
#include "metamgr.h" #include "metamgr.h"
#include "skill.h" #include "skill.h"
#include "room.h" #include "room.h"
#include "human.h"
void Trigger::Init() void Trigger::Init()
{ {
@ -100,6 +101,12 @@ void Trigger::Shot(MetaData::Equip* weapon_meta)
void Trigger::Kill(Creature* target) void Trigger::Kill(Creature* target)
{ {
if (owner_->IsHuman() && target->IsHuman()) {
owner_->AsHuman()->stats.kills++;
owner_->AsHuman()->stats.last_kill_frameno = owner_->room->GetFrameNo();
owner_->AsHuman()->kill_humans.insert(target->AsHuman());
owner_->AsHuman()->SyncAroundPlayers(__FILE__, __LINE__, __func__);
}
++kill_num_; ++kill_num_;
TraverseCondBuffs TraverseCondBuffs
(kCondBuffKillTarget, (kCondBuffKillTarget,