Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
sv_vampire.qc
Go to the documentation of this file.
1#include "sv_vampire.qh"
2
6
8
9MUTATOR_HOOKFUNCTION(vampire, PlayerDamage_SplitHealthArmor)
10{
11 // NOTE: vampire buff PlayerDamage_SplitHealthArmor code is similar
12 entity frag_attacker = M_ARGV(1, entity);
14 float health_take = M_ARGV(4, float);
15 float armor_take = M_ARGV(5, float);
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)
19 && frag_target != frag_attacker
20 && IS_PLAYER(frag_attacker) && !IS_DEAD(frag_target) && !STAT(FROZEN, frag_target))
21 {
22 float regen = autocvar_g_vampire_factor * damage_take;
23 GiveResource(frag_attacker, RES_HEALTH, regen);
24 float pl_alpha = (!frag_attacker.alpha ? 1 : frag_attacker.alpha);
25 if (pl_alpha > 0)
26 Send_Effect_Core(EFFECT_VAMPIRE, CENTER_OF_ENT(frag_attacker), vec2(frag_attacker.velocity), min(ceil(regen * 0.5), 50),
27 '0 0 0', '0 0 0', pl_alpha, pl_alpha, -1, NULL);
28 }
29}
30
31MUTATOR_HOOKFUNCTION(vampire, BuildMutatorsString)
32{
33 M_ARGV(0, string) = strcat(M_ARGV(0, string), ":Vampire");
34}
35
36MUTATOR_HOOKFUNCTION(vampire, BuildMutatorsPrettyString)
37{
38 M_ARGV(0, string) = strcat(M_ARGV(0, string), ", Vampire");
39}
#define MUTATOR_IS_ENABLED(this)
Definition base.qh:193
#define REGISTER_MUTATOR(...)
Definition base.qh:295
#define MUTATOR_HOOKFUNCTION(...)
Definition base.qh:335
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
#define M_ARGV(x, type)
Definition events.qh:17
#define IS_DEAD(s)
Definition player.qh:244
#define IS_PLAYER(s)
Definition player.qh:242
#define CENTER_OF_ENT(ent)
Definition util.qh:10
ERASEABLE bool expr_evaluate(string s)
Evaluate an expression of the form: [+ | -]?
Definition cvar.qh:48
void Send_Effect_Core(entity eff, vector eff_loc, vector eff_vel, int eff_cnt, vector eff_col_min, vector eff_col_max, float eff_alpha_min, float eff_alpha_max, float eff_alpha_fade, entity ignore)
Definition all.qc:74
#define STAT(...)
Definition stats.qh:94
float ceil(float f)
float min(float f,...)
strcat(_("^F4Countdown stopped!"), "\n^BG", _("Teams are too unbalanced."))
#define NULL
Definition post.qh:14
bool StatusEffects_active(StatusEffect this, entity actor)
entity frag_target
Definition sv_ctf.qc:2315
void GiveResource(entity receiver, Resource res_type, float amount)
Gives an entity some resource.
float autocvar_g_vampire_factor
Definition sv_vampire.qc:4
string autocvar_g_vampire
Definition sv_vampire.qc:3
bool autocvar_g_vampire_use_total_damage
Definition sv_vampire.qc:5
#define vec2(...)
Definition vector.qh:95