5 MODEL(MON_WYVERN, M_Model("wizard.mdl"));
9 ATTRIB(Wyvern, spawnflags, int, MONSTER_TYPE_FLY | MONSTER_SIZE_BROKEN | MON_FLAG_RANGED | MON_FLAG_RIDE);
10 ATTRIB(Wyvern, mins, vector, '-20 -20 -58');
11 ATTRIB(Wyvern, maxs, vector, '20 20 20');
13 ATTRIB(Wyvern, m_model, Model, MDL_MON_WYVERN);
15 ATTRIB(Wyvern, netname, string, "wyvern");
16 ATTRIB(Wyvern, monster_name, string, _("Wyvern"));
19 REGISTER_MONSTER(WYVERN, NEW(Wyvern)) {
21 this.mr_precache(this);
25 #include <common/weapons/all.qh>
27 CLASS(WyvernAttack, PortoLaunch)
28 /* flags */ ATTRIB(WyvernAttack, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
29 /* impulse */ ATTRIB(WyvernAttack, impulse, int, 9);
30 /* refname */ ATTRIB(WyvernAttack, netname, string, "wyvern");
31 /* wepname */ ATTRIB(WyvernAttack, m_name, string, _("Wyvern attack"));
32 ENDCLASS(WyvernAttack)
33 REGISTER_WEAPON(WYVERN_ATTACK, NEW(WyvernAttack));
41 float autocvar_g_monster_wyvern_attack_fireball_damage;
42 float autocvar_g_monster_wyvern_attack_fireball_edgedamage;
43 float autocvar_g_monster_wyvern_attack_fireball_damagetime;
44 float autocvar_g_monster_wyvern_attack_fireball_force;
45 float autocvar_g_monster_wyvern_attack_fireball_radius;
46 float autocvar_g_monster_wyvern_attack_fireball_speed;
48 void M_Wyvern_Attack_Fireball_Explode();
49 void M_Wyvern_Attack_Fireball_Touch();
51 SOUND(WyvernAttack_FIRE, W_Sound("electro_fire"));
52 METHOD(WyvernAttack, wr_think, void(WyvernAttack thiswep, entity actor, .entity weaponentity, int fire)) {
54 if (time > actor.attack_finished_single[0] || weapon_prepareattack(thiswep, actor, weaponentity, false, 1.2)) {
55 if (IS_PLAYER(actor)) W_SetupShot_Dir(actor, v_forward, false, 0, SND(WyvernAttack_FIRE), CH_WEAPON_B, 0);
56 if (IS_MONSTER(actor)) {
57 actor.attack_finished_single[0] = time + 1.2;
58 actor.anim_finished = time + 1.2;
59 monster_makevectors(actor, actor.enemy);
62 entity missile = spawn();
63 missile.owner = missile.realowner = actor;
64 missile.solid = SOLID_TRIGGER;
65 missile.movetype = MOVETYPE_FLYMISSILE;
66 missile.projectiledeathtype = DEATH_MONSTER_WYVERN.m_id;
67 setsize(missile, '-6 -6 -6', '6 6 6');
68 setorigin(missile, actor.origin + actor.view_ofs + v_forward * 14);
69 missile.flags = FL_PROJECTILE;
70 missile.velocity = w_shotdir * (autocvar_g_monster_wyvern_attack_fireball_speed);
71 missile.avelocity = '300 300 300';
72 missile.nextthink = time + 5;
73 missile.think = M_Wyvern_Attack_Fireball_Explode;
74 missile.touch = M_Wyvern_Attack_Fireball_Touch;
75 CSQCProjectile(missile, true, PROJECTILE_FIREMINE, true);
77 weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, 0, w_ready);
81 METHOD(WyvernAttack, wr_checkammo1, bool(WyvernAttack thiswep)) {
85 float autocvar_g_monster_wyvern_health;
86 float autocvar_g_monster_wyvern_damageforcescale = 0.6;
87 float autocvar_g_monster_wyvern_speed_stop;
88 float autocvar_g_monster_wyvern_speed_run;
89 float autocvar_g_monster_wyvern_speed_walk;
92 const float wyvern_anim_hover = 0;
93 const float wyvern_anim_fly = 1;
94 const float wyvern_anim_magic = 2;
95 const float wyvern_anim_pain = 3;
96 const float wyvern_anim_death = 4;
99 void M_Wyvern_Attack_Fireball_Explode()
102 Send_Effect(EFFECT_FIREBALL_EXPLODE, self.origin, '0 0 0', 1);
104 entity own = self.realowner;
106 RadiusDamage(self, own, autocvar_g_monster_wyvern_attack_fireball_damage, autocvar_g_monster_wyvern_attack_fireball_edgedamage, autocvar_g_monster_wyvern_attack_fireball_force, world, world, autocvar_g_monster_wyvern_attack_fireball_radius, self.projectiledeathtype, world);
108 FOREACH_ENTITY_FLOAT(takedamage, DAMAGE_AIM,
110 if(vdist(it.origin - self.origin, <=, autocvar_g_monster_wyvern_attack_fireball_radius))
111 Fire_AddDamage(it, own, 5 * MONSTER_SKILLMOD(own), autocvar_g_monster_wyvern_attack_fireball_damagetime, self.projectiledeathtype);
117 void M_Wyvern_Attack_Fireball_Touch()
121 M_Wyvern_Attack_Fireball_Explode();
124 bool M_Wyvern_Attack(int attack_type, entity actor, entity targ)
126 .entity weaponentity = weaponentities[0];
129 case MONSTER_ATTACK_MELEE:
130 case MONSTER_ATTACK_RANGED:
132 w_shotdir = normalize((actor.enemy.origin + '0 0 10') - actor.origin);
133 Weapon wep = WEP_WYVERN_ATTACK;
134 wep.wr_think(wep, actor, weaponentity, 1);
142 spawnfunc(monster_wyvern) { Monster_Spawn(this, MON_WYVERN.monsterid); }
146 METHOD(Wyvern, mr_think, bool(Wyvern thismon, entity actor))
150 METHOD(Wyvern, mr_pain, bool(Wyvern thismon, entity actor))
152 actor.pain_finished = time + 0.5;
153 setanim(actor, actor.anim_pain1, true, true, false);
156 METHOD(Wyvern, mr_death, bool(Wyvern thismon, entity actor))
158 setanim(actor, actor.anim_die1, false, true, true);
159 actor.velocity_x = -200 + 400 * random();
160 actor.velocity_y = -200 + 400 * random();
161 actor.velocity_z = 100 + 100 * random();
166 METHOD(Wyvern, mr_anim, bool(Wyvern thismon, entity actor))
168 vector none = '0 0 0';
169 actor.anim_die1 = animfixfps(actor, '4 1 0.5', none); // 2 seconds
170 actor.anim_walk = animfixfps(actor, '1 1 1', none);
171 actor.anim_idle = animfixfps(actor, '0 1 1', none);
172 actor.anim_pain1 = animfixfps(actor, '3 1 2', none); // 0.5 seconds
173 actor.anim_shoot = animfixfps(actor, '2 1 5', none); // analyze models and set framerate
174 actor.anim_run = animfixfps(actor, '1 1 1', none);
179 spawnfunc(item_cells);
180 METHOD(Wyvern, mr_setup, bool(Wyvern thismon, entity actor))
182 if(!actor.health) actor.health = (autocvar_g_monster_wyvern_health);
183 if(!actor.speed) { actor.speed = (autocvar_g_monster_wyvern_speed_walk); }
184 if(!actor.speed2) { actor.speed2 = (autocvar_g_monster_wyvern_speed_run); }
185 if(!actor.stopspeed) { actor.stopspeed = (autocvar_g_monster_wyvern_speed_stop); }
186 if(!actor.damageforcescale) { actor.damageforcescale = (autocvar_g_monster_wyvern_damageforcescale); }
188 actor.monster_loot = spawnfunc_item_cells;
189 actor.monster_attackfunc = M_Wyvern_Attack;
193 METHOD(Wyvern, mr_precache, bool(Wyvern thismon))