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 if (c_bloodData ==
null)
151 sucker.
Say(
"food_blood", c_bloodData);
153 MakeDish(c_bloodData, 100,
null, num + feeder.
uid);
157 feeder.c_bloodData = c_bloodData.
Duplicate(1);
164 sucker.
Say(
"food_blood", c_bloodData);
168 c_bloodData.
elements.
ModBase(710, 15 + (
int)Mathf.Min(Mathf.Sqrt(sucker.
Evalue(6607) + Mathf.Max(sucker.
LER, 0)), 55f));
174 Thing thing = MakeBloodMeal(sucker, feeder);
176 foreach (
Element value
in thing.elements.dict.Values)
180 thing2.elements.SetTo(10, 0);
181 thing2.MakeRefFrom(feeder);
182 thing2.c_idRefCard = thing.id;
190 for (
int i = 0; i < 4 +
EClass.
rnd(4); i++)
193 WrapIngredient(thing, c, GetRandomDarkSoupIngredient(c),
WrapType.Dark);
197 thing.c_IDTState = 1;
211 int num = c.uid + EClass.world.date.year * 10000 + EClass.world.date.month * 100;
213 float num2 = Mathf.Clamp(1f + Mathf.Sqrt(c.
Evalue(287) / 5), 2f, 6f);
216 thing.c_IDTState = 5;
218 for (
int i = 0; (float)i < num2; i++)
221 WrapIngredient(thing, c, GetRandomLoveLunchIngredient(c),
WrapType.Love);
224 if (thing.
Evalue(753) < 0)
239 for (
int i = 0; i < 3; i++)
247 MakeDish(thing, c.
LV, c);
258 foreach (
Element value
in ing.elements.dict.Values)
260 if (!IsValidTrait(value))
266 int num = value.
Value;
267 if (ing.id ==
"lunch_dystopia" && (wrapType ==
WrapType.Dark || num < 0))
271 product.elements.ModBase(value.
id, num);
275 int num2 = product.elements.Base(value.
id);
276 if ((num2 <= 0 && value.
Value < 0 && value.
Value < num2) || (value.
Value > 0 && value.
Value > num2))
278 product.elements.SetTo(value.
id, value.
Value);
282 product.elements.ModBase(10, ing.Evalue(10));
283 static bool IsValidTrait(
Element e)
285 if (e.
HasTag(
"noInherit"))
299 List<Thing> list =
new List<Thing>();
300 bool flag =
food.sourceCard.vals.Contains(
"fixed");
301 for (
int i = 0; i < ings.Count; i++)
303 Thing thing = ings[i];
309 if (!IsIgnoreName(thing))
316 Thing thing2 = list.RandomItem();
319 food.MakeRefFrom(thing2);
323 food.c_altName =
food.TryGetFoodName(thing2);
324 if (thing2.
id ==
"_egg" || thing2.
id ==
"egg_fertilized")
326 food.c_altName =
"_egg".lang(
food.c_altName);
331 MixIngredients(
food, ings,
MixType.Food, qualityBonus, crafter);
332 static bool IsIgnoreName(
Card t)
357 MixIngredients(thing, ings, type, 999, crafter);
364 bool isFood = type ==
MixType.Food;
365 int nutFactor = 100 - (ings.Count - 1) * 5;
366 Thing thing = ((ings.Count > 0) ? ings[0] :
null);
367 bool creative = crafter?.
HasElement(487) ??
false;
368 if (crafter !=
null && crafter.Evalue(1650) >= 3)
377 if ((uint)(
id - 914) > 1u && value2.
Value >= 0 && (value2.
HasTag(
"noInherit") || IsValidTrait(value2)))
397 foreach (
Thing ing
in ings)
409 if (product.id ==
"1300" && product.GetInt(118) == 0)
411 product.SetInt(118, ing.
GetInt(118));
418 product.isWeightChanged =
true;
419 product.c_weight = num;
420 product.c_priceAdd = num2;
422 product.c_priceCopy = num3;
425 product.elements.SetTo(10, thing.Evalue(10) / 4);
426 product.isWeightChanged =
true;
427 product.c_weight = Mathf.Min(thing.SelfWeight / 6, 1000);
428 product.c_idRefCard = thing.id;
429 product.c_priceCopy = ((thing.c_priceCopy == 0) ? thing.GetValue() : thing.c_priceCopy);
430 product.c_fixedValue = ((thing.c_fixedValue == 0) ? thing.sourceCard.value : thing.c_fixedValue) / 4;
431 product.c_priceAdd = 0;
432 product.decay = thing.decay;
433 product.elements.SetBase(707, 1);
434 product.SetTier(thing.tier, setTraits:
false);
435 product.idSkin = ((thing.trait is
TraitFoodFishSlice) ? thing.idSkin : (thing.HasTag(
CTAG.bigFish) ? 1 : 0));
437 if (product.HasElement(652))
439 product.ChangeWeight((isFood ? num : product.Thing.source.weight) * 100 / (100 + product.Evalue(652)));
441 if (product.elements.Value(2) > maxQuality)
443 product.elements.SetTo(2, maxQuality);
445 string id2 = product.id;
446 if (!(id2 ==
"zassouni"))
450 int num4 = 1 + product.Evalue(2) + product.Evalue(751);
455 foreach (
Thing ing2
in ings)
457 if (ing2 !=
null && ing2.
Thing !=
null && !(ing2.
id !=
"gem"))
459 num4 *= ing2.Thing.material.hardness / 20 + 2;
464 num4 = EClass.pc.FameLv + 10 - 1;
466 product.SetInt(25, num4);
471 product.elements.ModBase(10, 6);
473 if (product.HasElement(762))
475 product.elements.ModBase(10, product.Evalue(762) / 5);
476 if (product.Evalue(10) < 1)
478 product.elements.SetTo(10, 1);
481 if (creative && isFood && product.category.IsChildOf(
"meal"))
483 product.elements.SetBase(764, 1);
488 if (e.
HasTag(
"noInherit"))
501 return product.IsInheritFoodTraits;
513 void MixElements(
Card t)
519 if (IsValidTrait(value3) && (!
noMix || value3.
id == 2))
523 int num5 = value3.
Value;
524 if (product.id ==
"lunch_dystopia")
528 if (creative && num5 > 500)
532 product.elements.ModBase(value3.
id, num5);
536 int num6 = product.elements.Base(value3.
id);
537 if ((num6 <= 0 && value3.
Value < 0 && value3.
Value < num6) || (value3.
Value > 0 && value3.
Value > num6))
539 product.elements.SetTo(value3.
id, value3.
Value);
546 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
bool HasElement(int ele, int req=1)
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)
void Say(string lang, string ref1=null, string ref2=null)
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)