5 float autocvar_g_monster_wyvern_attack_fireball_damage;
6 float autocvar_g_monster_wyvern_attack_fireball_edgedamage;
7 float autocvar_g_monster_wyvern_attack_fireball_damagetime;
8 float autocvar_g_monster_wyvern_attack_fireball_force;
9 float autocvar_g_monster_wyvern_attack_fireball_radius;
10 float autocvar_g_monster_wyvern_attack_fireball_speed;
12 void M_Wyvern_Attack_Fireball_Explode(entity this);
13 void M_Wyvern_Attack_Fireball_Touch(entity this, entity toucher);
15 SOUND(WyvernAttack_FIRE, W_Sound("electro_fire"));
16 METHOD(WyvernAttack, wr_think, void(WyvernAttack thiswep, entity actor, .entity weaponentity, int fire))
18 TC(WyvernAttack, thiswep);
20 if (time > actor.attack_finished_single[0] || weapon_prepareattack(thiswep, actor, weaponentity, false, 1.2)) {
21 if (IS_PLAYER(actor)) W_SetupShot_Dir(actor, weaponentity, v_forward, false, 0, SND_WyvernAttack_FIRE, CH_WEAPON_B, 0, DEATH_MONSTER_WYVERN.m_id);
22 if (IS_MONSTER(actor)) monster_makevectors(actor, actor.enemy);
24 entity missile = spawn();
25 missile.owner = missile.realowner = actor;
26 missile.solid = SOLID_TRIGGER;
27 set_movetype(missile, MOVETYPE_FLYMISSILE);
28 missile.projectiledeathtype = DEATH_MONSTER_WYVERN.m_id;
29 setsize(missile, '-6 -6 -6', '6 6 6');
30 setorigin(missile, actor.origin + actor.view_ofs + v_forward * 14);
31 missile.flags = FL_PROJECTILE;
32 IL_PUSH(g_projectiles, missile);
33 IL_PUSH(g_bot_dodge, missile);
34 missile.velocity = w_shotdir * (autocvar_g_monster_wyvern_attack_fireball_speed);
35 missile.avelocity = '300 300 300';
36 missile.nextthink = time + 5;
37 setthink(missile, M_Wyvern_Attack_Fireball_Explode);
38 settouch(missile, M_Wyvern_Attack_Fireball_Touch);
39 CSQCProjectile(missile, true, PROJECTILE_FIREMINE, true);
41 weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, 0, w_ready);
45 METHOD(WyvernAttack, wr_checkammo1, bool(WyvernAttack this, entity actor, .entity weaponentity)) {
46 TC(WyvernAttack, this);
50 float autocvar_g_monster_wyvern_health;
51 float autocvar_g_monster_wyvern_damageforcescale = 0.6;
52 float autocvar_g_monster_wyvern_speed_stop;
53 float autocvar_g_monster_wyvern_speed_run;
54 float autocvar_g_monster_wyvern_speed_walk;
57 const float wyvern_anim_hover = 0;
58 const float wyvern_anim_fly = 1;
59 const float wyvern_anim_magic = 2;
60 const float wyvern_anim_pain = 3;
61 const float wyvern_anim_death = 4;
64 void M_Wyvern_Attack_Fireball_Explode(entity this)
66 Send_Effect(EFFECT_FIREBALL_EXPLODE, this.origin, '0 0 0', 1);
68 entity own = this.realowner;
70 RadiusDamage(this, own, autocvar_g_monster_wyvern_attack_fireball_damage, autocvar_g_monster_wyvern_attack_fireball_edgedamage, autocvar_g_monster_wyvern_attack_fireball_force,
71 own, NULL, autocvar_g_monster_wyvern_attack_fireball_radius, this.projectiledeathtype, DMG_NOWEP, NULL);
73 FOREACH_ENTITY_RADIUS(this.origin, autocvar_g_monster_wyvern_attack_fireball_radius, it.takedamage == DAMAGE_AIM && it != own,
75 Fire_AddDamage(it, own, 5 * MONSTER_SKILLMOD(own), autocvar_g_monster_wyvern_attack_fireball_damagetime, this.projectiledeathtype);
81 void M_Wyvern_Attack_Fireball_Touch(entity this, entity toucher)
83 PROJECTILE_TOUCH(this, toucher);
85 M_Wyvern_Attack_Fireball_Explode(this);
88 void M_Wyvern_Attack_Fireball(entity this)
90 w_shotdir = normalize((this.enemy.origin + '0 0 10') - this.origin);
91 Weapon wep = WEP_WYVERN_ATTACK;
93 .entity weaponentity = weaponentities[0];
94 wep.wr_think(wep, this, weaponentity, 1);
97 bool M_Wyvern_Attack(int attack_type, entity actor, entity targ, .entity weaponentity)
101 case MONSTER_ATTACK_MELEE:
102 case MONSTER_ATTACK_RANGED:
104 Monster_Delay(actor, 0, 1, M_Wyvern_Attack_Fireball);
105 //actor.anim_finished = time + 1.2;
106 setanim(actor, actor.anim_shoot, false, true, true);
107 if(actor.animstate_endtime > time)
108 actor.anim_finished = actor.animstate_endtime;
110 actor.anim_finished = time + 1.2;
111 actor.attack_finished_single[0] = actor.anim_finished + 0.2;
119 spawnfunc(monster_wyvern) { Monster_Spawn(this, true, MON_WYVERN.monsterid); }
123 METHOD(Wyvern, mr_think, bool(Wyvern this, entity actor))
129 METHOD(Wyvern, mr_deadthink, bool(Wyvern this, entity actor))
132 if(IS_ONGROUND(actor))
133 setanim(actor, actor.anim_die2, true, false, false);
137 METHOD(Wyvern, mr_pain, float(Wyvern this, entity actor, float damage_take, entity attacker, float deathtype))
140 actor.pain_finished = time + 0.5;
141 setanim(actor, actor.anim_pain1, true, true, false);
145 METHOD(Wyvern, mr_death, bool(Wyvern this, entity actor))
148 setanim(actor, actor.anim_die1, false, true, true);
149 actor.velocity_x = -200 + 400 * random();
150 actor.velocity_y = -200 + 400 * random();
151 actor.velocity_z = 100 + 100 * random();
156 METHOD(Wyvern, mr_anim, bool(Wyvern this, entity actor))
159 vector none = '0 0 0';
160 actor.anim_idle = animfixfps(actor, '0 1 1', none);
161 actor.anim_walk = animfixfps(actor, '1 1 1', none);
162 actor.anim_run = animfixfps(actor, '2 1 1', none);
163 actor.anim_pain1 = animfixfps(actor, '3 1 2', none); // 0.5 seconds
164 actor.anim_pain2 = animfixfps(actor, '4 1 2', none); // 0.5 seconds
165 actor.anim_melee = animfixfps(actor, '5 1 5', none); // analyze models and set framerate
166 actor.anim_shoot = animfixfps(actor, '6 1 5', none); // analyze models and set framerate
167 actor.anim_die1 = animfixfps(actor, '7 1 0.5', none); // 2 seconds
168 actor.anim_die2 = animfixfps(actor, '8 1 0.5', none); // 2 seconds
173 METHOD(Wyvern, mr_setup, bool(Wyvern this, entity actor))
176 if(!GetResource(this, RES_HEALTH)) SetResourceExplicit(actor, RES_HEALTH, autocvar_g_monster_wyvern_health);
177 if(!actor.speed) { actor.speed = (autocvar_g_monster_wyvern_speed_walk); }
178 if(!actor.speed2) { actor.speed2 = (autocvar_g_monster_wyvern_speed_run); }
179 if(!actor.stopspeed) { actor.stopspeed = (autocvar_g_monster_wyvern_speed_stop); }
180 if(!actor.damageforcescale) { actor.damageforcescale = (autocvar_g_monster_wyvern_damageforcescale); }
182 actor.monster_loot = ITEM_Cells;
183 actor.monster_attackfunc = M_Wyvern_Attack;