Elin Decompiled Documentation EA 23.331 Nightly
Loading...
Searching...
No Matches
FoodEffect Class Reference
Inheritance diagram for FoodEffect:
EClass

Static Public Member Functions

static bool IsLeftoverable (Thing food)
 
static void Proc (Chara c, Thing food, bool consume=true)
 
static void ProcDrink (Chara c, Thing food)
 
static void ProcNutrition (Chara c, Thing food, float effP, float validFill)
 
static void ProcTrait (Chara c, Card food)
 
- Static Public Member Functions inherited from EClass
static int rndSeed (int a, int seed)
 
static int rnd (long a)
 
static int rnd (int a)
 
static int curve (long _a, int start, int step, int rate=75)
 
static int sqrt (int a)
 
static int rndHalf (int a)
 
static float rndf (float a)
 
static int rndSqrt (int a)
 
static void Wait (float a, Card c)
 
static void Wait (float a, Point p)
 
static int Bigger (int a, int b)
 
static int Smaller (int a, int b)
 

Additional Inherited Members

- Static Public Attributes inherited from EClass
static Core core
 
- Properties inherited from EClass
static Game game [get]
 
static bool AdvMode [get]
 
static Player player [get]
 
static Chara pc [get]
 
static UI ui [get]
 
static Map _map [get]
 
static Zone _zone [get]
 
static FactionBranch Branch [get]
 
static FactionBranch BranchOrHomeBranch [get]
 
static Faction Home [get]
 
static Faction Wilds [get]
 
static Scene scene [get]
 
static BaseGameScreen screen [get]
 
static GameSetting setting [get]
 
static GameData gamedata [get]
 
static ColorProfile Colors [get]
 
static World world [get]
 
static SourceManager sources [get]
 
static SourceManager editorSources [get]
 
static SoundManager Sound [get]
 
static CoreDebug debug [get]
 

Detailed Description

Definition at line 5 of file FoodEffect.cs.

Member Function Documentation

◆ IsLeftoverable()

static bool FoodEffect.IsLeftoverable ( Thing  food)
inlinestatic

Definition at line 7 of file FoodEffect.cs.

8 {
9 if (food.HasElement(758) || food.HasElement(1229))
10 {
11 return false;
12 }
13 return food.trait is TraitLunch;
14 }

References food.

Referenced by Proc(), and Thing.WriteNote().

◆ Proc()

static void FoodEffect.Proc ( Chara  c,
Thing  food,
bool  consume = true 
)
inlinestatic

Definition at line 16 of file FoodEffect.cs.

