1using System.Collections.Generic;
25 List<Element> list =
new List<Element>();
26 foreach (
Element value
in t.elements.dict.Values)
35 Element element = list.RandomItem();
37 if (element.
Value > 60)
39 t.elements.SetTo(element.
id, 60);
49 if (t.elements.dict.ContainsKey(e.id))
57 t.elements.SetBase(row.
id, 1);
65 List<Thing> list =
new List<Thing>();
67 if (recipeSource ==
null || !recipeSource.
IsCraftable())
77 if (thing.
id ==
"deadbody")
92 MakeDish(
food, list, num, crafter);
93 if (crafter !=
null && crafter.id !=
"rodwyn")
95 if (
food.HasElement(709))
97 food.elements.Remove(709);
99 if (
food.HasElement(708) && !crafter.HasElement(1205))
101 food.elements.Remove(708);
123 for (
int i = 0; i < num; i++)
126 string[] textArray = element.
source.GetTextArray(
"textAlt");
127 int num2 = Mathf.Clamp(element.
Value / 10 + 1, (element.
Value < 0 || textArray.Length <= 2) ? 1 : 2, textArray.Length - 1);
128 string text2 = textArray[num2];
137 text =
" (" + text +
")";
145 foreach (
Element value
in food.elements.dict.Values)
158 if (c_bloodData ==
null)
165 sucker.
Say(
"food_blood", c_bloodData);
167 MakeDish(c_bloodData, 100,
null, num + feeder.
uid);
171 feeder.c_bloodData = c_bloodData.
Duplicate(1);
178 sucker.
Say(
"food_blood", c_bloodData);
182 c_bloodData.
elements.
ModBase(710, 15 + (
int)Mathf.Min(Mathf.Sqrt(sucker.
Evalue(6607) + Mathf.Max(sucker.
LER, 0)), 55f));
188 Thing thing = MakeBloodMeal(sucker, feeder);
190 foreach (
Element value
in thing.elements.dict.Values)
194 thing2.elements.SetTo(10, 0);
195 thing2.MakeRefFrom(feeder);
196 thing2.c_idRefCard = thing.id;
204 for (
int i = 0; i < 4 +
EClass.
rnd(4); i++)
207 WrapIngredient(thing, c, GetRandomDarkSoupIngredient(c),
WrapType.Dark);
211 thing.c_IDTState = 1;
225 int num = c.uid + EClass.world.date.year * 10000 + EClass.world.date.month * 100;
227 float num2 = Mathf.Clamp(1f + Mathf.Sqrt(c.
Evalue(287) / 5), 2f, 6f);
230 thing.c_IDTState = 5;
232 for (
int i = 0; (float)i < num2; i++)
235 WrapIngredient(thing, c, GetRandomLoveLunchIngredient(c),
WrapType.Love);
238 if (thing.
Evalue(753) < 0)
253 for (
int i = 0; i < 3; i++)
261 MakeDish(thing, c.
LV, c);
272 foreach (
Element value
in ing.elements.dict.Values)
274 if (!IsValidTrait(value))
280 int num = value.
Value;
281 if (ing.id ==
"lunch_dystopia" && (wrapType ==
WrapType.Dark || num < 0))
285 product.elements.ModBase(value.
id, num);
289 int num2 = product.elements.Base(value.
id);
290 if ((num2 <= 0 && value.
Value < 0 && value.
Value < num2) || (value.
Value > 0 && value.
Value > num2))
292 product.elements.SetTo(value.
id, value.
Value);
296 product.elements.ModBase(10, ing.Evalue(10));
297 static bool IsValidTrait(
Element e)
299 if (e.
HasTag(
"noInherit"))
313 List<Thing> list =
new List<Thing>();
314 bool flag =
food.sourceCard.vals.Contains(
"fixed");
315 for (
int i = 0; i < ings.Count; i++)
317 Thing thing = ings[i];
323 if (!IsIgnoreName(thing))
330 Thing thing2 = list.RandomItem();
333 food.MakeRefFrom(thing2);
337 food.c_altName =
food.TryGetFoodName(thing2);
338 if (thing2.
id ==
"_egg" || thing2.
id ==
"egg_fertilized")
340 food.c_altName =
"_egg".lang(
food.c_altName);
345 MixIngredients(
food, ings,
MixType.Food, qualityBonus, crafter);
346 static bool IsIgnoreName(
Card t)
371 MixIngredients(thing, ings, type, 999, crafter);
378 bool isFood = type ==
MixType.Food;
379 bool isDrink = type ==
MixType.Drink;
380 bool isFoodOrDrink = isFood || isDrink;
381 int nutFactor = 100 - (ings.Count - 1) * 5;
382 Thing thing = ((ings.Count > 0) ? ings[0] :
null);
383 bool creative = crafter?.
HasElement(487) ??
false;
384 if (crafter !=
null && crafter.Evalue(1650) >= 3)
390 nutFactor = 100 / ings.Count;
397 if ((uint)(
id - 914) > 1u && value2.
Value >= 0 && (value2.
HasTag(
"noInherit") || IsValidTrait(value2)))
421 foreach (
Thing ing
in ings)
433 if (product.id ==
"1300" && product.GetInt(118) == 0)
435 product.SetInt(118, ing.
GetInt(118));
442 product.isWeightChanged =
true;
443 product.c_weight = num;
444 product.c_priceAdd = num2;
446 product.c_priceCopy = num3;
449 product.elements.SetTo(10, thing.Evalue(10) / 4);
450 product.isWeightChanged =
true;
451 product.c_weight = Mathf.Min(thing.SelfWeight / 6, 1000);
452 product.c_idRefCard = thing.id;
453 product.c_priceCopy = ((thing.c_priceCopy == 0) ? thing.GetValue() : thing.c_priceCopy);
454 product.c_fixedValue = ((thing.c_fixedValue == 0) ? thing.sourceCard.value : thing.c_fixedValue) / 4;
455 product.c_priceAdd = 0;
456 product.decay = thing.decay;
457 product.elements.SetBase(707, 1);
458 product.SetTier(thing.tier, setTraits:
false);
459 product.idSkin = ((thing.trait is
TraitFoodFishSlice) ? thing.idSkin : (thing.HasTag(
CTAG.bigFish) ? 1 : 0));
461 if (product.HasElement(652))
463 product.ChangeWeight((isFood ? num : product.Thing.source.weight) * 100 / (100 + product.Evalue(652)));
465 if (product.elements.Value(2) > maxQuality)
467 product.elements.SetTo(2, maxQuality);
469 string id2 = product.id;
470 if (!(id2 ==
"zassouni"))
474 int num4 = 1 + product.Evalue(2) + product.Evalue(751);
479 foreach (
Thing ing2
in ings)
481 if (ing2 !=
null && ing2.
Thing !=
null && !(ing2.
id !=
"gem"))
483 num4 *= ing2.Thing.material.hardness / 20 + 2;
488 num4 = EClass.pc.FameLv + 10 - 1;
490 product.SetInt(25, num4);
495 product.elements.ModBase(10, 6);
497 if (product.HasElement(762))
499 product.elements.ModBase(10, product.Evalue(762) / 5);
500 if (product.Evalue(10) < 1)
502 product.elements.SetTo(10, 1);
505 if (creative && isFood && product.category.IsChildOf(
"meal"))
507 product.elements.SetBase(764, 1);
512 if (e.
HasTag(
"noInherit"))
525 return product.IsInheritFoodTraits;
538 void MixElements(
Card t)
544 if (IsValidTrait(value3) && (!
noMix || value3.
id == 2))
548 int num5 = value3.
Value;
549 if (product.id ==
"lunch_dystopia")
553 if (creative && num5 > 500)
557 product.elements.ModBase(value3.
id, num5);
561 int num6 = product.elements.Base(value3.
id);
562 if ((num6 <= 0 && value3.
Value < 0 && value3.
Value < num6) || (value3.
Value > 0 && value3.
Value > num6))
564 product.elements.SetTo(value3.
id, value3.
Value);
571 product.elements.ModBase(10, t.
Evalue(10) * nutFactor / 100);
575 product.elements.ModBase(10, Mathf.CeilToInt((
float)t.
Evalue(10) * (
float)nutFactor / 100f));
Thing TryMakeRandomItem(int lv=-1, TryMakeRandomItemSource itemSource=TryMakeRandomItemSource.Default, Chara crafter=null)
ElementContainerCard elements
Card ChangeMaterial(int idNew, bool ignoreFixedMaterial=false)
Card MakeRefFrom(string id)
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)
int GetInt(string id, int? defaultInt=null)
bool HasElement(int ele, bool includeNagative=false)
void Say(string lang, string ref1=null, string ref2=null)
static int GetFoodScore(Thing food)
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 Thing MakeBloodSample(Chara sucker, Chara feeder)
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 Thing MakeBloodMeal(Chara sucker, Chara feeder, bool msg=true)
static void ModRandomFoodEnc(Thing t)
static string[] ListFoodEffect
static Thing GetRandomLoveLunchIngredient(Chara c)
static void MakeDish(Thing food, int lv, Chara crafter=null, int seed=-1)
static string GetBloodText(Chara c)
static Card MixIngredients(Card product, List< Thing > ings, MixType type, int maxQuality, Chara crafter=null)
static int curve(long _a, int start, int step, int rate=75)
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 CreateFromCategory(string idCat, int lv=-1)
static Thing Create(string id, int idMat=-1, int lv=-1)
static void LevelSeed(Thing t, SourceObj.Row obj, int num)