1
This commit is contained in:
parent
7c44186ea3
commit
d569773250
@ -3212,4 +3212,88 @@ void Human::CalcStats()
|
||||
return;
|
||||
}
|
||||
statsed_ = true;
|
||||
|
||||
int rank = 0;
|
||||
{
|
||||
std::vector<Human*> human_list;
|
||||
room->TraverseHumanList(
|
||||
[&human_list] (Human* hum) -> bool
|
||||
{
|
||||
human_list.push_back(hum);
|
||||
return true;
|
||||
});
|
||||
std::sort(human_list.begin(), human_list.end(),
|
||||
[] (Human* a, Human* b )
|
||||
{
|
||||
if (a->real_dead && b->real_dead) {
|
||||
if (a->dead_frameno == b->dead_frameno) {
|
||||
return a->GetUniId() < b->GetUniId();
|
||||
} else {
|
||||
return a->dead_frameno == 0 ||
|
||||
(b->dead_frameno != 0 && a->dead_frameno > b->dead_frameno);
|
||||
}
|
||||
} else {
|
||||
if (a->real_dead) {
|
||||
return false;
|
||||
}
|
||||
if (b->real_dead) {
|
||||
return true;
|
||||
}
|
||||
return a->GetUniId() < b->GetUniId();
|
||||
}
|
||||
});
|
||||
rank = human_list.size();
|
||||
for (size_t i = 0; i < human_list.size(); ++i) {
|
||||
if (human_list[i] == this) {
|
||||
rank = i + 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (room->GetAliveTeamNum() == 1) {
|
||||
if (room->GetAliveTeam() == GetTeam()) {
|
||||
rank = 1;
|
||||
}
|
||||
}
|
||||
stats->rank = rank;
|
||||
if (room->IsPveRoom()) {
|
||||
if (stats->pve_kill_boss) {
|
||||
stats->victory = true;
|
||||
stats->settlement_color = 1;
|
||||
}
|
||||
} else {
|
||||
stats->victory = stats->rank == 1;
|
||||
if (GetTeam()->GetAliveNum() <= 0) {
|
||||
GetTeam()->team_rank = room->GetAliveTeamNum();
|
||||
stats->pvp_settlement_type = GetTeam()->GetMemberNum() > 1 ? 1 : 0;
|
||||
stats->settlement_color = 1;
|
||||
} else {
|
||||
if (room->GetAliveTeamNum() == 1) {
|
||||
if (room->GetAliveTeam() == GetTeam()) {
|
||||
GetTeam()->team_rank = 1;
|
||||
stats->pvp_settlement_type = GetTeam()->GetMemberNum() > 1 ? 1 : 0;
|
||||
stats->settlement_color = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (rank < 10) {
|
||||
stats->settlement_color = 1;
|
||||
}
|
||||
if (stats->victory) {
|
||||
GetTeam()->team_rank = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!stats->statemented) {
|
||||
stats->Statement(this);
|
||||
}
|
||||
int alive_time = room->GetFrameNo() * FRAME_RATE_MS;
|
||||
if (!dead) {
|
||||
stats->alive_time = alive_time;
|
||||
} else {
|
||||
alive_time = (dead_frameno - room->GetBattleStartFrameNo()) * FRAME_RATE_MS;
|
||||
if (room->GetBattleStartFrameNo() <= 0) {
|
||||
alive_time = 0;
|
||||
}
|
||||
stats->alive_time = alive_time;
|
||||
}
|
||||
}
|
||||
|
@ -66,6 +66,7 @@ class PlayerStats
|
||||
int heal_amount = 0;
|
||||
int rescue_member = 0;
|
||||
int rescue_guild_member = 0;
|
||||
int alive_time = 0;
|
||||
|
||||
int old_rank = 0;
|
||||
int new_rank = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user