public static float GetRDamage(Obj_AI_Base unit, bool isFourthShoot = false) { if (!isFourthShoot && MenuManager.IsCacheEnabled && RDamages.Exist(unit.NetworkId)) { RDamages.RefreshRate = 1000; return(RDamages.Get(unit.NetworkId)); } var missingHealthAdditionalDamagePercent = 1 + (100 - unit.HealthPercent) * 0.025f; var minimumDamage = RMinimumDamage[R.Level] + GetRealAttackDamage() * RMinimumDamageTotalAdMod; var maximumDamage = RMaximumDamage[R.Level] + GetRealAttackDamage() * RMaximumDamageTotalAdMod; float damage; if (!isFourthShoot) { damage = Math.Min(minimumDamage * missingHealthAdditionalDamagePercent, maximumDamage); } else { damage = Math.Min(minimumDamage * missingHealthAdditionalDamagePercent, maximumDamage) * (Player.Instance.HasItem(ItemId.Infinity_Edge) ? 2.5f : 2f) * (1 + Player.Instance.FlatCritChanceMod); } var finalDamage = Player.Instance.CalculateDamageOnUnit(unit, DamageType.Physical, damage); if (!isFourthShoot && MenuManager.IsCacheEnabled) { RDamages.Add(unit.NetworkId, finalDamage); } return(finalDamage); }
public static float GetRDamage(Obj_AI_Base target, Vector3?customPosition = null) { if (MenuManager.IsCacheEnabled && RDamages.Exist(target.NetworkId)) { return(RDamages.Get(target.NetworkId)); } var distance = Player.Instance.DistanceCached(customPosition ?? target.Position) > 1500 ? 1499 : Player.Instance.DistanceCached(customPosition ?? target.Position); distance = distance < 100 ? 100 : distance; var baseDamage = Misc.GetNumberInRangeFromProcent(Misc.GetProcentFromNumberRange(distance, 100, 1505), RMinimalDamage[R.Level], RMinimalDamage[R.Level] * 10); var bonusAd = Misc.GetNumberInRangeFromProcent(Misc.GetProcentFromNumberRange(distance, 100, 1505), RBonusAdDamageMod, RBonusAdDamageMod * 10); var percentDamage = (target.MaxHealth - target.Health) * RMissingHealthBonusDamage[R.Level]; var finalDamage = Player.Instance.CalculateDamageOnUnit(target, DamageType.Physical, (float)(baseDamage + percentDamage + Player.Instance.FlatPhysicalDamageMod * bonusAd)); if (MenuManager.IsCacheEnabled) { RDamages.Add(target.NetworkId, finalDamage); } return(finalDamage); }