Beispiel #1
0
        public RefineResults Run(RefineSimulationParameters parameters, RefineCosts costs)
        {
            var refiner = new Refiner(parameters.Item, parameters.StartingLevel, parameters.RefineSteps);
            var counts  = new RefineCounts();

            for (int i = 0; i < parameters.Attempts; i++)
            {
                refiner.Item.ItemState   = ItemState.Valid;
                refiner.Item.RefineLevel = parameters.StartingLevel;

                while (refiner.Item.RefineLevel < parameters.SuccessLevel && refiner.Item.ItemState == ItemState.Valid)
                {
                    var method = parameters.RefineSteps[refiner.Item.RefineLevel];
                    refiner.RefineItem();

                    TickRefineCounts(counts, method, refiner.Item);

                    if (refiner.Item.ItemState == ItemState.Broken)
                    {
                        counts.BrokenItems++;
                        if (parameters.RepairOnBroken)
                        {
                            refiner.Item.ItemState = ItemState.Valid;
                            counts.RepairedItems++;
                        }
                        else // Downgrade
                        {
                            refiner.Item.RefineLevel = 9;
                            refiner.Item.ItemState   = ItemState.Valid;
                        }
                    }
                }

                if (refiner.Item.RefineLevel == parameters.SuccessLevel && refiner.Item.ItemState == ItemState.Valid)
                {
                    counts.Successes++;
                }

                counts.Attempts++;
            }

            return(BuildRefineResults(parameters.Item, counts, costs));
        }
Beispiel #2
0
        public List <RefineResults> Run()
        {
            var simParameters = new RefineSimulationParameters
            {
                Attempts       = Attempts,
                RepairOnBroken = true,
                StartingLevel  = Item.SafeLevel,
                SuccessLevel   = 10,
                Item           = Item
            };

            var refineCombinations = GetRefineCombinations();
            var costs = new RefineCosts()
            {
                ItemCost = ItemCost
            };

            var resultHistory = new List <RefineResults>();
            var runner        = new RefineSimulationRunner();

            for (int i = 0; i < refineCombinations.Count; i++)
            {
                Console.WriteLine($"Computing combination {i + 1} of {refineCombinations.Count}");

                var refineSteps = GetDefaultRefineSteps();
                for (int j = 0; j < refineCombinations[i].Count; j++)
                {
                    refineSteps[j + simParameters.StartingLevel] = refineCombinations[i][j];
                }

                simParameters.RefineSteps = refineSteps;
                var results = runner.Run(simParameters, costs);
                results.RefineSteps = refineCombinations[i];

                resultHistory.Add(results);
            }

            return(resultHistory);
        }