1 .float bot_secondary_fireballmooth; // whatever a mooth is
2 .vector fireball_impactvec;
4 void W_Fireball_Explode (void)
12 self.event_damage = SUB_Null;
15 d = (self.owner.health + self.owner.armorvalue);
16 RadiusDamage (self, self.realowner, cvar("g_balance_fireball_secondary_damage"), cvar("g_balance_fireball_secondary_edgedamage"), cvar("g_balance_fireball_secondary_radius"), world, cvar("g_balance_fireball_secondary_force"), self.projectiledeathtype, other);
17 if(self.realowner.health + self.realowner.armorvalue >= d)
20 shockwave_spawn("models/sphere/sphere.md3", self.origin, cvar("g_balance_fireball_secondary_bfgradius"), 0.1, 0.4);
23 FOR_EACH_PLAYER(e) if(e != self.owner) if(e.takedamage) if(!self.owner || IsDifferentTeam(e, self))
25 // can we see fireball?
26 traceline(e.origin + e.view_ofs, self.origin, MOVE_NORMAL, e);
27 if(trace_startsolid || trace_fraction != 1)
29 // can we see player who shot fireball?
30 traceline(e.origin + e.view_ofs, self.realowner.origin + self.realowner.view_ofs, MOVE_NORMAL, e);
31 if(trace_ent != self.realowner)
32 if(trace_startsolid || trace_fraction != 1)
34 dist = vlen(self.origin - e.origin - e.view_ofs);
35 points = (1 - sqrt(dist / cvar("g_balance_fireball_secondary_bfgradius")));
38 dir = normalize(e.origin + e.view_ofs - self.origin);
39 Damage(e, self, self.realowner, cvar("g_balance_fireball_secondary_bfgdamage") * points, self.projectiledeathtype | HITTYPE_BOUNCE | HITTYPE_SPLASH, e.origin + e.view_ofs, cvar("g_balance_fireball_secondary_bfgforce") * dir);
40 pointparticles(particleeffectnum("fireball_bfgdamage"), e.origin, -1 * dir, 1);
47 void W_Fireball_TouchExplode (void)
50 W_Fireball_Explode ();
53 void W_Fireball_LaserPlay(float dt, float dist, float damage, float edgedamage, float burntime)
59 RandomSelection_Init();
60 FOR_EACH_PLAYER(e) if(e != self.owner) if(e.takedamage) if(!self.owner || IsDifferentTeam(e, self))
63 p_x += e.mins_x + random() * (e.maxs_x - e.mins_x);
64 p_y += e.mins_y + random() * (e.maxs_y - e.mins_y);
65 p_z += e.mins_z + random() * (e.maxs_z - e.mins_z);
66 d = vlen(self.origin - p);
69 traceline(p, self.origin, MOVE_NORMAL, e);
70 if(trace_startsolid || trace_fraction != 1)
72 e.fireball_impactvec = p;
73 RandomSelection_Add(e, 0, string_null, 1 / (1 + d), !Fire_IsBurning(e));
76 if(RandomSelection_chosen_ent)
78 d = vlen(self.origin - RandomSelection_chosen_ent.fireball_impactvec);
79 d = damage + (edgedamage - damage) * (d / dist);
80 //Fire_AddDamage(RandomSelection_chosen_ent, self.realowner, d * burntime, burntime, self.projectiledeathtype | HITTYPE_BOUNCE);
81 //trailparticles(self, particleeffectnum("fireball_laser"), self.origin, RandomSelection_chosen_ent.fireball_impactvec);
82 pointparticles(particleeffectnum("fireball_laser"), self.origin, RandomSelection_chosen_ent.fireball_impactvec - self.origin, 1);
86 void W_Fireball_Think()
88 if(time > self.pushltime)
95 W_Fireball_LaserPlay(0.1, cvar("g_balance_fireball_secondary_laserradius"), cvar("g_balance_fireball_secondary_laserdamage"), cvar("g_balance_fireball_secondary_laseredgedamage"), cvar("g_balance_fireball_secondary_laserburntime"));
97 self.nextthink = time + 0.1;
100 void W_Fireball_Damage (entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force)
104 self.health = self.health - damage;
105 if (self.health <= 0)
108 W_PrepareExplosionByDamage(attacker, W_Fireball_Explode);
112 void W_Fireball_Attack2()
116 W_SetupShot_ProjectileSize (self, '-16 -16 -16', '16 16 16', FALSE, 2, "weapons/fireball_fire2.wav", cvar("g_balance_fireball_secondary_damage"));
118 pointparticles(particleeffectnum("fireball_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
121 proj.classname = "plasma_prim";
122 proj.owner = proj.realowner = self;
123 proj.bot_dodge = TRUE;
124 proj.bot_dodgerating = cvar("g_balance_fireball_secondary_damage");
125 proj.pushltime = time + cvar("g_balance_fireball_secondary_lifetime");
126 proj.use = W_Fireball_Explode;
127 proj.think = W_Fireball_Think;
128 proj.nextthink = time;
129 proj.health = cvar("g_balance_fireball_secondary_health");
130 proj.team = self.team;
131 proj.event_damage = W_Fireball_Damage;
132 proj.damageforcescale = cvar("g_balance_fireball_secondary_damageforcescale");
133 PROJECTILE_MAKETRIGGER(proj);
134 proj.projectiledeathtype = WEP_FIREBALL | HITTYPE_SECONDARY;
135 setorigin(proj, w_shotorg);
137 proj.movetype = MOVETYPE_FLY;
138 proj.velocity = w_shotdir * cvar("g_balance_fireball_secondary_speed");
139 W_SetupProjectileVelocity(proj);
140 proj.angles = vectoangles(proj.velocity);
141 proj.touch = W_Fireball_TouchExplode;
142 setsize(proj, '-16 -16 -16', '16 16 16');
143 proj.flags = FL_PROJECTILE;
145 CSQCProjectile(proj, TRUE, PROJECTILE_FIREBALL, TRUE);
148 void W_Fireball_AttackEffect(float i, vector f_diff)
150 W_SetupShot_ProjectileSize (self, '-16 -16 -16', '16 16 16', FALSE, 0, "", 0);
151 w_shotorg += f_diff_x * v_up + f_diff_y * v_right;
152 pointparticles(particleeffectnum("fireball_preattack_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
155 void W_Fireball_Attack2_Frame4()
157 W_Fireball_Attack2();
158 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_fireball_secondary_animtime"), w_ready);
161 void W_Fireball_Attack2_Frame3()
163 W_Fireball_AttackEffect(0, '+1.25 +3.75 0');
164 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_fireball_secondary_animtime"), W_Fireball_Attack2_Frame4);
167 void W_Fireball_Attack2_Frame2()
169 W_Fireball_AttackEffect(0, '-1.25 +3.75 0');
170 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_fireball_secondary_animtime"), W_Fireball_Attack2_Frame3);
173 void W_Fireball_Attack2_Frame1()
175 W_Fireball_AttackEffect(1, '+1.25 -3.75 0');
176 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_fireball_secondary_animtime"), W_Fireball_Attack2_Frame2);
179 void W_Fireball_Attack2_Frame0()
181 if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
182 self.ammo_rockets = self.ammo_rockets - cvar("g_balance_fireball_secondary_ammo");
184 W_Fireball_AttackEffect(0, '-1.25 -3.75 0');
185 sound (self, CHAN_WEAPON, "weapons/fireball_prefire2.wav", VOL_BASE, ATTN_NORM);
186 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_fireball_secondary_animtime"), W_Fireball_Attack2_Frame1);
189 void W_Firemine_Think()
191 if(time > self.pushltime)
197 // make it "hot" once it leaves its owner
199 if(vlen(self.origin - self.owner.origin - self.owner.view_ofs) > cvar("g_balance_fireball_primary_laserradius"))
202 W_Fireball_LaserPlay(0.1, cvar("g_balance_fireball_primary_laserradius"), cvar("g_balance_fireball_primary_laserdamage"), cvar("g_balance_fireball_primary_laseredgedamage"), cvar("g_balance_fireball_primary_laserburntime"));
204 self.nextthink = time + 0.1;
207 void W_Firemine_Touch (void)
210 if (other.takedamage == DAMAGE_AIM)
212 Fire_AddDamage(other, self.realowner, cvar("g_balance_fireball_primary_damage"), cvar("g_balance_fireball_primary_damagetime"), self.projectiledeathtype | HITTYPE_HEADSHOT);
217 self.projectiledeathtype |= HITTYPE_BOUNCE;
221 void W_Fireball_Attack1()
227 if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
228 self.ammo_rockets = self.ammo_rockets - cvar("g_balance_fireball_primary_ammo");
230 c = mod(self.bulletcounter, 4);
234 f_diff = '-1.25 -3.75 0';
237 f_diff = '+1.25 -3.75 0';
240 f_diff = '-1.25 +3.75 0';
244 f_diff = '+1.25 +3.75 0';
247 W_SetupShot_ProjectileSize(self, '-4 -4 -4', '4 4 4', FALSE, 2, "weapons/fireball_fire.wav", cvar("g_balance_fireball_primary_damage"));
248 traceline(w_shotorg, w_shotorg + f_diff_x * v_up + f_diff_y * v_right, MOVE_NORMAL, self);
249 w_shotorg = trace_endpos;
251 pointparticles(particleeffectnum("fireball_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
254 proj.owner = proj.realowner = self;
255 proj.classname = "grenade";
256 proj.bot_dodge = TRUE;
257 proj.bot_dodgerating = cvar("g_balance_fireball_primary_damage");
258 proj.movetype = MOVETYPE_BOUNCE;
259 proj.projectiledeathtype = WEP_FIREBALL;
260 proj.touch = W_Firemine_Touch;
261 PROJECTILE_MAKETRIGGER(proj);
262 setsize(proj, '-4 -4 -4', '4 4 4');
263 setorigin(proj, w_shotorg);
264 proj.think = W_Firemine_Think;
265 proj.nextthink = time;
266 proj.damageforcescale = cvar("g_balance_fireball_primary_damageforcescale");
267 proj.velocity = w_shotdir * cvar("g_balance_fireball_primary_speed") + v_up * cvar("g_balance_fireball_primary_speed_up");
268 proj.pushltime = time + cvar("g_balance_fireball_primary_lifetime");
269 W_SetupProjectileVelocity(proj);
271 proj.angles = vectoangles(proj.velocity);
272 proj.flags = FL_PROJECTILE;
274 CSQCProjectile(proj, TRUE, PROJECTILE_FIREMINE, TRUE);
277 void spawnfunc_weapon_fireball (void)
279 weapon_defaultspawnfunc(WEP_FIREBALL);
282 float w_fireball(float req)
286 self.BUTTON_ATCK = FALSE;
287 self.BUTTON_ATCK2 = FALSE;
288 if (self.bot_secondary_fireballmooth == 0)
290 if(bot_aim(cvar("g_balance_fireball_primary_speed"), cvar("g_balance_fireball_primary_speed_up"), cvar("g_balance_fireball_primary_lifetime"), TRUE))
292 self.BUTTON_ATCK = TRUE;
293 if(random() < 0.01) self.bot_secondary_fireballmooth = 1;
298 if(bot_aim(cvar("g_balance_fireball_secondary_speed"), 0, cvar("g_balance_fireball_secondary_lifetime"), FALSE))
300 self.BUTTON_ATCK2 = TRUE;
301 if(random() < 0.02) self.bot_secondary_fireballmooth = 0;
305 else if (req == WR_THINK)
307 if (self.BUTTON_ATCK)
308 if (weapon_prepareattack(0, cvar("g_balance_fireball_primary_refire")))
310 W_Fireball_Attack1();
311 weapon_thinkf(WFRAME_FIRE2, cvar("g_balance_fireball_primary_animtime"), w_ready);
313 if (self.BUTTON_ATCK2)
314 if (weapon_prepareattack(1, cvar("g_balance_fireball_secondary_refire")))
316 W_Fireball_Attack2_Frame0();
319 else if (req == WR_PRECACHE)
321 precache_model ("models/weapons/g_fireball.md3");
322 precache_model ("models/weapons/v_fireball.md3");
323 precache_model ("models/weapons/h_fireball.dpm");
324 precache_model ("models/sphere/sphere.md3");
325 precache_sound ("weapons/fireball_fire.wav");
326 precache_sound ("weapons/fireball_fire2.wav");
327 precache_sound ("weapons/fireball_prefire2.wav");
329 else if (req == WR_SETUP)
330 weapon_setup(WEP_FIREBALL);
331 else if (req == WR_CHECKAMMO1)
332 return self.ammo_rockets >= cvar("g_balance_fireball_primary_ammo");
333 else if (req == WR_CHECKAMMO2)
334 return self.ammo_rockets >= cvar("g_balance_fireball_secondary_ammo");
335 else if (req == WR_SUICIDEMESSAGE)
337 if(w_deathtype & HITTYPE_SECONDARY)
338 w_deathtypestring = "should have used a smaller gun";
340 w_deathtypestring = "forgot about some firemine";
342 else if (req == WR_KILLMESSAGE)
344 if(w_deathtype & HITTYPE_SECONDARY)
346 if(w_deathtype & HITTYPE_BOUNCE)
348 if(w_deathtype & HITTYPE_SPLASH) // BFG effect
350 w_deathtypestring = "could not hide from #'s fireball";
354 w_deathtypestring = "saw the pretty lights of #'s fireball";
357 else if(w_deathtype & HITTYPE_SPLASH)
358 w_deathtypestring = "got too close to #'s fireball";
360 w_deathtypestring = "tasted #'s fireball";
364 if(w_deathtype & HITTYPE_HEADSHOT)
365 w_deathtypestring = "tried to catch #'s firemine";
367 w_deathtypestring = "fatefully ignored #'s firemine";