1
This commit is contained in:
parent
25b8d8b67e
commit
601fee3925
@ -383,6 +383,7 @@ private:
|
|||||||
std::map<int, Skill*> passive_skill_hash_;
|
std::map<int, Skill*> passive_skill_hash_;
|
||||||
std::map<int, long long> buff_interval_hash_;
|
std::map<int, long long> buff_interval_hash_;
|
||||||
std::array<Inventory, IS_END> inventory_ = {};
|
std::array<Inventory, IS_END> inventory_ = {};
|
||||||
|
|
||||||
friend class Skill;
|
friend class Skill;
|
||||||
friend class Trigger;
|
friend class Trigger;
|
||||||
};
|
};
|
||||||
|
@ -1234,6 +1234,12 @@ void Human::DecHP(float dec_hp, int killer_id, const std::string& killer_name, i
|
|||||||
if (HasBuffEffect(kBET_Invincible)) {
|
if (HasBuffEffect(kBET_Invincible)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
Human* hum = room->GetHumanByUniId(real_killer_id);
|
||||||
|
if (hum) {
|
||||||
|
attacker_hash_[real_killer_id] = room->GetFrameNo();
|
||||||
|
}
|
||||||
|
}
|
||||||
struct DownedInfo
|
struct DownedInfo
|
||||||
{
|
{
|
||||||
int killer_id = 0;
|
int killer_id = 0;
|
||||||
@ -4852,3 +4858,25 @@ void Human::NotifyTeamMarkTargetPos()
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Human::CalcAssists(Human* target)
|
||||||
|
{
|
||||||
|
if (GetTeam() && GetTeam()->GetMemberNum() > 1) {
|
||||||
|
GetTeam()->TraverseMembers
|
||||||
|
(
|
||||||
|
[target, this] (Human* hum)
|
||||||
|
{
|
||||||
|
if (hum == this) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
auto itr = hum->attacker_hash_.find(target->GetUniId());
|
||||||
|
if (itr != hum->attacker_hash_.end()) {
|
||||||
|
if (hum->room->GetFrameNo() - itr->second <
|
||||||
|
SERVER_FRAME_RATE * MetaMgr::Instance()->GetSysParamAsInt("assist_time", 5)) {
|
||||||
|
++hum->stats.assist;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -364,6 +364,7 @@ class Human : public Creature
|
|||||||
void WinPveScore(int score);
|
void WinPveScore(int score);
|
||||||
int GetTeamMode();
|
int GetTeamMode();
|
||||||
void NotifyTeamMarkTargetPos();
|
void NotifyTeamMarkTargetPos();
|
||||||
|
void CalcAssists(Human* target);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void _InternalUpdateMove(float speed);
|
void _InternalUpdateMove(float speed);
|
||||||
@ -453,4 +454,5 @@ private:
|
|||||||
|
|
||||||
long long jump_frameno_ = 0;
|
long long jump_frameno_ = 0;
|
||||||
float old_sync_speed = 0;
|
float old_sync_speed = 0;
|
||||||
|
std::map<int, long long> attacker_hash_;
|
||||||
};
|
};
|
||||||
|
@ -132,13 +132,12 @@ void Trigger::Shot(MetaData::Equip* weapon_meta)
|
|||||||
void Trigger::Kill(Creature* target, int weapon_id)
|
void Trigger::Kill(Creature* target, int weapon_id)
|
||||||
{
|
{
|
||||||
if (owner_->IsHuman() && target->IsHuman()) {
|
if (owner_->IsHuman() && target->IsHuman()) {
|
||||||
#if 1
|
Human* owner_hum = owner_->AsHuman();
|
||||||
|
Human* target_hum = target->AsHuman();
|
||||||
|
owner_hum->CalcAssists(target_hum);
|
||||||
if (target->GetUniId() != owner_->GetUniId()) {
|
if (target->GetUniId() != owner_->GetUniId()) {
|
||||||
owner_->AsHuman()->stats.kills++;
|
owner_->AsHuman()->stats.kills++;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
owner_->AsHuman()->stats.kills++;
|
|
||||||
#endif
|
|
||||||
owner_->AsHuman()->stats.last_kill_frameno = owner_->room->GetFrameNo();
|
owner_->AsHuman()->stats.last_kill_frameno = owner_->room->GetFrameNo();
|
||||||
owner_->AsHuman()->kill_humans.insert(target->AsHuman());
|
owner_->AsHuman()->kill_humans.insert(target->AsHuman());
|
||||||
owner_->AsHuman()->SyncAroundPlayers(__FILE__, __LINE__, __func__);
|
owner_->AsHuman()->SyncAroundPlayers(__FILE__, __LINE__, __func__);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user