17 {
18 if (food.id == "bloodsample")
19 {
20 food.ModNum(-1);
21 return;
22 }
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;
27 if (num2 < 0.1f)
28 {
29 num2 = 0.1f;
30 }
31 int num3 = Mathf.Clamp(food.Evalue(10), 0, 10000);
32 float num4 = 25f;
33 float num5 = 1f;
34 string idTaste = "";
35 bool flag2 = food.HasElement(708);
36 bool flag3 = food.HasElement(709);
37 bool flag4 = c.HasElement(1205);
38 bool flag5 = food.IsDecayed || flag3;
39 bool flag6 = IsLeftoverable(food);
40 bool flag7 = EClass._zone.HasField(10001) && food.GetBool(128);
42 if (c.IsPCFaction && !c.IsPC)
43 {
44 int num6 = c.CountNumEaten(food);
45 bool flag8 = c.GetFavFood().id == food.id;
46 if (num6 < 2 || flag8)
47 {
48 if (num6 == 1 || flag8 || EClass.rnd(4) == 0)
49 {
50 c.Talk("foodNice");
51 }
52 }
53 else if (num6 > 3 && EClass.rnd(num6) >= 3)
54 {
55 c.Talk("foodBored");
56 }
57 }
58 if (food.IsBlessed)
59 {
60 num2 *= 1.5f;
61 }
62 if (food.IsCursed)
63 {
64 num2 *= 0.5f;
65 }
66 if (flag4)
67 {
68 if (flag2)
69 {
70 num5 *= 2f;
71 num2 *= 1.3f;
72 }
73 else
74 {
75 num5 *= 0.5f;
76 num2 /= 2f;
77 num3 /= 2;
78 }
79 }
80 else if (flag2)
81 {
82 num5 = 0f;
83 num2 *= 0.5f;
84 }
85 if (c.HasElement(1250))
86 {
87 if (food.HasElement(710))
88 {
89 num2 = num2 * 0.1f * (float)(food.Evalue(710) + 10);
90 }
91 else
92 {
93 num3 /= 10;
94 }
95 }
96 if (c.HasElement(1200))
97 {
98 num2 *= 1f + (float)c.Evalue(1200) * 0.3f;
99 }
100 if (!c.IsPC)
101 {
102 num2 *= 3f;
103 }
104 if (flag5 && !c.HasElement(480))
105 {
106 if (c.IsPC)
107 {
108 if (flag3)
109 {
110 c.Say("food_undead");
111 }
112 c.Say("food_rot");
113 }
114 num5 = 0f;
115 num3 /= 2;
116 }
117 else
118 {
119 switch (food.source._origin)
120 {
121 case "meat":
122 if (c.IsPC)
123 {
124 c.Say("food_raw_meat");
125 }
126 num2 *= 0.7f;
127 num5 = 0.5f;
128 break;
129 case "fish":
130 if (c.IsHuman)
131 {
132 if (c.IsPC)
133 {
134 c.Say("food_raw_fish");
135 }
136 num2 *= 0.9f;
137 num5 = 0.5f;
138 }
139 break;
140 case "dough":
141 if (c.IsPC)
142 {
143 c.Say("food_raw_powder");
144 }
145 num2 *= 0.9f;
146 num5 = 0.5f;
147 break;
148 }
149 }
150 float num7 = (flag7 ? num3 : Mathf.Min(c.hunger.value, num3));
151 if (c.hunger.GetPhase() >= 3)
152 {
153 num7 *= 1.1f;
154 }
155 ProcNutrition(c, food, num2, num7);
156 if (!c.isDead)
157 {
158 ProcTrait(c, food);
159 if (!c.isDead)
160 {
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);
171 num4 *= num5;
172 if (idTaste.IsEmpty())
173 {
174 if (num4 > 100f)
175 {
176 idTaste = "food_great";
177 }
178 else if (num4 > 70f)
179 {
180 idTaste = "food_good";
181 }
182 else if (num4 > 50f)
183 {
184 idTaste = "food_soso";
185 }
186 else if (num4 > 30f)
187 {
188 idTaste = "food_average";
189 }
190 else
191 {
192 idTaste = "food_bad";
193 }
194 if (c.IsPC)
195 {
196 c.Say(idTaste);
197 if (flag2)
198 {
199 c.Say(flag4 ? "food_human_pos" : "food_human_neg");
200 }
201 else if (flag4)
202 {
203 c.Say("food_human_whine");
204 }
205 }
206 }
207 if (LangGame.Has(idTaste + "2"))
208 {
209 c.Say(idTaste + "2", c, food);
210 }
211 if (!c.IsPCParty)
212 {
213 num3 *= 2;
214 }
215 num3 = num3 * (100 + c.Evalue(1235) * 10) / (100 + c.Evalue(1234) * 10 + c.Evalue(1236) * 15);
216 c.hunger.Mod(-num3);
217 if (flag2)
218 {
219 if (!flag4)
220 {
221 if (c.IsHuman)
222 {
223 c.AddCondition<ConInsane>(200);
224 c.SAN.Mod(15);
225 }
226 if (EClass.rnd(c.IsHuman ? 5 : 20) == 0)
227 {
228 c.SetFeat(1205, 1, msg: true);
229 flag4 = true;
230 }
231 }
232 if (flag4)
233 {
234 c.SetInt(31, EClass.world.date.GetRaw() + 10080);
235 }
236 }
237 else if (flag4 && c.GetInt(31) < EClass.world.date.GetRaw())
238 {
239 c.SetFeat(1205, 0, msg: true);
240 }
241 if (flag5 && !c.HasElement(480))
242 {
244 c.AddCondition<ConConfuse>(200);
245 }
246 if (c.HasCondition<ConAnorexia>())
247 {
248 c.Vomit();
249 }
250 if (num3 > 20 && c.HasElement(1413))
251 {
252 Thing thing = ThingGen.Create("seed");
253 if (EClass.rnd(EClass.debug.enable ? 2 : 10) == 0)
254 {
255 TraitSeed.ApplySeed(thing, (EClass.rnd(4) == 0) ? 118 : ((EClass.rnd(3) == 0) ? 119 : 90));
256 }
257 thing.SetNum(2 + EClass.rnd(3));
258 c.Talk("vomit");
259 c.Say("fairy_vomit", c, thing);
260 c.PickOrDrop(c.pos, thing);
261 }
262 food.trait.OnEat(c);
263 }
264 }
265 if (consume)
266 {
267 num7 += 5f;
268 if (flag6 && (float)food.Evalue(10) > num7 + 10f)
269 {
270 food.elements.SetTo(10, (int)Mathf.Max((float)food.Evalue(10) - num7, 1f));
271 food.SetBool(125, enable: true);
272 if (food.HasElement(1229))
273 {
274 food.elements.Remove(1229);
275 }
276 }
277 else
278 {
279 food.ModNum(-1);
280 }
281 }
282 if (c.isDead)
283 {
284 return;
285 }
286 if (!c.IsCat && food.trait is TraitFoodChuryu)
287 {
288 int num8 = 0;
289 foreach (Chara item in c.pos.ListCharasInRadius(c, 5, (Chara c) => c.IsCat))
290 {
291 item.Say("angry", item);
292 item.ShowEmo(Emo.angry);
293 item.PlaySound("Animal/Cat/cat_angry");
294 if (c.IsPC)
295 {
297 }
298 num8++;
299 }
300 EClass.player.stats.angryCats += num8;
301 Debug.Log(num8 + "/" + EClass.player.stats.angryCats);
302 if (num8 >= 10)
303 {
305 }
306 }
307 if (c.IsPC && EClass._zone is Zone_Lothria)
308 {
309 switch (food.id)
310 {
311 case "681":
312 case "pie_meat":
313 case "pie_fish":
315 break;
316 }
317 }
318 if (!(food.trait is TraitGene) || !c.IsSlimeEvolvable)
319 {
320 return;
321 }
322 DNA c_DNA = food.c_DNA;
323 int slot = c_DNA.slot;
324 CharaGenes genes = c.c_genes;
325 int excess = c.CurrentGeneSlot + slot - c.MaxGeneSlot;
326 switch (c_DNA.type)
327 {
328 case DNA.Type.Inferior:
329 if (genes != null)
330 {
331 RemoveDNA(fromOldest: false);
332 }
333 return;
334 case DNA.Type.Brain:
335 if (genes != null)
336 {
337 genes.items.Shuffle();
338 Msg.Say("reconstruct", c);
339 c.Say("food_mind", c);
341 }
342 return;
343 }
344 if (excess > 0)
345 {
346 while (excess > 0 && genes != null && genes.items.Count != 0)
347 {
348 RemoveDNA(fromOldest: true);
349 }
350 }
351 c_DNA.Apply(c);
352 c.Say("little_eat", c);
353 c.PlaySound("ding_potential");
354 SE.Play("mutation");
355 c.PlayEffect("identify");
356 void RemoveDNA(bool fromOldest)
357 {
358 DNA dNA = (fromOldest ? genes.items[0] : genes.items.Last());
359 CharaGenes.Remove(c, dNA);
360 excess -= dNA.slot;
361 }
362 }
Emo
Definition: Emo.cs:2
ID_Achievement
SoundSource PlaySound(string id, float v=1f, bool spatial=true)
Definition: Card.cs:6613
void SetInt(string id, int value=0)
Definition: Card.cs:2586
void Talk(string idTopic, string ref1=null, string ref2=null, bool forceSync=false)
Definition: Card.cs:7173
Thing SetNum(int a)
Definition: Card.cs:3669
Point pos
Definition: Card.cs:60
Effect PlayEffect(string id, bool useRenderPos=true, float range=0f, Vector3 fix=default(Vector3))
Definition: Card.cs:6647
CharaGenes c_genes
Definition: Card.cs:1897
int Evalue(int ele)
Definition: Card.cs:2704
bool IsSlimeEvolvable
Definition: Card.cs:2312
int GetInt(string id, int? defaultInt=null)
Definition: Card.cs:2567
bool HasElement(int ele, bool includeNagative=false)
Definition: Card.cs:6351
void Say(string lang, string ref1=null, string ref2=null)
Definition: Card.cs:7291
static void Remove(Chara c, DNA item)
Definition: CharaGenes.cs:12
List< DNA > items
Definition: CharaGenes.cs:7
Definition: Chara.cs:10
Condition AddCondition(string id, int p=100, bool force=false)
Definition: Chara.cs:9773
override bool IsPC
Definition: Chara.cs:630
void SetFeat(int id, int value=1, bool msg=false)
Definition: Chara.cs:10428
override bool IsPCParty
Definition: Chara.cs:633
int MaxGeneSlot
Definition: Chara.cs:1115
bool HasCondition(string alias)
Definition: Chara.cs:9938
Stats hunger
Definition: Chara.cs:1201
bool IsHuman
Definition: Chara.cs:926
void PickOrDrop(Point p, string idThing, int idMat=-1, int num=1, bool msg=true)
Definition: Chara.cs:4522
override bool IsPCFaction
Definition: Chara.cs:689
void Vomit()
Definition: Chara.cs:5552
Stats SAN
Definition: Chara.cs:1217
SourceThing.Row GetFavFood()
Definition: Chara.cs:8443
void AddFoodHistory(Thing food)
Definition: Chara.cs:10693
int CountNumEaten(Thing food)
Definition: Chara.cs:10713
bool isDead
Definition: Chara.cs:393
bool IsCat
Definition: Chara.cs:1034
bool enable
Definition: CoreDebug.cs:301
Definition: DNA.cs:8
Type type
Definition: DNA.cs:29
Type
Definition: DNA.cs:10
int slot
Definition: DNA.cs:77
void Apply(Chara c)
Definition: DNA.cs:178
int GetRaw(int offsetHours=0)
Definition: Date.cs:328
Definition: EClass.cs:6
static Zone _zone
Definition: EClass.cs:21
static World world
Definition: EClass.cs:41
static int rnd(long a)
Definition: EClass.cs:59
static Player player
Definition: EClass.cs:13
static Chara pc
Definition: EClass.cs:15
static CoreDebug debug
Definition: EClass.cs:49
static void ProcNutrition(Chara c, Thing food, float effP, float validFill)
Definition: FoodEffect.cs:388
static void ProcTrait(Chara c, Card food)
Definition: FoodEffect.cs:519
static bool IsLeftoverable(Thing food)
Definition: FoodEffect.cs:7
static bool Has(string id)
Definition: LangGame.cs:99
Definition: Msg.cs:5
static string Say(string idLang, string ref1, string ref2=null, string ref3=null, string ref4=null)
Definition: Msg.cs:58
int angryCats
Definition: Player.cs:135
void ModKarma(int a)
Definition: Player.cs:2610
Stats stats
Definition: Player.cs:1083
List< Chara > ListCharasInRadius(Chara cc, int dist, Func< Chara, bool > func, bool onlyVisible=true)
Definition: Point.cs:1226
virtual void Mod(int a)
Definition: Stats.cs:135
override int GetPhase()
Definition: Stats.cs:117
virtual int value
Definition: Stats.cs:56
Definition: Steam.cs:10
static void GetAchievement(ID_Achievement id)
Definition: Steam.cs:51
static Thing Create(string id, int idMat=-1, int lv=-1)
Definition: ThingGen.cs:53
Definition: Thing.cs:8
static Thing ApplySeed(Thing t, int refval)
Definition: TraitSeed.cs:208
GameDate date
Definition: World.cs:6
bool HasField(int idEle)
Definition: Zone.cs:3069

