1using System.Collections.Generic;
9 if (
food.HasElement(758) ||
food.HasElement(1229))
18 if (
food.id ==
"bloodsample")
23 food.CheckJustCooked();
24 bool flag = EClass._zone.IsPCFactionOrTent && c.IsInSpot<
TraitSpotDining>();
25 int num = (food.isCrafted ? ((
EClass.
pc.
Evalue(1650) >= 3) ? 5 : 0) : 0);
26 float num2 = (float)(100 + (
food.HasElement(757) ? 10 : 0) + (flag ? 10 : 0) + num + Mathf.Min(
food.QualityLv * 10, 100)) / 200f;
31 int num3 = Mathf.Clamp(
food.Evalue(10), 0, 10000);
35 bool flag2 =
food.HasElement(708);
36 bool flag3 =
food.HasElement(709);
38 bool flag5 = food.IsDecayed || flag3;
46 if (num6 < 2 || flag8)
48 if (num6 == 1 || flag8 ||
EClass.
rnd(4) == 0)
53 else if (num6 > 3 &&
EClass.
rnd(num6) >= 3)
87 if (
food.HasElement(710))
89 num2 = num2 * 0.1f * (float)(
food.Evalue(710) + 10);
98 num2 *= 1f + (float)c.
Evalue(1200) * 0.3f;
110 c.
Say(
"food_undead");
119 switch (
food.source._origin)
124 c.
Say(
"food_raw_meat");
134 c.
Say(
"food_raw_fish");
143 c.
Say(
"food_raw_powder");
150 float num7 = (flag7 ? num3 : Mathf.Min(c.
hunger.
value, num3));
161 num4 += (float)
food.Evalue(70);
162 num4 += (float)(
food.Evalue(72) / 2);
163 num4 += (float)(
food.Evalue(73) / 2);
164 num4 += (float)(
food.Evalue(75) / 2);
165 num4 += (float)(
food.Evalue(76) * 3 / 2);
166 num4 += (float)
food.Evalue(440);
167 num4 += (float)(
food.Evalue(445) / 2);
168 num4 -= (float)
food.Evalue(71);
169 num4 += (float)
food.Evalue(18);
170 num4 += (float)(num3 / 2);
172 if (idTaste.IsEmpty())
176 idTaste =
"food_great";
180 idTaste =
"food_good";
184 idTaste =
"food_soso";
188 idTaste =
"food_average";
192 idTaste =
"food_bad";
199 c.
Say(flag4 ?
"food_human_pos" :
"food_human_neg");
203 c.
Say(
"food_human_whine");
215 num3 = num3 * (100 + c.
Evalue(1235) * 10) / (100 + c.
Evalue(1234) * 10 + c.
Evalue(1236) * 15);
263 c.
Say(
"fairy_vomit", c, thing);
272 if (flag6 && (
float)
food.Evalue(10) > num7 + 10f)
274 food.elements.SetTo(10, (
int)Mathf.Max((
float)
food.Evalue(10) - num7, 1f));
275 food.SetBool(125, enable:
true);
276 if (
food.HasElement(1229))
278 food.elements.Remove(1229);
297 item.PlaySound(
"Animal/Cat/cat_angry");
304 EClass.player.stats.angryCats += num8;
327 int slot = c_DNA.
slot;
329 int excess = c.CurrentGeneSlot + slot - c.
MaxGeneSlot;
335 RemoveDNA(fromOldest:
false);
341 genes.
items.Shuffle();
342 Msg.
Say(
"reconstruct", c);
343 c.
Say(
"food_mind", c);
350 while (excess > 0 && genes !=
null && genes.
items.Count != 0)
352 RemoveDNA(fromOldest:
true);
356 c.
Say(
"little_eat", c);
360 void RemoveDNA(
bool fromOldest)
362 DNA dNA = (fromOldest ? genes.
items[0] : genes.
items.Last());
370 int num = Mathf.Max(1,
food.Evalue(10));
371 float num2 = (float)(100 + Mathf.Min(
food.QualityLv * 10, 100)) / 200f;
388 food.trait.OnDrink(c);
394 bool flag =
food.HasElement(709);
407 effP = effP * validFill / 10f;
412 List<Element> list =
food.ListValidTraits(isCraft:
true, limit:
false);
413 foreach (
Element value
in food.elements.dict.Values)
415 if (value.
source.foodEffect.IsEmpty() || !list.Contains(value))
419 string[] foodEffect = value.
source.foodEffect;
421 float v = effP * (float)Mathf.Min(value.
Value, 10000);
422 if (value.
source.category ==
"food" && c.IsPC)
424 bool flag2 = v >= 0f;
425 string text = value.
source.GetText(flag2 ?
"textInc" :
"textDec", returnNull:
true);
432 switch (foodEffect[0])
436 int int2 = c.GetInt(117);
439 foreach (
Element value2
in c.elements.dict.Values)
443 c.elements.ModPotential(value2.
id, 2);
447 c.Say(
"little_eat", c);
448 c.PlaySound(
"ding_potential");
449 c.elements.ModExp(306, -1000f);
450 c.SetInt(117, int2 + 1);
456 int a = (int)(v * (
float)((foodEffect.Length > 2) ? foodEffect[2].ToInt() : 4)) * 2 / 3;
489 int @
int = c.GetInt(112);
492 c.Say(
"little_eat", c);
493 c.PlaySound(
"ding_potential");
494 int v2 = Mathf.Max(5 - @
int / 2, 1);
495 Debug.Log(
"sister eaten:" + @
int +
"/" + v2);
496 foreach (
Element value3
in c.elements.dict.Values)
500 c.elements.ModPotential(value3.
id, v2);
504 if (c.race.id ==
"mutant" && c.elements.Base(1230) < 10)
506 c.Say(
"little_adam", c);
507 c.SetFeat(1230, c.elements.Base(1230) + 1);
509 c.SetInt(112, @
int + 1);
513 void AddPotential(
int idEle)
515 int vTempPotential = c.elements.GetElement(idEle).vTempPotential;
517 num = num * 100 / Mathf.Max(100, vTempPotential * 2 / 3);
518 c.elements.ModTempPotential(idEle, num, 8);
526 foreach (
Element value
in food.elements.dict.Values)
532 if (value.
Value >= 0)
537 c.CureCondition<
ConPoison>(value.Value * 2);
540 c.AddCondition<
ConPeace>(value.Value * 5);
546 c.AddCondition<
ConHotspring>(value.Value * 2)?.SetPerfume();
560 Msg.
Say(
"recharge_stamina_fail");
565 c.Say(
"recharge_stamina", c);
566 c.stamina.Mod(c.stamina.max * (value.
Value / 10 + 1) / 100 + value.Value * 2 / 3 +
EClass.
rnd(5));
576 SayTaste(
"food_poison");
577 c.AddCondition<
ConPoison>(-value.Value * 10);
580 SayTaste(
"food_mind");
581 c.AddCondition<
ConConfuse>(-value.Value * 10);
582 c.AddCondition<
ConInsane>(-value.Value * 10);
586 c.AddCondition<
ConBleed>(-value.Value * 10);
596 c.Say(
"recharge_stamina_negative", c);
597 c.stamina.Mod(-c.stamina.max * (-value.
Value / 10 + 1) / 100 + value.
Value);
602 void SayTaste(
string _id)
static void Poison(Chara tc, Chara c, int power)
static void LoveMiracle(Chara tc, Chara c, int power, EffectId idEffect=EffectId.Love, BlessedState? state=null)
void Mod(int a, bool force=false)
SoundSource PlaySound(string id, float v=1f, bool spatial=true)
void SetInt(string id, int value=0)
void Talk(string idTopic, string ref1=null, string ref2=null, bool forceSync=false)
Effect PlayEffect(string id, bool useRenderPos=true, float range=0f, Vector3 fix=default(Vector3))
void ModExp(string alias, int a)
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 void Remove(Chara c, DNA item)
Condition AddCondition(string id, int p=100, bool force=false)
void SetFeat(int id, int value=1, bool msg=false)
bool HasCondition(string alias)
void PickOrDrop(Point p, string idThing, int idMat=-1, int num=1, bool msg=true)
override bool IsPCFaction
SourceThing.Row GetFavFood()
void AddFoodHistory(Thing food)
int CountNumEaten(Thing food)
int GetRaw(int offsetHours=0)
static SourceManager sources
static int rndHalf(int a)
static void ProcNutrition(Chara c, Thing food, float effP, float validFill)
static void ProcTrait(Chara c, Card food)
static bool IsLeftoverable(Thing food)
static void ProcDrink(Chara c, Thing food)
static void Proc(Chara c, Thing food, bool consume=true)
static bool Has(string id)
static string Say(string idLang, string ref1, string ref2=null, string ref3=null, string ref4=null)
List< Chara > ListCharasInRadius(Chara cc, int dist, Func< Chara, bool > func, bool onlyVisible=true)
static void GetAchievement(ID_Achievement id)
static Thing Create(string id, int idMat=-1, int lv=-1)
static Thing ApplySeed(Thing t, int refval)