Beispiel #1
0
 public DKCombatTable(Character c, StatsDK stats, CharacterCalculationsBase calcs, ICalculationOptionBase calcOpts, BossOptions bossOpts)
 {
     m_CState = new CombatState();
     if (c != null)
     {
         m_CState.m_Char    = c;
         m_CState.m_Talents = c.DeathKnightTalents;
         m_CState.m_Spec    = CalculationsDPSDK.GetSpec(c.DeathKnightTalents);
     }
     m_CState.m_Stats = stats;
     // TODO: Put in check here for null.
     m_Calcs             = calcs as CharacterCalculationsDPSDK;
     m_Opts              = calcOpts as CalculationOptionsDPSDK;
     m_CState.m_Presence = Presence.Frost;
     if (calcOpts != null && m_Opts == null)
     {
         //throw new Exception("Opts not converted properly.");
         m_Opts = new CalculationOptionsDPSDK();
     }
     try { m_CState.m_Presence = m_Opts.presence; } catch { } // pass  stay w/ default
     m_BO = bossOpts;
     if (m_BO == null)
     {
         m_BO = new BossOptions();
     }
     // JOTHAY TODO: Kind of an Ugly Hack to do this, but it will give them a value
     m_CState.m_NumberOfTargets = m_BO.MultiTargs ? m_BO.DynamicCompiler_MultiTargs.GetAverageTargetGroupSize(m_BO.BerserkTimer) : 1f;
     //
     m_CState.m_bAttackingFromBehind = m_BO.InBack;
     m_CState.fBossArmor             = m_BO.Armor;
     SetupExpertise(c);
 }
Beispiel #2
0
        public void DPSDK_TrinketHang()
        {
            Stats StatTrink = new Stats();

            StatTrink.AddSpecialEffect(new SpecialEffect(Trigger.MainHandHit, new Stats()
            {
                Strength = 300
            }, 10, 0, .1f, 5));
            StatTrink.MasteryRating = 500;
            Item Trinket = new Item("testTrink", ItemQuality.Epic, ItemType.None, 10102, "icon.bmp", ItemSlot.Trinket, "", false,
                                    StatTrink, StatTrink, ItemSlot.None, ItemSlot.None, ItemSlot.None, 0, 0, ItemDamageType.Physical, 0, "");

            m_char.Trinket1 = new ItemInstance(Trinket, 0, null, null, null, new Enchant(), new Reforging(), new Tinkering());

            // This bug was due to non-valid swing times.
            m_char.MainHand = null;

            Rawr.DPSDK.CalculationsDPSDK CalcDPSDK = new Rawr.DPSDK.CalculationsDPSDK();

            CalculationOptionsDPSDK calcOpts = new CalculationOptionsDPSDK();

            calcOpts.presence         = Rawr.DK.Presence.Frost;
            m_char.CalculationOptions = calcOpts;
            this.testContextInstance.BeginTimer("GetCalc");
            CharacterCalculationsBase calcs = CalcDPSDK.GetCharacterCalculations(m_char);

            calcs.GetCharacterDisplayCalculationValues();
            this.testContextInstance.EndTimer("GetCalc");
        }
Beispiel #3
0
        public void DPSDK_Rotation()
        {
            Rawr.DPSDK.CharacterCalculationsDPSDK CalcDPSDK = new Rawr.DPSDK.CharacterCalculationsDPSDK();
            CalculationOptionsDPSDK calcOpts = new CalculationOptionsDPSDK();

            Rawr.DK.StatsDK TotalStats = new Rawr.DK.StatsDK();

            Rawr.DK.DKCombatTable ct  = new Rawr.DK.DKCombatTable(m_char, TotalStats, CalcDPSDK, calcOpts, m_char.BossOptions);
            Rawr.DK.Rotation      rot = new Rawr.DK.Rotation(ct, false);
            rot.PRE_OneEachRot();
            rot.ReportRotation();
            Assert.IsTrue(rot.m_DPS > 0, "rotation OneEach produces 0 DPS");
            rot.PRE_Frost();
            rot.ReportRotation();
            Assert.IsTrue(rot.m_DPS > 0, "rotation Frost produces 0 DPS");
            rot.PRE_Unholy();
            rot.ReportRotation();
            Assert.IsTrue(rot.m_DPS > 0, "rotation Unholy produces 0 DPS");
            rot.PRE_BloodDiseased();
            rot.ReportRotation();
            Assert.IsTrue(rot.m_DPS > 0, "rotation BloodDiseased produces 0 DPS");
            //rot.Solver();
            //rot.ReportRotation();
            //Assert.IsTrue(rot.m_DPS > 0, "rotation solver produces 0 DPS");
        }
