This commit is contained in:
aozhiwei 2024-01-16 13:24:40 +08:00
parent 59e5a526da
commit 4abe8e7f8b

View File

@ -1581,9 +1581,22 @@ void Human::OnDie()
SyncAroundPlayers(__FILE__, __LINE__, __func__);
{
Creature* killer = room->GetCreatureByUniId(stats->killer_id);
if (killer && killer->GetHeroGrowMeta() && killer->IsHuman() &&
killer->GetHeroGrowMeta()->lootExp() > 0) {
killer->WinExp(killer->GetHeroGrowMeta()->lootExp() * mt::Param::s().battle_gain_exp_rate_killer);
if (killer && GetHeroGrowMeta() && killer->IsHuman() &&
GetHeroGrowMeta()->lootExp() > 0) {
killer->WinExp(GetHeroGrowMeta()->lootExp() * mt::Param::s().battle_gain_exp_rate_killer);
killer->AsHuman()->GetTeam()->TraverseMembers
(
[this, killer] (Human* hum) -> bool
{
if (killer != hum) {
if (GetPos().Distance2D2(hum->GetPos().ToGlmVec3()) <
mt::Param::s().battle_gain_exp_radium) {
hum->WinExp(GetHeroGrowMeta()->lootExp() *
mt::Param::s().battle_gain_exp_rate_teammate);
}
}
return true;
});
}
}
if (GetTeam()) {