Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
handicap.qh
Go to the documentation of this file.
1#pragma once
2
3#include <common/mapinfo.qh>
6
11
12// Handicap is used to make the game harder for strong players and easier for
13// weak players. Values greater than 1 make the game harder and values less than
14// 1 make the game easier. Right now handicap only affects damage. There are 2
15// types of handicap: voluntary and forced. Voluntary handicap can be set via
16// cl_handicap cvars. For obvious reasons, it can't be less than 1. Forced
17// handicap can be set by server mutators. The total handicap is the product of
18// voluntary and forced handicap.
19// Both handicaps are separated into _take and _give so that mutators and
20// players are able to nerf their damage output or increase intake
21// without changing the other.
22
26void Handicap_Initialize(entity player);
27
32float Handicap_GetVoluntaryHandicap(entity player, bool receiving);
33
38float Handicap_GetForcedHandicap(entity player, bool receiving);
39
45void Handicap_SetForcedHandicap(entity player, float value, bool receiving);
46
51float Handicap_GetTotalHandicap(entity player, bool receiving);
52
56
57#define HANDICAP_DISABLED() \
58 (IS_GAMETYPE(CTS) || IS_GAMETYPE(RACE))
59
60// This int ranges from 0 to 16, representing handicap "levels" mapped from
61// 1.0 to HANDICAP_MAX_LEVEL_EQUIVALENT, using (given + taken)/2 (i.e. both-ways handicap).
62// It is networked to the client.
63// The levels are mostly meaningless, just used to determine the player_handicap icon color.
65
66#define HANDICAP_MAX_LEVEL_EQUIVALENT 2.0
67
68// These store the player's total "average-sum" given/taken damage handicaps respectively.
69// average-sum refers to the arithmetic sum of damage taken/given, weighted by respective handicap.
70// To calculate the average handicap, divide by damage taken/given.
73
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
handicap_level
Definition ent_cs.qc:155
void Handicap_SetForcedHandicap(entity player, float value, bool receiving)
Sets the forced handicap of the player.
Definition handicap.qc:81
void Handicap_Initialize(entity player)
Initializes handicap to its default value.
Definition handicap.qc:16
float Handicap_GetTotalHandicap(entity player, bool receiving)
Returns the total handicap of the player.
Definition handicap.qc:96
float Handicap_GetForcedHandicap(entity player, bool receiving)
Returns the forced handicap of the player.
Definition handicap.qc:71
float handicap_avg_taken_sum
Definition handicap.qh:72
void Handicap_UpdateHandicapLevel(entity player)
Updates .handicap_level for the player.
Definition handicap.qc:104
float handicap_avg_given_sum
Definition handicap.qh:71
float Handicap_GetVoluntaryHandicap(entity player, bool receiving)
Returns the voluntary handicap of the player.
Definition handicap.qc:25