13 {
15 if (
food.id ==
"bloodsample")
16 {
18 return;
19 }
20 food.CheckJustCooked();
22 int num = (food.isCrafted ? ((
EClass.
pc.
Evalue(1650) >= 3) ? 5 : 0) : 0);
23 float num2 = (float)(100 + (
food.HasElement(757) ? 10 : 0) + (flag ? 10 : 0) + num + Mathf.Min(
food.QualityLv * 10, 100)) / 200f;
24 if (num2 < 0.1f)
25 {
26 num2 = 0.1f;
27 }
28 int num3 = Mathf.Clamp(
food.Evalue(10), 0, 10000);
29 float num4 = 25f;
30 float num5 = 1f;
31 string idTaste = "";
32 bool flag2 =
food.HasElement(708);
33 bool flag3 =
food.HasElement(709);
35 bool flag5 = food.IsDecayed || flag3;
40 {
43 if (num6 < 2 || flag8)
44 {
45 if (num6 == 1 || flag8 ||
EClass.
rnd(4) == 0)
46 {
48 }
49 }
50 else if (num6 > 3 &&
EClass.
rnd(num6) >= 3)
51 {
53 }
54 }
56 {
57 num2 *= 1.5f;
58 }
60 {
61 num2 *= 0.5f;
62 }
63 if (flag4)
64 {
65 if (flag2)
66 {
67 num5 *= 2f;
68 num2 *= 1.3f;
69 }
70 else
71 {
72 num5 *= 0.5f;
73 num2 /= 2f;
74 num3 /= 2;
75 }
76 }
77 else if (flag2)
78 {
79 num5 = 0f;
80 num2 *= 0.5f;
81 }
83 {
84 if (
food.HasElement(710))
85 {
86 num2 = num2 * 0.1f * (float)(
food.Evalue(710) + 10);
87 }
88 else
89 {
90 num3 /= 10;
91 }
92 }
94 {
95 num2 *= 1f + (float)c2.
Evalue(1200) * 0.25f;
96 }
98 {
99 num2 *= 3f;
100 }
102 {
104 {
105 if (flag3)
106 {
107 c2.
Say(
"food_undead");
108 }
110 }
111 num5 = 0f;
112 num3 /= 2;
113 }
114 else
115 {
116 switch (
food.source._origin)
117 {
118 case "meat":
120 {
121 c2.
Say(
"food_raw_meat");
122 }
123 num2 *= 0.7f;
124 num5 = 0.5f;
125 break;
126 case "fish":
128 {
130 {
131 c2.
Say(
"food_raw_fish");
132 }
133 num2 *= 0.9f;
134 num5 = 0.5f;
135 }
136 break;
137 case "dough":
139 {
140 c2.
Say(
"food_raw_powder");
141 }
142 num2 *= 0.9f;
143 num5 = 0.5f;
144 break;
145 }
146 }
147 float num7 = (flag7 ? num3 : Mathf.Min(c2.
hunger.
value, num3));
149 {
150 num7 *= 1.1f;
151 }
153 {
162 }
163 else
164 {
165 num2 = num2 * num7 / 10f;
167 {
168 num2 = 0.01f;
169 }
170 List<Element> list =
food.ListValidTraits(isCraft:
true, limit:
false);
171 foreach (
Element value
in food.elements.dict.Values)
172 {
173 if (value.
source.foodEffect.IsEmpty() || !list.Contains(value))
174 {
175 continue;
176 }
177 string[] foodEffect = value.
source.foodEffect;
179 float num8 = num2 * (float)value.
Value;
181 {
182 bool flag9 = num8 >= 0f;
183 string text = value.
source.GetText(flag9 ?
"textInc" :
"textDec", returnNull:
true);
184 if (text != null)
185 {
188 }
189 }
190 switch (foodEffect[0])
191 {
192 case "god":
193 {
194 int int2 = c2.
GetInt(117);
195 if (int2 < 10)
196 {
198 {
200 {
202 }
203 }
204 }
205 c2.
Say(
"little_eat", c2);
209 flag6 = false;
210 break;
211 }
212 case "exp":
213 {
215 int a = (int)(num8 * (float)((foodEffect.Length > 2) ? foodEffect[2].ToInt() : 4)) * 2 / 3;
217 break;
218 }
219 case "pot":
220 {
224 num9 = num9 * 100 / Mathf.Max(100, vTempPotential * 2 / 3);
226 break;
227 }
228 case "karma":
230 {
232 }
233 break;
234 case "poison":
237 {
238 break;
239 }
240 goto IL_0fad;
241 case "love":
243 break;
244 case "loseWeight":
246 break;
247 case "gainWeight":
249 break;
250 case "little":
251 {
252 int @
int = c2.
GetInt(112);
253 if (@int < 30)
254 {
255 c2.
Say(
"little_eat", c2);
257 int v = Mathf.Max(5 - @int / 2, 1);
258 Debug.Log(
"sister eaten:" + @
int +
"/" + v);
260 {
262 {
264 }
265 }
266 }
268 {
269 c2.
Say(
"little_adam", c2);
271 }
273 break;
274 }
275 }
276 }
277 }
279 num4 += (float)
food.Evalue(70);
280 num4 += (float)(
food.Evalue(72) / 2);
281 num4 += (float)(
food.Evalue(73) / 2);
282 num4 += (float)(
food.Evalue(75) / 2);
283 num4 += (float)(
food.Evalue(76) * 3 / 2);
284 num4 += (float)
food.Evalue(440);
285 num4 += (float)(
food.Evalue(445) / 2);
286 num4 -= (float)
food.Evalue(71);
287 num4 += (float)
food.Evalue(18);
288 num4 += (float)(num3 / 2);
289 num4 *= num5;
290 if (idTaste.IsEmpty())
291 {
292 if (num4 > 100f)
293 {
294 idTaste = "food_great";
295 }
296 else if (num4 > 70f)
297 {
298 idTaste = "food_good";
299 }
300 else if (num4 > 50f)
301 {
302 idTaste = "food_soso";
303 }
304 else if (num4 > 30f)
305 {
306 idTaste = "food_average";
307 }
308 else
309 {
310 idTaste = "food_bad";
311 }
313 {
315 if (flag2)
316 {
317 c2.
Say(flag4 ?
"food_human_pos" :
"food_human_neg");
318 }
319 else if (flag4)
320 {
321 c2.
Say(
"food_human_whine");
322 }
323 }
324 }
326 {
327 c2.
Say(idTaste +
"2", c2,
food);
328 }
330 {
331 num3 *= 2;
332 }
333 num3 = num3 * (100 + c2.
Evalue(1235) * 10) / (100 + c2.
Evalue(1234) * 10 + c2.
Evalue(1236) * 15);
335 if (flag2)
336 {
337 if (!flag4)
338 {
340 {
343 }
345 {
346 c2.
SetFeat(1205, 1, msg:
true);
347 flag4 = true;
348 }
349 }
350 if (flag4)
351 {
353 }
354 }
356 {
357 c2.
SetFeat(1205, 0, msg:
true);
358 }
360 {
363 }
365 {
367 }
369 {
372 {
374 }
377 c2.
Say(
"fairy_vomit", c2, thing);
379 }
380 food.trait.OnEat(c2);
382 {
383 food.trait.OnDrink(c2);
384 }
385 goto IL_0fad;
386 IL_0fad:
387 if (consume)
388 {
389 num7 += 5f;
390 if (flag6 && (
float)
food.Evalue(10) > num7 + 10f)
391 {
392 food.elements.SetTo(10, (
int)Mathf.Max((
float)
food.Evalue(10) - num7, 1f));
393 food.SetBool(125, enable:
true);
394 if (
food.HasElement(1229))
395 {
396 food.elements.Remove(1229);
397 }
398 }
399 else
400 {
402 }
403 }
405 {
407 {
410 item.PlaySound(
"Animal/Cat/cat_angry");
412 {
414 }
415 }
416 }
418 {
420 {
421 case "681":
422 case "pie_meat":
423 case "pie_fish":
425 break;
426 }
427 }
429 {
430 return;
431 }
433 int slot = c_DNA.
slot;
435 int excess = c2.CurrentGeneSlot + slot - c2.
MaxGeneSlot;
437 {
439 if (genes != null)
440 {
441 RemoveDNA(fromOldest: false);
442 }
443 return;
445 if (genes != null)
446 {
447 genes.
items.Shuffle();
448 Msg.
Say(
"reconstruct", c2);
449 c2.
Say(
"food_mind", c2);
451 }
452 return;
453 }
454 if (excess > 0)
455 {
456 while (excess > 0 && genes !=
null && genes.
items.Count != 0)
457 {
458 RemoveDNA(fromOldest: true);
459 }
460 }
462 c2.
Say(
"little_eat", c2);
464 SE.Play("mutation");
466 void RemoveDNA(bool fromOldest)
467 {
468 DNA dNA = (fromOldest ? genes.
items[0] : genes.
items.Last());
471 }
472 }
if(item3.idFile==idFirstFile &&item3.id==idFirstTopic)
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)
int GetInt(int id, int? defaultInt=null)
void SetInt(int id, int value=0)
ElementContainerCard elements
SoundSource PlaySound(string id, float v=1f, bool spatial=true)
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)
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 ModWeight(int a, bool ignoreLimit=false)
void AddFoodHistory(Thing food)
int CountNumEaten(Thing food)
int GetRaw(int offsetHours=0)
static SourceManager sources
static int rndHalf(int a)
void ModExp(int ele, float a, bool chain=false)
Dictionary< int, Element > dict
Element ModPotential(int ele, int v)
Element ModTempPotential(int ele, int v, int threshMsg=0)
Element GetElement(string alias)
static bool IsLeftoverable(Thing food)
static void ProcTrait(Chara c, Card t)
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)