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

Static Public Member Functions

static void Proc (Chara c, Thing food)
 
static void ProcTrait (Chara c, Card t)
 
- Static Public Member Functions inherited from EClass
static int rndSeed (int a, int seed)
 
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

◆ Proc()

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

Definition at line 6 of file FoodEffect.cs.

7 {
8 food.CheckJustCooked();
9 bool flag = EClass._zone.IsPCFaction && c.IsInSpot<TraitSpotDining>();
10 int num = (food.isCrafted ? ((EClass.pc.Evalue(1650) >= 3) ? 5 : 0) : 0);
11 float num2 = (float)(100 + (food.HasElement(757) ? 10 : 0) + (flag ? 10 : 0) + num + Mathf.Min(food.QualityLv * 10, 100)) / 200f;
12 if (num2 < 0.1f)
13 {
14 num2 = 0.1f;
15 }
16 int num3 = food.Evalue(10);
17 float num4 = 25f;
18 float num5 = 1f;
19 string idTaste = "";
20 bool flag2 = food.HasElement(708);
21 bool flag3 = food.HasElement(709);
22 bool flag4 = c.HasElement(1205);
23 bool flag5 = food.IsDecayed || flag3;
25 if (c.IsPCFaction && !c.IsPC)
26 {
27 int num6 = c.CountNumEaten(food);
28 bool flag6 = c.GetFavFood().id == food.id;
29 if (num6 < 2 || flag6)
30 {
31 if (num6 == 1 || flag6 || EClass.rnd(4) == 0)
32 {
33 c.Talk("foodNice");
34 }
35 }
36 else if (num6 > 3 && EClass.rnd(num6) >= 3)
37 {
38 c.Talk("foodBored");
39 }
40 }
41 if (food.IsBlessed)
42 {
43 num2 *= 1.5f;
44 }
45 if (food.IsCursed)
46 {
47 num2 *= 0.5f;
48 }
49 if (flag4)
50 {
51 if (flag2)
52 {
53 num5 *= 2f;
54 num2 *= 1.5f;
55 }
56 else
57 {
58 num5 *= 0.5f;
59 num2 /= 2f;
60 num3 /= 2;
61 }
62 }
63 else if (flag2)
64 {
65 num5 = 0f;
66 num2 *= 0.5f;
67 }
68 if (c.HasElement(1200))
69 {
70 num2 *= 1.25f;
71 }
72 if (!c.IsPC)
73 {
74 num2 *= 3f;
75 }
76 if (flag5 && !c.HasElement(480))
77 {
78 if (c.IsPC)
79 {
80 if (flag3)
81 {
82 c.Say("food_undead");
83 }
84 c.Say("food_rot");
85 }
86 num5 = 0f;
87 num3 /= 2;
88 }
89 else
90 {
91 switch (food.source._origin)
92 {
93 case "meat":
94 if (c.IsPC)
95 {
96 c.Say("food_raw_meat");
97 }
98 num2 *= 0.7f;
99 num5 = 0.5f;
100 break;
101 case "fish":
102 if (c.IsHuman)
103 {
104 if (c.IsPC)
105 {
106 c.Say("food_raw_fish");
107 }
108 num2 *= 0.9f;
109 num5 = 0.5f;
110 }
111 break;
112 case "dough":
113 if (c.IsPC)
114 {
115 c.Say("food_raw_powder");
116 }
117 num2 *= 0.9f;
118 num5 = 0.5f;
119 break;
120 }
121 }
122 float num7 = Mathf.Min(c.hunger.value, num3);
123 if (c.hunger.GetPhase() >= 3)
124 {
125 num7 *= 1.1f;
126 }
127 if (flag5 && !c.HasElement(480))
128 {
129 c.ModExp(70, -300);
130 c.ModExp(71, -300);
131 c.ModExp(72, -200);
132 c.ModExp(73, -200);
133 c.ModExp(74, -200);
134 c.ModExp(75, 500);
135 c.ModExp(76, -200);
136 c.ModExp(77, -300);
137 }
138 else
139 {
140 num2 = num2 * num7 / 10f;
141 if (c.HasCondition<ConAnorexia>())
142 {
143 num2 = 0.01f;
144 }
145 List<Element> list = food.ListValidTraits(isCraft: true, limit: false);
146 foreach (Element value in food.elements.dict.Values)
147 {
148 if (value.source.foodEffect.IsEmpty() || !list.Contains(value))
149 {
150 continue;
151 }
152 string[] foodEffect = value.source.foodEffect;
153 int id = value.id;
154 float num8 = num2 * (float)value.Value;
155 if (value.source.category == "food" && c.IsPC)
156 {
157 bool flag7 = num8 >= 0f;
158 string text = value.source.GetText(flag7 ? "textInc" : "textDec", returnNull: true);
159 if (text != null)
160 {
161 Msg.SetColor(flag7 ? "positive" : "negative");
162 c.Say(text);
163 }
164 }
165 switch (foodEffect[0])
166 {
167 case "god":
168 {
169 int int2 = c.GetInt(117);
170 if (int2 < 10)
171 {
172 foreach (Element value2 in c.elements.dict.Values)
173 {
174 if (value2.IsMainAttribute)
175 {
176 c.elements.ModPotential(value2.id, 2);
177 }
178 }
179 }
180 c.Say("little_eat", c);
181 c.PlaySound("ding_potential");
182 c.elements.ModExp(306, -1000);
183 c.SetInt(117, int2 + 1);
184 break;
185 }
186 case "exp":
187 {
188 id = ((foodEffect.Length > 1) ? EClass.sources.elements.alias[foodEffect[1]].id : value.id);
189 int a = (int)(num8 * (float)((foodEffect.Length > 2) ? foodEffect[2].ToInt() : 4)) * 2 / 3;
190 c.ModExp(id, a);
191 break;
192 }
193 case "pot":
194 {
195 id = ((foodEffect.Length > 1) ? EClass.sources.elements.alias[foodEffect[1]].id : value.id);
196 int vTempPotential = c.elements.GetElement(id).vTempPotential;
197 int num9 = EClass.rndHalf((int)(num8 / 5f) + 1);
198 num9 = num9 * 100 / Mathf.Max(100, vTempPotential * 2 / 3);
199 c.elements.ModTempPotential(id, num9, 8);
200 break;
201 }
202 case "karma":
203 if (c.IsPCParty)
204 {
206 }
207 break;
208 case "poison":
209 ActEffect.Poison(c, EClass.pc, value.Value * 10);
210 if (c.isDead)
211 {
212 return;
213 }
214 break;
215 case "love":
216 ActEffect.LoveMiracle(c, EClass.pc, value.Value * 10);
217 break;
218 case "loseWeight":
219 c.ModWeight(-EClass.rndHalf(value.Value), ignoreLimit: true);
220 break;
221 case "gainWeight":
222 c.ModWeight(EClass.rndHalf(value.Value), ignoreLimit: true);
223 break;
224 case "little":
225 {
226 int @int = c.GetInt(112);
227 if (@int < 30)
228 {
229 c.Say("little_eat", c);
230 c.PlaySound("ding_potential");
231 int v = Mathf.Max(5 - @int / 2, 1);
232 Debug.Log("sister eaten:" + @int + "/" + v);
233 foreach (Element value3 in c.elements.dict.Values)
234 {
235 if (value3.IsMainAttribute)
236 {
237 c.elements.ModPotential(value3.id, v);
238 }
239 }
240 }
241 if (c.race.id == "mutant" && c.elements.Base(1230) < 10)
242 {
243 c.Say("little_adam", c);
244 c.SetFeat(1230, c.elements.Base(1230) + 1);
245 }
246 c.SetInt(112, @int + 1);
247 break;
248 }
249 }
250 }
251 }
252 ProcTrait(c, food);
253 num4 += (float)food.Evalue(70);
254 num4 += (float)(food.Evalue(72) / 2);
255 num4 += (float)(food.Evalue(73) / 2);
256 num4 += (float)(food.Evalue(75) / 2);
257 num4 += (float)(food.Evalue(76) * 3 / 2);
258 num4 += (float)food.Evalue(440);
259 num4 += (float)(food.Evalue(445) / 2);
260 num4 -= (float)food.Evalue(71);
261 num4 += (float)(num3 / 2);
262 num4 *= num5;
263 if (idTaste.IsEmpty())
264 {
265 if (num4 > 100f)
266 {
267 idTaste = "food_great";
268 }
269 else if (num4 > 70f)
270 {
271 idTaste = "food_good";
272 }
273 else if (num4 > 50f)
274 {
275 idTaste = "food_soso";
276 }
277 else if (num4 > 30f)
278 {
279 idTaste = "food_average";
280 }
281 else
282 {
283 idTaste = "food_bad";
284 }
285 if (c.IsPC)
286 {
287 c.Say(idTaste);
288 if (flag2)
289 {
290 c.Say(flag4 ? "food_human_pos" : "food_human_neg");
291 }
292 else if (flag4)
293 {
294 c.Say("food_human_whine");
295 }
296 }
297 }
298 if (LangGame.Has(idTaste + "2"))
299 {
300 c.Say(idTaste + "2", c, food);
301 }
302 if (!c.IsPCParty)
303 {
304 num3 *= 2;
305 }
306 num3 = num3 * (100 + c.Evalue(1235) * 10) / (100 + c.Evalue(1234) * 10 + c.Evalue(1236) * 15);
307 c.hunger.Mod(-num3);
308 if (flag2)
309 {
310 if (!flag4)
311 {
312 if (c.IsHuman)
313 {
314 c.AddCondition<ConInsane>(200);
315 c.SAN.Mod(15);
316 }
317 if (EClass.rnd(c.IsHuman ? 5 : 20) == 0)
318 {
319 c.SetFeat(1205, 1, msg: true);
320 flag4 = true;
321 }
322 }
323 if (flag4)
324 {
325 c.SetInt(31, EClass.world.date.GetRaw() + 10080);
326 }
327 }
328 else if (flag4 && c.GetInt(31) < EClass.world.date.GetRaw())
329 {
330 c.SetFeat(1205, 0, msg: true);
331 }
332 if (flag5 && !c.HasElement(480))
333 {
335 c.AddCondition<ConConfuse>(200);
336 }
337 if (c.HasCondition<ConAnorexia>())
338 {
339 c.Vomit();
340 }
341 if (num3 > 20 && c.HasElement(1413))
342 {
343 Thing thing = ThingGen.Create("seed");
344 if (EClass.rnd(EClass.debug.enable ? 2 : 10) == 0)
345 {
346 TraitSeed.ApplySeed(thing, (EClass.rnd(4) == 0) ? 118 : ((EClass.rnd(3) == 0) ? 119 : 90));
347 }
348 thing.SetNum(2 + EClass.rnd(3));
349 c.Talk("vomit");
350 c.Say("fairy_vomit", c, thing);
351 c.PickOrDrop(c.pos, thing);
352 }
353 food.trait.OnEat(c);
354 if (food.trait is TraitDrink)
355 {
356 food.trait.OnDrink(c);
357 }
358 }
if(item3.idFile==idFirstFile &&item3.id==idFirstTopic)
Definition: UIBook.cs:627
static void Poison(Chara tc, Chara c, int power)
Definition: ActEffect.cs:2194
static void LoveMiracle(Chara tc, Chara c, int power)
Definition: ActEffect.cs:2206
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:5395
SoundSource PlaySound(string id, float v=1f, bool spatial=true)
Definition: Card.cs:5585
void Talk(string idTopic, string ref1=null, string ref2=null, bool forceSync=false)
Definition: Card.cs:6135
Thing SetNum(int a)
Definition: Card.cs:3286
Point pos
Definition: Card.cs:55
int Evalue(int ele)
Definition: Card.cs:2471
void ModExp(string alias, int a)
Definition: Card.cs:2548
void Say(string lang, string ref1=null, string ref2=null)
Definition: Card.cs:6232
Condition AddCondition(string id, int p=100, bool force=false)
Definition: Chara.cs:8513
override bool IsPC
Definition: Chara.cs:602
void SetFeat(int id, int value=1, bool msg=false)
Definition: Chara.cs:9063
override bool IsPCParty
Definition: Chara.cs:605
bool HasCondition(string alias)
Definition: Chara.cs:8666
Stats hunger
Definition: Chara.cs:956
bool IsHuman
Definition: Chara.cs:840
void PickOrDrop(Point p, string idThing, int idMat=-1, int num=1, bool msg=true)
Definition: Chara.cs:3920
override bool IsPCFaction
Definition: Chara.cs:661
void Vomit()
Definition: Chara.cs:4784
Stats SAN
Definition: Chara.cs:972
SourceThing.Row GetFavFood()
Definition: Chara.cs:7356
void ModWeight(int a, bool ignoreLimit=false)
Definition: Chara.cs:8980
void AddFoodHistory(Thing food)
Definition: Chara.cs:9271
int CountNumEaten(Thing food)
Definition: Chara.cs:9291
bool isDead
Definition: Chara.cs:379
SourceRace.Row race
Definition: Chara.cs:454
bool enable
Definition: CoreDebug.cs:285
int GetRaw(int offsetHours=0)
Definition: Date.cs:322
Definition: EClass.cs:5
static int rnd(int a)
Definition: EClass.cs:58
static World world
Definition: EClass.cs:40
static SourceManager sources
Definition: EClass.cs:42
static int rndHalf(int a)
Definition: EClass.cs:82
static Player player
Definition: EClass.cs:12
static Chara pc
Definition: EClass.cs:14
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:246
SourceElement.Row source
Definition: ELEMENT.cs:269
int vTempPotential
Definition: ELEMENT.cs:254
int Value
Definition: ELEMENT.cs:288
bool IsMainAttribute
Definition: ELEMENT.cs:379
static void ProcTrait(Chara c, Card t)
Definition: FoodEffect.cs:360
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:2306
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(), Chara.AddFoodHistory(), TraitSeed.ApplySeed(), ElementContainer.Base(), Chara.CountNumEaten(), ThingGen.Create(), World.date, EClass.debug, Debug, ElementContainer.dict, Card.elements, SourceManager.elements, CoreDebug.enable, Card.Evalue(), food, ElementContainer.GetElement(), Chara.GetFavFood(), BaseCard.GetInt(), Stats.GetPhase(), Date.GetRaw(), LangGame.Has(), Chara.HasCondition(), Card.HasElement(), Chara.hunger, Element.id, if(), Chara.isDead, Chara.IsHuman, Element.IsMainAttribute, Chara.IsPC, Chara.IsPCFaction, Chara.IsPCParty, 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 360 of file FoodEffect.cs.

