private void ShuffleSimRecipeConditionsClicked(object sender, RoutedEventArgs e)
        {
            bool isExpert = Sim.CurrentRecipe.Level == 481;

            Dictionary <double, RecipeCondition> Chances = new Dictionary <double, RecipeCondition>();

            if (isExpert)
            {
                Chances[0.12]                      = RecipeCondition.Good;
                Chances[0.12 + 0.15]               = RecipeCondition.Centered;
                Chances[0.12 + 0.15 + 0.12]        = RecipeCondition.Pliant;
                Chances[0.12 + 0.15 + 0.12 + 0.15] = RecipeCondition.Sturdy;
                Chances[1] = RecipeCondition.Normal;
            }
            else
            {
                Chances[0.2]        = RecipeCondition.Good;
                Chances[0.2 + 0.04] = RecipeCondition.Excellent;
                Chances[1]          = RecipeCondition.Normal;
            }

            Random r = new Random();

            bool nextShouldBePoor = false;

            for (int i = 0; i < Sim.StepSettings.Length; i++)
            {
                if (nextShouldBePoor)
                {
                    Sim.StepSettings[i].RecipeCondition = RecipeCondition.Poor;
                    nextShouldBePoor = false;
                    continue;
                }
                var             chance    = r.NextDouble();
                double          key       = Chances.Keys.FirstOrDefault(x => chance <= x);
                RecipeCondition condition = Chances[key];
                Sim.StepSettings[i].RecipeCondition = condition;
                if (condition == RecipeCondition.Excellent)
                {
                    nextShouldBePoor = true;
                }
            }

            SimulateConditions();
        }
Exemplo n.º 2
0
 public CraftingSimStepSettings()
 {
     RecipeCondition = RecipeCondition.Normal;
 }