public void GetDRAvoidanceChanceTest_DK_TestFromForums() { ItemInstance[] IIArray = new ItemInstance[1]; Character toon = new Character("TestDK", "Malygos", CharacterRegion.US, CharacterRace.Human, new BossOptions(), IIArray, new System.Collections.Generic.List <Buff>(), "TankDK"); // TODO: Initialize to an appropriate value Assert.IsNotNull(toon); //toon.Level = 80; //Asumption here. toon.Class = CharacterClass.DeathKnight; Stats stats = new Stats(); stats += BaseStats.GetBaseStats(toon); stats.Miss += .03f; // 3% Miss from talents stats.Defense = 425; // 25 Def from SSG rune stats.Dodge += .05f; // 5% dodge from talents. stats.DefenseRating = 566f; uint TargetLevel = 83; //float levelDiff = 0.006f; float[] expected = new float[HitResultCount]; expected[(int)HitResult.Miss] = 0.121f; expected[(int)HitResult.Dodge] = 0.134f; expected[(int)HitResult.Parry] = 0.098f; expected[(int)HitResult.Block] = .05f; expected[(int)HitResult.Crit] = .05f; expected[(int)HitResult.AnyMiss] = 0; expected[(int)HitResult.AnyHit] = 0; expected[(int)HitResult.Glance] = .05f; expected[(int)HitResult.Resist] = .05f; expected[(int)HitResult.Hit] = .05f; // Iterate through the hit result types. for (HitResult i = 0; i < (HitResult)HitResultCount; i++) { float actual = (float)System.Math.Round((double)StatConversion.GetDRAvoidanceChance(toon, stats, i, TargetLevel), 3); Assert.AreEqual(expected[(int)i], actual, i.ToString()); } }
public void TestMultipleFailConditions(HitResult resultApplied) { var beatmap = createBeatmap(0, 1000); createProcessor(beatmap); AddStep("setup multiple fail conditions", () => { processor.FailConditions += ((_, result) => result.Type == HitResult.Miss); processor.FailConditions += ((_, result) => result.Type == HitResult.Meh); }); AddStep("apply perfect hit result", () => processor.ApplyResult(new JudgementResult(beatmap.HitObjects[0], new Judgement()) { Type = HitResult.Perfect })); AddAssert("not failed", () => !processor.HasFailed); AddStep($"apply {resultApplied.ToString().ToLower()} hit result", () => processor.ApplyResult(new JudgementResult(beatmap.HitObjects[0], new Judgement()) { Type = resultApplied })); AddAssert("failed", () => processor.HasFailed); }