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.weapon_id = weapon_id;
}
{
Entity* killer = room->GetEntityByUniId(killer_id);
if (killer && killer->IsCreature(room)) {
((Creature*)killer)->GetTrigger()->Kill(this);
}
}
{
GetTrigger()->Die();
dead = true;

View File

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

View File

@ -7,6 +7,7 @@
#include "metamgr.h"
#include "skill.h"
#include "room.h"
#include "human.h"
void Trigger::Init()
{
@ -100,6 +101,12 @@ void Trigger::Shot(MetaData::Equip* weapon_meta)
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_;
TraverseCondBuffs
(kCondBuffKillTarget,