]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/monsters/monster/mage.qc
f307b8aa1da4d0972bc6c0ca38fe60db39b641c4
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / monsters / monster / mage.qc
1 #include "mage.qh"
2
3 #ifdef SVQC
4
5 SOUND(MageSpike_FIRE, W_Sound("electro_fire"));
6 void M_Mage_Attack_Spike(entity this, vector dir);
7 void M_Mage_Attack_Push(entity this);
8 METHOD(MageSpike, wr_think, void(MageSpike thiswep, entity actor, .entity weaponentity, int fire))
9 {
10     TC(MageSpike, thiswep);
11     if (fire & 1)
12     if (!IS_PLAYER(actor) || weapon_prepareattack(thiswep, actor, weaponentity, false, 0.2)) {
13         if (!actor.target_range) actor.target_range = autocvar_g_monsters_target_range;
14         actor.enemy = Monster_FindTarget(actor);
15         monster_makevectors(actor, actor.enemy);
16         W_SetupShot_Dir(actor, weaponentity, v_forward, false, 0, SND_MageSpike_FIRE, CH_WEAPON_B, 0, DEATH_MONSTER_MAGE.m_id);
17         if (!IS_PLAYER(actor)) w_shotdir = normalize((actor.enemy.origin + '0 0 10') - actor.origin);
18         M_Mage_Attack_Spike(actor, w_shotdir);
19         weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, 0, w_ready);
20     }
21     if (fire & 2)
22     if (!IS_PLAYER(actor) || weapon_prepareattack(thiswep, actor, weaponentity, true, 0.5)) {
23         M_Mage_Attack_Push(actor);
24         weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, 0, w_ready);
25     }
26 }
27
28 void M_Mage_Attack_Teleport(entity this, entity targ);
29
30 CLASS(OffhandMageTeleport, OffhandWeapon)
31     .bool OffhandMageTeleport_key_pressed;
32     METHOD(OffhandMageTeleport, offhand_think, void(OffhandMageTeleport this, entity player, bool key_pressed))
33     {
34         TC(OffhandMageTeleport, this);
35         if (key_pressed && !player.OffhandMageTeleport_key_pressed)
36                 M_Mage_Attack_Teleport(player, player.enemy);
37         player.OffhandMageTeleport_key_pressed = key_pressed;
38     }
39 ENDCLASS(OffhandMageTeleport)
40 OffhandMageTeleport OFFHAND_MAGE_TELEPORT;
41 STATIC_INIT(OFFHAND_MAGE_TELEPORT) { OFFHAND_MAGE_TELEPORT = NEW(OffhandMageTeleport); }
42
43 float autocvar_g_monster_mage_health;
44 float autocvar_g_monster_mage_damageforcescale = 0.5;
45 float autocvar_g_monster_mage_attack_spike_damage;
46 float autocvar_g_monster_mage_attack_spike_radius;
47 float autocvar_g_monster_mage_attack_spike_delay;
48 float autocvar_g_monster_mage_attack_spike_accel;
49 float autocvar_g_monster_mage_attack_spike_decel;
50 float autocvar_g_monster_mage_attack_spike_chance = 0.45;
51 float autocvar_g_monster_mage_attack_spike_turnrate;
52 float autocvar_g_monster_mage_attack_spike_speed_max;
53 float autocvar_g_monster_mage_attack_spike_smart;
54 float autocvar_g_monster_mage_attack_spike_smart_trace_min;
55 float autocvar_g_monster_mage_attack_spike_smart_trace_max;
56 float autocvar_g_monster_mage_attack_spike_smart_mindist;
57 float autocvar_g_monster_mage_attack_push_chance = 0.7;
58 float autocvar_g_monster_mage_attack_push_damage;
59 float autocvar_g_monster_mage_attack_push_radius;
60 float autocvar_g_monster_mage_attack_push_delay;
61 float autocvar_g_monster_mage_attack_push_force;
62 float autocvar_g_monster_mage_attack_teleport_chance = 0.2;
63 float autocvar_g_monster_mage_attack_teleport_delay = 2;
64 float autocvar_g_monster_mage_attack_teleport_random = 0.4;
65 float autocvar_g_monster_mage_attack_teleport_random_range = 1200;
66 float autocvar_g_monster_mage_heal_self;
67 float autocvar_g_monster_mage_heal_allies;
68 float autocvar_g_monster_mage_heal_minhealth;
69 float autocvar_g_monster_mage_heal_range;
70 float autocvar_g_monster_mage_heal_delay;
71 float autocvar_g_monster_mage_shield_time;
72 float autocvar_g_monster_mage_shield_delay;
73 float autocvar_g_monster_mage_shield_blockpercent;
74 float autocvar_g_monster_mage_speed_stop;
75 float autocvar_g_monster_mage_speed_run;
76 float autocvar_g_monster_mage_speed_walk;
77
78 /*
79 const float mage_anim_idle              = 0;
80 const float mage_anim_walk              = 1;
81 const float mage_anim_attack    = 2;
82 const float mage_anim_pain              = 3;
83 const float mage_anim_death             = 4;
84 const float mage_anim_run               = 5;
85 */
86
87 void M_Mage_Defend_Heal(entity this);
88 void M_Mage_Defend_Shield(entity this);
89
90 .entity mage_spike;
91 .float mage_shield_delay;
92
93 bool M_Mage_Defend_Heal_Check(entity this, entity targ)
94 {
95         if(targ == NULL)
96                 return false;
97         if(GetResource(targ, RES_HEALTH) <= 0)
98                 return false;
99         if(DIFF_TEAM(targ, this) && targ != this.monster_follow)
100                 return false;
101         if(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: return (GetResource(targ, RES_HEALTH) < autocvar_g_balance_health_regenstable);
111                 case 1:
112                 {
113                         return ((GetResource(targ, RES_CELLS) && GetResource(targ, RES_CELLS) < g_pickup_cells_max)
114                                 ||  (GetResource(targ, RES_PLASMA) && GetResource(targ, RES_PLASMA) < g_pickup_plasma_max)
115                                 ||  (GetResource(targ, RES_ROCKETS) && GetResource(targ, RES_ROCKETS) < g_pickup_rockets_max)
116                                 ||  (GetResource(targ, RES_BULLETS) && GetResource(targ, RES_BULLETS) < g_pickup_nails_max)
117                                 ||  (GetResource(targ, RES_SHELLS) && GetResource(targ, RES_SHELLS) < g_pickup_shells_max)
118                                         );
119                 }
120                 case 2: return (GetResource(targ, RES_ARMOR) < autocvar_g_balance_armor_regenstable);
121                 case 3: return (GetResource(targ, RES_HEALTH) > 0);
122         }
123
124         return false;
125 }
126
127 void M_Mage_Attack_Spike_Explode(entity this, entity directhitentity)
128 {
129         this.event_damage = func_null;
130
131         sound(this, CH_SHOTS, SND_GRENADE_IMPACT, VOL_BASE, ATTEN_NORM);
132
133         this.realowner.mage_spike = NULL;
134
135         Send_Effect(EFFECT_EXPLOSION_SMALL, this.origin, '0 0 0', 1);
136         RadiusDamage (this, this.realowner, (autocvar_g_monster_mage_attack_spike_damage), (autocvar_g_monster_mage_attack_spike_damage) * 0.5, (autocvar_g_monster_mage_attack_spike_radius),
137                                                 NULL, NULL, 0, DEATH_MONSTER_MAGE.m_id, DMG_NOWEP, directhitentity);
138
139         delete(this);
140 }
141
142 void M_Mage_Attack_Spike_Touch(entity this, entity toucher)
143 {
144         PROJECTILE_TOUCH(this, toucher);
145
146         M_Mage_Attack_Spike_Explode(this, toucher);
147 }
148
149 .float wait;
150
151 // copied from W_Seeker_Think
152 void M_Mage_Attack_Spike_Think(entity this)
153 {
154         if (time > this.ltime || (this.enemy && GetResource(this.enemy, RES_HEALTH) <= 0) || GetResource(this.owner, RES_HEALTH) <= 0) {
155                 this.projectiledeathtype |= HITTYPE_SPLASH;
156                 M_Mage_Attack_Spike_Explode(this, NULL);
157         }
158
159         float spd = vlen(this.velocity);
160         spd = bound(
161                 spd - (autocvar_g_monster_mage_attack_spike_decel) * frametime,
162                 (autocvar_g_monster_mage_attack_spike_speed_max),
163                 spd + (autocvar_g_monster_mage_attack_spike_accel) * frametime
164         );
165
166         if (this.enemy != NULL)
167                 if (this.enemy.takedamage != DAMAGE_AIM || IS_DEAD(this.enemy))
168                         this.enemy = NULL;
169
170         if (this.enemy != NULL)
171         {
172                 entity e = this.enemy;
173                 vector eorg = 0.5 * (e.absmin + e.absmax);
174                 float turnrate = (autocvar_g_monster_mage_attack_spike_turnrate); // how fast to turn
175                 vector desireddir = normalize(eorg - this.origin);
176                 vector olddir = normalize(this.velocity); // get my current direction
177
178                 // Do evasive maneuvers for world objects? ( this should be a cpu hog. :P )
179                 if ((autocvar_g_monster_mage_attack_spike_smart) && vdist(eorg - this.origin, >, autocvar_g_monster_mage_attack_spike_smart_mindist))
180                 {
181                         // Is it a better idea (shorter distance) to trace to the target itself?
182                         if ( vlen2(this.origin + olddir * this.wait) < vlen2(eorg - this.origin))
183                                 traceline(this.origin, this.origin + olddir * this.wait, false, this);
184                         else
185                                 traceline(this.origin, eorg, false, this);
186
187                         // Setup adaptive tracelength
188                         this.wait = bound((autocvar_g_monster_mage_attack_spike_smart_trace_min), vlen(this.origin - trace_endpos), this.wait = (autocvar_g_monster_mage_attack_spike_smart_trace_max));
189
190                         // Calc how important it is that we turn and add this to the desierd (enemy) dir.
191                         desireddir = normalize(((trace_plane_normal * (1 - trace_fraction)) + (desireddir * trace_fraction)) * 0.5);
192                 }
193
194                 vector newdir = normalize(olddir + desireddir * turnrate); // take the average of the 2 directions; not the best method but simple & easy
195                 this.velocity = newdir * spd; // make me fly in the new direction at my flight speed
196         }
197
198         ///////////////
199
200         //this.angles = vectoangles(this.velocity);                     // turn model in the new flight direction
201         this.nextthink = time;// + 0.05; // csqc projectiles
202         UpdateCSQCProjectile(this);
203 }
204
205 void M_Mage_Attack_Spike(entity this, vector dir)
206 {
207         makevectors(this.angles);
208
209         entity missile = new(M_Mage_Attack_Spike);
210         missile.owner = missile.realowner = this;
211         setthink(missile, M_Mage_Attack_Spike_Think);
212         missile.ltime = time + 7;
213         missile.nextthink = time;
214         missile.solid = SOLID_BBOX;
215         set_movetype(missile, MOVETYPE_FLYMISSILE);
216         missile.flags = FL_PROJECTILE;
217         IL_PUSH(g_projectiles, missile);
218         IL_PUSH(g_bot_dodge, missile);
219         setorigin(missile, this.origin + v_forward * 14 + '0 0 30' + v_right * -14);
220         setsize(missile, '0 0 0', '0 0 0');
221         missile.velocity = dir * 400;
222         missile.avelocity = '300 300 300';
223         missile.enemy = this.enemy;
224         settouch(missile, M_Mage_Attack_Spike_Touch);
225
226         this.mage_spike = missile;
227
228         CSQCProjectile(missile, true, PROJECTILE_MAGE_SPIKE, true);
229 }
230
231 void M_Mage_Defend_Heal(entity this)
232 {
233         bool washealed = false;
234
235         FOREACH_ENTITY_RADIUS(this.origin, autocvar_g_monster_mage_heal_range, M_Mage_Defend_Heal_Check(this, it),
236         {
237                 washealed = true;
238                 entity fx = EFFECT_Null;
239                 if(IS_PLAYER(it))
240                 {
241                         switch(this.skin)
242                         {
243                                 case 0:
244                                 {
245                                         Heal(it, this, autocvar_g_monster_mage_heal_allies, autocvar_g_balance_health_regenstable);
246                                         fx = EFFECT_HEALING;
247                                         break;
248                                 }
249                                 case 1:
250                                 {
251                                         if(GetResource(it, RES_CELLS)) GiveResourceWithLimit(it, RES_CELLS, 1, g_pickup_cells_max);
252                                         if(GetResource(it, RES_PLASMA)) GiveResourceWithLimit(it, RES_PLASMA, 1, g_pickup_plasma_max);
253                                         if(GetResource(it, RES_ROCKETS)) GiveResourceWithLimit(it, RES_ROCKETS, 1, g_pickup_rockets_max);
254                                         if(GetResource(it, RES_SHELLS)) GiveResourceWithLimit(it, RES_SHELLS, 2, g_pickup_shells_max);
255                                         if(GetResource(it, RES_BULLETS)) GiveResourceWithLimit(it, RES_BULLETS, 5, g_pickup_nails_max);
256                                         // TODO: fuel?
257                                         fx = EFFECT_AMMO_REGEN;
258                                         break;
259                                 }
260                                 case 2:
261                                         if(GetResource(it, RES_ARMOR) < autocvar_g_balance_armor_regenstable)
262                                         {
263                                                 GiveResourceWithLimit(it, RES_ARMOR, autocvar_g_monster_mage_heal_allies, autocvar_g_balance_armor_regenstable);
264                                                 fx = EFFECT_ARMOR_REPAIR;
265                                         }
266                                         break;
267                                 case 3:
268                                         float hp = ((it == this) ? autocvar_g_monster_mage_heal_self : autocvar_g_monster_mage_heal_allies);
269                                         TakeResource(it, RES_HEALTH, hp); // TODO: use regular damage functions? needs a way to bypass friendly fire checks
270                                         fx = EFFECT_RAGE;
271                                         break;
272                         }
273
274                         Send_Effect(fx, it.origin, '0 0 0', 1);
275                 }
276                 else
277                 {
278                         Send_Effect(EFFECT_HEALING, it.origin, '0 0 0', 1);
279                         Heal(it, this, autocvar_g_monster_mage_heal_allies, RES_LIMIT_NONE);
280                         if(!(it.spawnflags & MONSTERFLAG_INVINCIBLE) && it.sprite)
281                                 WaypointSprite_UpdateHealth(it.sprite, GetResource(it, RES_HEALTH));
282                 }
283         });
284
285         if(washealed)
286         {
287                 setanim(this, this.anim_melee, true, true, true);
288                 this.attack_finished_single[0] = time + (autocvar_g_monster_mage_heal_delay);
289                 this.state = MONSTER_ATTACK_MELEE;
290                 this.anim_finished = time + 1.5;
291         }
292 }
293
294 void M_Mage_Attack_Push(entity this)
295 {
296         sound(this, CH_SHOTS, SND_TAGEXP1, 1, ATTEN_NORM);
297         RadiusDamage (this, this, (autocvar_g_monster_mage_attack_push_damage), (autocvar_g_monster_mage_attack_push_damage), (autocvar_g_monster_mage_attack_push_radius),
298                                                 NULL, NULL, (autocvar_g_monster_mage_attack_push_force), DEATH_MONSTER_MAGE.m_id, DMG_NOWEP, this.enemy);
299         Send_Effect(EFFECT_TE_EXPLOSION, this.origin, '0 0 0', 1);
300
301         setanim(this, this.anim_duckjump, true, true, true);
302         this.attack_finished_single[0] = time + (autocvar_g_monster_mage_attack_push_delay);
303         this.anim_finished = time + 1;
304         this.state = MONSTER_ATTACK_MELEE; // prevent moving while firing spike
305 }
306
307 void M_Mage_Attack_Teleport(entity this, entity targ)
308 {
309         if(!targ) return;
310         if(vdist(targ.origin - this.origin, >, 1500)) return;
311
312         if(autocvar_g_monster_mage_attack_teleport_random && random() <= autocvar_g_monster_mage_attack_teleport_random)
313         {
314                 vector oldpos = this.origin;
315                 vector extrasize = '1 1 1' * autocvar_g_monster_mage_attack_teleport_random_range;
316                 if(MoveToRandomLocationWithinBounds(this, this.absmin - extrasize, this.absmax + extrasize,
317                                                                                         DPCONTENTS_SOLID | DPCONTENTS_CORPSE | DPCONTENTS_PLAYERCLIP, DPCONTENTS_SLIME | DPCONTENTS_LAVA | DPCONTENTS_SKY | DPCONTENTS_BODY | DPCONTENTS_DONOTENTER, 
318                                                                                         Q3SURFACEFLAG_SKY, 10, 64, 256, true))
319                 {
320                         vector a = vectoangles(targ.origin - this.origin);
321                         this.angles = '0 1 0' * a.y;
322                         this.fixangle = true;
323                         Send_Effect(EFFECT_SPAWN_NEUTRAL, oldpos, '0 0 0', 1);
324                         Send_Effect(EFFECT_SPAWN_NEUTRAL, this.origin, '0 0 0', 1);
325                         this.attack_finished_single[0] = time + autocvar_g_monster_mage_attack_teleport_delay;
326                         return;
327                 }
328         }
329
330         if(!IS_ONGROUND(targ)) return;
331
332         makevectors(targ.angles);
333         tracebox(CENTER_OR_VIEWOFS(targ), this.mins, this.maxs, CENTER_OR_VIEWOFS(targ) + ((v_forward * -1) * 200), MOVE_NOMONSTERS, this);
334
335         if(trace_fraction < 1)
336                 return;
337
338         vector newpos = trace_endpos;
339
340         Send_Effect(EFFECT_SPAWN_NEUTRAL, this.origin, '0 0 0', 1);
341         Send_Effect(EFFECT_SPAWN_NEUTRAL, newpos, '0 0 0', 1);
342
343         setorigin(this, newpos);
344
345         vector a = vectoangles(targ.origin - this.origin);
346         a.x = -a.x;
347         this.angles_x = a.x;
348         this.angles_y = a.y;
349         this.fixangle = true;
350         this.velocity *= 0.5;
351
352         this.attack_finished_single[0] = time + autocvar_g_monster_mage_attack_teleport_delay;
353 }
354
355 void M_Mage_Defend_Shield(entity this)
356 {
357         StatusEffects_apply(STATUSEFFECT_Shield, this, time + autocvar_g_monster_mage_shield_time, 0);
358         this.mage_shield_delay = time + (autocvar_g_monster_mage_shield_delay);
359         SetResourceExplicit(this, RES_ARMOR, autocvar_g_monster_mage_shield_blockpercent);
360         setanim(this, this.anim_shoot, true, true, true);
361         this.attack_finished_single[0] = time + 1; // give just a short cooldown on attacking
362         this.anim_finished = time + 1;
363 }
364
365 bool M_Mage_Attack(int attack_type, entity actor, entity targ, .entity weaponentity)
366 {
367         switch(attack_type)
368         {
369                 case MONSTER_ATTACK_MELEE:
370                 {
371                         if(random() <= autocvar_g_monster_mage_attack_push_chance)
372                         {
373                                 Weapon wep = WEP_MAGE_SPIKE;
374
375                                 wep.wr_think(wep, actor, weaponentity, 2);
376                                 return true;
377                         }
378
379                         return false;
380                 }
381                 case MONSTER_ATTACK_RANGED:
382                 {
383                         if(random() <= autocvar_g_monster_mage_attack_teleport_chance)
384                         {
385                                 OffhandWeapon off = OFFHAND_MAGE_TELEPORT;
386                                 actor.OffhandMageTeleport_key_pressed = 0;
387                                 off.offhand_think(off, actor, 1);
388                                 return true;
389                         }
390                         else if(!actor.mage_spike && random() <= autocvar_g_monster_mage_attack_spike_chance)
391                         {
392                                 setanim(actor, actor.anim_shoot, true, true, true);
393                                 actor.attack_finished_single[0] = time + (autocvar_g_monster_mage_attack_spike_delay);
394                                 actor.anim_finished = time + 1;
395                                 actor.state = MONSTER_ATTACK_MELEE; // prevent moving while firing spike
396                                 Weapon wep = WEP_MAGE_SPIKE;
397                                 wep.wr_think(wep, actor, weaponentity, 1);
398                                 return true;
399                         }
400
401                         return false;
402                 }
403         }
404
405         return false;
406 }
407
408 spawnfunc(monster_mage) { Monster_Spawn(this, true, MON_MAGE); }
409
410 #endif // SVQC
411
412 #ifdef SVQC
413 METHOD(Mage, mr_think, bool(Mage thismon, entity actor))
414 {
415     TC(Mage, thismon);
416     bool need_help = false;
417
418     FOREACH_CLIENT(IS_PLAYER(it) && it != actor,
419     {
420         if(vdist(it.origin - actor.origin, <=, autocvar_g_monster_mage_heal_range))
421         if(M_Mage_Defend_Heal_Check(actor, it))
422         {
423             need_help = true;
424             break;
425         }
426     });
427
428     if(!need_help)
429     {
430         IL_EACH(g_monsters, it != actor,
431         {
432                 if(vdist(it.origin - actor.origin, <=, autocvar_g_monster_mage_heal_range))
433                 if(M_Mage_Defend_Heal_Check(actor, it))
434                 {
435                     need_help = true;
436                     break;
437                 }
438         });
439     }
440
441     if(GetResource(actor, RES_HEALTH) < (autocvar_g_monster_mage_heal_minhealth) || need_help)
442     if(time >= actor.attack_finished_single[0])
443     if(random() < 0.5)
444         M_Mage_Defend_Heal(actor);
445
446     if(actor.enemy && time >= actor.mage_shield_delay && random() < 0.5)
447     if(GetResource(actor, RES_HEALTH) < actor.max_health && !StatusEffects_active(STATUSEFFECT_Shield, actor))
448         M_Mage_Defend_Shield(actor);
449
450     return true;
451 }
452
453 METHOD(Mage, mr_pain, float(Mage this, entity actor, float damage_take, entity attacker, float deathtype))
454 {
455     TC(Mage, this);
456     return damage_take;
457 }
458
459 METHOD(Mage, mr_death, bool(Mage this, entity actor))
460 {
461     TC(Mage, this);
462     setanim(actor, ((random() > 0.5) ? actor.anim_die2 : actor.anim_die1), false, true, true);
463     return true;
464 }
465
466 #endif
467 #ifdef GAMEQC
468 METHOD(Mage, mr_anim, bool(Mage this, entity actor))
469 {
470     TC(Mage, this);
471     vector none = '0 0 0';
472     actor.anim_idle = animfixfps(actor, '0 1 1', none);
473     actor.anim_walk = animfixfps(actor, '1 1 1', none);
474     actor.anim_run = animfixfps(actor, '1 1 1', none);
475     actor.anim_shoot = animfixfps(actor, '2 1 5', none); // analyze models and set framerate
476     actor.anim_duckjump = animfixfps(actor, '4 1 5', none); // analyze models and set framerate
477     actor.anim_melee = animfixfps(actor, '5 1 5', none); // analyze models and set framerate
478     //actor.anim_fire1 = animfixfps(actor, '3 1 5', none); // analyze models and set framerate
479     //actor.anim_fire2 = animfixfps(actor, '4 1 5', none); // analyze models and set framerate
480     //actor.anim_fire3 = animfixfps(actor, '5 1 5', none); // analyze models and set framerate
481     actor.anim_pain1 = animfixfps(actor, '6 1 2', none); // 0.5 seconds
482     actor.anim_pain2 = animfixfps(actor, '7 1 2', none); // 0.5 seconds
483     //actor.anim_pain3 = animfixfps(actor, '8 1 2', none); // 0.5 seconds
484     actor.anim_die1 = animfixfps(actor, '9 1 0.5', none); // 2 seconds
485     actor.anim_die2 = animfixfps(actor, '10 1 0.5', none); // 2 seconds
486     //actor.anim_dead1 = animfixfps(actor, '11 1 0.5', none); // 2 seconds
487     //actor.anim_dead2 = animfixfps(actor, '12 1 0.5', none); // 2 seconds
488     return true;
489 }
490 #endif
491 #ifdef SVQC
492 .float speed;
493 METHOD(Mage, mr_setup, bool(Mage this, entity actor))
494 {
495     TC(Mage, this);
496     if(!GetResource(this, RES_HEALTH)) SetResourceExplicit(actor, RES_HEALTH, autocvar_g_monster_mage_health);
497     if(!actor.speed) { actor.speed = (autocvar_g_monster_mage_speed_walk); }
498     if(!actor.speed2) { actor.speed2 = (autocvar_g_monster_mage_speed_run); }
499     if(!actor.stopspeed) { actor.stopspeed = (autocvar_g_monster_mage_speed_stop); }
500     if(!actor.damageforcescale) { actor.damageforcescale = (autocvar_g_monster_mage_damageforcescale); }
501
502     actor.monster_loot = ITEM_HealthBig;
503     actor.monster_attackfunc = M_Mage_Attack;
504
505     return true;
506 }
507 #endif