Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
vampire.qc
Go to the documentation of this file.
1#include "vampire.qh"
2
3#ifdef SVQC
4MUTATOR_HOOKFUNCTION(buffs, PlayerDamage_SplitHealthArmor)
5{
6 // NOTE: vampire PlayerDamage_SplitHealthArmor code is similar
7 entity frag_attacker = M_ARGV(1, entity);
9 if (!StatusEffects_active(BUFF_VAMPIRE, frag_attacker))
10 return;
11 float health_take = M_ARGV(4, float);
12
13 if (!StatusEffects_active(STATUSEFFECT_SpawnShield, frag_target)
14 && frag_target != frag_attacker
15 && IS_PLAYER(frag_attacker) && !IS_DEAD(frag_target) && !STAT(FROZEN, frag_target))
16 {
17 float regen = autocvar_g_buffs_vampire_damage_steal * health_take;
18 GiveResource(frag_attacker, RES_HEALTH, regen);
19 buff_Effect(frag_attacker, EFFECT_VAMPIRE, CENTER_OF_ENT(frag_attacker), vec2(frag_attacker.velocity), min(ceil(regen), 50), false);
20 }
21}
22#endif // SVQC
23#ifdef MENUQC
24#include "vengeance.qh"
25
26METHOD(VampireBuff, describe, string(VampireBuff this))
27{
28 TC(VampireBuff, this);
30 PAR(_("The %s buff converts some of the damage you deal to enemies and monsters into health for yourself, until the buff expires."), COLORED_NAME(this));
31 PAR(_("In some sense, this is the opposite of the %s buff."), COLORED_NAME(BUFF_VENGEANCE));
32 return PAGE_TEXT;
33}
34#endif // MENUQC
#define MUTATOR_HOOKFUNCTION(...)
Definition base.qh:335
float autocvar_g_buffs_vampire_damage_steal
Definition vampire.qh:6
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
#define COLORED_NAME(this)
Definition color.qh:189
#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
#define TC(T, sym)
Definition _all.inc:82
#define STAT(...)
Definition stats.qh:94
float ceil(float f)
float min(float f,...)
#define METHOD(cname, name, prototype)
Definition oo.qh:274
bool StatusEffects_active(StatusEffect this, entity actor)
#define PAGE_TEXT
Definition string.qh:651
#define PAR(...)
Adds an individually translatable paragraph to PAGE_TEXT without having to deal with strcat and sprin...
Definition string.qh:657
#define PAGE_TEXT_INIT()
Definition string.qh:650
void buff_Effect(entity player, entity eff, vector eff_loc, vector eff_vel, int eff_cnt, bool hide)
Spawn effects on a player with a buff.
Definition sv_buffs.qc:103
entity frag_target
Definition sv_ctf.qc:2315
void GiveResource(entity receiver, Resource res_type, float amount)
Gives an entity some resource.
#define vec2(...)
Definition vector.qh:95