Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
mage.qc File Reference
#include "mage.qh"
Include dependency graph for mage.qc:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  OffhandMageTeleport

Functions

bool M_Mage_Attack (int attack_type, entity actor, entity targ,.entity weaponentity)
void M_Mage_Attack_Push (entity this)
void M_Mage_Attack_Spike (entity this, vector dir)
void M_Mage_Attack_Spike_Explode (entity this, entity directhitentity)
void M_Mage_Attack_Spike_Think (entity this)
void M_Mage_Attack_Spike_Touch (entity this, entity toucher)
void M_Mage_Attack_Teleport (entity this, entity targ)
void M_Mage_Defend_Heal (entity this)
bool M_Mage_Defend_Heal_Check (entity this, entity targ)
bool M_Mage_Defend_Heal_cond (entity e)
void M_Mage_Defend_Shield (entity this)
 SOUND (MageSpike_FIRE, W_Sound("electro_fire"))
 SOUND (MageSpike_IMPACT, W_Sound("grenade_impact"))
 SOUND (MageSpike_PUSH, W_Sound("tagexp1"))
 spawnfunc (monster_mage)
 STATIC_INIT (OFFHAND_MAGE_TELEPORT)

Variables

float autocvar_g_monster_mage_attack_push_chance = 0.7
float autocvar_g_monster_mage_attack_push_damage
float autocvar_g_monster_mage_attack_push_delay
float autocvar_g_monster_mage_attack_push_force
float autocvar_g_monster_mage_attack_push_radius
float autocvar_g_monster_mage_attack_spike_accel
float autocvar_g_monster_mage_attack_spike_chance = 0.45
float autocvar_g_monster_mage_attack_spike_damage
float autocvar_g_monster_mage_attack_spike_decel
float autocvar_g_monster_mage_attack_spike_delay
float autocvar_g_monster_mage_attack_spike_radius
float autocvar_g_monster_mage_attack_spike_smart
float autocvar_g_monster_mage_attack_spike_smart_mindist
float autocvar_g_monster_mage_attack_spike_smart_trace_max
float autocvar_g_monster_mage_attack_spike_smart_trace_min
float autocvar_g_monster_mage_attack_spike_speed_max
float autocvar_g_monster_mage_attack_spike_turnrate
float autocvar_g_monster_mage_attack_teleport_chance = 0.2
float autocvar_g_monster_mage_attack_teleport_delay = 2
float autocvar_g_monster_mage_attack_teleport_random = 0.4
float autocvar_g_monster_mage_attack_teleport_random_range = 1200
float autocvar_g_monster_mage_damageforcescale = 0.5
float autocvar_g_monster_mage_heal_allies
float autocvar_g_monster_mage_heal_delay
float autocvar_g_monster_mage_heal_minhealth
float autocvar_g_monster_mage_heal_range
float autocvar_g_monster_mage_health
string autocvar_g_monster_mage_loot = "health_big"
float autocvar_g_monster_mage_shield_blockpercent
float autocvar_g_monster_mage_shield_delay
float autocvar_g_monster_mage_shield_time
float autocvar_g_monster_mage_speed_run
float autocvar_g_monster_mage_speed_stop
float autocvar_g_monster_mage_speed_walk
bool M_Mage_Defend_Heal_cond_checkvalid
float mage_shield_delay
entity mage_spike
OffhandMageTeleport OFFHAND_MAGE_TELEPORT

Function Documentation

◆ M_Mage_Attack()

bool M_Mage_Attack ( int attack_type,
entity actor,
entity targ,
.entity weaponentity )

Definition at line 354 of file mage.qc.

355{
356 switch (attack_type)
357 {
359 {
361 {
362 Weapon wep = WEP_MAGE_SPIKE;
363
364 wep.wr_think(wep, actor, weaponentity, 2);
365 return true;
366 }
367 return false;
368 }
370 {
372 {
374 actor.OffhandMageTeleport_key_pressed = 0;
375 off.offhand_think(off, actor, 1);
376 return true;
377 }
378 else if (!actor.mage_spike && random() <= autocvar_g_monster_mage_attack_spike_chance)
379 {
380 setanim(actor, actor.anim_shoot, true, true, true);
381 actor.attack_finished_single[0] = time + autocvar_g_monster_mage_attack_spike_delay;
382 actor.anim_finished = time + 1;
383 actor.state = MONSTER_ATTACK_MELEE; // prevent moving while firing spike
384 Weapon wep = WEP_MAGE_SPIKE;
385 wep.wr_think(wep, actor, weaponentity, 1);
386 return true;
387 }
388 return false;
389 }
390 }
391
392 return false;
393}
#define setanim(...)
Definition anim.qh:45
virtual void offhand_think()
Definition weapon.qh:238
fields which are explicitly/manually set are marked with "M", fields set automatically are marked wit...
Definition weapon.qh:42
virtual void wr_think()
(SERVER) logic to run every frame
Definition weapon.qh:98
float time
float autocvar_g_monster_mage_attack_spike_chance
Definition mage.qc:12
float autocvar_g_monster_mage_attack_spike_delay
Definition mage.qc:9
OffhandMageTeleport OFFHAND_MAGE_TELEPORT
Definition mage.qc:82
float autocvar_g_monster_mage_attack_teleport_chance
Definition mage.qc:24
float autocvar_g_monster_mage_attack_push_chance
Definition mage.qc:19
float random(void)
const int MONSTER_ATTACK_MELEE
const int MONSTER_ATTACK_RANGED

References autocvar_g_monster_mage_attack_push_chance, autocvar_g_monster_mage_attack_spike_chance, autocvar_g_monster_mage_attack_spike_delay, autocvar_g_monster_mage_attack_teleport_chance, entity(), MONSTER_ATTACK_MELEE, MONSTER_ATTACK_RANGED, OFFHAND_MAGE_TELEPORT, OffhandWeapon::offhand_think(), random(), setanim, time, and Weapon::wr_think().

◆ M_Mage_Attack_Push()

void M_Mage_Attack_Push ( entity this)

Definition at line 273 of file mage.qc.

274{
275 sound(this, CH_SHOTS, SND_MageSpike_PUSH, 1, ATTEN_NORM);
276 RadiusDamage(this, this,
280 NULL,
281 NULL,
283 DEATH_MONSTER_MAGE.m_id,
284 DMG_NOWEP,
285 this.enemy
286 );
287 Send_Effect(EFFECT_TE_EXPLOSION, this.origin, '0 0 0', 1);
288
289 setanim(this, this.anim_duckjump, true, true, true);
291 this.anim_finished = time + 1;
292 this.state = MONSTER_ATTACK_MELEE; // prevent moving while firing spike
293}
vector origin
float RadiusDamage(entity inflictor, entity attacker, float coredamage, float edgedamage, float rad, entity cantbe, entity mustbe, float forceintensity, int deathtype,.entity weaponentity, entity directhitentity)
Definition damage.qc:937
#define DMG_NOWEP
Definition damage.qh:104
int state
void Send_Effect(entity eff, vector eff_loc, vector eff_vel, int eff_cnt)
Definition all.qc:155
float autocvar_g_monster_mage_attack_push_force
Definition mage.qc:23
float autocvar_g_monster_mage_attack_push_radius
Definition mage.qc:21
float autocvar_g_monster_mage_attack_push_delay
Definition mage.qc:22
float autocvar_g_monster_mage_attack_push_damage
Definition mage.qc:20
#define NULL
Definition post.qh:14
const int CH_SHOTS
Definition sound.qh:14
const float ATTEN_NORM
Definition sound.qh:30
#define sound(e, c, s, v, a)
Definition sound.qh:52
float anim_finished
will be phased out when we have proper animations system
float attack_finished_single[MAX_WEAPONSLOTS]

References anim_finished, attack_finished_single, ATTEN_NORM, autocvar_g_monster_mage_attack_push_damage, autocvar_g_monster_mage_attack_push_delay, autocvar_g_monster_mage_attack_push_force, autocvar_g_monster_mage_attack_push_radius, CH_SHOTS, DMG_NOWEP, entity(), MONSTER_ATTACK_MELEE, NULL, origin, RadiusDamage(), Send_Effect(), setanim, sound, state, and time.

◆ M_Mage_Attack_Spike()

void M_Mage_Attack_Spike ( entity this,
vector dir )

Definition at line 182 of file mage.qc.

