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 if (recipeSource ==
null || !recipeSource.
IsCraftable())
76 if (thing.
id ==
"deadbody")
91 MakeDish(
food, list, num, crafter);
92 if (crafter !=
null && crafter.id !=
"rodwyn")
94 if (
food.HasElement(709))
96 food.elements.Remove(709);
98 if (
food.HasElement(708) && !crafter.HasElement(1205))
100 food.elements.Remove(708);
122 for (
int i = 0; i < num; i++)
125 string[] textArray = element.
source.GetTextArray(
"textAlt");
126 int num2 = Mathf.Clamp(element.
Value / 10 + 1, (element.
Value < 0 || textArray.Length <= 2) ? 1 : 2, textArray.Length - 1);
127 string text2 = textArray[num2];
136 text =
" (" + text +
")";
144 foreach (
Element value
in food.elements.dict.Values)
157 if (c_bloodData ==
null)
164 sucker.
Say(
"food_blood", c_bloodData);
166 MakeDish(c_bloodData, 100,
null, num + feeder.
uid);
170 feeder.c_bloodData = c_bloodData.
Duplicate(1);
177 sucker.
Say(
"food_blood", c_bloodData);
181 c_bloodData.
elements.
ModBase(710, 15 + (
int)Mathf.Min(Mathf.Sqrt(sucker.
Evalue(6607) + Mathf.Max(sucker.
LER, 0)), 55f));
187 Thing thing = MakeBloodMeal(sucker, feeder);
189 foreach (
Element value
in thing.elements.dict.Values)
193 thing2.elements.SetTo(10, 0);
194 thing2.MakeRefFrom(feeder);
195 thing2.c_idRefCard = thing.id;
203 for (
int i = 0; i < 4 +
EClass.
rnd(4); i++)
206 WrapIngredient(thing, c, GetRandomDarkSoupIngredient(c),
WrapType.Dark);
210 thing.c_IDTState = 1;
224 int num = c.uid + EClass.world.date.year * 10000 + EClass.world.date.month * 100;
226 float num2 = Mathf.Clamp(1f + Mathf.Sqrt(c.
Evalue(287) / 5), 2f, 6f);
229 thing.c_IDTState = 5;
231 for (
int i = 0; (float)i < num2; i++)
234 WrapIngredient(thing, c, GetRandomLoveLunchIngredient(c),
WrapType.Love);
237 if (thing.
Evalue(753) < 0)
252 for (
int i = 0; i < 3; i++)
260 MakeDish(thing, c.
LV, c);
271 foreach (
Element value
in ing.elements.dict.Values)
273 if (!IsValidTrait(value))
279 int num = value.
Value;
280 if (ing.id ==
"lunch_dystopia" && (wrapType ==
WrapType.Dark || num < 0))
284 product.elements.ModBase(value.
id, num);
288 int num2 = product.elements.Base(value.
id);
289 if ((num2 <= 0 && value.
Value < 0 && value.
Value < num2) || (value.
Value > 0 && value.
Value > num2))
291 product.elements.SetTo(value.
id, value.
Value);
295 product.elements.ModBase(10, ing.Evalue(10));
296 static bool IsValidTrait(
Element e)
298 if (e.
HasTag(
"noInherit"))
312 List<Thing> list =
new List<Thing>();
313 bool flag =
food.sourceCard.vals.Contains(
"fixed");
314 for (
int i = 0; i < ings.Count; i++)
316 Thing thing = ings[i];
322 if (!IsIgnoreName(thing))
329 Thing thing2 = list.RandomItem();
332 food.MakeRefFrom(thing2);
336 food.c_altName =
food.TryGetFoodName(thing2);
337 if (thing2.
id ==
"_egg" || thing2.
id ==
"egg_fertilized")
339 food.c_altName =
"_egg".lang(
food.c_altName);
344 MixIngredients(
food, ings,
MixType.Food, qualityBonus, crafter);
345 static bool IsIgnoreName(
Card t)
370 MixIngredients(thing, ings, type, 999, crafter);
377 bool isFood = type ==
MixType.Food;
378 int nutFactor = 100 - (ings.Count - 1) * 5;
379 Thing thing = ((ings.Count > 0) ? ings[0] :
null);
380 bool creative = crafter?.
HasElement(487) ??
false;
381 if (crafter !=
null && crafter.Evalue(1650) >= 3)
390 if ((uint)(
id - 914) > 1u && value2.
Value >= 0 && (value2.
HasTag(
"noInherit") || IsValidTrait(value2)))
410 foreach (
Thing ing
in ings)
422 if (product.id ==
"1300" && product.GetInt(118) == 0)
424 product.SetInt(118, ing.
GetInt(118));
431 product.isWeightChanged =
true;
432 product.c_weight = num;
433 product.c_priceAdd = num2;
435 product.c_priceCopy = num3;
438 product.elements.SetTo(10, thing.Evalue(10) / 4);
439 product.isWeightChanged =
true;
440 product.c_weight = Mathf.Min(thing.SelfWeight / 6, 1000);
441 product.c_idRefCard = thing.id;
442 product.c_priceCopy = ((thing.c_priceCopy == 0) ? thing.GetValue() : thing.c_priceCopy);
443 product.c_fixedValue = ((thing.c_fixedValue == 0) ? thing.sourceCard.value : thing.c_fixedValue) / 4;
444 product.c_priceAdd = 0;
445 product.decay = thing.decay;
446 product.elements.SetBase(707, 1);
447 product.SetTier(thing.tier, setTraits:
false);
448 product.idSkin = ((thing.trait is
TraitFoodFishSlice) ? thing.idSkin : (thing.HasTag(
CTAG.bigFish) ? 1 : 0));
450 if (product.HasElement(652))
452 product.ChangeWeight((isFood ? num : product.Thing.source.weight) * 100 / (100 + product.Evalue(652)));
454 if (product.elements.Value(2) > maxQuality)
456 product.elements.SetTo(2, maxQuality);
458 string id2 = product.id;
459 if (!(id2 ==
"zassouni"))
463 int num4 = 1 + product.Evalue(2) + product.Evalue(751);
468 foreach (
Thing ing2
in ings)
470 if (ing2 !=
null && ing2.
Thing !=
null && !(ing2.
id !=
"gem"))
472 num4 *= ing2.Thing.material.hardness / 20 + 2;
477 num4 = EClass.pc.FameLv + 10 - 1;
479 product.SetInt(25, num4);
484 product.elements.ModBase(10, 6);
486 if (product.HasElement(762))
488 product.elements.ModBase(10, product.Evalue(762) / 5);
489 if (product.Evalue(10) < 1)
491 product.elements.SetTo(10, 1);
494 if (creative && isFood && product.category.IsChildOf(
"meal"))
496 product.elements.SetBase(764, 1);
501 if (e.
HasTag(
"noInherit"))
514 return product.IsInheritFoodTraits;
526 void MixElements(
Card t)
532 if (IsValidTrait(value3) && (!
noMix || value3.
id == 2))
536 int num5 = value3.
Value;
537 if (product.id ==
"lunch_dystopia")
541 if (creative && num5 > 500)
545 product.elements.ModBase(value3.
id, num5);
549 int num6 = product.elements.Base(value3.
id);
550 if ((num6 <= 0 && value3.
Value < 0 && value3.
Value < num6) || (value3.
Value > 0 && value3.
Value > num6))
552 product.elements.SetTo(value3.
id, value3.
Value);
559 product.elements.ModBase(10, t.
Evalue(10) * nutFactor / 100);
int GetInt(int id, int? defaultInt=null)
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)
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(int _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)