Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- long cycleTest = 1;
- long totalLimit = 0;
- while (cookingTime > 0)
- {
- cookingTime -= cycleTest;
- totalLimit += (long)(cycleTest * temperature);
- foreach (Food f in ingredients)
- {
- if (totalLimit > f.limit * 12000)
- {//this ingredient is burning
- Console.Write("burning!");
- f.quality -= f.quality / 100f * cycleTest;
- f.deliciousness -= f.deliciousness / 100f * cycleTest;
- for (int i = 0; i < f.nutrients.Length; i++)
- {
- f.nutrients[i] -= (f.nutrients[i] / 100f) * cycleTest;
- }
- }
- else
- {
- f.idealTemp = (short)((f.idealTemp * 0.25f) + (93 * 0.75f));//moving ingredient idealTemp close to 93ºC
- short highLimit = (short)(f.idealTemp + (25 * f.resilience));
- short lowerLimit = (short)(f.idealTemp - (50 * f.resilience));
- if (temperature > highLimit)
- {
- f.rawValue += ((1 - f.rawValue) * (temperature / highLimit) / 100f) * cycleTest;
- f.quality -= (f.quality * (1 - (highLimit / temperature)) / 100f) * cycleTest;
- for (int i = 0; i < f.nutrients.Length; i++)
- {
- f.nutrients[i] -= (f.nutrients[i] * (1 - (f.idealTemp / temperature)) / 100f) * cycleTest;
- }
- }
- else if (temperature < lowerLimit)
- {
- f.quality -= (f.quality * (1 - (temperature / lowerLimit)) / 100f) * cycleTest;
- f.deliciousness -= (f.deliciousness * (1 - (temperature / f.idealTemp)) / 100f) * cycleTest;
- }
- else if (temperature > f.idealTemp)
- {
- f.quality += ((1 - f.quality) * (f.idealTemp / temperature) / 100f) * cycleTest;
- f.rawValue += ((1 - f.rawValue) * (temperature / highLimit) / 100f) * cycleTest;
- f.deliciousness += ((1 - f.deliciousness) * (temperature / f.idealTemp) / 100f) * cycleTest;
- for (int i = 0; i < f.nutrients.Length; i++)
- {
- f.nutrients[i] -= (f.nutrients[i] * (1 - (f.idealTemp / temperature)) / 100f) * cycleTest;
- }
- }
- else if (temperature < f.idealTemp)
- {
- f.quality += ((1 - f.quality) * (temperature / f.idealTemp) / 100f) * cycleTest;
- f.rawValue += ((1 - f.rawValue) * (temperature / highLimit) / 100f) * cycleTest;
- f.deliciousness -= (f.deliciousness * (1 - (temperature / f.idealTemp)) / 100f) * cycleTest;
- for (int i = 0; i < f.nutrients.Length; i++)
- {
- f.nutrients[i] += ((1 - f.nutrients[i]) * (temperature / f.idealTemp) / 100f) * cycleTest;
- }
- }
- else
- {//perfect temperature
- f.quality += (1 - f.quality) / 100f * cycleTest;
- f.rawValue += (1 - f.rawValue) / 100f * cycleTest;
- f.deliciousness += (1 - f.deliciousness) / 100f * cycleTest;
- for (int i = 0; i < f.nutrients.Length; i++)
- {
- f.nutrients[i] += ((1 - f.nutrients[i]) / 100f) * cycleTest;
- }
- }
- }
- if (totalLimit >= f.cookPoint * 6000)
- {
- f.rawValue = 1;
- }
- }
- }
- string name = "";
- FoodType type = FoodType.soup;
- short calories = 0;
- short unitsOfMass = (short)totalMass;
- short idealTemp = 93;
- float water = 0;
- float fat = 0;
- float resilience = 0;
- long cookPoint = 0;
- long limit = 0;
- float rawValue = 0;
- float deliciousness = 0;
- float quality = 0;
- bool leaveningAgent = false;
- float[] tastes = new float[7];
- float[] nutrients = new float[5];
- List<Food> mainIngredients = new List<Food>();
- float largestAmount = 0;
- long shelfTime = 48;
- float freshness = 1;
- foreach (Food f in ingredients){
- if (largestAmount < f.unitsOfMass){
- if ((f.rawValue >= 1 && !f.liquidCooked) || (f.rawValue < 1 && !f.liquidRaw)){
- largestAmount = f.unitsOfMass;
- }
- }
- float percent = (f.unitsOfMass / totalMass);
- calories += (short)(f.calories * percent);
- water += (f.water * percent);
- fat += (f.fat * percent);
- resilience += (f.resilience * percent);
- limit += (long)(f.limit * percent);
- rawValue += (f.rawValue * percent);
- deliciousness += (f.deliciousness * percent * f.rawValue);
- float q = f.quality * (1 + (f.freshness * 0.3f));
- quality += percent * (q < 1 ? q : 1);
- for (int i = 0; i < tastes.Length; i++){
- tastes[i] += (f.tastes[i] * percent);
- }
- for (int i = 0; i < nutrients.Length; i++){
- nutrients[i] += (f.nutrients[i] * percent * f.rawValue);
- }
- }
- foreach (Food f in ingredients){
- if (f.unitsOfMass >= 0.95 * largestAmount)
- {//if it is at least 95% of the largest ingredient it counts as a main ingredient
- mainIngredients.Add(f);
- }
- }
- string mainingnames = mainIngredients[0].name;
- for (int i = 1; i < mainIngredients.Count - 1; i++){
- mainingnames += ", " + mainIngredients[i];
- }
- if (mainIngredients.Count > 1){
- mainingnames += "and " + mainIngredients[mainIngredients.Count];
- }
- bool liquidRaw = liquid;
- bool liquidCooked = liquid;
- name = dishName.Replace("?", mainingnames);
- return new Dish(0, name, type, water, fat, deliciousness, resilience, freshness, quality, cookPoint, limit, shelfTime, rawValue, unitsOfMass, idealTemp, calories, nutrients, tastes, leaveningAgent, ingredients, liquidRaw, liquidCooked);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement