Example #1
0
        public void Calculate()
        {
            float attackSpeed = ParryModel.BossAttackSpeed;           // Options.BossAttackSpeed;

#if (RAWR3)
            float armorReduction = (1.0f - Lookup.ArmorReduction(Character, Stats, BossOpts.Level));
#else
            float armorReduction = (1.0f - Lookup.ArmorReduction(Character, Stats, CalcOpts.TargetLevel));
#endif
            float baseDamagePerSecond = CalcOpts.BossAttackValue / CalcOpts.BossAttackSpeed;
            float guaranteedReduction = (Lookup.StanceDamageReduction(Character, Stats) * armorReduction);
            float absorbed            = Stats.DamageAbsorbed;

            DamagePerHit   = (CalcOpts.BossAttackValue * guaranteedReduction) - absorbed;
            DamagePerCrit  = (2.0f * DamagePerHit);
            DamagePerBlock = Math.Max(0.0f, DamagePerHit - Lookup.ActiveBlockReduction(Character, Stats));

            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;

            float reductionAD = 1.0f - Lookup.ArdentDefenderReduction(Character);
            float healthAD    = (0.65f + (0.35f / reductionAD)) * Stats.Health;

            DamagePerSecond     = AverageDamagePerAttack / attackSpeed;
            DamageTaken         = DamagePerSecond / baseDamagePerSecond;
            Mitigation          = (1.0f - (DamagePerSecond / baseDamagePerSecond));
            TankPoints          = (healthAD / (1.0f - Mitigation));
            EffectiveHealth     = (healthAD / guaranteedReduction);
            GuaranteedReduction = (1.0f - guaranteedReduction);


            double a = Convert.ToDouble(DefendTable.AnyMiss);
            double h = Convert.ToDouble(healthAD);
            double H = Convert.ToDouble(AverageDamagePerHit);
            double s = Convert.ToDouble(ParryModel.BossAttackSpeed / CalcOpts.BossAttackSpeed);
            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;
             */
        }
Example #2
0
        public static float MagicReduction(Character character, Stats stats, DamageType school, int targetLevel)
        {
            float damageReduction = Lookup.StanceDamageReduction(character, stats, school);
            float totalResist     = 0.0f;
            float resistScale     = 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;
            }

            if ((targetLevel - character.Level) == 0)
            {
                resistScale = 400.0f;
            }
            else if ((targetLevel - character.Level) == 1)
            {
                resistScale = 405.0f;
            }
            else if ((targetLevel - character.Level) == 2)
            {
                resistScale = 410.0f;
            }
            else
            {
                // This number is still being tested by many and may be slightly higher
                // update: it seems 510 is a more realistic value
                // NB: resistScale is the resistance constant for 50% Mean Average Damage depending on Level difference.
                resistScale = 510.0f;
            }

            return(Math.Max(0.0f, (1.0f - (totalResist / (resistScale + totalResist))) * damageReduction));
        }