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);
121 sucker.
Say(
"food_blood", thing);
142 Thing thing = MakeBloodMeal(sucker, feeder);
144 foreach (
Element value
in thing.elements.dict.Values)
148 thing2.elements.SetTo(10, 0);
149 thing2.MakeRefFrom(feeder);
150 thing2.c_idRefCard = thing.id;
157 for (
int i = 0; i < 4 +
EClass.
rnd(4); i++)
160 WrapIngredient(thing, c, GetRandomDarkSoupIngredient(c),
WrapType.Dark);
164 thing.c_IDTState = 1;
178 int num = c.uid + EClass.world.date.year * 10000 + EClass.world.date.month * 100;
180 float num2 = Mathf.Clamp(1f + Mathf.Sqrt(c.
Evalue(287) / 5), 2f, 6f);
183 thing.c_IDTState = 5;
185 for (
int i = 0; (float)i < num2; i++)
188 WrapIngredient(thing, c, GetRandomLoveLunchIngredient(c),
WrapType.Love);
191 if (thing.
Evalue(753) < 0)
202 for (
int i = 0; i < 3; i++)
210 MakeDish(thing, c.
LV, c);
221 foreach (
Element value
in ing.elements.dict.Values)
223 if (!IsValidTrait(value))
229 int num = value.
Value;
230 if (ing.id ==
"lunch_dystopia" && (wrapType ==
WrapType.Dark || num < 0))
234 product.elements.ModBase(value.
id, num);
238 int num2 = product.elements.Base(value.
id);
239 if ((num2 <= 0 && value.
Value < 0 && value.
Value < num2) || (value.
Value > 0 && value.
Value > num2))
241 product.elements.SetTo(value.
id, value.
Value);
245 product.elements.ModBase(10, ing.Evalue(10));
246 static bool IsValidTrait(
Element e)
248 if (e.
HasTag(
"noInherit"))
262 List<Thing> list =
new List<Thing>();
263 bool flag =
food.sourceCard.vals.Contains(
"fixed");
264 for (
int i = 0; i < ings.Count; i++)
266 Thing thing = ings[i];
272 if (!IsIgnoreName(thing))
279 Thing thing2 = list.RandomItem();
282 food.MakeRefFrom(thing2);
286 food.c_altName =
food.TryGetFoodName(thing2);
287 if (thing2.
id ==
"_egg" || thing2.
id ==
"egg_fertilized")
289 food.c_altName =
"_egg".lang(
food.c_altName);
294 MixIngredients(
food, ings,
MixType.Food, qualityBonus, crafter);
295 static bool IsIgnoreName(
Card t)
320 MixIngredients(thing, ings, type, 999, crafter);
327 bool isFood = type ==
MixType.Food;
328 int nutFactor = 100 - (ings.Count - 1) * 5;
329 Thing thing = ((ings.Count > 0) ? ings[0] :
null);
330 bool creative = crafter?.
HasElement(487) ??
false;
331 if (crafter !=
null && crafter.Evalue(1650) >= 3)
340 if ((uint)(
id - 914) > 1u && value2.
Value >= 0 && (value2.
HasTag(
"noInherit") || IsValidTrait(value2)))
360 foreach (
Thing ing
in ings)
376 product.isWeightChanged =
true;
377 product.c_weight = num;
378 product.c_priceAdd = num2;
380 product.c_priceCopy = num3;
383 product.elements.SetTo(10, thing.Evalue(10) / 4);
384 product.isWeightChanged =
true;
385 product.c_weight = Mathf.Min(thing.SelfWeight / 6, 1000);
386 product.c_idRefCard = thing.id;
387 product.c_priceCopy = ((thing.c_priceCopy == 0) ? thing.GetValue() : thing.c_priceCopy);
388 product.c_fixedValue = ((thing.c_fixedValue == 0) ? thing.sourceCard.value : thing.c_fixedValue) / 4;
389 product.c_priceAdd = 0;
390 product.decay = thing.decay;
391 product.elements.SetBase(707, 1);
392 product.SetTier(thing.tier, setTraits:
false);
393 product.idSkin = ((thing.trait is
TraitFoodFishSlice) ? thing.idSkin : (thing.HasTag(
CTAG.bigFish) ? 1 : 0));
395 if (product.HasElement(652))
397 product.ChangeWeight((isFood ? num : product.Thing.source.weight) * 100 / (100 + product.Evalue(652)));
399 if (product.elements.Value(2) > maxQuality)
401 product.elements.SetTo(2, maxQuality);
403 string id2 = product.id;
404 if (!(id2 ==
"zassouni"))
408 int num4 = 1 + product.Evalue(2) + product.Evalue(751);
413 foreach (
Thing ing2
in ings)
415 if (ing2 !=
null && ing2.
Thing !=
null && !(ing2.
id !=
"gem"))
417 num4 *= ing2.Thing.material.hardness / 20 + 2;
422 num4 = EClass.pc.FameLv + 10 - 1;
424 product.SetInt(25, num4);
429 product.elements.ModBase(10, 6);
431 if (product.HasElement(762))
433 product.elements.ModBase(10, product.Evalue(762) / 5);
434 if (product.Evalue(10) < 1)
436 product.elements.SetTo(10, 1);
439 if (creative && isFood && product.category.IsChildOf(
"meal"))
441 product.elements.SetBase(764, 1);
446 if (e.
HasTag(
"noInherit"))
459 return product.IsInheritFoodTraits;
471 void MixElements(
Card t)
477 if (IsValidTrait(value3) && (!
noMix || value3.
id == 2))
481 int num5 = value3.
Value;
482 if (product.id ==
"lunch_dystopia")
486 if (creative && num5 > 500)
490 product.elements.ModBase(value3.
id, num5);
494 int num6 = product.elements.Base(value3.
id);
495 if ((num6 <= 0 && value3.
Value < 0 && value3.
Value < num6) || (value3.
Value > 0 && value3.
Value > num6))
497 product.elements.SetTo(value3.
id, value3.
Value);
504 product.elements.ModBase(10, t.
Evalue(10) * nutFactor / 100);
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 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 Card MixIngredients(Card product, List< Thing > ings, MixType type, int maxQuality, Chara crafter=null)
static Thing MakeBloodMeal(Chara sucker, Chara feeder)
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)