public override void Initialize() { Logger.Write("*** Default Combat v90***"); Logger.Write("Level: " + BuddyTor.Me.Level); Logger.Write("Class: " + Class); Logger.Write("Advanced Class: " + BuddyTor.Me.AdvancedClass); Logger.Write("Discipline: " + BuddyTor.Me.Discipline); var f = new RotationFactory(); var b = f.Build(BuddyTor.Me.Discipline.ToString()); CombatHotkeys.Initialize(); if (b == null) { b = f.Build(BuddyTor.Me.CharacterClass.ToString()); } Logger.Write("Rotation Selected : " + b.Name); if (BuddyTor.Me.IsHealer()) { IsHealer = true; Logger.Write("Healing Enabled"); } _ooc = new Decorator(ret => !BuddyTor.Me.IsDead && !BuddyTor.Me.IsMounted && !CombatHotkeys.PauseRotation, new PrioritySelector( Spell.Buff(BuddyTor.Me.SelfBuffName()), b.Buffs, Rest.HandleRest, Scavenge.ScavengeCorpse )); _combat = new Decorator(ret => !CombatHotkeys.PauseRotation, new PrioritySelector( Spell.WaitForCast(), s_medPack.UseItem(ret => BuddyTor.Me.HealthPercent <= 30), Targeting.ScanTargets, b.Cooldowns, new Decorator(ret => CombatHotkeys.EnableAoe, b.AreaOfEffect), b.SingleTarget)); _pull = new Decorator(ret => !CombatHotkeys.PauseRotation && !MovementDisabled || IsHealer && !Grind, _combat ); }
static double RunSimulation(StatsGroup stats, RotationFactory rotation, bool enableLogging = false) { double totalPotency = 0; if (CurrentSimulationRules is DeterministicSimulator) { Battle battle = new Battle(new DeterministicSimulator(), sampleDuration); if (enableLogging) { battle.Logger += Console.WriteLine; } WarriorOfLight hero = rotation(battle, stats); battle.Simulate(hero); totalPotency = battle.TotalPotency; if (enableLogging) { Console.WriteLine(); Console.WriteLine("Breakdown by Ability"); foreach (var breakdown in battle.PotencyBySource) { double percent = breakdown.Value / battle.TotalPotency * 100; Console.WriteLine($" {breakdown.Key}: {breakdown.Value:#.0} ({percent:0.00}%)"); } } } else if (CurrentSimulationRules is RandomSimulator) { double[] potencies = new double[monteCarloCount]; Stopwatch timer = new Stopwatch(); timer.Start(); int count = 0; Battle firstBattle = new Battle(new RandomSimulator(), sampleDuration); { WarriorOfLight hero = rotation(firstBattle, stats); firstBattle.Simulate(hero); potencies[0] = firstBattle.TotalPotency; } Parallel.For(1, monteCarloCount, (i) => { if (timer.Elapsed > monteCarloDuration) { return; } Battle battle = new Battle(new RandomSimulator(), sampleDuration); WarriorOfLight hero = rotation(battle, stats); battle.Simulate(hero); potencies[i] = battle.TotalPotency; }); timer.Stop(); double minPotency = double.MaxValue, maxPotency = double.MinValue; for (int i = 0; i < monteCarloCount; ++i) { totalPotency += potencies[i]; if (potencies[i] != 0) { minPotency = Math.Min(minPotency, potencies[i]); maxPotency = Math.Max(maxPotency, potencies[i]); count++; } } totalPotency /= count; if (enableLogging) { foreach (var breakdown in firstBattle.PotencyBySource) { double percent = breakdown.Value / firstBattle.TotalPotency * 100; Console.WriteLine($" {breakdown.Key}: {breakdown.Value:#.0} ({percent:0.00}%)"); } Console.WriteLine(); Console.WriteLine($"Over {count} trials, PPS ranged from {minPotency / sampleDuration:#.0} to {maxPotency / sampleDuration:#.0}"); } } return(totalPotency); }