Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // This checks if weapon will impact and how much damage it will inflict
- public void RegisterShot(MakeSentinel Sent, PlayerPositionEvent p)
- {
- // used to check for impact
- WeaponCalc newshot = new WeaponCalc();
- string result = newshot.Configure(Sent.Info.HitRegion, p);
- // If thor change to lvl 4 bomb
- // This makes it easier to calculate damage since thor prox is same as lvl4 bomb
- if (p.Weapon.Type == WeaponTypes.Thor)
- {
- p.Weapon.Type = WeaponTypes.ProxBomb;
- p.Weapon.Level = 3;
- }
- // First check for direct hits
- if (!result.Equals("~miss"))
- {
- // storing time until impact
- double time2hit = newshot.timeHit(result);
- // Bombs
- if (p.Weapon.Type.ToString().ToLower().Contains("bomb"))
- TargetHit(p.PlayerName, time2hit, Sent.Settings.BombDamage);
- // Bullets
- else
- TargetHit(p.PlayerName, time2hit, Sent.Settings.BulletDamage[p.Weapon.Level]);
- }
- // checks for the next 2 lvls out for prox - a cheap way to calculate prox
- else if (p.Weapon.Type == WeaponTypes.ProxBomb)
- {
- // a list of how far out bomb proximity is at each lvl
- ushort[] _BombProx = new ushort[4] { 53, 71, 89, 107 };
- // outer area between direct hit and outer proximity
- ushort range = (ushort)(_BombProx[p.Weapon.Level] / 2);
- // making the hit region a tad bigger for collision check
- ushort[] _NewHitRegion = new ushort[4] { (ushort)(Sent.Info.HitRegion[0] - range), (ushort)(Sent.Info.HitRegion[1] - range),
- (ushort)(Sent.Info.HitRegion[2] + range), (ushort)(Sent.Info.HitRegion[3] + range) };
- // checking for impact
- result = newshot.Configure(_NewHitRegion, p);
- if (!result.Equals("~miss"))
- {
- // storing time until impact
- double time2hit = newshot.timeHit(result);
- // less damage at this proximity
- TargetHit(p.PlayerName, time2hit, (ushort)(Sent.Settings.BombDamage / 1.5));
- return;
- }
- // Final check in prox- most outer section
- else
- {
- range = _BombProx[p.Weapon.Level];
- // adjusting area for collision check
- _NewHitRegion = new ushort[4] { (ushort)(Sent.Info.HitRegion[0] - range), (ushort)(Sent.Info.HitRegion[1] - range),
- (ushort)(Sent.Info.HitRegion[2] + range), (ushort)(Sent.Info.HitRegion[3] + range) };
- // checking for impact
- result = newshot.Configure(_NewHitRegion, p);
- if (!result.Equals("~miss"))
- {
- // storing time until impact
- double time2hit = newshot.timeHit(result);
- // we will deal 1/3rd the max damage of a bomb
- TargetHit(p.PlayerName, time2hit, (ushort)(Sent.Settings.BombDamage / 3));
- return;
- }
- return;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment