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 = bound(0, M_ARGV(4, float), GetResource(frag_target, RES_HEALTH));
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 GiveResource(frag_attacker, RES_HEALTH, autocvar_g_buffs_vampire_damage_steal * health_take);
18 }
19}
20#endif // SVQC
21#ifdef MENUQC
22#include "vengeance.qh"
23
24METHOD(VampireBuff, describe, string(VampireBuff this))
25{
26 TC(VampireBuff, this);
28 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));
29 PAR(_("In some sense, this is the opposite of the %s buff."), COLORED_NAME(BUFF_VENGEANCE));
30 return PAGE_TEXT;
31}
32#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
float GetResource(entity e, Resource res_type)
Returns the current amount of resource the given entity has.
#define COLORED_NAME(this)
Definition color.qh:195
#define M_ARGV(x, type)
Definition events.qh:17
#define IS_DEAD(s)
Definition player.qh:245
#define IS_PLAYER(s)
Definition player.qh:243
#define TC(T, sym)
Definition _all.inc:82
#define STAT(...)
Definition stats.qh:82
float bound(float min, float value, float max)
#define METHOD(cname, name, prototype)
Definition oo.qh:269
bool StatusEffects_active(StatusEffect this, entity actor)
#define PAGE_TEXT
Definition string.qh:643
#define PAR(...)
Adds an individually translatable paragraph to PAGE_TEXT without having to deal with strcat and sprin...
Definition string.qh:649
#define PAGE_TEXT_INIT()
Definition string.qh:642
entity frag_target
Definition sv_ctf.qc:2321
void GiveResource(entity receiver, Resource res_type, float amount)
Gives an entity some resource.