public void Calculate() { float attackSpeed = BossOpts.DefaultMeleeAttack.AttackSpeed / (1f - Stats.BossAttackSpeedReductionMultiplier); float armorReduction = (1.0f - Lookup.ArmorReduction(Stats.Armor, BossOpts.Level)); float baseDamagePerSecond = BossOpts.DefaultMeleeAttack.DamagePerHit / BossOpts.DefaultMeleeAttack.AttackSpeed; float guaranteedReduction = (Lookup.DamageReduction(Stats) * armorReduction); float absorbed = Stats.DamageAbsorbed; DamagePerHit = (BossOpts.DefaultMeleeAttack.DamagePerHit * guaranteedReduction) - absorbed; DamagePerCrit = (2.0f * DamagePerHit); DamagePerBlock = Math.Max(0.0f, DamagePerHit * (1f - Lookup.ActiveBlockReduction(Stats.BonusBlockValueMultiplier, Character.PaladinTalents.HolyShield))); AverageDamagePerHit = DamagePerHit * (DefendTable.Hit / DefendTable.AnyHit) + DamagePerCrit * (DefendTable.Critical / DefendTable.AnyHit) + DamagePerBlock * (DefendTable.Block / DefendTable.AnyHit); AverageDamagePerAttack = DamagePerHit * DefendTable.Hit + DamagePerCrit * DefendTable.Critical + DamagePerBlock * DefendTable.Block; DamagePerSecond = AverageDamagePerAttack / attackSpeed; DamageTaken = DamagePerSecond / baseDamagePerSecond; Mitigation = (1.0f - (DamagePerSecond / baseDamagePerSecond)); CTCovered = (DefendTable.AnyMiss + DefendTable.Block); TankPoints = (Stats.Health / (1.0f - Mitigation)); EffectiveHealth = (Stats.Health / guaranteedReduction); GuaranteedReduction = (1.0f - guaranteedReduction); double a = Convert.ToDouble(DefendTable.AnyMiss); double h = Convert.ToDouble(Stats.Health); double H = Convert.ToDouble(AverageDamagePerHit); double s = Convert.ToDouble(BossOpts.DefaultMeleeAttack.AttackSpeed / BossOpts.DefaultMeleeAttack.AttackSpeed); BurstTime = Convert.ToSingle((1.0d / a) * ((1.0d / Math.Pow(1.0d - a, h / H)) - 1.0d) * s); /* * // Attempt to make a different TTL: * float damageTaken = Options.BossAttackValue; // for TTL(EH) * float health = EffectiveHealth; * float anyHit = 1.0f; // worst case, you get hit every swing * float attacksToKill = (float)Math.Ceiling(health / DamageTaken); // So 10 health / 4 damage = 2.5 attacks = 3 attacks. * float timeToDie = attacksToKill * attackSpeed; // time in seconds * float chanceToDie = Convert.ToSingle((float)Math.Pow(anyHit, attacksToKill)); // (= 1^attacksToKill) * float timeToLive = timeToDie * chanceToDie; * BurstTime = timeToLive; */ }
public static float MagicReduction(Stats stats, DamageType school, int targetLevel) { float damageReduction = Lookup.DamageReduction(stats); float resistanceConstant = 150f + (targetLevel - 60f) * (targetLevel - 67.5f); float totalResist = 0.0f; switch (school) { case DamageType.Arcane: totalResist += stats.ArcaneResistance; break; case DamageType.Fire: totalResist += stats.FireResistance; break; case DamageType.Frost: totalResist += stats.FrostResistance; break; case DamageType.Nature: totalResist += stats.NatureResistance; break; case DamageType.Shadow: totalResist += stats.ShadowResistance; break; } return(totalResist / (totalResist + resistanceConstant)); }