7 float autocvar_g_monster_troll_health = 900;
8 float autocvar_g_monster_troll_damageforcescale = 0.1;
9 float autocvar_g_monster_troll_attack_claw_damage = 90;
10 float autocvar_g_monster_troll_speed_stop = 300;
11 float autocvar_g_monster_troll_speed_run = 300;
12 float autocvar_g_monster_troll_speed_walk = 190;
15 const float troll_anim_attack = 0;
16 const float troll_anim_idle = 1;
17 const float troll_anim_walk = 2;
18 const float troll_anim_death = 3;
19 const float troll_anim_dead = 4;
20 const float troll_anim_run = 5;
23 void M_Troll_Attack_Swing(entity this)
25 Monster_Attack_Melee(this, this.enemy, (autocvar_g_monster_troll_attack_claw_damage), this.anim_melee1, this.attack_range, 0.5, DEATH_MONSTER_TROLL_MELEE.m_id, true);
28 bool M_Troll_Attack(int attack_type, entity actor, entity targ, .entity weaponentity)
32 case MONSTER_ATTACK_MELEE:
34 actor.state = MONSTER_ATTACK_MELEE; // freeze monster
35 setanim(actor, actor.anim_melee1, false, true, true);
36 Monster_Delay(actor, 1, 0.6, M_Troll_Attack_Swing);
37 actor.anim_finished = actor.attack_finished_single[0] = time + 0.6; // set this for the delay
40 case MONSTER_ATTACK_RANGED:
42 // troll has no ranged attack
50 spawnfunc(monster_troll) { Monster_Spawn(this, true, MON_TROLL.monsterid); }
54 METHOD(Troll, mr_think, bool(Troll this, entity actor))
60 METHOD(Troll, mr_pain, float(Troll this, entity actor, float damage_take, entity attacker, float deathtype))
63 actor.pain_finished = time + 0.5;
64 // no pain animation yet
65 //setanim(actor, actor.anim_pain1, true, true, false);
69 METHOD(Troll, mr_death, bool(Troll this, entity actor))
72 setanim(actor, actor.anim_die1, false, true, true);
77 METHOD(Troll, mr_anim, bool(Troll this, entity actor))
80 vector none = '0 0 0';
81 actor.anim_die1 = animfixfps(actor, '3 1 1', none); // 2 seconds
82 actor.anim_walk = animfixfps(actor, '2 1 1', none);
83 actor.anim_idle = animfixfps(actor, '1 1 1', none);
84 actor.anim_melee1 = animfixfps(actor, '0 1 1', none); // analyze models and set framerate
85 actor.anim_run = animfixfps(actor, '5 1 1', none);
90 spawnfunc(item_armor_big);
91 .float animstate_endtime;
92 METHOD(Troll, mr_setup, bool(Troll this, entity actor))
95 if(!actor.health) actor.health = (autocvar_g_monster_troll_health);
96 if(!actor.attack_range) actor.attack_range = 150;
97 if(!actor.speed) { actor.speed = (autocvar_g_monster_troll_speed_walk); }
98 if(!actor.speed2) { actor.speed2 = (autocvar_g_monster_troll_speed_run); }
99 if(!actor.stopspeed) { actor.stopspeed = (autocvar_g_monster_troll_speed_stop); }
100 if(!actor.damageforcescale) { actor.damageforcescale = (autocvar_g_monster_troll_damageforcescale); }
102 actor.view_ofs = '0 0 35'; // we swing at a lower height than our eyes
104 actor.monster_loot = spawnfunc_item_armor_big;
105 actor.weapon = WEP_MORTAR.m_id;
107 setanim(actor, actor.anim_idle, false, true, true);
108 actor.spawn_time = actor.animstate_endtime;
109 actor.spawnshieldtime = actor.spawn_time;
110 actor.monster_attackfunc = M_Troll_Attack;
115 METHOD(Troll, mr_precache, bool(Troll this))