361 {
362 bool flag = false;
363 foreach (Element value in t.elements.dict.Values)
364 {
365 if (!value.IsTrait)
366 {
367 continue;
368 }
369 if (value.Value >= 0)
370 {
371 switch (value.id)
372 {
373 case 753:
374 c.CureCondition<ConPoison>(value.Value * 2);
375 break;
376 case 754:
377 c.AddCondition<ConPeace>(value.Value * 5);
378 break;
379 case 755:
380 c.CureCondition<ConBleed>(value.Value);
381 break;
382 case 756:
383 c.AddCondition<ConHotspring>(value.Value * 2)?.SetPerfume();
384 break;
385 case 760:
386 if (!c.HasCondition<ConAwakening>())
387 {
388 flag = true;
389 }
390 c.AddCondition<ConAwakening>(1000 + value.Value * 20);
391 break;
392 case 761:
393 if (c.HasCondition<ConAwakening>() && !flag)
394 {
395 if (c.IsPC)
396 {
397 Msg.Say("recharge_stamina_fail");
398 }
399 }
400 else
401 {
402 c.Say("recharge_stamina", c);
403 c.stamina.Mod(c.stamina.max * (value.Value / 10 + 1) / 100 + value.Value * 2 / 3 + EClass.rnd(5));
404 }
405 break;
406 }
407 }
408 else
409 {
410 switch (value.id)
411 {
412 case 753:
413 SayTaste("food_poison");
414 c.AddCondition<ConPoison>(-value.Value * 10);
415 break;
416 case 754:
417 SayTaste("food_mind");
418 c.AddCondition<ConConfuse>(-value.Value * 10);
419 c.AddCondition<ConInsane>(-value.Value * 10);
420 c.AddCondition<ConHallucination>(-value.Value * 20);
421 break;
422 case 761:
423 c.Say("recharge_stamina_negative", c);
424 c.stamina.Mod(-c.stamina.max * (-value.Value / 10 + 1) / 100 + value.Value);
425 break;
426 }
427 }
428 }
429 void SayTaste(string _id)
430 {
431 if (c.IsPC)
432 {
433 c.Say(_id);
434 }
435 }
436 }
Stats stamina
Definition: Chara.cs:960
bool IsTrait
Definition: ELEMENT.cs:358
static string Say(string idLang, string ref1, string ref2=null, string ref3=null, string ref4=null)
Definition: Msg.cs:58
virtual int max
Definition: Stats.cs:68

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

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


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