修复 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,22 +767,16 @@ void Human::BeKill(int killer_id, const std::string& killer_name, int weapon_id)
name name
}); });
} else { } else {
MetaData::Equip* equip_meta = MetaMgr::Instance()->GetEquip(weapon_id); info.killer_id = killer->GetEntityUniId();
if (equip_meta) { info.killer_team_id = killer->team_id;
info.killer_id = killer->GetEntityUniId(); SendRollMsgEx
info.killer_team_id = killer->team_id; (info,
SendRollMsgEx TEXT("battle_server_dead_weapon", "%s 使用 ${weapon_text_icon} 干掉了 %s").c_str(),
(info, {
TEXT("battle_server_dead_weapon", "%s 使用 ${weapon_text_icon} 干掉了 %s").c_str(), killer_name,
{ name
killer_name, }
#if 0 );
equip_meta->i->name(),
#endif
name
}
);
}
} }
} }
} else { } else {

View File

@ -308,7 +308,16 @@ void Obstacle::Explosion(Bullet* bullet)
float dmg = meta->i->damage(); float dmg = meta->i->damage();
float def = hum->ability.def; float def = hum->ability.def;
float finaly_dmg = dmg * (1 - def/MetaMgr::Instance()->K); float finaly_dmg = dmg * (1 - def/MetaMgr::Instance()->K);
hum->DecHP(finaly_dmg, VP_Mine, TEXT("battle_server_killer_mine", "地雷"), VW_Mine); 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; break;

View File

@ -202,6 +202,12 @@ Entity* Room::GetEntityByUniId(int uniid)
return itr != uniid_hash_.end() ? itr->second : nullptr; 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() int Room::AliveCount()
{ {
return alive_count_; return alive_count_;

View File

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

View File

@ -222,7 +222,11 @@ void RoomObstacle::Explosion()
float dmg = meta->i->damage(); float dmg = meta->i->damage();
float def = hum->ability.def; float def = hum->ability.def;
float finaly_dmg = dmg * (1 - def/MetaMgr::Instance()->K); float finaly_dmg = dmg * (1 - def/MetaMgr::Instance()->K);
hum->DecHP(finaly_dmg, VP_Mine, TEXT("battle_server_killer_mine", "地雷"), VW_Mine); 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; break;