References EClass._zone, Chara.AddCondition(), Chara.AddFoodHistory(), Player.Stats.angryCats, DNA.Apply(), TraitSeed.ApplySeed(), Card.c_genes, Chara.CountNumEaten(), ThingGen.Create(), World.date, EClass.debug, Debug, CoreDebug.enable, Card.Evalue(), food, Steam.GetAchievement(), Chara.GetFavFood(), Card.GetInt(), Stats.GetPhase(), Date.GetRaw(), LangGame.Has(), Chara.HasCondition(), Card.HasElement(), Zone.HasField(), Chara.hunger, Chara.IsCat, Chara.isDead, Chara.IsHuman, IsLeftoverable(), Chara.IsPC, Chara.IsPCFaction, Chara.IsPCParty, Card.IsSlimeEvolvable, item, CharaGenes.items, Point.ListCharasInRadius(), Chara.MaxGeneSlot, Stats.Mod(), Player.ModKarma(), EClass.pc, Chara.PickOrDrop(), Card.PlayEffect(), EClass.player, Card.PlaySound(), Card.pos, ProcNutrition(), ProcTrait(), CharaGenes.Remove(), EClass.rnd(), Chara.SAN, Msg.Say(), Card.Say(), Chara.SetFeat(), Card.SetInt(), Card.SetNum(), DNA.slot, Player.stats, Card.Talk(), DNA.type, Stats.value, Chara.Vomit(), and EClass.world.

