Xonotic
sv_vampire.qc File Reference
#include "sv_vampire.qh"
+ Include dependency graph for sv_vampire.qc:

Go to the source code of this file.

Functions

 MUTATOR_HOOKFUNCTION (vampire, PlayerDamage_SplitHealthArmor)
 
 MUTATOR_HOOKFUNCTION (vampire, BuildMutatorsString)
 
 MUTATOR_HOOKFUNCTION (vampire, BuildMutatorsPrettyString)
 
 REGISTER_MUTATOR (vampire, expr_evaluate(autocvar_g_vampire) &&!MUTATOR_IS_ENABLED(mutator_instagib))
 

Variables

string autocvar_g_vampire
 
float autocvar_g_vampire_factor = 1.0
 
bool autocvar_g_vampire_use_total_damage = false
 

Function Documentation

◆ MUTATOR_HOOKFUNCTION() [1/3]

MUTATOR_HOOKFUNCTION ( vampire  ,
PlayerDamage_SplitHealthArmor   
)

Definition at line 9 of file sv_vampire.qc.

References autocvar_g_vampire_factor, autocvar_g_vampire_use_total_damage, bound(), entity(), GetResource(), GiveResource(), IS_DEAD, IS_PLAYER, M_ARGV, and RES_HEALTH.

10 {
11  // NOTE: vampire buff PlayerDamage_SplitHealthArmor code is similar
12  entity frag_attacker = M_ARGV(1, entity);
13  entity frag_target = M_ARGV(2, entity);
14  float health_take = bound(0, M_ARGV(4, float), GetResource(frag_target, RES_HEALTH));
15  float armor_take = bound(0, M_ARGV(5, float), GetResource(frag_target, RES_ARMOR));
16  float damage_take = (autocvar_g_vampire_use_total_damage) ? health_take + armor_take : health_take;
17 
18  if (!StatusEffects_active(STATUSEFFECT_SpawnShield, frag_target) && frag_target != frag_attacker
19  && IS_PLAYER(frag_attacker) && !IS_DEAD(frag_target) && !STAT(FROZEN, frag_target))
20  {
21  GiveResource(frag_attacker, RES_HEALTH, autocvar_g_vampire_factor * damage_take);
22  }
23 }
entity() spawn
RES_HEALTH
Definition: ent_cs.qc:126
float autocvar_g_vampire_factor
Definition: sv_vampire.qc:4
bool autocvar_g_vampire_use_total_damage
Definition: sv_vampire.qc:5
#define M_ARGV(x, type)
Definition: events.qh:17
#define IS_DEAD(s)
Definition: utils.qh:26
void GiveResource(entity receiver, Resource res_type, float amount)
Gives an entity some resource.
float GetResource(entity e, Resource res_type)
Returns the current amount of resource the given entity has.
Definition: cl_resources.qc:10
#define IS_PLAYER(v)
Definition: utils.qh:9
+ Here is the call graph for this function:

◆ MUTATOR_HOOKFUNCTION() [2/3]

MUTATOR_HOOKFUNCTION ( vampire  ,
BuildMutatorsString   
)

Definition at line 25 of file sv_vampire.qc.

References M_ARGV, and strcat().

26 {
27  M_ARGV(0, string) = strcat(M_ARGV(0, string), ":Vampire");
28 }
spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 f1 s1 strcat(_("Level %s: "), "^BG%s\3\, _("^BGPress ^F2%s^BG to enter the game"))
#define M_ARGV(x, type)
Definition: events.qh:17
+ Here is the call graph for this function:

◆ MUTATOR_HOOKFUNCTION() [3/3]

MUTATOR_HOOKFUNCTION ( vampire  ,
BuildMutatorsPrettyString   
)

Definition at line 30 of file sv_vampire.qc.

References M_ARGV, and strcat().

31 {
32  M_ARGV(0, string) = strcat(M_ARGV(0, string), ", Vampire");
33 }
spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 f1 s1 strcat(_("Level %s: "), "^BG%s\3\, _("^BGPress ^F2%s^BG to enter the game"))
#define M_ARGV(x, type)
Definition: events.qh:17
+ Here is the call graph for this function:

◆ REGISTER_MUTATOR()

REGISTER_MUTATOR ( vampire  ,
expr_evaluate(autocvar_g_vampire) &&!MUTATOR_IS_ENABLED(mutator_instagib)   
)

Variable Documentation

◆ autocvar_g_vampire

string autocvar_g_vampire

Definition at line 3 of file sv_vampire.qc.

◆ autocvar_g_vampire_factor

float autocvar_g_vampire_factor = 1.0

Definition at line 4 of file sv_vampire.qc.

Referenced by MUTATOR_HOOKFUNCTION().

◆ autocvar_g_vampire_use_total_damage

bool autocvar_g_vampire_use_total_damage = false

Definition at line 5 of file sv_vampire.qc.

Referenced by MUTATOR_HOOKFUNCTION().