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)
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
float mage_shield_delay
entity mage_spike
OffhandMageTeleport OFFHAND_MAGE_TELEPORT
float speed
float wait

Function Documentation

◆ M_Mage_Attack()

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

Definition at line 350 of file mage.qc.

351{
352 switch(attack_type)
353 {
355 {
357 {
358 Weapon wep = WEP_MAGE_SPIKE;
359
360 wep.wr_think(wep, actor, weaponentity, 2);
361 return true;
362 }
363
364 return false;
365 }
367 {
369 {
371 actor.OffhandMageTeleport_key_pressed = 0;
372 off.offhand_think(off, actor, 1);
373 return true;
374 }
375 else if(!actor.mage_spike && random() <= autocvar_g_monster_mage_attack_spike_chance)
376 {
377 setanim(actor, actor.anim_shoot, true, true, true);
378 actor.attack_finished_single[0] = time + (autocvar_g_monster_mage_attack_spike_delay);
379 actor.anim_finished = time + 1;
380 actor.state = MONSTER_ATTACK_MELEE; // prevent moving while firing spike
381 Weapon wep = WEP_MAGE_SPIKE;
382 wep.wr_think(wep, actor, weaponentity, 1);
383 return true;
384 }
385
386 return false;
387 }
388 }
389
390 return false;
391}
#define setanim(...)
Definition anim.qh:45
virtual void offhand_think()
Definition weapon.qh:195
fields which are explicitly/manually set are marked with "M", fields set automatically are marked wit...
Definition weapon.qh:44
virtual void wr_think()
(SERVER) logic to run every frame
Definition weapon.qh:90
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:76
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 279 of file mage.qc.

280{
281 sound(this, CH_SHOTS, SND_MageSpike_PUSH, 1, ATTEN_NORM);
283 NULL, NULL, (autocvar_g_monster_mage_attack_push_force), DEATH_MONSTER_MAGE.m_id, DMG_NOWEP, this.enemy);
284 Send_Effect(EFFECT_TE_EXPLOSION, this.origin, '0 0 0', 1);
285
286 setanim(this, this.anim_duckjump, true, true, true);
288 this.anim_finished = time + 1;
289 this.state = MONSTER_ATTACK_MELEE; // prevent moving while firing spike
290}
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:981
#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:124
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
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 196 of file mage.qc.

197{
198 makevectors(this.angles);
199
200 entity missile = new(M_Mage_Attack_Spike);
201 missile.owner = missile.realowner = this;
203 missile.ltime = time + 7;
204 missile.nextthink = time;
205 missile.solid = SOLID_BBOX;
207 missile.flags = FL_PROJECTILE;
208 IL_PUSH(g_projectiles, missile);
209 IL_PUSH(g_bot_dodge, missile);
210 setorigin(missile, this.origin + v_forward * 14 + '0 0 30' + v_right * -14);
211 setsize(missile, '0 0 0', '0 0 0');
212 missile.velocity = dir * 400;
213 missile.avelocity = '300 300 300';
214 missile.enemy = this.enemy;
216
217 this.mage_spike = missile;
218
219 CSQCProjectile(missile, true, PROJECTILE_MAGE_SPIKE, true);
220}
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:85
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:121
ERASEABLE entity IL_PUSH(IntrusiveList this, entity it)
Push to tail.
void M_Mage_Attack_Spike_Think(entity this)
Definition mage.qc:143
entity mage_spike
Definition mage.qc:82
void M_Mage_Attack_Spike(entity this, vector dir)
Definition mage.qc:196
void M_Mage_Attack_Spike_Touch(entity this, entity toucher)
Definition mage.qc:133
void set_movetype(entity this, int mt)
Definition movetypes.qc:4
const int MOVETYPE_FLYMISSILE
Definition movetypes.qh:138
#define makevectors
Definition post.qh:21
const int PROJECTILE_MAGE_SPIKE
#define setthink(e, f)
#define settouch(e, f)
Definition self.qh:73
int dir
Definition impulse.qc:89
IntrusiveList g_projectiles
Definition common.qh:58
entity enemy
Definition sv_ctf.qh:153

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, and vector.

Referenced by M_Mage_Attack_Spike().

◆ M_Mage_Attack_Spike_Explode()

void M_Mage_Attack_Spike_Explode ( entity this,
entity directhitentity )

Definition at line 118 of file mage.qc.

119{
120 this.event_damage = func_null;
121
122 sound(this, CH_SHOTS, SND_MageSpike_IMPACT, VOL_BASE, ATTEN_NORM);
123
124 this.realowner.mage_spike = NULL;
125
126 Send_Effect(EFFECT_EXPLOSION_SMALL, this.origin, '0 0 0', 1);
128 NULL, NULL, 0, DEATH_MONSTER_MAGE.m_id, DMG_NOWEP, directhitentity);
129
130 delete(this);
131}
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 143 of file mage.qc.

144{
145 if (time > this.ltime || (this.enemy && GetResource(this.enemy, RES_HEALTH) <= 0) || !this.owner || GetResource(this.owner, RES_HEALTH) <= 0) {
148 }
149
150 float spd = vlen(this.velocity);
151 spd = bound(
155 );
156
157 if (this.enemy != NULL)
158 if (this.enemy.takedamage != DAMAGE_AIM || IS_DEAD(this.enemy))
159 this.enemy = NULL;
160
161 if (this.enemy != NULL)
162 {
163 entity e = this.enemy;
164 vector eorg = 0.5 * (e.absmin + e.absmax);
165 float turnrate = (autocvar_g_monster_mage_attack_spike_turnrate); // how fast to turn
166 vector desireddir = normalize(eorg - this.origin);
167 vector olddir = normalize(this.velocity); // get my current direction
168
169 // Do evasive maneuvers for world objects? ( this should be a cpu hog. :P )
171 {
172 // Is it a better idea (shorter distance) to trace to the target itself?
173 if ( vlen2(this.origin + olddir * this.wait) < vlen2(eorg - this.origin))
174 traceline(this.origin, this.origin + olddir * this.wait, false, this);
175 else
176 traceline(this.origin, eorg, false, this);
177
178 // Setup adaptive tracelength
180
181 // Calc how important it is that we turn and add this to the desierd (enemy) dir.
182 desireddir = normalize(((trace_plane_normal * (1 - trace_fraction)) + (desireddir * trace_fraction)) * 0.5);
183 }
184
185 vector newdir = normalize(olddir + desireddir * turnrate); // take the average of the 2 directions; not the best method but simple & easy
186 this.velocity = newdir * spd; // make me fly in the new direction at my flight speed
187 }
188
190
191 //this.angles = vectoangles(this.velocity); // turn model in the new flight direction
192 this.nextthink = time;// + 0.05; // csqc projectiles
194}
float GetResource(entity e, Resource res_type)
Returns the current amount of resource the given entity has.
float wait
Definition items.qc:17
entity owner
Definition main.qh:87
#define IS_DEAD(s)
Definition player.qh:245
float frametime
vector velocity
vector trace_endpos
float nextthink
float trace_fraction
vector trace_plane_normal
void UpdateCSQCProjectile(entity e)
const int HITTYPE_SPLASH
Definition all.qh:30
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:118
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 bound(float min, float value, float max)
float vlen(vector v)
vector normalize(vector v)
float ltime
Definition net.qc:10
vector
Definition self.qh:92
int projectiledeathtype
Definition common.qh:21
const int DAMAGE_AIM
Definition subs.qh:81
#define vlen2(v)
Definition vector.qh:4
#define vdist(v, cmp, f)
Vector distance comparison, avoids sqrt()
Definition vector.qh:8

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, bound(), DAMAGE_AIM, enemy, entity(), frametime, GetResource(), HITTYPE_SPLASH, IS_DEAD, ltime, M_Mage_Attack_Spike_Explode(), nextthink, normalize(), NULL, origin, owner, projectiledeathtype, time, trace_endpos, trace_fraction, trace_plane_normal, UpdateCSQCProjectile(), vdist, vector, velocity, vlen(), vlen2, and wait.

Referenced by M_Mage_Attack_Spike().

◆ M_Mage_Attack_Spike_Touch()

void M_Mage_Attack_Spike_Touch ( entity this,
entity toucher )

Definition at line 133 of file mage.qc.

134{
136
138}
entity entity toucher
Definition self.qh:72
#define PROJECTILE_TOUCH(e, t)
Definition common.qh:28

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 292 of file mage.qc.

293{
294 if(!targ) return;
295 if(vdist(targ.origin - this.origin, >, autocvar_g_monster_mage_attack_teleport_random_range)) return;
296
298 {
299 vector oldpos = this.origin;
301 if(MoveToRandomLocationWithinBounds(this, this.absmin - extrasize, this.absmax + extrasize,
303 Q3SURFACEFLAG_SKY, 10, 64, 256, true))
304 {
305 vector a = vectoangles(targ.origin - this.origin);
306 this.angles = '0 1 0' * a.y;
307 this.fixangle = true;
308 Send_Effect(EFFECT_SPAWN, oldpos, '0 0 0', 1);
309 Send_Effect(EFFECT_SPAWN, this.origin, '0 0 0', 1);
311 return;
312 }
313 }
314
315 if(!IS_ONGROUND(targ)) return;
316
317 makevectors(targ.angles);
318 tracebox(CENTER_OR_VIEWOFS(targ), this.mins, this.maxs, CENTER_OR_VIEWOFS(targ) + ((v_forward * -1) * 200), MOVE_NOMONSTERS, this);
319
320 if(trace_fraction < 1)
321 return;
322
323 vector newpos = trace_endpos;
324
325 Send_Effect(EFFECT_SPAWN, this.origin, '0 0 0', 1);
326 Send_Effect(EFFECT_SPAWN, newpos, '0 0 0', 1);
327
328 setorigin(this, newpos);
329
330 vector a = vectoangles(targ.origin - this.origin);
331 a.x = -a.x;
332 this.angles_x = a.x;
333 this.angles_y = a.y;
334 this.fixangle = true;
335 this.velocity *= 0.5;
336
338}
float Q3SURFACEFLAG_SKY
float DPCONTENTS_SKY
const float MOVE_NOMONSTERS
float DPCONTENTS_DONOTENTER
float DPCONTENTS_SOLID
float DPCONTENTS_CORPSE
vector mins
float DPCONTENTS_BODY
float DPCONTENTS_PLAYERCLIP
float DPCONTENTS_SLIME
vector maxs
vector absmax
float DPCONTENTS_LAVA
vector absmin
angles_y
Definition ent_cs.qc:119
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
#define CENTER_OR_VIEWOFS(ent)
Definition utils.qh:29
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:1101

References absmax, absmin, angles, angles_y, 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 222 of file mage.qc.

223{
224 bool washealed = false;
225
227 {
228 washealed = true;
229 entity fx = EFFECT_Null;
230 if(IS_PLAYER(it))
231 {
232 switch(this.skin)
233 {
234 case 0:
235 {
237 fx = EFFECT_HEALING;
238 break;
239 }
240 case 1:
241 {
242 if(GetResource(it, RES_CELLS)) GiveResourceWithLimit(it, RES_CELLS, 1, autocvar_g_pickup_cells_max);
243 if(GetResource(it, RES_ROCKETS)) GiveResourceWithLimit(it, RES_ROCKETS, 1, autocvar_g_pickup_rockets_max);
244 if(GetResource(it, RES_SHELLS)) GiveResourceWithLimit(it, RES_SHELLS, 2, autocvar_g_pickup_shells_max);
245 if(GetResource(it, RES_BULLETS)) GiveResourceWithLimit(it, RES_BULLETS, 5, autocvar_g_pickup_nails_max);
246 // TODO: fuel?
247 fx = EFFECT_AMMO_REGEN;
248 break;
249 }
250 case 2:
252 {
254 fx = EFFECT_ARMOR_REPAIR;
255 }
256 break;
257 }
258
259 Send_Effect(fx, it.origin, '0 0 0', 1);
260 }
261 else
262 {
263 Send_Effect(EFFECT_HEALING, it.origin, '0 0 0', 1);
265 if(!(it.spawnflags & MONSTERFLAG_INVINCIBLE) && it.sprite)
266 WaypointSprite_UpdateHealth(it.sprite, GetResource(it, RES_HEALTH));
267 }
268 });
269
270 if(washealed)
271 {
272 setanim(this, this.anim_melee, true, true, true);
275 this.anim_finished = time + 1.5;
276 }
277}
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:243
float skin
bool Heal(entity targ, entity inflictor, float amount, float limit)
Definition damage.qc:987
RES_ARMOR
Definition ent_cs.qc:130
#define FOREACH_ENTITY_RADIUS(org, dist, cond, body)
Definition iter.qh:160
float autocvar_g_monster_mage_heal_delay
Definition mage.qc:31
float autocvar_g_monster_mage_heal_range
Definition mage.qc:30
bool M_Mage_Defend_Heal_Check(entity this, entity targ)
Definition mage.qc:85
float autocvar_g_monster_mage_heal_allies
Definition mage.qc:28
const int RES_LIMIT_NONE
Definition resources.qh:60
const int MONSTERFLAG_INVINCIBLE
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
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(), FOREACH_ENTITY_RADIUS, GetResource(), GiveResourceWithLimit(), Heal(), IS_PLAYER, M_Mage_Defend_Heal_Check(), MONSTER_ATTACK_MELEE, MONSTERFLAG_INVINCIBLE, origin, RES_ARMOR, RES_LIMIT_NONE, Send_Effect(), setanim, skin, state, time, and WaypointSprite_UpdateHealth().

◆ M_Mage_Defend_Heal_Check()

bool M_Mage_Defend_Heal_Check ( entity this,
entity targ )

Definition at line 85 of file mage.qc.

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

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().

◆ M_Mage_Defend_Shield()

void M_Mage_Defend_Shield ( entity this)

Definition at line 340 of file mage.qc.

341{
342 StatusEffects_apply(STATUSEFFECT_Shield, this, time + autocvar_g_monster_mage_shield_time, 0);
345 setanim(this, this.anim_shoot, true, true, true);
346 this.attack_finished_single[0] = time + 1; // give just a short cooldown on attacking
347 this.anim_finished = time + 1;
348}
bool SetResourceExplicit(entity e, Resource res_type, float amount)
Sets the resource amount of an entity without calling any hooks.
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:83
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 393 of file mage.qc.

393{ Monster_Spawn(this, true, MON_MAGE); }
bool Monster_Spawn(entity this, bool check_appear, Monster mon)

References Monster_Spawn().

◆ STATIC_INIT()

STATIC_INIT ( OFFHAND_MAGE_TELEPORT )

Definition at line 77 of file mage.qc.

#define NEW(cname,...)
Definition oo.qh:117

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.

◆ mage_shield_delay

float mage_shield_delay

Definition at line 83 of file mage.qc.

Referenced by M_Mage_Defend_Shield().

◆ mage_spike

entity mage_spike

Definition at line 82 of file mage.qc.

Referenced by M_Mage_Attack_Spike().

◆ OFFHAND_MAGE_TELEPORT

OffhandMageTeleport OFFHAND_MAGE_TELEPORT

Definition at line 76 of file mage.qc.

Referenced by M_Mage_Attack(), and STATIC_INIT().

◆ speed

float speed

Definition at line 477 of file mage.qc.

◆ wait

float wait

Definition at line 140 of file mage.qc.