Referenced by AI_Fuck.Finish(), Chara.InstantEat(), and AI_Eat.Run().

◆ ProcDrink()

static void FoodEffect.ProcDrink ( Chara  c,
Thing  food 
)
inlinestatic

Definition at line 364 of file FoodEffect.cs.

365 {
366 int num = Mathf.Max(1, food.Evalue(10));
367 float num2 = (float)(100 + Mathf.Min(food.QualityLv * 10, 100)) / 200f;
368 if (num2 < 0.1f)
369 {
370 num2 = 0.1f;
371 }
372 if (c.hunger.GetPhase() <= 0)
373 {
374 num = 0;
375 }
376 c.hunger.Mod(-num);
377 ProcNutrition(c, food, num2, num);
378 if (!c.isDead)
379 {
380 ProcTrait(c, food);
381 }
382 if (!c.isDead)
383 {
384 food.trait.OnDrink(c);
385 }
386 }

References food, Stats.GetPhase(), Chara.hunger, Chara.isDead, Stats.Mod(), ProcNutrition(), and ProcTrait().

Referenced by Chara.Drink(), and ActThrow.Throw().

◆ ProcNutrition()

static void FoodEffect.ProcNutrition ( Chara  c,
Thing  food,
float  effP,
float  validFill 
)
inlinestatic

