protected override void Calculate() { float tableSize = 0.0f; int targetLevel = BossOpts.Level; float SpellHitChance = Lookup.SpellHitChance(Character.Level, Stats, targetLevel); float bonusExpertise = Lookup.BonusExpertisePercentage(Stats); if (Lookup.IsSpell(Ability)) { // Miss Miss = Math.Min(1.0f - tableSize, 1.0f - SpellHitChance); tableSize += Miss; // Crit Critical = Lookup.SpellCritChance(Character.Level, Stats, targetLevel); tableSize += Critical; } else { float bonusHit = Lookup.HitChance(Stats, targetLevel, Character.Level); // Miss // Miss = Math.Min(1.0f - tableSize, Math.Max(0.0f, Lookup.TargetAvoidanceChance(Character, Stats, HitResult.Miss) - bonusHit)); Miss = Math.Min(1.0f - tableSize, Math.Max(0.0f, 1.0f - bonusHit)); tableSize += Miss; // Avoidance if (Lookup.IsAvoidable(Ability)) { // Dodge Dodge = Math.Min(1.0f - tableSize, Math.Max(0.0f, Lookup.TargetAvoidanceChance(Character.Level, Stats.SpellPenetration, HitResult.Dodge, targetLevel) - bonusExpertise)); tableSize += Dodge; // Parry Parry = Math.Min(1.0f - tableSize, Math.Max(0.0f, Lookup.TargetAvoidanceChance(Character.Level, Stats.SpellPenetration, HitResult.Parry, targetLevel) - bonusExpertise)); tableSize += Parry; } // Glancing Blow if (Ability == Ability.MeleeSwing) { Glance = Math.Min(1.0f - tableSize, Math.Max(0.0f, Lookup.TargetAvoidanceChance(Character.Level, Stats.SpellPenetration, HitResult.Glance, targetLevel))); tableSize += Glance; } // Block if (Ability == Ability.MeleeSwing || Ability == Ability.HammerOfTheRighteous) { Block = Math.Min(1.0f - tableSize, Math.Max(0.0f, Lookup.TargetAvoidanceChance(Character.Level, Stats.SpellPenetration, HitResult.Block, targetLevel))); tableSize += Block; } // Critical Hit Critical = Math.Min(1.0f - tableSize, Lookup.BonusCritPercentage(Character, Stats, Ability, targetLevel)); if (Critical > 0) { tableSize += Critical; } } // Normal Hit Hit = Math.Max(0.0f, 1.0f - tableSize); }
protected override void Calculate() { float tableSize = 0.0f; #if (RAWR3) int targetLevel = BossOpts.Level; #else int targetLevel = CalcOpts.TargetLevel; #endif float SpellHitChance = Lookup.SpellHitChance(Character, Stats, targetLevel); float bonusExpertise = Lookup.BonusExpertisePercentage(Character, Stats); if (Lookup.IsSpell(Ability)) { // Miss Miss = Math.Min(1.0f - tableSize, 1.0f - SpellHitChance);// - bonusHit)); tableSize += Miss; // Crit Critical = Lookup.SpellCritChance(Character, Stats, targetLevel); tableSize += Critical; } else { float bonusHit = Lookup.HitChance(Character, Stats, targetLevel); // Miss // Miss = Math.Min(1.0f - tableSize, Math.Max(0.0f, Lookup.TargetAvoidanceChance(Character, Stats, HitResult.Miss) - bonusHit)); Miss = Math.Min(1.0f - tableSize, Math.Max(0.0f, 1.0f - bonusHit)); tableSize += Miss; // Avoidance if (Lookup.IsAvoidable(Ability)) { // Dodge Dodge = Math.Min(1.0f - tableSize, Math.Max(0.0f, Lookup.TargetAvoidanceChance(Character, Stats, HitResult.Dodge, targetLevel) - bonusExpertise)); tableSize += Dodge; // Parry Parry = Math.Min(1.0f - tableSize, Math.Max(0.0f, Lookup.TargetAvoidanceChance(Character, Stats, HitResult.Parry, targetLevel) - bonusExpertise)); tableSize += Parry; } // Glancing Blow if (Ability == Ability.None) { Glance = Math.Min(1.0f - tableSize, Math.Max(0.0f, Lookup.TargetAvoidanceChance(Character, Stats, HitResult.Glance, targetLevel))); tableSize += Glance; } // Block if (Ability == Ability.None || Ability == Ability.HammerOfTheRighteous) { Block = Math.Min(1.0f - tableSize, Math.Max(0.0f, Lookup.TargetAvoidanceChance(Character, Stats, HitResult.Block, targetLevel))); tableSize += Block; } // Critical Hit Critical = Math.Min(1.0f - tableSize, Lookup.BonusCritPercentage(Character, Stats, Ability, targetLevel, CalcOpts.TargetType)); tableSize += Critical;//FIXME: Tablesize must not change when critchance is negative (boss) } // Normal Hit Hit = Math.Max(0.0f, 1.0f - tableSize); // Partial Resist TODO: Partial Resists don't belong in the combat table, they're not an avoidance type but a damage multiplier. if (Lookup.HasPartials(Ability)) { Resist = Math.Min(1.0f - tableSize, Math.Max(0.0f, Lookup.TargetAvoidanceChance(Character, Stats, HitResult.Resist, targetLevel))); } }