Added .handicap_avg_given_sum and .handicap_avg_taken_sum.
Currently it doesn't include self-damage which *is* influenced by handicap.
- Including this would require minimum 2 but probably 4 more entity fields, so I'm not sure it's really necessary.
The given and taken handicaps are sent to XonStat separately.
strfree(it.playerstats_id);
PlayerStats_GameReport_AddEvent(sprintf("kills-%d", it.playerid));
PlayerStats_GameReport_AddPlayer(it);
+ it.handicap_avg_given_sum = 0;
+ it.handicap_avg_taken_sum = 0;
});
FOREACH(Scores, true, {
string label = scores_label(it);
}
}
+ // handicap
+ const float given = GameRules_scoring_add(it, DMG, 0);
+ const float taken = GameRules_scoring_add(it, DMGTAKEN, 0);
+ PlayerStats_GameReport_Event_Player(it, PLAYERSTATS_HANDICAP_GIVEN, given <= 0 ? 1 : it.handicap_avg_given_sum / given);
+ PlayerStats_GameReport_Event_Player(it, PLAYERSTATS_HANDICAP_TAKEN, taken <= 0 ? 1 : it.handicap_avg_taken_sum / taken);
+
// collect final player information
PlayerStats_GameReport_FinalizePlayer(it);
});
PlayerStats_GameReport_AddEvent(PLAYERSTATS_SCOREBOARD_VALID);
PlayerStats_GameReport_AddEvent(PLAYERSTATS_SCOREBOARD_POS);
PlayerStats_GameReport_AddEvent(PLAYERSTATS_RANK);
+ PlayerStats_GameReport_AddEvent(PLAYERSTATS_HANDICAP_GIVEN);
+ PlayerStats_GameReport_AddEvent(PLAYERSTATS_HANDICAP_TAKEN);
// accuracy stats
FOREACH(Weapons, it != WEP_Null, {
* achievement-<achievementname>: achievement counters (their "count" is usually 1 if nonzero at all)
* kills-<index>: number of kills against the indexed player
* rank <number>: rank of player
+ * handicapgiven: average handicap on given (dealt) damage throughout the match
+ * handicaptaken: average handicap on taken (received) damage throughout the match
* acc-<weapon netname>-hit: total damage dealt
* acc-<weapon netname>-fired: total damage that all fired projectiles *could* have dealt
* acc-<weapon netname>-cnt-hit: amount of shots that actually hit
const string PLAYERSTATS_SCOREBOARD_VALID = "scoreboardvalid";
const string PLAYERSTATS_RANK = "rank";
const string PLAYERSTATS_SCOREBOARD_POS = "scoreboardpos";
+const string PLAYERSTATS_HANDICAP_GIVEN = "handicapgiven";
+const string PLAYERSTATS_HANDICAP_TAKEN = "handicaptaken";
const string PLAYERSTATS_TOTAL = "total-";
const string PLAYERSTATS_SCOREBOARD = "scoreboard-";
if (this.score_frame_dmg)
{
+ this.handicap_avg_given_sum += this.score_frame_dmg * Handicap_GetTotalHandicap(this, false);
GameRules_scoring_add(this, DMG, this.score_frame_dmg);
this.score_frame_dmg = 0;
}
if (this.score_frame_dmgtaken)
{
+ this.handicap_avg_taken_sum += this.score_frame_dmgtaken * Handicap_GetTotalHandicap(this, true);
GameRules_scoring_add(this, DMGTAKEN, this.score_frame_dmgtaken);
this.score_frame_dmgtaken = 0;
}
/// \param[in] player Player to check.
void Handicap_UpdateHandicapLevel(entity player);
-#define HANDICAP_MAX_LEVEL_EQUIVALENT 2.0
-
-.int handicap_level;
// This int ranges 0 to 16, 0 meaning no handicap, 1 to 16 representing handicap "levels" mapped
// from 1.0 to HANDICAP_MAX_LEVEL_EQUIVALENT, using (given + taken)/2 (i.e. both-ways handicap).
// It is networked to the client.
// The levels are mostly meaningless, just used to determine the player_handicap icon color.
+.int handicap_level;
+
+#define HANDICAP_MAX_LEVEL_EQUIVALENT 2.0
+
+// These store the player's total "average-sum" given/taken damage handicaps respectively.
+// average-sum refers to the arithmetic sum of damage taken/given, weighted by respective handicap.
+// To calculate the average handicap, divide by damage taken/given.
+.float handicap_avg_given_sum;
+.float handicap_avg_taken_sum;