Definition at line 388 of file FoodEffect.cs.

389 {
390 bool flag = food.HasElement(709);
391 if ((food.IsDecayed || flag) && !c.HasElement(480))
392 {
393 c.ModExp(70, -300);
394 c.ModExp(71, -300);
395 c.ModExp(72, -200);
396 c.ModExp(73, -200);
397 c.ModExp(74, -200);
398 c.ModExp(75, 500);
399 c.ModExp(76, -200);
400 c.ModExp(77, -300);
401 return;
402 }
403 effP = effP * validFill / 10f;
404 if (c.HasCondition<ConAnorexia>())
405 {
406 effP = 0.01f;
407 }
408 List<Element> list = food.ListValidTraits(isCraft: true, limit: false);
409 foreach (Element value in food.elements.dict.Values)
410 {
411 if (value.source.foodEffect.IsEmpty() || !list.Contains(value))
412 {
413 continue;
414 }
415 string[] foodEffect = value.source.foodEffect;
416 int id = value.id;
417 float v = effP * (float)Mathf.Min(value.Value, 10000);
418 if (value.source.category == "food" && c.IsPC)
419 {
420 bool flag2 = v >= 0f;
421 string text = value.source.GetText(flag2 ? "textInc" : "textDec", returnNull: true);
422 if (text != null)
423 {
424 Msg.SetColor(flag2 ? "positive" : "negative");
425 c.Say(text);
426 }
427 }
428 switch (foodEffect[0])
429 {
430 case "god":
431 {
432 int int2 = c.GetInt(117);
433 if (int2 < 10)
434 {
435 foreach (Element value2 in c.elements.dict.Values)
436 {
437 if (value2.IsMainAttribute)
438 {
439 c.elements.ModPotential(value2.id, 2);
440 }
441 }
442 }
443 c.Say("little_eat", c);
444 c.PlaySound("ding_potential");
445 c.elements.ModExp(306, -1000f);
446 c.SetInt(117, int2 + 1);
447 break;
448 }
449 case "exp":
450 {
451 id = ((foodEffect.Length > 1) ? EClass.sources.elements.alias[foodEffect[1]].id : value.id);
452 int a = (int)(v * (float)((foodEffect.Length > 2) ? foodEffect[2].ToInt() : 4)) * 2 / 3;
453 c.ModExp(id, a);
454 break;
455 }
456 case "pot":
457 id = ((foodEffect.Length > 1) ? EClass.sources.elements.alias[foodEffect[1]].id : value.id);
458 AddPotential(id);
459 break;
460 case "catechin":
461 AddPotential(71);
462 AddPotential(75);
463 c.ModWeight(-EClass.rndHalf(value.Value / 5));
464 break;
465 case "karma":
466 if (c.IsPCParty)
467 {
469 }
470 break;
471 case "poison":
472 ActEffect.Poison(c, EClass.pc, value.Value * 10);
473 break;
474 case "love":
475 ActEffect.LoveMiracle(c, EClass.pc, value.Value * 10);
476 break;
477 case "loseWeight":
478 c.ModWeight(-EClass.rndHalf(value.Value), ignoreLimit: true);
479 break;
480 case "gainWeight":
481 c.ModWeight(EClass.rndHalf(value.Value), ignoreLimit: true);
482 break;
483 case "little":
484 {
485 int @int = c.GetInt(112);
486 if (@int < 30)
487 {
488 c.Say("little_eat", c);
489 c.PlaySound("ding_potential");
490 int v2 = Mathf.Max(5 - @int / 2, 1);
491 Debug.Log("sister eaten:" + @int + "/" + v2);
492 foreach (Element value3 in c.elements.dict.Values)
493 {
494 if (value3.IsMainAttribute)
495 {
496 c.elements.ModPotential(value3.id, v2);
497 }
498 }
499 }
500 if (c.race.id == "mutant" && c.elements.Base(1230) < 10)
501 {
502 c.Say("little_adam", c);
503 c.SetFeat(1230, c.elements.Base(1230) + 1);
504 }
505 c.SetInt(112, @int + 1);
506 break;
507 }
508 }
509 void AddPotential(int idEle)
510 {
511 int vTempPotential = c.elements.GetElement(idEle).vTempPotential;
512 int num = EClass.rndHalf((int)(v / 5f) + 1);
513 num = num * 100 / Mathf.Max(100, vTempPotential * 2 / 3);
514 c.elements.ModTempPotential(idEle, num, 8);
515 }
516 }
517 }
static void Poison(Chara tc, Chara c, int power)
Definition: ActEffect.cs:2946
static void LoveMiracle(Chara tc, Chara c, int power, EffectId idEffect=EffectId.Love, BlessedState? state=null)
Definition: ActEffect.cs:2962
ElementContainerCard elements
Definition: Card.cs:42
void ModExp(string alias, int a)
Definition: Card.cs:2781
void ModWeight(int a, bool ignoreLimit=false)
Definition: Chara.cs:10341
SourceRace.Row race
Definition: Chara.cs:468
static SourceManager sources
Definition: EClass.cs:43
static int rndHalf(int a)
Definition: EClass.cs:97
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)
int id
Definition: ELEMENT.cs:259
SourceElement.Row source
Definition: ELEMENT.cs:282
int vTempPotential
Definition: ELEMENT.cs:267
int Value
Definition: ELEMENT.cs:301
bool IsMainAttribute
Definition: ELEMENT.cs:392
static void SetColor()
Definition: Msg.cs:22
SourceElement elements

