1
This commit is contained in:
parent
f56448e17a
commit
e6c8c551aa
@ -502,6 +502,7 @@ void Car::BeKill(int killer_id, const std::string& killer_name, int weapon_id)
|
||||
);
|
||||
room->NotifyUiUpdate();
|
||||
room->frame_event.AddDead(GetWeakPtrRef(), 0);
|
||||
AllocDeadExp(killer_id);
|
||||
GetTrigger()->Die(killer_id, weapon_id);
|
||||
}
|
||||
|
||||
|
@ -4047,3 +4047,31 @@ void Creature::GenLevelAttr()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Creature::AllocDeadExp(int real_killer_id)
|
||||
{
|
||||
Creature* killer = room->GetCreatureByUniId(real_killer_id);
|
||||
if (killer && GetHeroGrowMeta() &&
|
||||
GetHeroGrowMeta()->lootExp() > 0) {
|
||||
Human* real_killer = nullptr;
|
||||
if (killer->IsHuman()) {
|
||||
real_killer = killer->AsHuman();
|
||||
} else if (killer->IsHero() && killer->master.Get() && killer->master.Get()->IsHuman()) {
|
||||
real_killer = killer->master.Get()->AsHuman();
|
||||
}
|
||||
real_killer->WinExp(GetHeroGrowMeta()->lootExp() * mt::Param::s().battle_gain_exp_rate_killer);
|
||||
real_killer->AsHuman()->GetTeam()->TraverseMembers
|
||||
(
|
||||
[this, real_killer] (Human* hum) -> bool
|
||||
{
|
||||
if (real_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;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -359,6 +359,7 @@ class Creature : public MoveableEntity
|
||||
int GetHeroExp();
|
||||
int GetHeroMaxExp();
|
||||
void WinExp(int win_exp);
|
||||
void AllocDeadExp(int real_killer_id);
|
||||
void RecalcDtoAttr();
|
||||
void AutoNavigation(const glm::vec3& target_pos, float speed,
|
||||
std::function<void (Creature*)> cb);
|
||||
|
@ -369,6 +369,7 @@ void Hero::BeKill(int killer_id, const std::string& killer_name, int weapon_id)
|
||||
room->pve_data.OnBeKill(this);
|
||||
room->NotifyUiUpdate();
|
||||
}
|
||||
AllocDeadExp(killer_id);
|
||||
GetTrigger()->Die(killer_id, weapon_id);
|
||||
}
|
||||
|
||||
|
@ -1579,32 +1579,7 @@ void Human::OnDie()
|
||||
real_dead_frameno = room->GetFrameNo();
|
||||
room->OnHumanDie(this);
|
||||
SyncAroundPlayers(__FILE__, __LINE__, __func__);
|
||||
{
|
||||
Creature* killer = room->GetCreatureByUniId(stats->killer_id);
|
||||
if (killer && GetHeroGrowMeta() &&
|
||||
GetHeroGrowMeta()->lootExp() > 0) {
|
||||
Human* real_killer = nullptr;
|
||||
if (killer->IsHuman()) {
|
||||
real_killer = killer->AsHuman();
|
||||
} else if (killer->IsHero() && killer->master.Get() && killer->master.Get()->IsHuman()) {
|
||||
real_killer = killer->master.Get()->AsHuman();
|
||||
}
|
||||
real_killer->WinExp(GetHeroGrowMeta()->lootExp() * mt::Param::s().battle_gain_exp_rate_killer);
|
||||
real_killer->AsHuman()->GetTeam()->TraverseMembers
|
||||
(
|
||||
[this, real_killer] (Human* hum) -> bool
|
||||
{
|
||||
if (real_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;
|
||||
});
|
||||
}
|
||||
}
|
||||
AllocDeadExp(stats->killer_id);
|
||||
if (GetTeam()) {
|
||||
GetTeam()->TraverseMembers
|
||||
(
|
||||
|
Loading…
x
Reference in New Issue
Block a user