Example #1
0
        public static int ReduceArmor(int damage, Stats stats, Target target)
        {
            var mitigationValue = (0.1 * target.Armor) / (8.5 * stats.Character.Level + 40);
            var mitigation      = 1 - (mitigationValue / (1 + mitigationValue));

            return(damage * WowMath.ToInt(mitigation));
        }
Example #2
0
        public static (int low, int high) GetGlancingRange(Weapon weapon, Target target)
        {
            int skillDiff = target.Defence - weapon.Skill;

            return
                (
                WowMath.ToIntPercentage(Math.Max(0, Math.Min(0.91, 1.3 - 0.05 * skillDiff))),
                WowMath.ToIntPercentage(Math.Max(0.2, Math.Min(0.99, 1.2 - 0.03 * skillDiff)))
                );
        }
Example #3
0
        private static int GetMissChance(CharacterStats stats, Weapon weapon, Target target)
        {
            float missChance = MissChance(weapon.Skill, target);

            if (HasDualWieldPenalty(stats, target))
            {
                missChance = AddDualWieldPenalty(missChance);
            }

            return(WowMath.ToIntTimesTen(missChance));
        }
Example #4
0
        public static int Calculate(Outcome outcome, Stats stats, Weapon weapon)
        {
            switch (outcome)
            {
            case Outcome.Glancing:
                int glanceModifier = RollGlance(stats.GlanceModifier);
                return(WowMath.ToInt(glanceModifier * GetWeaponDamage(weapon) / 100f));

            case Outcome.Hit:
                return(GetWeaponDamage(weapon));

            case Outcome.Crit:
                return(WowMath.ToInt(GetWeaponDamage(weapon) * stats.CritModifier));

            case Outcome.Miss:
            case Outcome.Dodge:
            case Outcome.Parry:
            default:
                return(0);
            }
        }
Example #5
0
 private static int GlancingChance(CharacterStats stats, Target target)
 {
     return(WowMath.ToIntTimesTen(10 + (target.Defence - Math.Min(stats.Level * 5, stats.MainHandSkill) * 2)));
 }
Example #6
0
 private static int MobDodge(Weapon weapon, Target target) => WowMath.ToIntTimesTen(5 + (target.Defence - weapon.Skill) * 0.1f);
Example #7
0
 private static int PlayerDodge(Weapon weapon, Target target) => WowMath.ToIntTimesTen(target.Dodge + (target.Defence - weapon.Skill) * 0.04f);