References Debug, SourceManager.elements, food, Chara.HasCondition(), Card.HasElement(), Element.id, Element.IsMainAttribute, ActEffect.LoveMiracle(), Card.ModExp(), Player.ModKarma(), EClass.pc, EClass.player, ActEffect.Poison(), EClass.rndHalf(), Msg.SetColor(), Element.source, EClass.sources, and Element.Value.

Referenced by Proc(), and ProcDrink().

◆ ProcTrait()

static void FoodEffect.ProcTrait ( Chara  c,
Card  food 
)
inlinestatic

Definition at line 519 of file FoodEffect.cs.

520 {
521 bool flag = false;
522 foreach (Element value in food.elements.dict.Values)
523 {
524 if (!value.IsTrait)
525 {
526 continue;
527 }
528 if (value.Value >= 0)
529 {
530 switch (value.id)
531 {
532 case 753:
533 c.CureCondition<ConPoison>(value.Value * 2);
534 break;
535 case 754:
536 c.AddCondition<ConPeace>(value.Value * 5);
537 break;
538 case 755:
539 c.CureCondition<ConBleed>(value.Value);
540 break;
541 case 756:
542 c.AddCondition<ConHotspring>(value.Value * 2)?.SetPerfume();
543 break;
544 case 760:
545 if (!c.HasCondition<ConAwakening>())
546 {
547 flag = true;
548 }
549 c.AddCondition<ConAwakening>(1000 + value.Value * 20);
550 break;
551 case 761:
552 if (c.HasCondition<ConAwakening>() && !flag)
553 {
554 if (c.IsPC)
555 {
556 Msg.Say("recharge_stamina_fail");
557 }
558 }
559 else
560 {
561 c.Say("recharge_stamina", c);
562 c.stamina.Mod(c.stamina.max * (value.Value / 10 + 1) / 100 + value.Value * 2 / 3 + EClass.rnd(5));
563 }
564 break;
565 }
566 }
567 else
568 {
569 switch (value.id)
570 {
571 case 753:
572 SayTaste("food_poison");
573 c.AddCondition<ConPoison>(-value.Value * 10);
574 break;
575 case 754:
576 SayTaste("food_mind");
577 c.AddCondition<ConConfuse>(-value.Value * 10);
578 c.AddCondition<ConInsane>(-value.Value * 10);
579 c.AddCondition<ConHallucination>(-value.Value * 20);
580 break;
581 case 755:
582 c.AddCondition<ConBleed>(-value.Value * 10);
583 break;
584 case 756:
585 c.hygiene.Mod(-value.Value * 5);
586 break;
587 case 760:
588 c.RemoveCondition<ConAwakening>();
589 c.sleepiness.Mod(value.Value);
590 break;
591 case 761:
592 c.Say("recharge_stamina_negative", c);
593 c.stamina.Mod(-c.stamina.max * (-value.Value / 10 + 1) / 100 + value.Value);
594 break;
595 }
596 }
597 }
598 void SayTaste(string _id)
599 {
600 if (c.IsPC)
601 {
602 c.Say(_id);
603 }
604 }
605 }
Stats sleepiness
Definition: Chara.cs:1215
Stats hygiene
Definition: Chara.cs:1211
Stats stamina
Definition: Chara.cs:1205
bool IsTrait
Definition: ELEMENT.cs:371
virtual int max
Definition: Stats.cs:68

References food, Element.id, Element.IsTrait, BaseCondition.Mod(), EClass.rnd(), Msg.Say(), and Element.Value.

Referenced by TraitItemProc.OnUse(), Proc(), and ProcDrink().


The documentation for this class was generated from the following file: