修复 10 浣熊的地雷,炸死的目标未显示击杀ICON

This commit is contained in:
aozhiwei 2021-06-07 11:43:45 +08:00
parent ad63b15144
commit 3f7f8c4b42
5 changed files with 32 additions and 18 deletions

View File

@ -767,8 +767,6 @@ void Human::BeKill(int killer_id, const std::string& killer_name, int weapon_id)
name
});
} else {
MetaData::Equip* equip_meta = MetaMgr::Instance()->GetEquip(weapon_id);
if (equip_meta) {
info.killer_id = killer->GetEntityUniId();
info.killer_team_id = killer->team_id;
SendRollMsgEx
@ -776,15 +774,11 @@ void Human::BeKill(int killer_id, const std::string& killer_name, int weapon_id)
TEXT("battle_server_dead_weapon", "%s 使用 ${weapon_text_icon} 干掉了 %s").c_str(),
{
killer_name,
#if 0
equip_meta->i->name(),
#endif
name
}
);
}
}
}
} else {
switch (weapon_id) {
case VW_SafeArea:

View File

@ -308,8 +308,17 @@ void Obstacle::Explosion(Bullet* bullet)
float dmg = meta->i->damage();
float def = hum->ability.def;
float finaly_dmg = dmg * (1 - def/MetaMgr::Instance()->K);
if (GetMasterId(bullet->room)) {
Human* master = bullet->room->GetHumanByUniId(GetMasterId(bullet->room));
if (master) {
hum->DecHP(finaly_dmg, master->GetEntityUniId(), master->GetName(), VW_Mine);
} else {
hum->DecHP(finaly_dmg, VP_Mine, TEXT("battle_server_killer_mine", "地雷"), VW_Mine);
}
} else {
hum->DecHP(finaly_dmg, VP_Mine, TEXT("battle_server_killer_mine", "地雷"), VW_Mine);
}
}
}
break;
case ET_Obstacle:

View File

@ -202,6 +202,12 @@ Entity* Room::GetEntityByUniId(int uniid)
return itr != uniid_hash_.end() ? itr->second : nullptr;
}
Human* Room::GetHumanByUniId(int uniid)
{
Entity* entity = GetEntityByUniId(uniid);
return entity && entity->GetEntityType() == ET_Player ? (Human*)entity : nullptr;
}
int Room::AliveCount()
{
return alive_count_;

View File

@ -82,6 +82,7 @@ public:
Player* GetPlayerByAccountId(const std::string& accountid);
Player* GetPlayerByUniId(int uniid);
Entity* GetEntityByUniId(int uniid);
Human* GetHumanByUniId(int uniid);
Human* GetFirstNewBie() { return first_newbie_; }
int GetRealPlayerNum() { return accountid_hash_.size();}

View File

@ -222,9 +222,13 @@ void RoomObstacle::Explosion()
float dmg = meta->i->damage();
float def = hum->ability.def;
float finaly_dmg = dmg * (1 - def/MetaMgr::Instance()->K);
if (master.Get()) {
hum->DecHP(finaly_dmg, master.Get()->GetEntityUniId(), master.Get()->GetName(), VW_Mine);
} else {
hum->DecHP(finaly_dmg, VP_Mine, TEXT("battle_server_killer_mine", "地雷"), VW_Mine);
}
}
}
break;
case ET_Obstacle:
{