‪Black Ops 3 Source Code Explorer  0.1
‪An script explorer for Black Ops 3 by ZeRoY
_killstreak_bundles.gsc
Go to the documentation of this file.
1 #using scripts\codescripts\struct;
2 
3 #using scripts\shared\clientfield_shared;
4 #using scripts\shared\killstreaks_shared;
5 #using scripts\shared\popups_shared;
6 #using scripts\shared\system_shared;
7 #using scripts\shared\util_shared;
8 
9 #using scripts\mp\_util;
10 #using scripts\mp\killstreaks\_killstreaks;
11 
12 #insert scripts\mp\_hacker_tool.gsh;
13 #insert scripts\mp\killstreaks\_killstreaks.gsh;
14 #insert scripts\shared\shared.gsh;
15 #insert scripts\shared\version.gsh;
16 #insert scripts\shared\weapons\_hive_gun.gsh;
17 
18 #namespace killstreak_bundles;
19 
20 function ‪register_killstreak_bundle( killstreakType )
21 {
22  level.killstreakBundle[killstreakType] = ‪struct::get_script_bundle( "killstreak", "killstreak_" + killstreakType );
23  level.killstreakBundle["inventory_" + killstreakType] = level.killstreakBundle[killstreakType];
24  level.killstreakMaxHealthFunction = &‪killstreak_bundles::get_max_health;
25  assert( isdefined( level.killstreakBundle[killstreakType] ) );
26 }
27 
28 function ‪get_bundle( killstreak )
29 {
30  if( killstreak.archetype === "raps" )
31  return level.killstreakBundle[‪RAPS_DRONE_NAME];
32  else
33  return level.killstreakBundle[killstreak.killstreakType];
34 }
35 
37 {
38  killstreak = self;
39  bundle = ‪get_bundle( killstreak );
40 
41  return bundle.ksHackTimeout;
42 }
43 
45 {
46  killstreak = self;
47  hackedProtection = false;
48 
49  bundle = ‪get_bundle( killstreak );
50  if ( isdefined( bundle.ksHackProtection ) )
51  {
52  hackedProtection = bundle.ksHackProtection;
53  }
54 
55  return hackedProtection;
56 }
57 
59 {
60  killstreak = self;
61  hackToolInnerTime = 10000;
62 
63  bundle = ‪get_bundle( killstreak );
64  if ( isdefined( bundle.ksHackToolInnerTime ) )
65  {
66  hackToolInnerTime = bundle.ksHackToolInnerTime;
67  }
68 
69  return hackToolInnerTime;
70 }
71 
73 {
74  killstreak = self;
75  hackToolOuterTime = 10000;
76 
77  bundle = ‪get_bundle( killstreak );
78  if ( isdefined( bundle.ksHackToolOuterTime ) )
79  {
80  hackToolOuterTime = bundle.ksHackToolOuterTime;
81  }
82 
83  return hackToolOuterTime;
84 }
85 
87 {
88  killstreak = self;
89  hackedToolInnerRadius = 10000;
90 
91  bundle = ‪get_bundle( killstreak );
92  if ( isdefined( bundle.ksHackToolInnerRadius ) )
93  {
94  hackedToolInnerRadius = bundle.ksHackToolInnerRadius;
95  }
96 
97  return hackedToolInnerRadius;
98 }
99 
100 
102 {
103  killstreak = self;
104  hackedToolOuterRadius = 10000;
105 
106  bundle = ‪get_bundle( killstreak );
107  if ( isdefined( bundle.ksHackToolOuterRadius ) )
108  {
109  hackedToolOuterRadius = bundle.ksHackToolOuterRadius;
110  }
111 
112  return hackedToolOuterRadius;
113 }
114 
115 
117 {
118  killstreak = self;
119  hackedToolLostLineOfSightLimitMs = 1000;
120 
121  bundle = ‪get_bundle( killstreak );
122  if ( isdefined( bundle.ksHackToolLostLineOfSightLimitMs ) )
123  {
124  hackedToolLostLineOfSightLimitMs = bundle.ksHackToolLostLineOfSightLimitMs;
125  }
126 
127  return hackedToolLostLineOfSightLimitMs;
128 }
129 
130 
132 {
133  killstreak = self;
134  hackToolNoLineOfSightTime = 1000;
135 
136  bundle = ‪get_bundle( killstreak );
137  if ( isdefined( bundle.ksHackToolNoLineOfSightTime ) )
138  {
139  hackToolNoLineOfSightTime = bundle.ksHackToolNoLineOfSightTime;
140  }
141 
142  return hackToolNoLineOfSightTime;
143 }
144 
145 
146 
148 {
149  killstreak = self;
150  hackedScoreEvent = undefined;
151  bundle = ‪get_bundle( killstreak );
152  if ( isdefined( bundle.ksHackScoreEvent ) )
153  {
154  hackedScoreEvent = bundle.ksHackScoreEvent;
155  }
156 
157  return hackedScoreEvent;
158 }
159 
160 function ‪get_hack_fx()
161 {
162  killstreak = self;
163  hackFX = "";
164 
165  bundle = ‪get_bundle( killstreak );
166  if ( isdefined( bundle.ksHackFX ) )
167  {
168  hackFX = bundle.ksHackFX;
169  }
170 
171  return hackFX;
172 }
173 
175 {
176  killstreak = self;
177  hackLoopFX = "";
178 
179  bundle = ‪get_bundle( killstreak );
180  if ( isdefined( bundle.ksHackLoopFX ) )
181  {
182  hackLoopFX = bundle.ksHackLoopFX;
183  }
184 
185  return hackLoopFX;
186 }
187 
188 function ‪get_max_health( killstreakType )
189 {
190  bundle = level.killstreakBundle[killstreakType];
191 
192  return bundle.ksHealth;
193 }
194 
195 function ‪get_low_health( killstreakType )
196 {
197  bundle = level.killstreakBundle[killstreakType];
198 
199  return bundle.ksLowHealth;
200 }
201 
202 function ‪get_hacked_health( killstreakType )
203 {
204  bundle = level.killstreakBundle[killstreakType];
205 
206  return bundle.ksHackedHealth;
207 }
208 
209 function ‪get_shots_to_kill( weapon, meansOfDeath, bundle )
210 {
211  shotsToKill = undefined;
212 
213  switch( weapon.rootweapon.name )
214  {
215  case "remote_missile_missile":
216  shotsToKill = bundle.ksRemote_missile_missile;
217  break;
218  case "hero_annihilator":
219  shotsToKill = bundle.ksHero_annihilator;
220  break;
221  case "hero_armblade":
222  shotsToKill = bundle.ksHero_armblade;
223  break;
224  case "hero_bowlauncher":
225  case "hero_bowlauncher2":
226  case "hero_bowlauncher3":
227  case "hero_bowlauncher4":
228  if ( meansOfDeath == "MOD_PROJECTILE_SPLASH" || meansOfDeath == "MOD_PROJECTILE" )
229  {
230  shotsToKill = bundle.ksHero_bowlauncher;
231  }
232  else
233  {
234  shotstoKill = -1;
235  }
236  break;
237  case "hero_gravityspikes":
238  shotsToKill = bundle.ksHero_gravityspikes;
239  break;
240  case "hero_lightninggun":
241  shotsToKill = bundle.ksHero_lightninggun;
242  break;
243  case "hero_minigun":
244  case "hero_minigun_body3":
245  shotsToKill = bundle.ksHero_minigun;
246  break;
247  case "hero_pineapplegun":
248  shotsToKill = bundle.ksHero_pineapplegun;
249  break;
250  case "hero_firefly_swarm":
251  shotsToKill = ‪VAL( bundle.ksHero_firefly_swarm, 0 ) * ‪HIVE_POD_HITS_VS_KILLSTREAKS_AND_ROBOTS;
252  break;
253  case "dart_blade":
254  case "dart_turret":
255  shotsToKill = bundle.ksDartsToKill;
256  break;
257  case "gadget_heat_wave":
258  shotsToKill = bundle.ksHero_heatwave;
259  break;
260  }
261 
262  return ‪VAL( shotsToKill, 0 );
263 }
264 
265 function ‪get_emp_grenade_damage( killstreakType, maxhealth )
266 {
267  // weapon_damage returns as undefined if it is not handled here
268 
269  emp_weapon_damage = undefined;
270 
271  if ( isdefined( level.killstreakBundle[killstreakType] ) )
272  {
273  bundle = level.killstreakBundle[killstreakType];
274 
275  empGrenadesToKill = ‪VAL( bundle.ksEmpGrenadesToKill, 0 );
276 
277  if ( empGrenadesToKill == 0 )
278  {
279  // not handled here
280  }
281  else if ( empGrenadesToKill > 0 )
282  {
283  emp_weapon_damage = maxhealth / empGrenadesToKill + 1;
284  }
285  else
286  {
287  // immune
288  emp_weapon_damage = 0;
289  }
290  }
291 
292  return emp_weapon_damage;
293 }
294 
295 function ‪get_weapon_damage( killstreakType, maxhealth, attacker, weapon, type, ‪damage, flags, chargeShotLevel )
296 {
297  // weapon_damage returns as undefined if it is not handled here
298 
299  weapon_damage = undefined;
300 
301  if ( isdefined( level.killstreakBundle[killstreakType] ) )
302  {
303  bundle = level.killstreakBundle[killstreakType];
304 
305  if ( isdefined( weapon ) )
306  {
307  shotsToKill = ‪get_shots_to_kill( weapon, type, bundle );
308 
309  if ( shotsToKill == 0 )
310  {
311  // not handled here
312  }
313  else if ( shotsToKill > 0 )
314  {
315  if ( isdefined( chargeShotLevel ) && chargeShotLevel > 0 )
316  {
317  // chargeShotLevel should be between 0 and 1.
318  // 1 = full charge
319  // > 0 = fraction of charge
320  shotsToKill = shotsToKill / chargeShotLevel;
321  }
322 
323  weapon_damage = maxhealth / shotsToKill + 1;
324  }
325  else
326  {
327  // immune
328  weapon_damage = 0;
329  }
330 
331  }
332 
333  if ( !isdefined( weapon_damage ) )
334  {
335  if ( type == "MOD_RIFLE_BULLET" || type == "MOD_PISTOL_BULLET" || type == "MOD_HEAD_SHOT" )
336  {
337  hasArmorPiercing = isdefined( attacker ) && isPlayer( attacker ) && attacker HasPerk( "specialty_armorpiercing" );
338 
339  clipsToKill = ‪VAL( bundle.ksClipsToKill, 0 );
340  if( clipsToKill == -1 )
341  {
342  // immune
343  weapon_damage = 0;
344  }
345  else if ( hasArmorPiercing && self.aitype !== "spawner_bo3_robot_grunt_assault_mp_escort" ) // HACK TU4 FFOTD DT 150126 - Don't apply FMJ damage to the escort robot
346  {
347  weapon_damage = ‪damage + int( ‪damage * level.cac_armorpiercing_data);
348  }
349 
350  if ( weapon.weapClass == "spread" )
351  {
352  ksShotgunMultiplier = ‪VAL( bundle.ksShotgunMultiplier, 1);
353 
354  if ( ksShotgunMultiplier == 0 )
355  {
356  // not handled here
357  }
358  else if ( ksShotgunMultiplier > 0 )
359  {
360  weapon_damage = ‪VAL( weapon_damage, ‪damage ) * ksShotgunMultiplier;
361  }
362  }
363  }
364  else if ( ( type == "MOD_PROJECTILE" || type == "MOD_EXPLOSIVE" )
365  && ( !isdefined( weapon.isEmpKillstreak ) || !weapon.isEmpKillstreak )
366  && ( weapon.statIndex != level.weaponPistolEnergy.statIndex )
367  && ( weapon.statIndex != level.weaponSpecialCrossbow.statIndex )
368  && ( weapon.statIndex != level.weaponSmgNailGun.statIndex )
369  && ( weapon.statIndex != level.weaponBouncingBetty.statIndex ) )
370  {
371  if ( weapon.statIndex == level.weaponShotgunEnergy.statIndex )
372  {
373  shotgunEnergyToKill = ‪VAL( bundle.ksShotgunEnergyToKill, 0 );
374 
375  if ( shotgunEnergyToKill == 0 )
376  {
377  // not handled here
378  }
379  else if ( shotgunEnergyToKill > 0 )
380  {
381  weapon_damage = maxhealth / shotgunEnergyToKill + 1;
382  }
383  else
384  {
385  // immune
386  weapon_damage = 0;
387  }
388  }
389  else
390  {
391  rocketsToKill = ‪VAL( bundle.ksRocketsToKill, 0 );
392 
393  if ( rocketsToKill == 0 )
394  {
395  // not handled here
396  }
397  else if ( rocketsToKill > 0 )
398  {
399  if ( weapon.rootweapon.name == "launcher_multi" )
400  {
401  rocketsToKill *= 2;
402  }
403 
404  weapon_damage = maxhealth / rocketsToKill + 1;
405  }
406  else
407  {
408  // immune
409  weapon_damage = 0;
410  }
411  }
412  }
413  else if (( type == "MOD_GRENADE" || type == "MOD_GRENADE_SPLASH" ) && ( !isdefined( weapon.isEmpKillstreak ) || !weapon.isEmpKillstreak ) )
414  {
415  grenadeDamageMultiplier = ‪VAL( bundle.ksGrenadeDamageMultiplier, 0 );
416 
417  if ( grenadeDamageMultiplier == 0 )
418  {
419  // not handled here
420  }
421  else if ( grenadeDamageMultiplier > 0 )
422  {
423  weapon_damage = ‪damage * grenadeDamageMultiplier;
424  }
425  else
426  {
427  // immune
428  weapon_damage = 0;
429  }
430  }
431  else if ( type == "MOD_MELEE_WEAPON_BUTT" || type == "MOD_MELEE" )
432  {
433  ksMeleeDamageMultiplier = ‪VAL( bundle.ksMeleeDamageMultiplier, 0 );
434 
435  if ( ksMeleeDamageMultiplier == 0 )
436  {
437  // not handled here
438  }
439  else if ( ksMeleeDamageMultiplier > 0 )
440  {
441  weapon_damage = ‪damage * ksMeleeDamageMultiplier;
442  }
443  else
444  {
445  // immune
446  weapon_damage = 0;
447  }
448  }
449  else if ( type == "MOD_PROJECTILE_SPLASH" )
450  {
451  ksProjectileSpashMultiplier = ‪VAL( bundle.ksProjectileSpashMultiplier, 0 );
452 
453  if ( ksProjectileSpashMultiplier == 0 )
454  {
455  // not handled here
456  }
457  else if ( ksProjectileSpashMultiplier > 0 )
458  {
459  weapon_damage = ‪damage * ksProjectileSpashMultiplier;
460  }
461  else
462  {
463  // immune
464  weapon_damage = 0;
465  }
466  }
467  }
468  }
469 
470  return weapon_damage;
471 }
‪get_hack_tool_inner_time
‪function get_hack_tool_inner_time()
Definition: _killstreak_bundles.gsc:58
‪get_shots_to_kill
‪function get_shots_to_kill(weapon, meansOfDeath, bundle)
Definition: _killstreak_bundles.gsc:209
‪get_weapon_damage
‪function get_weapon_damage(killstreakType, maxhealth, attacker, weapon, type, damage, flags, chargeShotLevel)
Definition: _killstreak_bundles.gsc:295
‪register_killstreak_bundle
‪function register_killstreak_bundle(killstreakType)
Definition: _killstreak_bundles.gsc:20
‪get_hack_tool_no_line_of_sight_time
‪function get_hack_tool_no_line_of_sight_time()
Definition: _killstreak_bundles.gsc:131
‪VAL
‪#define VAL(__var, __default)
Definition: shared.gsh:272
‪get_hack_timeout
‪function get_hack_timeout()
Definition: _killstreak_bundles.gsc:36
‪get_hack_scoreevent
‪function get_hack_scoreevent()
Definition: _killstreak_bundles.gsc:147
‪get_lost_line_of_sight_limit_msec
‪function get_lost_line_of_sight_limit_msec()
Definition: _killstreak_bundles.gsc:116
‪get_hack_protection
‪function get_hack_protection()
Definition: _killstreak_bundles.gsc:44
‪get_hack_loop_fx
‪function get_hack_loop_fx()
Definition: _killstreak_bundles.gsc:174
‪get_low_health
‪function get_low_health(killstreakType)
Definition: _killstreak_bundles.gsc:195
‪damage
‪function damage(trap)
Definition: _zm_trap_electric.gsc:116
‪get_hack_fx
‪function get_hack_fx()
Definition: _killstreak_bundles.gsc:160
‪get_bundle
‪function get_bundle(killstreak)
Definition: _killstreak_bundles.gsc:28
‪get_hack_tool_inner_radius
‪function get_hack_tool_inner_radius()
Definition: _killstreak_bundles.gsc:86
‪get_max_health
‪function get_max_health(killstreakType)
Definition: _killstreak_bundles.gsc:188
‪get_hacked_health
‪function get_hacked_health(killstreakType)
Definition: _killstreak_bundles.gsc:202
‪HIVE_POD_HITS_VS_KILLSTREAKS_AND_ROBOTS
‪#define HIVE_POD_HITS_VS_KILLSTREAKS_AND_ROBOTS
Definition: _hive_gun.gsh:3
‪get_script_bundle
‪function get_script_bundle(str_type, str_name)
Definition: struct.csc:45
‪get_emp_grenade_damage
‪function get_emp_grenade_damage(killstreakType, maxhealth)
Definition: _killstreak_bundles.gsc:265
‪get_hack_tool_outer_radius
‪function get_hack_tool_outer_radius()
Definition: _killstreak_bundles.gsc:101
‪RAPS_DRONE_NAME
‪#define RAPS_DRONE_NAME
Definition: _killstreaks.gsh:109
‪get_hack_tool_outer_time
‪function get_hack_tool_outer_time()
Definition: _killstreak_bundles.gsc:72