1using System.Collections.Generic;
24 List<Element> list =
new List<Element>();
25 foreach (
Element value
in t.elements.dict.Values)
34 Element element = list.RandomItem();
36 if (element.
Value > 60)
38 t.elements.SetTo(element.
id, 60);
48 if (t.elements.dict.ContainsKey(e.id))
56 t.elements.SetBase(row.
id, 1);
64 List<Thing> list =
new List<Thing>();
66 Debug.Log(recipeSource);
67 if (recipeSource ==
null)
75 if (thing.
id ==
"deadbody")
88 MakeDish(
food, list, num, crafter);
89 if (crafter !=
null && crafter.id !=
"rodwyn")
91 if (
food.HasElement(709))
93 food.elements.Remove(709);
95 if (
food.HasElement(708) && !crafter.HasElement(1205))
97 food.elements.Remove(708);
105 for (
int i = 0; i < 4 +
EClass.
rnd(4); i++)
108 WrapIngredient(thing, c, GetRandomDarkSoupIngredient(c),
WrapType.Dark);
112 thing.c_IDTState = 1;
126 int num = c.uid + EClass.world.date.year * 10000 + EClass.world.date.month * 100;
128 float num2 = Mathf.Clamp(1f + Mathf.Sqrt(c.
Evalue(287) / 5), 2f, 6f);
131 thing.c_IDTState = 5;
133 for (
int i = 0; (float)i < num2; i++)
136 WrapIngredient(thing, c, GetRandomLoveLunchIngredient(c),
WrapType.Love);
139 if (thing.
Evalue(753) < 0)
150 for (
int i = 0; i < 3; i++)
158 MakeDish(thing, c.
LV, c);
169 foreach (
Element value
in ing.elements.dict.Values)
171 if (!IsValidTrait(value))
177 int num = value.
Value;
178 if (ing.id ==
"lunch_dystopia" && (wrapType ==
WrapType.Dark || num < 0))
182 product.elements.ModBase(value.
id, num);
186 int num2 = product.elements.Base(value.
id);
187 if ((num2 <= 0 && value.
Value < 0 && value.
Value < num2) || (value.
Value > 0 && value.
Value > num2))
189 product.elements.SetTo(value.
id, value.
Value);
193 product.elements.ModBase(10, ing.Evalue(10));
194 static bool IsValidTrait(
Element e)
196 if (e.
HasTag(
"noInherit"))
210 List<Thing> list =
new List<Thing>();
211 bool flag =
food.sourceCard.vals.Contains(
"fixed");
212 for (
int i = 0; i < ings.Count; i++)
214 Thing thing = ings[i];
220 if (!IsIgnoreName(thing))
227 Thing thing2 = list.RandomItem();
230 food.MakeRefFrom(thing2);
234 food.c_altName =
food.TryGetFoodName(thing2);
235 if (thing2.
id ==
"_egg" || thing2.
id ==
"egg_fertilized")
237 food.c_altName =
"_egg".lang(
food.c_altName);
242 MixIngredients(
food, ings,
MixType.Food, qualityBonus, crafter);
243 static bool IsIgnoreName(
Card t)
268 MixIngredients(thing, ings, type, 999, crafter);
275 bool isFood = type ==
MixType.Food;
276 int nutFactor = 100 - (ings.Count - 1) * 5;
277 Thing thing = ((ings.Count > 0) ? ings[0] :
null);
278 bool creative = crafter?.
HasElement(487) ??
false;
279 if (crafter !=
null && crafter.Evalue(1650) >= 3)
288 if ((uint)(
id - 914) > 1u && value2.
Value >= 0 && (value2.
HasTag(
"noInherit") || IsValidTrait(value2)))
308 foreach (
Thing ing
in ings)
324 product.isWeightChanged =
true;
325 product.c_weight = num;
326 product.c_priceAdd = num2;
328 product.c_priceCopy = num3;
331 product.elements.SetTo(10, thing.Evalue(10) / 4);
332 product.isWeightChanged =
true;
333 product.c_weight = Mathf.Min(thing.SelfWeight / 6, 1000);
334 product.c_idRefCard = thing.id;
335 product.c_priceCopy = ((thing.c_priceCopy == 0) ? thing.GetValue() : thing.c_priceCopy);
336 product.c_fixedValue = ((thing.c_fixedValue == 0) ? thing.sourceCard.value : thing.c_fixedValue) / 4;
337 product.c_priceAdd = 0;
338 product.decay = thing.decay;
339 product.elements.SetBase(707, 1);
340 product.SetTier(thing.tier, setTraits:
false);
341 product.idSkin = ((thing.trait is
TraitFoodFishSlice) ? thing.idSkin : (thing.HasTag(
CTAG.bigFish) ? 1 : 0));
343 if (product.HasElement(652))
345 product.ChangeWeight((isFood ? num : product.Thing.source.weight) * 100 / (100 + product.Evalue(652)));
347 if (product.elements.Value(2) > maxQuality)
349 product.elements.SetTo(2, maxQuality);
351 string id2 = product.id;
352 if (!(id2 ==
"zassouni"))
356 int num4 = 1 + product.Evalue(2) + product.Evalue(751);
361 foreach (
Thing ing2
in ings)
363 if (ing2 !=
null && ing2.
Thing !=
null && !(ing2.
id !=
"gem"))
365 num4 *= ing2.Thing.material.hardness / 20 + 2;
370 num4 = EClass.pc.FameLv + 10 - 1;
372 product.SetInt(25, num4);
377 product.elements.ModBase(10, 6);
379 if (product.HasElement(762))
381 product.elements.ModBase(10, product.Evalue(762) / 5);
382 if (product.Evalue(10) < 1)
384 product.elements.SetTo(10, 1);
387 if (creative && isFood && product.category.IsChildOf(
"meal"))
389 product.elements.SetBase(764, 1);
394 if (e.
HasTag(
"noInherit"))
407 return product.IsInheritFoodTraits;
419 void MixElements(
Card t)
425 if (IsValidTrait(value3) && (!
noMix || value3.
id == 2))
429 int num5 = value3.
Value;
430 if (product.id ==
"lunch_dystopia")
434 if (creative && num5 > 500)
438 product.elements.ModBase(value3.
id, num5);
442 int num6 = product.elements.Base(value3.
id);
443 if ((num6 <= 0 && value3.
Value < 0 && value3.
Value < num6) || (value3.
Value > 0 && value3.
Value > num6))
445 product.elements.SetTo(value3.
id, value3.
Value);
452 product.elements.ModBase(10, t.
Evalue(10) * nutFactor / 100);
Thing TryMakeRandomItem(int lv=-1, TryMakeRandomItemSource itemSource=TryMakeRandomItemSource.Default, Chara crafter=null)
void MakeRefFrom(string id)
ElementContainerCard elements
bool HasElement(int ele, int req=1)
Card ChangeMaterial(int idNew, bool ignoreFixedMaterial=false)
MixedFoodData c_mixedFoodData
bool HasCraftBonusTrait()
virtual CardRow sourceCard
List< Element > ListCraftBonusTraits()
Thing Add(string id, int num=1, int lv=1)
int GetValue(PriceType priceType=PriceType.Default, bool sell=false)
static Thing GetRandomDarkSoupIngredient(Chara c)
static Thing MakeLoveLunch(Chara c)
static void WrapIngredient(Card product, Chara c, Card ing, WrapType wrapType)
static Thing MakeDarkSoup()
static void MakeDish(Thing food, int lv, Chara crafter=null)
static void MakeDish(Card food, List< Thing > ings, int qualityBonus, Chara crafter=null)
static void AddRandomFoodEnc(Thing t)
static Thing MixIngredients(string idProduct, List< Thing > ings, MixType type, int idMat=0, Chara crafter=null)
static void ModRandomFoodEnc(Thing t)
static string[] ListFoodEffect
static Thing GetRandomLoveLunchIngredient(Chara c)
static Card MixIngredients(Card product, List< Thing > ings, MixType type, int maxQuality, Chara crafter=null)
static SourceManager sources
Dictionary< int, Element > dict
Element ModBase(int ele, int v)
void SetTo(int id, int v)
Element SetBase(string alias, int v, int potential=0)
static void SetSeed(int a=-1)
static RecipeSource Get(string id)
List< Recipe.Ingredient > GetIngredients()
static Thing CreateFromFilter(string id, int lv=-1)
static Thing Create(string id, int idMat=-1, int lv=-1)
static void LevelSeed(Thing t, SourceObj.Row obj, int num)