183{
184 makevectors(this.angles);
185
186 entity missile = new(M_Mage_Attack_Spike);
187 WarpZone_RefSys_Copy(missile, this);
188 missile.owner = missile.realowner = this;
190 missile.ltime = time + 7;
191 missile.nextthink = time;
192 missile.solid = SOLID_BBOX;
194 missile.flags = FL_PROJECTILE;
195 IL_PUSH(g_projectiles, missile);
196 IL_PUSH(g_bot_dodge, missile);
197 setorigin(missile, this.origin + v_forward * 14 + '0 0 30' + v_right * -14);
198 setsize(missile, '0 0 0', '0 0 0');
199 missile.velocity = dir * 400;
200 missile.avelocity = '300 300 300';
201 missile.enemy = this.enemy;
203
204 this.mage_spike = missile;
205
206 CSQCProjectile(missile, true, PROJECTILE_MAGE_SPIKE, true);
207}
IntrusiveList g_bot_dodge
Definition api.qh:150
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
const int FL_PROJECTILE
Definition constants.qh:77
const float SOLID_BBOX
vector v_right
vector v_forward
void CSQCProjectile(entity e, float clientanimate, int type, float docull)
ent angles
Definition ent_cs.qc:146
ERASEABLE entity IL_PUSH(IntrusiveList this, entity it)
Push to tail.
void WarpZone_RefSys_Copy(entity me, entity from)
Copies the warpzone reference of from onto me.
Definition common.qc:824
void M_Mage_Attack_Spike_Think(entity this)
Definition mage.qc:157
entity mage_spike
Definition mage.qc:91
void M_Mage_Attack_Spike(entity this, vector dir)
Definition mage.qc:182
void M_Mage_Attack_Spike_Touch(entity this, entity toucher)
Definition mage.qc:149
void set_movetype(entity this, int mt)
Definition movetypes.qc:4
const int MOVETYPE_FLYMISSILE
Definition movetypes.qh:142
#define makevectors
Definition post.qh:21
const int PROJECTILE_MAGE_SPIKE
#define setthink(e, f)
#define settouch(e, f)
Definition self.qh:77
int dir
Definition impulse.qc:89
IntrusiveList g_projectiles
Definition common.qh:70
entity enemy
Definition sv_ctf.qh:152

References angles, CSQCProjectile(), dir, enemy, entity(), FL_PROJECTILE, g_bot_dodge, g_projectiles, IL_PUSH(), M_Mage_Attack_Spike(), M_Mage_Attack_Spike_Think(), M_Mage_Attack_Spike_Touch(), mage_spike, makevectors, MOVETYPE_FLYMISSILE, origin, PROJECTILE_MAGE_SPIKE, set_movetype(), setthink, settouch, SOLID_BBOX, time, v_forward, v_right, vector, and WarpZone_RefSys_Copy().

Referenced by M_Mage_Attack_Spike().

◆ M_Mage_Attack_Spike_Explode()

void M_Mage_Attack_Spike_Explode ( entity this,
entity directhitentity )

Definition at line 125 of file mage.qc.

126{
127 this.event_damage = func_null;
128
129 sound(this, CH_SHOTS, SND_MageSpike_IMPACT, VOL_BASE, ATTEN_NORM);
130
131 this.realowner.mage_spike = NULL;
132
133 Send_Effect(EFFECT_EXPLOSION_SMALL, this.origin, '0 0 0', 1);
134 RadiusDamage(this, this.realowner,
138 NULL,
139 NULL,
140 0,
141 DEATH_MONSTER_MAGE.m_id,
142 DMG_NOWEP,
143 directhitentity
144 );
145
146 delete(this);
147}
float autocvar_g_monster_mage_attack_spike_radius
Definition mage.qc:8
float autocvar_g_monster_mage_attack_spike_damage
Definition mage.qc:7
var void func_null()
const float VOL_BASE
Definition sound.qh:36
entity realowner

References ATTEN_NORM, autocvar_g_monster_mage_attack_spike_damage, autocvar_g_monster_mage_attack_spike_radius, CH_SHOTS, DMG_NOWEP, entity(), func_null(), NULL, origin, RadiusDamage(), realowner, Send_Effect(), sound, and VOL_BASE.

Referenced by M_Mage_Attack_Spike_Think(), and M_Mage_Attack_Spike_Touch().

◆ M_Mage_Attack_Spike_Think()

void M_Mage_Attack_Spike_Think ( entity this)

Definition at line 157 of file mage.qc.

158{
159 if (time > this.ltime
160 || (this.enemy && GetResource(this.enemy, RES_HEALTH) <= 0)
161 || !this.owner || GetResource(this.owner, RES_HEALTH) <= 0)
162 {
165 }
166
167 W_SeekOutEnemy(this,
176
177 //this.angles = vectoangles(this.velocity); // turn model in the new flight direction
178 this.nextthink = time;// + 0.05; // csqc projectiles
180}
float GetResource(entity e, Resource res_type)
Returns the current amount of resource the given entity has.
entity owner
Definition main.qh:87
float ltime
Definition net.qh:10
float nextthink
void UpdateCSQCProjectile(entity e)
const int HITTYPE_SPLASH
automatically set by RadiusDamage
Definition all.qh:32
float autocvar_g_monster_mage_attack_spike_smart_mindist
Definition mage.qc:18
float autocvar_g_monster_mage_attack_spike_smart_trace_min
Definition mage.qc:16
void M_Mage_Attack_Spike_Explode(entity this, entity directhitentity)
Definition mage.qc:125
float autocvar_g_monster_mage_attack_spike_smart
Definition mage.qc:15
float autocvar_g_monster_mage_attack_spike_accel
Definition mage.qc:10
float autocvar_g_monster_mage_attack_spike_smart_trace_max
Definition mage.qc:17
float autocvar_g_monster_mage_attack_spike_decel
Definition mage.qc:11
float autocvar_g_monster_mage_attack_spike_turnrate
Definition mage.qc:13
float autocvar_g_monster_mage_attack_spike_speed_max
Definition mage.qc:14
float W_SeekOutEnemy(entity this, float speed_decel, float speed_accel, float speed_max, float turn_rate, bool smart, float smart_mindist, float smart_trace_min, float smart_trace_max)
Automatically guides a projectile towards its enemy.
Definition common.qc:239
int projectiledeathtype
Definition common.qh:33

References autocvar_g_monster_mage_attack_spike_accel, autocvar_g_monster_mage_attack_spike_decel, autocvar_g_monster_mage_attack_spike_smart, autocvar_g_monster_mage_attack_spike_smart_mindist, autocvar_g_monster_mage_attack_spike_smart_trace_max, autocvar_g_monster_mage_attack_spike_smart_trace_min, autocvar_g_monster_mage_attack_spike_speed_max, autocvar_g_monster_mage_attack_spike_turnrate, enemy, entity(), GetResource(), HITTYPE_SPLASH, ltime, M_Mage_Attack_Spike_Explode(), nextthink, NULL, owner, projectiledeathtype, time, UpdateCSQCProjectile(), and W_SeekOutEnemy().

Referenced by M_Mage_Attack_Spike().

◆ M_Mage_Attack_Spike_Touch()

void M_Mage_Attack_Spike_Touch ( entity this,
entity toucher )

Definition at line 149 of file mage.qc.

150{
152
154}
entity entity toucher
Definition self.qh:76
#define PROJECTILE_TOUCH(e, t)
Definition common.qh:40

References entity(), M_Mage_Attack_Spike_Explode(), PROJECTILE_TOUCH, and toucher.

Referenced by M_Mage_Attack_Spike().

◆ M_Mage_Attack_Teleport()

void M_Mage_Attack_Teleport ( entity this,
entity targ )

Definition at line 295 of file mage.qc.

296{
297 if (!targ || vdist(targ.origin - this.origin, >, autocvar_g_monster_mage_attack_teleport_random_range))
298 return;
299
300 vector a;
302 {
303 vector oldpos = this.origin;
305 if (MoveToRandomLocationWithinBounds(this, this.absmin - extrasize, this.absmax + extrasize,
307 Q3SURFACEFLAG_SKY, 10, 64, 256, true))
308 {
309 a = vectoangles(targ.origin - this.origin);
310 this.angles = '0 1 0' * a.y;
311 this.fixangle = true;
312 Send_Effect(EFFECT_SPAWN, oldpos, '0 0 0', 1);
313 Send_Effect(EFFECT_SPAWN, this.origin, '0 0 0', 1);
315 return;
316 }
317 }
318
319 if (!IS_ONGROUND(targ))
320 return;
321
322 makevectors(targ.angles);
323 tracebox(CENTER_OR_VIEWOFS(targ), this.mins, this.maxs, CENTER_OR_VIEWOFS(targ) + (v_forward * -200), MOVE_NOMONSTERS, this);
324
325 if (trace_fraction < 1)
326 return;
327
328 vector newpos = trace_endpos;
329
330 Send_Effect(EFFECT_SPAWN, this.origin, '0 0 0', 1);
331 Send_Effect(EFFECT_SPAWN, newpos, '0 0 0', 1);
332
333 setorigin(this, newpos);
334
335 a = vectoangles(targ.origin - this.origin);
336 a.x = -a.x;
337 this.angles.x = a.x;
338 this.angles.y = a.y;
339 this.fixangle = true;
340 this.velocity *= 0.5;
341
343}
float Q3SURFACEFLAG_SKY
float DPCONTENTS_SKY
const float MOVE_NOMONSTERS
float DPCONTENTS_DONOTENTER
float DPCONTENTS_SOLID
float DPCONTENTS_CORPSE
vector mins
vector velocity
float DPCONTENTS_BODY
float DPCONTENTS_PLAYERCLIP
float DPCONTENTS_SLIME
vector trace_endpos
vector maxs
vector absmax
float trace_fraction
float DPCONTENTS_LAVA
vector absmin
float autocvar_g_monster_mage_attack_teleport_random
Definition mage.qc:26
float autocvar_g_monster_mage_attack_teleport_random_range
Definition mage.qc:27
float autocvar_g_monster_mage_attack_teleport_delay
Definition mage.qc:25
vector vectoangles(vector v)
#define IS_ONGROUND(s)
Definition movetypes.qh:16
float fixangle
Definition progsdefs.qc:160
vector
Definition self.qh:96
#define CENTER_OR_VIEWOFS(ent)
Definition utils.qh:31
#define vdist(v, cmp, f)
Vector distance comparison, avoids sqrt().
Definition vector.qh:8
bool MoveToRandomLocationWithinBounds(entity e, vector boundmin, vector boundmax, float goodcontents, float badcontents, float badsurfaceflags, int attempts, float maxaboveground, float minviewdistance, bool frompos)
Definition world.qc:1117

References absmax, absmin, angles, attack_finished_single, autocvar_g_monster_mage_attack_teleport_delay, autocvar_g_monster_mage_attack_teleport_random, autocvar_g_monster_mage_attack_teleport_random_range, CENTER_OR_VIEWOFS, DPCONTENTS_BODY, DPCONTENTS_CORPSE, DPCONTENTS_DONOTENTER, DPCONTENTS_LAVA, DPCONTENTS_PLAYERCLIP, DPCONTENTS_SKY, DPCONTENTS_SLIME, DPCONTENTS_SOLID, entity(), fixangle, IS_ONGROUND, makevectors, maxs, mins, MOVE_NOMONSTERS, MoveToRandomLocationWithinBounds(), origin, Q3SURFACEFLAG_SKY, random(), Send_Effect(), time, trace_endpos, trace_fraction, v_forward, vdist, vectoangles(), vector, and velocity.

Referenced by OffhandMageTeleport::offhand_think().

◆ M_Mage_Defend_Heal()

void M_Mage_Defend_Heal ( entity this)

Definition at line 217 of file mage.qc.

218{
222 bool was_healed = (head != NULL);
223 for (; head; head = head.chain)
224 {
225 if (IS_PLAYER(head))
226 {
227 fx = EFFECT_Null;
228 switch (this.skin)
229 {
230 case 0:
232 fx = EFFECT_HEALING;
233 break;
234 case 1:
235 if (GetResource(head, RES_CELLS)) GiveResourceWithLimit(head, RES_CELLS, 1, autocvar_g_pickup_cells_max);
236 if (GetResource(head, RES_ROCKETS)) GiveResourceWithLimit(head, RES_ROCKETS, 1, autocvar_g_pickup_rockets_max);
237 if (GetResource(head, RES_SHELLS)) GiveResourceWithLimit(head, RES_SHELLS, 2, autocvar_g_pickup_shells_max);
238 if (GetResource(head, RES_BULLETS)) GiveResourceWithLimit(head, RES_BULLETS, 5, autocvar_g_pickup_nails_max);
239 // TODO: fuel?
240 fx = EFFECT_AMMO_REGEN;
241 break;
242 case 2:
244 {
246 fx = EFFECT_ARMOR_REPAIR;
247 }
248 break;
249 }
250
251 float pl_alpha = (!head.alpha ? 1 : head.alpha);
252 if (pl_alpha > 0)
253 Send_Effect_Core(fx, head.origin, vec2(head.velocity), 5, '0 0 0', '0 0 0', pl_alpha, pl_alpha, -1, NULL);
254 }
255 else
256 {
257 Send_Effect(EFFECT_HEALING, head.origin, vec2(head.velocity), 5);
259 if (!(head.spawnflags & MONSTERFLAG_INVINCIBLE) && head.sprite)
260 WaypointSprite_UpdateHealth(head.sprite, GetResource(head, RES_HEALTH));
261 }
262 }
263
264 if (was_healed)
265 {
266 setanim(this, this.anim_melee, true, true, true);
269 this.anim_finished = time + 1.5;
270 }
271}
int autocvar_g_pickup_rockets_max
Definition ammo.qh:116
int autocvar_g_pickup_shells_max
Definition ammo.qh:44
int autocvar_g_pickup_cells_max
Definition ammo.qh:152
int autocvar_g_pickup_nails_max
Definition ammo.qh:80
#define IS_PLAYER(s)
Definition player.qh:242
bool Heal(entity targ, entity inflictor, float amount, float limit)
Definition damage.qc:951
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
RES_ARMOR
Definition ent_cs.qc:155
skin
Definition ent_cs.qc:168
entity WarpZone_SearchInRadius(vector org, float rad, float nomonsters, WarpZone_FindRadius_cond_callback_t cb)
Modified findradius aware of warpzones, that only includes entities that meet the "cb" criteria.
Definition common.qc:680
noref entity WarpZone_SearchInRadius_otherent
Free to use in the callback.
Definition common.qh:71
#define MOVE_NOTHING
Definition common.qh:35
float autocvar_g_monster_mage_heal_delay
Definition mage.qc:31
float autocvar_g_monster_mage_heal_range
Definition mage.qc:30
float autocvar_g_monster_mage_heal_allies
Definition mage.qc:28
bool M_Mage_Defend_Heal_cond(entity e)
Definition mage.qc:211
bool M_Mage_Defend_Heal_cond_checkvalid
Definition mage.qc:210
const int RES_LIMIT_NONE
Definition resources.qh:60
const int MONSTERFLAG_INVINCIBLE
monster doesn't take damage (may be used for map objects & temporary monsters)
void GiveResourceWithLimit(entity receiver, Resource res_type, float amount, float limit)
Gives an entity some resource but not more than a limit.
float autocvar_g_balance_health_regenstable
int autocvar_g_balance_armor_regenstable
#define vec2(...)
Definition vector.qh:95
void WaypointSprite_UpdateHealth(entity e, float f)

References anim_finished, attack_finished_single, autocvar_g_balance_armor_regenstable, autocvar_g_balance_health_regenstable, autocvar_g_monster_mage_heal_allies, autocvar_g_monster_mage_heal_delay, autocvar_g_monster_mage_heal_range, autocvar_g_pickup_cells_max, autocvar_g_pickup_nails_max, autocvar_g_pickup_rockets_max, autocvar_g_pickup_shells_max, entity(), GetResource(), GiveResourceWithLimit(), Heal(), IS_PLAYER, M_Mage_Defend_Heal_cond(), M_Mage_Defend_Heal_cond_checkvalid, MONSTER_ATTACK_MELEE, MONSTERFLAG_INVINCIBLE, MOVE_NOTHING, NULL, origin, RES_ARMOR, RES_LIMIT_NONE, Send_Effect(), Send_Effect_Core(), setanim, skin, state, time, vec2, WarpZone_SearchInRadius(), WarpZone_SearchInRadius_otherent, and WaypointSprite_UpdateHealth().

◆ M_Mage_Defend_Heal_Check()

bool M_Mage_Defend_Heal_Check ( entity this,
entity targ )

Definition at line 94 of file mage.qc.

95{
96 // TODO: mutator hook to choose valid healing targets?
97 if (!targ)
98 return false;
99 if (DIFF_TEAM(targ, this) && targ != this.monster_follow)
100 return false;
101 if (GetResource(targ, RES_HEALTH) <= 0 || STAT(FROZEN, targ))
102 return false;
103 if (!IS_PLAYER(targ))
104 return IS_MONSTER(targ) && GetResource(targ, RES_HEALTH) < targ.max_health;
105 if (StatusEffects_active(STATUSEFFECT_Shield, targ))
106 return false;
107
108 switch (this.skin)
109 {
110 case 0:
111 return GetResource(targ, RES_HEALTH) < autocvar_g_balance_health_regenstable;
112 case 1:
113 return ((GetResource(targ, RES_CELLS) && GetResource(targ, RES_CELLS) < autocvar_g_pickup_cells_max)
114 || (GetResource(targ, RES_ROCKETS) && GetResource(targ, RES_ROCKETS) < autocvar_g_pickup_rockets_max)
115 || (GetResource(targ, RES_BULLETS) && GetResource(targ, RES_BULLETS) < autocvar_g_pickup_nails_max)
116 || (GetResource(targ, RES_SHELLS) && GetResource(targ, RES_SHELLS) < autocvar_g_pickup_shells_max)
117 );
118 case 2:
120 }
121
122 return false;
123}
#define STAT(...)
Definition stats.qh:94
bool StatusEffects_active(StatusEffect this, entity actor)
entity monster_follow
monster follow target
#define DIFF_TEAM(a, b)
Definition teams.qh:242
#define IS_MONSTER(v)
Definition utils.qh:23

References autocvar_g_balance_armor_regenstable, autocvar_g_balance_health_regenstable, autocvar_g_pickup_cells_max, autocvar_g_pickup_nails_max, autocvar_g_pickup_rockets_max, autocvar_g_pickup_shells_max, DIFF_TEAM, entity(), GetResource(), IS_MONSTER, IS_PLAYER, monster_follow, RES_ARMOR, skin, STAT, and StatusEffects_active().

Referenced by M_Mage_Defend_Heal_cond().

◆ M_Mage_Defend_Heal_cond()

bool M_Mage_Defend_Heal_cond ( entity e)

Definition at line 211 of file mage.qc.

212{
214 return false;
216}
bool M_Mage_Defend_Heal_Check(entity this, entity targ)
Definition mage.qc:94

References entity(), IS_MONSTER, IS_PLAYER, M_Mage_Defend_Heal_Check(), M_Mage_Defend_Heal_cond_checkvalid, and WarpZone_SearchInRadius_otherent.

Referenced by M_Mage_Defend_Heal().

◆ M_Mage_Defend_Shield()

void M_Mage_Defend_Shield ( entity this)

Definition at line 345 of file mage.qc.

346{
347 StatusEffects_apply(STATUSEFFECT_Shield, this, time + autocvar_g_monster_mage_shield_time, 0);
350 setanim(this, this.anim_shoot, true, true, true);
351 this.attack_finished_single[0] = this.anim_finished = time + 1; // give just a short cooldown on attacking
352}
SetResourceExplicit(ent, RES_ARMOR, ReadByte() *DEC_FACTOR)) ENTCS_PROP(NAME
float autocvar_g_monster_mage_shield_time
Definition mage.qc:32
float autocvar_g_monster_mage_shield_delay
Definition mage.qc:33
float autocvar_g_monster_mage_shield_blockpercent
Definition mage.qc:34
float mage_shield_delay
Definition mage.qc:92
void StatusEffects_apply(StatusEffect this, entity actor, float eff_time, int eff_flags)

References anim_finished, attack_finished_single, autocvar_g_monster_mage_shield_blockpercent, autocvar_g_monster_mage_shield_delay, autocvar_g_monster_mage_shield_time, entity(), mage_shield_delay, RES_ARMOR, setanim, SetResourceExplicit(), StatusEffects_apply(), and time.

◆ SOUND() [1/3]

SOUND ( MageSpike_FIRE ,
W_Sound("electro_fire")  )

◆ SOUND() [2/3]

SOUND ( MageSpike_IMPACT ,
W_Sound("grenade_impact")  )

◆ SOUND() [3/3]

SOUND ( MageSpike_PUSH ,
W_Sound("tagexp1")  )

◆ spawnfunc()

spawnfunc ( monster_mage )

Definition at line 395 of file mage.qc.

396{
397 Monster_Spawn(this, true, MON_MAGE);
398}
bool Monster_Spawn(entity this, bool check_appear, Monster mon)
Setup the basic required properties for a monster.

References Monster_Spawn().

◆ STATIC_INIT()

STATIC_INIT ( OFFHAND_MAGE_TELEPORT )

Definition at line 83 of file mage.qc.

84{
86}
#define NEW(cname,...)
Definition oo.qh:120

References NEW, OFFHAND_MAGE_TELEPORT, and STATIC_INIT.

Variable Documentation

◆ autocvar_g_monster_mage_attack_push_chance

float autocvar_g_monster_mage_attack_push_chance = 0.7

Definition at line 19 of file mage.qc.

Referenced by M_Mage_Attack().

◆ autocvar_g_monster_mage_attack_push_damage

float autocvar_g_monster_mage_attack_push_damage

Definition at line 20 of file mage.qc.

Referenced by M_Mage_Attack_Push().

◆ autocvar_g_monster_mage_attack_push_delay

float autocvar_g_monster_mage_attack_push_delay

Definition at line 22 of file mage.qc.

Referenced by M_Mage_Attack_Push().

◆ autocvar_g_monster_mage_attack_push_force

float autocvar_g_monster_mage_attack_push_force

Definition at line 23 of file mage.qc.

Referenced by M_Mage_Attack_Push().

◆ autocvar_g_monster_mage_attack_push_radius

float autocvar_g_monster_mage_attack_push_radius

Definition at line 21 of file mage.qc.

Referenced by M_Mage_Attack_Push().

◆ autocvar_g_monster_mage_attack_spike_accel

float autocvar_g_monster_mage_attack_spike_accel

Definition at line 10 of file mage.qc.

Referenced by M_Mage_Attack_Spike_Think().

◆ autocvar_g_monster_mage_attack_spike_chance

float autocvar_g_monster_mage_attack_spike_chance = 0.45

Definition at line 12 of file mage.qc.

Referenced by M_Mage_Attack().

◆ autocvar_g_monster_mage_attack_spike_damage

float autocvar_g_monster_mage_attack_spike_damage

Definition at line 7 of file mage.qc.

Referenced by M_Mage_Attack_Spike_Explode().

◆ autocvar_g_monster_mage_attack_spike_decel

float autocvar_g_monster_mage_attack_spike_decel

Definition at line 11 of file mage.qc.

Referenced by M_Mage_Attack_Spike_Think().

◆ autocvar_g_monster_mage_attack_spike_delay

float autocvar_g_monster_mage_attack_spike_delay

Definition at line 9 of file mage.qc.

Referenced by M_Mage_Attack().

◆ autocvar_g_monster_mage_attack_spike_radius

float autocvar_g_monster_mage_attack_spike_radius

Definition at line 8 of file mage.qc.

Referenced by M_Mage_Attack_Spike_Explode().

◆ autocvar_g_monster_mage_attack_spike_smart

float autocvar_g_monster_mage_attack_spike_smart

Definition at line 15 of file mage.qc.

Referenced by M_Mage_Attack_Spike_Think().

◆ autocvar_g_monster_mage_attack_spike_smart_mindist

float autocvar_g_monster_mage_attack_spike_smart_mindist

Definition at line 18 of file mage.qc.

Referenced by M_Mage_Attack_Spike_Think().

◆ autocvar_g_monster_mage_attack_spike_smart_trace_max

float autocvar_g_monster_mage_attack_spike_smart_trace_max

Definition at line 17 of file mage.qc.

Referenced by M_Mage_Attack_Spike_Think().

◆ autocvar_g_monster_mage_attack_spike_smart_trace_min

float autocvar_g_monster_mage_attack_spike_smart_trace_min

Definition at line 16 of file mage.qc.

Referenced by M_Mage_Attack_Spike_Think().

◆ autocvar_g_monster_mage_attack_spike_speed_max

float autocvar_g_monster_mage_attack_spike_speed_max

Definition at line 14 of file mage.qc.

Referenced by M_Mage_Attack_Spike_Think().

◆ autocvar_g_monster_mage_attack_spike_turnrate

float autocvar_g_monster_mage_attack_spike_turnrate

Definition at line 13 of file mage.qc.

Referenced by M_Mage_Attack_Spike_Think().

◆ autocvar_g_monster_mage_attack_teleport_chance

float autocvar_g_monster_mage_attack_teleport_chance = 0.2

Definition at line 24 of file mage.qc.

Referenced by M_Mage_Attack().

◆ autocvar_g_monster_mage_attack_teleport_delay

float autocvar_g_monster_mage_attack_teleport_delay = 2

Definition at line 25 of file mage.qc.

Referenced by M_Mage_Attack_Teleport().

◆ autocvar_g_monster_mage_attack_teleport_random

float autocvar_g_monster_mage_attack_teleport_random = 0.4

Definition at line 26 of file mage.qc.

Referenced by M_Mage_Attack_Teleport().

◆ autocvar_g_monster_mage_attack_teleport_random_range

float autocvar_g_monster_mage_attack_teleport_random_range = 1200

Definition at line 27 of file mage.qc.

Referenced by M_Mage_Attack_Teleport().

◆ autocvar_g_monster_mage_damageforcescale

float autocvar_g_monster_mage_damageforcescale = 0.5

Definition at line 6 of file mage.qc.

◆ autocvar_g_monster_mage_heal_allies

float autocvar_g_monster_mage_heal_allies

Definition at line 28 of file mage.qc.

Referenced by M_Mage_Defend_Heal().

◆ autocvar_g_monster_mage_heal_delay

float autocvar_g_monster_mage_heal_delay

Definition at line 31 of file mage.qc.

Referenced by M_Mage_Defend_Heal().

◆ autocvar_g_monster_mage_heal_minhealth

float autocvar_g_monster_mage_heal_minhealth

Definition at line 29 of file mage.qc.

◆ autocvar_g_monster_mage_heal_range

float autocvar_g_monster_mage_heal_range

Definition at line 30 of file mage.qc.

Referenced by M_Mage_Defend_Heal().

◆ autocvar_g_monster_mage_health

float autocvar_g_monster_mage_health

Definition at line 4 of file mage.qc.

◆ autocvar_g_monster_mage_loot

string autocvar_g_monster_mage_loot = "health_big"

Definition at line 5 of file mage.qc.

◆ autocvar_g_monster_mage_shield_blockpercent

float autocvar_g_monster_mage_shield_blockpercent

Definition at line 34 of file mage.qc.

Referenced by M_Mage_Defend_Shield().

◆ autocvar_g_monster_mage_shield_delay

float autocvar_g_monster_mage_shield_delay

Definition at line 33 of file mage.qc.

Referenced by M_Mage_Defend_Shield().

◆ autocvar_g_monster_mage_shield_time

float autocvar_g_monster_mage_shield_time

Definition at line 32 of file mage.qc.

Referenced by M_Mage_Defend_Shield().

◆ autocvar_g_monster_mage_speed_run

float autocvar_g_monster_mage_speed_run

Definition at line 36 of file mage.qc.

◆ autocvar_g_monster_mage_speed_stop

float autocvar_g_monster_mage_speed_stop

Definition at line 35 of file mage.qc.

◆ autocvar_g_monster_mage_speed_walk

float autocvar_g_monster_mage_speed_walk

Definition at line 37 of file mage.qc.

◆ M_Mage_Defend_Heal_cond_checkvalid

bool M_Mage_Defend_Heal_cond_checkvalid

Definition at line 210 of file mage.qc.

Referenced by M_Mage_Defend_Heal(), and M_Mage_Defend_Heal_cond().

◆ mage_shield_delay

float mage_shield_delay

Definition at line 92 of file mage.qc.

Referenced by M_Mage_Defend_Shield().

◆ mage_spike

entity mage_spike

Definition at line 91 of file mage.qc.

Referenced by M_Mage_Attack_Spike().

◆ OFFHAND_MAGE_TELEPORT

OffhandMageTeleport OFFHAND_MAGE_TELEPORT

Definition at line 82 of file mage.qc.

Referenced by M_Mage_Attack(), and STATIC_INIT().