示例#1
0
        // -------------------------------------------------------------------
        // Private
        // -------------------------------------------------------------------
        private SimulationStats Simulate(Simulation simulation)
        {
            Diagnostic.Info("Starting simulation for " + simulation.Class);

            // Create the struct and pass it to the logic
            ISimulationData simulationData = new SimulationData(this.data, simulation, this.randomValues);

            // Todo: choose which modules to use
            IList<ISimulationModule> modules = new List<ISimulationModule>
                                                   {
                                                       new SimulationBasicAttack()
                                                   };

            if (simulationData.Class.Skills != null)
            {
                foreach (D3Skill skill in simulationData.Class.Skills)
                {
                    modules.Add(new SimulationBasicSkill(skill.Name));
                }
            }

            foreach (ISimulationModule module in modules)
            {
                simulationData.ClearTargets();
                simulationData.CurrentTime = 0.0f;
                SimulationSampleSet sampleSet = module.Simulate(simulationData);
                if (sampleSet == null)
                {
                    Diagnostic.Warning("No sample returned for {0}", module.Name);
                    continue;
                }

                simulationData.Stats.SampleSets.Add(sampleSet);
            }

            return simulationData.Stats;
        }
示例#2
0
        public static Simulation GetDefaultSimulation()
        {
            var sim = new Simulation
                          {
                              Attributes = new Dictionary<D3Attribute, float>
                                      {
                                          { D3Attribute.Dex, 10 },
                                          { D3Attribute.Vit, 10 },
                                      },
                              Class = "Demon Hunter",
                              TargetCountMin = 1,
                              TargetCountMax = 4,
                              Seconds = 60,
                              Gear = new List<D3Gear>
                                         {
                                             new D3Gear
                                                 {
                                                     Name = "MainHand",
                                                     Attributes = new Dictionary<D3Attribute, float>
                                                                      {
                                                                          { D3Attribute.DmgMin, 10.0f },
                                                                          { D3Attribute.DmgMax, 20.0f },
                                                                          { D3Attribute.AttackSpeed, 1.0f },
                                                                      }
                                                 }
                                         }
                          };

            return sim;
        }