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

Static Public Member Functions

static bool IsHumanFlesh (Thing food)
 
static bool IsUndeadFlesh (Thing food)
 
static bool IsHumanFlesh (CardRow r)
 
static bool IsUndeadFlesh (CardRow r)
 
static void Proc (Chara c, Thing food)
 
static void ProcTrait (Chara c, Card t)
 
- Static Public Member Functions inherited from EClass
static int rnd (int a)
 
static int curve (int a, int start, int step, int rate=75)
 
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 4 of file FoodEffect.cs.

Member Function Documentation

◆ IsHumanFlesh() [1/2]

static bool FoodEffect.IsHumanFlesh ( CardRow  r)
inlinestatic

Definition at line 48 of file FoodEffect.cs.

49 {
50 if (r == null)
51 {
52 return false;
53 }
54 if (r.id == "chara")
55 {
56 return EClass.pc.race.tag.Contains("human");
57 }
58 if (r.isChara)
59 {
60 return EClass.sources.races.map[EClass.sources.charas.map[r.id].race].tag.Contains("human");
61 }
62 return false;
63 }
bool isChara
Definition: CardRow.cs:55
string id
Definition: CardRow.cs:7
SourceRace.Row race
Definition: Chara.cs:449
Definition: EClass.cs:5
static SourceManager sources
Definition: EClass.cs:42
static Chara pc
Definition: EClass.cs:14
SourceRace races
SourceChara charas

References SourceManager.charas, CardRow.id, CardRow.isChara, EClass.pc, Chara.race, SourceManager.races, and EClass.sources.

◆ IsHumanFlesh() [2/2]

static bool FoodEffect.IsHumanFlesh ( Thing  food)
inlinestatic

Definition at line 6 of file FoodEffect.cs.

7 {
8 if (food.HasTag(CTAG.notHumanMeat))
9 {
10 return false;
11 }
12 if (food.id == "deadbody")
13 {
14 return true;
15 }
16 if (food.source._origin != "meat" && food.source._origin != "dish")
17 {
18 return false;
19 }
20 string[] components = food.source.components;
21 for (int i = 0; i < components.Length; i++)
22 {
23 if (components[i].Contains("egg"))
24 {
25 return false;
26 }
27 }
28 if (!IsHumanFlesh(food.refCard))
29 {
30 return IsHumanFlesh(food.refCard2);
31 }
32 return true;
33 }
CTAG
Definition: CTAG.cs:2
static bool IsHumanFlesh(Thing food)
Definition: FoodEffect.cs:6

References food, and IsHumanFlesh().

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

◆ IsUndeadFlesh() [1/2]

static bool FoodEffect.IsUndeadFlesh ( CardRow  r)
inlinestatic

Definition at line 65 of file FoodEffect.cs.

66 {
67 if (r == null)
68 {
69 return false;
70 }
71 if (r.id == "chara")
72 {
73 return EClass.pc.race.tag.Contains("undead");
74 }
75 if (r.isChara)
76 {
77 return EClass.sources.races.map[EClass.sources.charas.map[r.id].race].tag.Contains("undead");
78 }
79 return false;
80 }

References SourceManager.charas, CardRow.id, CardRow.isChara, EClass.pc, Chara.race, SourceManager.races, and EClass.sources.

◆ IsUndeadFlesh() [2/2]

static bool FoodEffect.IsUndeadFlesh ( Thing  food)
inlinestatic

Definition at line 35 of file FoodEffect.cs.

36 {
37 if (food.source._origin != "meat" && food.source._origin != "dish")
38 {
39 return false;
40 }
41 if (!IsUndeadFlesh(food.refCard))
42 {
43 return IsUndeadFlesh(food.refCard2);
44 }
45 return true;
46 }
static bool IsUndeadFlesh(Thing food)
Definition: FoodEffect.cs:35

References food, and IsUndeadFlesh().

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

◆ Proc()

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

Definition at line 82 of file FoodEffect.cs.

83 {
84 food.CheckJustCooked();
85 bool flag = EClass._zone.IsPCFaction && c.IsInSpot<TraitSpotDining>();
86 int num = (food.isCrafted ? ((EClass.pc.Evalue(1650) >= 3) ? 5 : 0) : 0);
87 float num2 = (float)(100 + (food.HasElement(757) ? 10 : 0) + (flag ? 10 : 0) + num + Mathf.Min(food.QualityLv * 10, 100)) / 200f;
88 if (num2 < 0.1f)
89 {
90 num2 = 0.1f;
91 }
92 int num3 = food.Evalue(10);
93 float num4 = 25f;
94 float num5 = 1f;
95 string idTaste = "";
96 bool flag2 = IsHumanFlesh(food);
97 bool flag3 = IsUndeadFlesh(food);
98 bool flag4 = c.HasElement(1205);
99 bool flag5 = food.IsDecayed || flag3;
100 if (food.IsBlessed)
101 {
102 num2 *= 1.5f;
103 }
104 if (food.IsCursed)
105 {
106 num2 *= 0.5f;
107 }
108 if (flag4)
109 {
110 if (flag2)
111 {
112 num5 *= 2f;
113 num2 *= 1.5f;
114 }
115 else
116 {
117 num5 *= 0.5f;
118 num2 /= 2f;
119 num3 /= 2;
120 }
121 }
122 else if (flag2)
123 {
124 num5 = 0f;
125 num2 *= 0.5f;
126 }
127 if (c.HasElement(1200))
128 {
129 num2 *= 1.25f;
130 }
131 if (!c.IsPC)
132 {
133 num2 *= 3f;
134 }
135 if (flag5 && !c.HasElement(480))
136 {
137 if (c.IsPC)
138 {
139 if (flag3)
140 {
141 c.Say("food_undead");
142 }
143 c.Say("food_rot");
144 }
145 num5 = 0f;
146 num3 /= 2;
147 }
148 else
149 {
150 switch (food.source._origin)
151 {
152 case "meat":
153 if (c.IsPC)
154 {
155 c.Say("food_raw_meat");
156 }
157 num2 *= 0.7f;
158 num5 = 0.5f;
159 break;
160 case "fish":
161 if (c.IsHuman)
162 {
163 if (c.IsPC)
164 {
165 c.Say("food_raw_fish");
166 }
167 num2 *= 0.9f;
168 num5 = 0.5f;
169 }
170 break;
171 case "dough":
172 if (c.IsPC)
173 {
174 c.Say("food_raw_powder");
175 }
176 num2 *= 0.9f;
177 num5 = 0.5f;
178 break;
179 }
180 }
181 float num6 = Mathf.Min(c.hunger.value, num3);
182 if (c.hunger.GetPhase() >= 3)
183 {
184 num6 *= 1.1f;
185 }
186 if (flag5 && !c.HasElement(480))
187 {
188 c.ModExp(70, -300);
189 c.ModExp(71, -300);
190 c.ModExp(72, -200);
191 c.ModExp(73, -200);
192 c.ModExp(74, -200);
193 c.ModExp(75, 500);
194 c.ModExp(76, -200);
195 c.ModExp(77, -300);
196 }
197 else
198 {
199 num2 = num2 * num6 / 10f;
200 if (c.HasCondition<ConAnorexia>())
201 {
202 num2 = 0.01f;
203 }
204 List<Element> list = food.ListValidTraits(isCraft: true, limit: false);
205 foreach (Element value in food.elements.dict.Values)
206 {
207 if (value.source.foodEffect.IsEmpty() || !list.Contains(value))
208 {
209 continue;
210 }
211 string[] foodEffect = value.source.foodEffect;
212 int id = value.id;
213 float num7 = num2 * (float)value.Value;
214 if (value.source.category == "food" && c.IsPC)
215 {
216 bool flag6 = num7 >= 0f;
217 string text = value.source.GetText(flag6 ? "textInc" : "textDec", returnNull: true);
218 if (text != null)
219 {
220 Msg.SetColor(flag6 ? "positive" : "negative");
221 c.Say(text);
222 }
223 }
224 switch (foodEffect[0])
225 {
226 case "god":
227 {
228 int int2 = c.GetInt(117);
229 if (int2 < 10)
230 {
231 foreach (Element value2 in c.elements.dict.Values)
232 {
233 if (value2.IsMainAttribute)
234 {
235 c.elements.ModPotential(value2.id, 2);
236 }
237 }
238 }
239 c.Say("little_eat", c);
240 c.PlaySound("ding_potential");
241 c.elements.ModExp(306, -1000);
242 c.SetInt(117, int2 + 1);
243 break;
244 }
245 case "exp":
246 {
247 id = ((foodEffect.Length > 1) ? EClass.sources.elements.alias[foodEffect[1]].id : value.id);
248 int a = (int)(num7 * (float)((foodEffect.Length > 2) ? foodEffect[2].ToInt() : 4)) * 2 / 3;
249 c.ModExp(id, a);
250 break;
251 }
252 case "pot":
253 {
254 id = ((foodEffect.Length > 1) ? EClass.sources.elements.alias[foodEffect[1]].id : value.id);
255 int vTempPotential = c.elements.GetElement(id).vTempPotential;
256 int num8 = EClass.rndHalf((int)(num7 / 5f) + 1);
257 num8 = num8 * 100 / Mathf.Max(100, vTempPotential * 2 / 3);
258 c.elements.ModTempPotential(id, num8, 8);
259 break;
260 }
261 case "karma":
262 if (c.IsPCParty)
263 {
265 }
266 break;
267 case "poison":
268 ActEffect.Poison(c, EClass.pc, value.Value * 10);
269 if (c.isDead)
270 {
271 return;
272 }
273 break;
274 case "love":
275 ActEffect.LoveMiracle(c, EClass.pc, value.Value * 10);
276 break;
277 case "loseWeight":
278 c.ModWeight(-EClass.rndHalf(value.Value), ignoreLimit: true);
279 break;
280 case "gainWeight":
281 c.ModWeight(EClass.rndHalf(value.Value), ignoreLimit: true);
282 break;
283 case "little":
284 {
285 int @int = c.GetInt(112);
286 if (@int >= 30)
287 {
288 break;
289 }
290 c.Say("little_eat", c);
291 c.PlaySound("ding_potential");
292 int v = Mathf.Max(5 - @int / 2, 1);
293 Debug.Log("sister eaten:" + @int + "/" + v);
294 foreach (Element value3 in c.elements.dict.Values)
295 {
296 if (value3.IsMainAttribute)
297 {
298 c.elements.ModPotential(value3.id, v);
299 }
300 }
301 if (c.race.id == "mutant" && c.elements.Base(1230) < 10)
302 {
303 c.Say("little_adam", c);
304 c.SetFeat(1230, c.elements.Base(1230) + 1);
305 }
306 c.SetInt(112, @int + 1);
307 break;
308 }
309 }
310 }
311 }
312 ProcTrait(c, food);
313 num4 += (float)food.Evalue(70);
314 num4 += (float)(food.Evalue(72) / 2);
315 num4 += (float)(food.Evalue(73) / 2);
316 num4 += (float)(food.Evalue(75) / 2);
317 num4 += (float)(food.Evalue(76) * 3 / 2);
318 num4 += (float)food.Evalue(440);
319 num4 += (float)(food.Evalue(445) / 2);
320 num4 -= (float)food.Evalue(71);
321 num4 += (float)(num3 / 2);
322 num4 *= num5;
323 if (idTaste.IsEmpty())
324 {
325 if (num4 > 100f)
326 {
327 idTaste = "food_great";
328 }
329 else if (num4 > 70f)
330 {
331 idTaste = "food_good";
332 }
333 else if (num4 > 50f)
334 {
335 idTaste = "food_soso";
336 }
337 else if (num4 > 30f)
338 {
339 idTaste = "food_average";
340 }
341 else
342 {
343 idTaste = "food_bad";
344 }
345 if (c.IsPC)
346 {
347 c.Say(idTaste);
348 if (flag2)
349 {
350 c.Say(flag4 ? "food_human_pos" : "food_human_neg");
351 }
352 else if (flag4)
353 {
354 c.Say("food_human_whine");
355 }
356 }
357 }
358 if (LangGame.Has(idTaste + "2"))
359 {
360 c.Say(idTaste + "2", c, food);
361 }
362 if (!c.IsPCParty)
363 {
364 num3 *= 2;
365 }
366 num3 = num3 * (100 + c.Evalue(1235) * 10) / (100 + c.Evalue(1234) * 10 + c.Evalue(1236) * 15);
367 c.hunger.Mod(-num3);
368 if (flag2)
369 {
370 if (!flag4)
371 {
372 if (c.IsHuman)
373 {
374 c.AddCondition<ConInsane>(200);
375 c.SAN.Mod(15);
376 }
377 if (EClass.rnd(c.IsHuman ? 5 : 20) == 0)
378 {
379 c.SetFeat(1205, 1, msg: true);
380 flag4 = true;
381 }
382 }
383 if (flag4)
384 {
385 c.SetInt(31, EClass.world.date.GetRaw() + 10080);
386 }
387 }
388 else if (flag4 && c.GetInt(31) < EClass.world.date.GetRaw())
389 {
390 c.SetFeat(1205, 0, msg: true);
391 }
392 if (flag5 && !c.HasElement(480))
393 {
395 c.AddCondition<ConConfuse>(200);
396 }
397 if (c.HasCondition<ConAnorexia>())
398 {
399 c.Vomit();
400 }
401 if (num3 > 20 && c.HasElement(1413))
402 {
403 Thing thing = ThingGen.Create("seed");
404 if (EClass.rnd(EClass.debug.enable ? 2 : 10) == 0)
405 {
406 TraitSeed.ApplySeed(thing, (EClass.rnd(4) == 0) ? 118 : ((EClass.rnd(3) == 0) ? 119 : 90));
407 }
408 thing.SetNum(2 + EClass.rnd(3));
409 c.Talk("vomit");
410 c.Say("fairy_vomit", c, thing);
411 c.PickOrDrop(c.pos, thing);
412 }
413 food.trait.OnEat(c);
414 if (food.trait is TraitDrink)
415 {
416 food.trait.OnDrink(c);
417 }
418 }
if(item3.idFile==idFirstFile &&item3.id==idFirstTopic)
Definition: UIBook.cs:627
static void Poison(Chara tc, Chara c, int power)
Definition: ActEffect.cs:2160
static void LoveMiracle(Chara tc, Chara c, int power)
Definition: ActEffect.cs:2172
int GetInt(int id, int? defaultInt=null)
Definition: BaseCard.cs:25
void SetInt(int id, int value=0)
Definition: BaseCard.cs:39
ElementContainerCard elements
Definition: Card.cs:37
bool HasElement(int ele, int req=1)
Definition: Card.cs:5214
SoundSource PlaySound(string id, float v=1f, bool spatial=true)
Definition: Card.cs:5404
void Talk(string idTopic, string ref1=null, string ref2=null, bool forceSync=false)
Definition: Card.cs:5949
Thing SetNum(int a)
Definition: Card.cs:3242
Point pos
Definition: Card.cs:55
int Evalue(int ele)
Definition: Card.cs:2431
void ModExp(string alias, int a)
Definition: Card.cs:2508
void Say(string lang, string ref1=null, string ref2=null)
Definition: Card.cs:6046
Condition AddCondition(string id, int p=100, bool force=false)
Definition: Chara.cs:8415
override bool IsPC
Definition: Chara.cs:597
void SetFeat(int id, int value=1, bool msg=false)
Definition: Chara.cs:8964
override bool IsPCParty
Definition: Chara.cs:600
bool HasCondition(string alias)
Definition: Chara.cs:8568
Stats hunger
Definition: Chara.cs:951
bool IsHuman
Definition: Chara.cs:835
void PickOrDrop(Point p, string idThing, int idMat=-1, int num=1, bool msg=true)
Definition: Chara.cs:3900
void Vomit()
Definition: Chara.cs:4764
Stats SAN
Definition: Chara.cs:967
void ModWeight(int a, bool ignoreLimit=false)
Definition: Chara.cs:8881
bool isDead
Definition: Chara.cs:374
bool enable
Definition: CoreDebug.cs:285
int GetRaw(int offsetHours=0)
Definition: Date.cs:322
static int rnd(int a)
Definition: EClass.cs:50
static World world
Definition: EClass.cs:40
static int rndHalf(int a)
Definition: EClass.cs:74
static Player player
Definition: EClass.cs:12
static CoreDebug debug
Definition: EClass.cs:48
Dictionary< int, Element > dict
Element ModPotential(int ele, int v)
Element ModTempPotential(int ele, int v, int threshMsg=0)
void ModExp(int ele, int a, bool chain=false)
Element GetElement(string alias)
int id
Definition: ELEMENT.cs:240
SourceElement.Row source
Definition: ELEMENT.cs:263
int vTempPotential
Definition: ELEMENT.cs:248
int Value
Definition: ELEMENT.cs:282
bool IsMainAttribute
Definition: ELEMENT.cs:373
static void ProcTrait(Chara c, Card t)
Definition: FoodEffect.cs:420
static bool Has(string id)
Definition: LangGame.cs:46
Definition: Msg.cs:5
static void SetColor()
Definition: Msg.cs:22
void ModKarma(int a)
Definition: Player.cs:2289
SourceElement elements
virtual void Mod(int a)
Definition: Stats.cs:135
override int GetPhase()
Definition: Stats.cs:117
virtual int value
Definition: Stats.cs:56
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:158
GameDate date
Definition: World.cs:6

References Chara.AddCondition(), TraitSeed.ApplySeed(), ElementContainer.Base(), ThingGen.Create(), World.date, EClass.debug, Debug, ElementContainer.dict, Card.elements, SourceManager.elements, CoreDebug.enable, Card.Evalue(), food, ElementContainer.GetElement(), BaseCard.GetInt(), Stats.GetPhase(), Date.GetRaw(), LangGame.Has(), Chara.HasCondition(), Card.HasElement(), Chara.hunger, Element.id, if(), Chara.isDead, Chara.IsHuman, IsHumanFlesh(), Element.IsMainAttribute, Chara.IsPC, Chara.IsPCParty, IsUndeadFlesh(), ActEffect.LoveMiracle(), Stats.Mod(), ElementContainer.ModExp(), Card.ModExp(), Player.ModKarma(), ElementContainer.ModPotential(), ElementContainer.ModTempPotential(), Chara.ModWeight(), EClass.pc, Chara.PickOrDrop(), EClass.player, Card.PlaySound(), ActEffect.Poison(), Card.pos, ProcTrait(), Chara.race, EClass.rnd(), EClass.rndHalf(), Chara.SAN, Card.Say(), Msg.SetColor(), Chara.SetFeat(), BaseCard.SetInt(), Card.SetNum(), Element.source, EClass.sources, Card.Talk(), Element.Value, Stats.value, Chara.Vomit(), Element.vTempPotential, and EClass.world.

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

◆ ProcTrait()

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

Definition at line 420 of file FoodEffect.cs.

421 {
422 foreach (Element value in t.elements.dict.Values)
423 {
424 if (!value.IsTrait)
425 {
426 continue;
427 }
428 if (value.Value >= 0)
429 {
430 switch (value.id)
431 {
432 case 753:
433 c.CureCondition<ConPoison>(value.Value * 2);
434 break;
435 case 754:
436 c.AddCondition<ConPeace>(value.Value * 5);
437 break;
438 case 755:
439 c.CureCondition<ConBleed>(value.Value);
440 break;
441 case 756:
442 c.AddCondition<ConHotspring>(value.Value * 2)?.SetPerfume();
443 break;
444 }
445 }
446 else
447 {
448 switch (value.id)
449 {
450 case 753:
451 SayTaste("food_poison");
452 c.AddCondition<ConPoison>(-value.Value * 10);
453 break;
454 case 754:
455 SayTaste("food_mind");
456 c.AddCondition<ConConfuse>(-value.Value * 10);
457 c.AddCondition<ConInsane>(-value.Value * 10);
458 c.AddCondition<ConHallucination>(-value.Value * 20);
459 break;
460 }
461 }
462 }
463 void SayTaste(string _id)
464 {
465 if (c.IsPC)
466 {
467 c.Say(_id);
468 }
469 }
470 }
bool IsTrait
Definition: ELEMENT.cs:352

References Element.id, Element.IsTrait, and Element.Value.

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


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