Beispiel #4
0
        public void DPSDK_BuildAcceptance()
        {
            Rawr.DPSDK.CalculationsDPSDK CalcDPSDK = new Rawr.DPSDK.CalculationsDPSDK();

            CalculationOptionsDPSDK calcOpts = new CalculationOptionsDPSDK();

            calcOpts.presence         = Rawr.DK.Presence.Frost;
            m_char.CalculationOptions = calcOpts;
            this.testContextInstance.BeginTimer("GetCalc");
            CharacterCalculationsBase calcs = CalcDPSDK.GetCharacterCalculations(m_char);

            calcs.GetCharacterDisplayCalculationValues();
            this.testContextInstance.EndTimer("GetCalc");
        }
Beispiel #5
0
        public void DPSDK_DPSMisMatch()
        {
            Rawr.DPSDK.CalculationsDPSDK CalcDPSDK = new Rawr.DPSDK.CalculationsDPSDK();

            CalculationOptionsDPSDK calcOpts = new CalculationOptionsDPSDK();

            calcOpts.presence         = Rawr.DK.Presence.Frost;
            m_char.CalculationOptions = calcOpts;
            CharacterCalculationsDPSDK calcs = CalcDPSDK.GetCharacterCalculations(m_char) as CharacterCalculationsDPSDK;

            calcs.GetCharacterDisplayCalculationValues();
            for (int i = 0; i < EnumHelper.GetCount(typeof(Rawr.DK.DKability)); i++)
            {
                Assert.IsTrue(calcs.dpsSub[i] <= calcs.damSub[i], string.Format("{0} Dam: {1} DPS: {2}",
                                                                                ((Rawr.DK.DKability)i).ToString(), calcs.damSub[i], calcs.dpsSub[i]));
                Assert.IsTrue(calcs.tpsSub[i] <= calcs.threatSub[i], string.Format("{0} Threat: {1} TPS: {2}",
                                                                                   ((Rawr.DK.DKability)i).ToString(), calcs.threatSub[i], calcs.tpsSub[i]));
            }
        }
Beispiel #6
0
        public Weapon(Item i, Stats stats, CalculationOptionsDPSDK calcOpts, BossOptions bossOpts, DeathKnightTalents talents, float expertise, CharacterSlot hand)
        {
            if (stats == null || calcOpts == null || !(hand == CharacterSlot.MainHand || hand == CharacterSlot.OffHand))
            {
                return;
            }

            if (i == null)
            {
                i           = new Item();
                i.Speed     = 2.0f;
                i.MinDamage = 0;
                i.MaxDamage = 0;
            }
            else
            {
                twohander = (i.Slot == ItemSlot.TwoHand);
            }

            effectiveExpertise = expertise;

            if (i == null)
            {
                return;
            }

            baseSpeed  = i.Speed;
            baseDamage = (float)(i.MinDamage + i.MaxDamage) / 2f + stats.WeaponDamage;

            #region Attack Speed
            {
                hastedSpeed = baseSpeed / (1 + stats.PhysicalHaste);
            }
            #endregion

            #region Dodge
            {
                float baseDodged = StatConversion.WHITE_DODGE_CHANCE_CAP[bossOpts.Level - 85];
                chanceDodged = baseDodged - StatConversion.GetDodgeParryReducFromExpertise(effectiveExpertise);
                chanceDodged = Math.Min(Math.Max(chanceDodged, 0f), baseDodged);
            }
            #endregion

            #region Parry
            {
                float baseParried = StatConversion.WHITE_PARRY_CHANCE_CAP[bossOpts.Level - 85];
                chanceParried = baseParried - StatConversion.GetDodgeParryReducFromExpertise(effectiveExpertise);
                chanceParried = Math.Min(Math.Max(chanceParried, 0f), baseParried);
            }
            #endregion

            #region Miss
            {
                float baseMissed = StatConversion.WHITE_MISS_CHANCE_CAP[bossOpts.Level - 85];
                if (!twohander)
                {
                    baseMissed = StatConversion.WHITE_MISS_CHANCE_CAP_DW[bossOpts.Level - 85];
                }
                chanceMissed = baseMissed - stats.PhysicalHit;
                chanceMissed = Math.Min(Math.Max(chanceMissed, 0f), baseMissed);
            }
            #endregion

#if DEBUG
            if (chanceDodged < 0 ||
                chanceParried < 0 ||
                chanceMissed < 0)
            {
                throw new Exception("Chance to hit out of range.");
            }
#endif
            #region White Damage
            {
                // White damage per hit.  Basic white hits are use elsewhere.
                float baseDPS = baseDamage / baseSpeed;
                damage = (baseDPS + (stats.AttackPower / 14.0f)) * baseSpeed;
                DPS    = damage / hastedSpeed;
                if (hand == CharacterSlot.OffHand)
                {
                    damage /= 2;
                    DPS    /= 2;
                    if (talents.NervesOfColdSteel > 0)
                    {
                        damage *= 1f + (.25f * (talents.NervesOfColdSteel / 3f));
                        DPS    *= 1f + (.25f * (talents.NervesOfColdSteel / 3f));;
                    }
                }
            }
            #endregion
        }