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