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