Elin Decompiled Documentation EA 23.130 Nightly
Loading...
Searching...
No Matches
ELEMENT.cs
Go to the documentation of this file.
1using System;
2using System.Collections.Generic;
3using UnityEngine;
4using UnityEngine.UI;
5
6public class ELEMENT
7{
8 public const int rare = 751;
9
10 public const int cute = 752;
11
12 public const int antidote = 753;
13
14 public const int nerve = 754;
15
16 public const int blood = 755;
17
18 public const int hotspring = 756;
19
20 public const int stimulant = 760;
21
22 public const int recharge = 761;
23
24 public const int roasted = 762;
25
26 public const int comfort = 750;
27
28 public const int purity = 759;
29
30 public const int _void = 0;
31
32 public const int d = 3;
33
34 public const int lv = 1;
35
36 public const int quality = 2;
37
38 public const int socket = 5;
39
40 public const int nutrition = 10;
41
42 public const int weight = 11;
43
44 public const int size = 12;
45
46 public const int hardness = 13;
47
48 public const int growth = 14;
49
50 public const int heat = 16;
51
52 public const int decay = 17;
53
54 public const int taste = 18;
55
56 public const int water = 15;
57
58 public const int fire = 21;
59
60 public const int cut = 22;
61
62 public const int old_detox = 23;
63
64 public const int old_heal = 24;
65
66 public const int old_antidote = 25;
67
68 public const int cure = 26;
69
70 public const int race = 29;
71
72 public const int piety = 85;
73
74 public const int poison = 20;
75
76 public static readonly int[] IDS = new int[34]
77 {
78 751, 752, 753, 754, 755, 756, 760, 761, 762, 750,
79 759, 0, 3, 1, 2, 5, 10, 11, 12, 13,
80 14, 16, 17, 18, 15, 21, 22, 23, 24, 25,
81 26, 29, 85, 20
82 };
83}
84public class Element : EClass
85{
86 public class BonusInfo
87 {
88 public Element ele;
89
90 public UINote n;
91
92 public Chara c;
93
94 public bool first = true;
95
96 public int total;
97
98 public void CheckFirst()
99 {
100 if (first)
101 {
102 first = false;
103 n.Space(8);
104 }
105 }
106
107 public void AddText(string text, FontColor col = FontColor.Warning)
108 {
109 CheckFirst();
110 n.AddText("_bullet".lang() + text, col);
111 }
112
113 public void AddText(int v, string text, string textBad = null)
114 {
115 if (v != 0)
116 {
117 string text2 = text;
118 if (!textBad.IsEmpty() && v < 0)
119 {
120 text2 = textBad;
121 }
122 CheckFirst();
123 total += v;
124 n.AddText("_bullet".lang() + text2 + " " + ((v > 0) ? "+" : "") + v, (v > 0) ? FontColor.Good : FontColor.Bad);
125 }
126 }
127
128 public void AddFix(int v, string text)
129 {
130 if (v != 0)
131 {
132 CheckFirst();
133 n.AddText("_bullet".lang() + text + " " + ((v > 0) ? "+" : "") + v + "%", (v > 0) ? FontColor.Good : FontColor.Bad);
134 }
135 }
136
137 public void WriteNote()
138 {
139 int id = ele.id;
140 int num = 0;
141 foreach (BodySlot slot in c.body.slots)
142 {
143 if (slot.elementId != 44 && slot.thing != null && ((id != 67 && id != 66) || slot.elementId != 35))
144 {
145 Element orCreateElement = slot.thing.elements.GetOrCreateElement(id);
146 if (orCreateElement != null && !orCreateElement.IsGlobalElement)
147 {
148 num += orCreateElement.Value;
149 }
150 }
151 }
152 AddText(num, "equipment".lang());
153 if (c.IsPCFaction)
154 {
156 if (element != null)
157 {
158 AddText(element.Value, "sub_faction".lang());
159 }
160 }
161 foreach (Condition condition in c.conditions)
162 {
163 if (condition.elements != null)
164 {
165 AddText(condition.elements.Value(id), condition.Name);
166 }
167 }
168 if (c.tempElements != null)
169 {
170 AddText(c.tempElements.Value(id), "tempStrengthen".lang(), "tempWeaken".lang());
171 }
172 try
173 {
174 if (c.faithElements != null)
175 {
176 Element element2 = c.elements.GetElement("featGod_" + c.faith.id + "1");
177 if (element2 != null)
178 {
179 AddText(c.faithElements.Value(id), element2.Name);
180 }
181 }
182 }
183 catch
184 {
185 }
186 _ = ele.Value;
187 _ = ele.ValueWithoutLink + total;
188 foreach (Element value in c.elements.dict.Values)
189 {
190 if (value.HasTag("multiplier") && value.source.aliasRef == ele.source.alias)
191 {
192 AddFix(value.Value, value.Name);
193 }
194 }
195 if (id == 79)
196 {
197 c.RefreshSpeed(this);
198 }
199 if (id == 78 && c.IsPCFactionOrMinion)
200 {
201 int num2 = EClass.player.CountKeyItem("lucky_coin");
202 if (num2 > 0)
203 {
204 AddText(EClass.sources.keyItems.alias["lucky_coin"].GetName() + " (+" + num2 * 2 + ")", FontColor.Great);
205 }
207 {
208 AddFix(100, EClass.sources.elements.map[663].GetName());
209 }
210 }
211 if (!c.race.IsMachine && !(c.id == "android"))
212 {
213 return;
214 }
215 int num3 = c.Evalue(664);
216 if (num3 > 0)
217 {
218 switch (id)
219 {
220 case 64:
221 case 65:
222 AddFix(num3 / 2, EClass.sources.elements.map[664].GetName());
223 break;
224 case 79:
225 AddFix(num3, EClass.sources.elements.map[664].GetName());
226 break;
227 }
228 }
229 }
230 }
231
232 public const int Div = 5;
233
234 public static Element Void = new Element();
235
236 public static int[] List_MainAttributes = new int[9] { 70, 72, 71, 77, 74, 75, 76, 73, 79 };
237
238 public static int[] List_MainAttributesMajor = new int[8] { 70, 72, 71, 77, 74, 75, 76, 73 };
239
240 public static int[] List_Body = new int[4] { 70, 72, 71, 77 };
241
242 public static int[] List_Mind = new int[4] { 74, 75, 76, 73 };
243
245
246 public int id;
247
248 public int vBase;
249
250 public int vExp;
251
252 public int vPotential;
253
254 public int vTempPotential;
255
256 public int vLink;
257
258 public int vSource;
259
261
263
264 public static List<SourceElement.Row> ListElements = new List<SourceElement.Row>();
265
266 public static List<SourceElement.Row> ListAttackElements = new List<SourceElement.Row>();
267
269 {
270 get
271 {
273 if (row == null)
274 {
275 SourceElement.Row obj = ((id == 0) ? GetSource() : Get(id)) ?? EClass.sources.elements.rows[0];
276 SourceElement.Row row2 = obj;
277 _source = obj;
278 row = row2;
279 }
280 return row;
281 }
282 }
283
284 public virtual int DisplayValue => Value;
285
286 public virtual int MinValue => -100;
287
288 public int Value => ValueWithoutLink + vLink + ((owner != null) ? owner.ValueBonus(this) : 0);
289
291
292 public virtual int MinPotential => 100;
293
295
296 public virtual bool CanGainExp => ValueWithoutLink > 0;
297
298 public bool IsFlag => source.tag.Contains("flag");
299
300 public virtual string Name => source.GetName();
301
302 public virtual string FullName => Name;
303
304 public virtual int ExpToNext => 1000;
305
306 public virtual bool UseExpMod => true;
307
308 public virtual int CostTrain => Mathf.Max((ValueWithoutLink / 10 + 5) * (100 + vTempPotential) / 500, 1);
309
310 public virtual int CostLearn => 5;
311
312 public virtual bool ShowXP
313 {
314 get
315 {
317 {
318 return source.category != "attribute";
319 }
320 return true;
321 }
322 }
323
324 public virtual bool ShowMsgOnValueChanged => true;
325
326 public virtual bool ShowValue => true;
327
328 public virtual bool ShowPotential => true;
329
330 public virtual bool UsePotential => true;
331
332 public virtual bool PotentialAsStock => false;
333
334 public virtual bool ShowRelativeAttribute => false;
335
336 public virtual bool ShowBonuses => true;
337
338 public virtual string ShortName => Name;
339
340 public bool IsGlobalElement
341 {
342 get
343 {
344 if (vExp != -1)
345 {
346 return vExp == -2;
347 }
348 return true;
349 }
350 }
351
352 public bool IsFactionWideElement => vExp == -1;
353
354 public bool IsPartyWideElement => vExp == -2;
355
356 public virtual bool ShowEncNumber => true;
357
358 public bool IsTrait => source.tag.Contains("trait");
359
360 public bool IsFoodTrait => !source.foodEffect.IsEmpty();
361
362 public bool IsFoodTraitMain
363 {
364 get
365 {
366 if (IsFoodTrait)
367 {
368 if (!source.tag.Contains("primary"))
369 {
370 return source.tag.Contains("foodpot");
371 }
372 return true;
373 }
374 return false;
375 }
376 }
377
378 public bool IsMainAttribute
379 {
380 get
381 {
382 if (source.category == "attribute")
383 {
384 return source.tag.Contains("primary");
385 }
386 return false;
387 }
388 }
389
390 public Act act => (this as Act) ?? ACT.Create(id);
391
392 public static string GetName(string alias)
393 {
394 return EClass.sources.elements.alias[alias].GetName();
395 }
396
397 public static SourceElement.Row Get(int id)
398 {
399 return EClass.sources.elements.map[id];
400 }
401
403 {
404 return EClass.sources.elements.alias.TryGetValue(GetType().ToString());
405 }
406
407 public virtual int GetSourcePotential(int v)
408 {
409 return 0;
410 }
411
412 public virtual Sprite GetSprite()
413 {
414 return null;
415 }
416
417 public int GetMaterialSourceValue(Thing t, int v)
418 {
419 if (id == 2 || v < 0)
420 {
421 return v;
422 }
423 if (IsTrait)
424 {
425 if (t.IsFurniture)
426 {
427 return v;
428 }
429 return Mathf.Min(v + t.encLV * 10, 60);
430 }
431 return v * (100 + t.encLV * 10) / 100;
432 }
433
434 public virtual int GetSourceValue(int v, int lv, SourceValueType type)
435 {
436 return type switch
437 {
438 SourceValueType.Chara => v * (100 + (lv - 1 + EClass.rnd(lv / 2 + 1)) * source.lvFactor / 10) / 100 + EClass.rnd(lv / 3) * source.lvFactor / 100,
439 SourceValueType.Fixed => v,
440 _ => v * ((source.encFactor == 0) ? 100 : (50 + EClass.rnd(100) + EClass.rnd((int)Mathf.Sqrt(lv * 100)) * source.encFactor / 100)) / 100,
441 };
442 }
443
444 public virtual Sprite GetIcon(string suffix = "")
445 {
446 return SpriteSheet.Get("Media/Graphics/Icon/Element/icon_elements", "ele_" + source.alias + suffix) ?? SpriteSheet.Get("Media/Graphics/Icon/Element/icon_elements", "ele_" + source.aliasParent + suffix) ?? SpriteSheet.Get("Media/Graphics/Icon/Element/icon_elements", "cat_" + source.category);
447 }
448
449 public bool IsActive(Card c)
450 {
451 if (IsGlobalElement && c != null && !c.c_idDeity.IsEmpty() && c.c_idDeity != EClass.pc.idFaith)
452 {
453 return false;
454 }
455 return Value != 0;
456 }
457
458 public int SortVal(bool charaSheet = false)
459 {
460 int num = ((source.sort != 0) ? source.sort : id);
461 return (IsFlag ? 100000 : 0) + ((!charaSheet && IsGlobalElement) ? (-1000000) : 0) + (((IsFoodTrait || IsTrait) && owner != null && owner.Card != null && owner.Card.ShowFoodEnc) ? 10000 : 0) + num;
462 }
463
464 public virtual bool CanLink(ElementContainer owner)
465 {
466 return false;
467 }
468
469 public bool HasTag(string tag)
470 {
471 return source.tag.Contains(tag);
472 }
473
474 public void SetImage(Image i)
475 {
476 Sprite icon = GetIcon();
477 if ((bool)icon)
478 {
479 i.sprite = icon;
480 i.SetNativeSize();
481 }
482 }
483
484 public virtual string GetDetail()
485 {
486 return source.GetDetail();
487 }
488
489 public bool IsFactionElement(Chara c)
490 {
491 if (c == null)
492 {
493 return false;
494 }
495 if (c.IsPCFaction)
496 {
497 foreach (Element value in EClass.pc.faction.charaElements.dict.Values)
498 {
499 if (value.id == id && value.Value > 0)
500 {
501 return true;
502 }
503 }
504 }
505 if (c.faithElements != null)
506 {
507 foreach (Element value2 in c.faithElements.dict.Values)
508 {
509 if (value2.id == id && value2.Value > 0)
510 {
511 return true;
512 }
513 }
514 }
515 return false;
516 }
517
519 {
520 if (!source.aliasParent.IsEmpty())
521 {
522 return c.elements.GetOrCreateElement(source.aliasParent);
523 }
524 return null;
525 }
526
527 public static Dictionary<int, int> GetElementMap(int[] list)
528 {
529 Dictionary<int, int> dictionary = new Dictionary<int, int>();
530 if (list != null)
531 {
532 for (int i = 0; i < list.Length / 2; i++)
533 {
534 dictionary[list[i * 2]] = list[i * 2 + 1];
535 }
536 }
537 return dictionary;
538 }
539
540 public static Dictionary<int, int> GetElementMap(int[] list, Dictionary<int, int> map)
541 {
542 if (list != null)
543 {
544 for (int i = 0; i < list.Length / 2; i++)
545 {
546 map[list[i * 2]] = list[i * 2 + 1];
547 }
548 }
549 return map;
550 }
551
552 public static SourceElement.Row GetRandomElement(int lv = 1)
553 {
554 if (lv > 100)
555 {
556 lv = 100;
557 }
558 if (ListElements.Count == 0)
559 {
560 foreach (SourceElement.Row row in EClass.sources.elements.rows)
561 {
562 if (row.categorySub == "eleAttack" && row.chance > 0)
563 {
564 ListElements.Add(row);
565 }
566 }
567 }
568 List<Tuple<SourceElement.Row, int>> list = new List<Tuple<SourceElement.Row, int>>();
569 foreach (SourceElement.Row listElement in ListElements)
570 {
571 int num = 40 * (listElement.eleP - 100) / 100;
572 if (list.Count == 0 || num < lv)
573 {
574 list.Add(new Tuple<SourceElement.Row, int>(listElement, num));
575 }
576 }
577 return list.RandomItemWeighted((Tuple<SourceElement.Row, int> a) => 10000 / (100 + (lv - a.Item2) * 25)).Item1;
578 }
579
580 public void WriteNote(UINote n, ElementContainer owner = null, Action<UINote> onWriteNote = null)
581 {
582 n.Clear();
583 _WriteNote(n, owner, onWriteNote, isRef: false);
584 n.Build();
585 }
586
587 public void WriteNoteWithRef(UINote n, ElementContainer owner, Action<UINote> onWriteNote, Element refEle)
588 {
589 n.Clear();
590 _WriteNote(n, owner, onWriteNote, isRef: false);
591 if (refEle.Value > 0)
592 {
593 refEle._WriteNote(n, owner, onWriteNote, isRef: true);
594 }
596 {
598 }
599 n.Build();
600 }
601
602 public void _WriteNote(UINote n, Chara c, Act act)
603 {
605 Act.Cost cost = e.GetCost(c);
606 int p = e.GetPower(c);
607 n.Space(6);
608 string text = source.GetText("textExtra");
609 if (!text.IsEmpty())
610 {
611 string[] array = text.Split(',');
612 foreach (string text2 in array)
613 {
614 if (text2.StartsWith("@"))
615 {
616 Condition condition = Condition.Create(text2.Replace("@", ""), p);
617 condition.owner = c;
618 if (!source.aliasRef.IsEmpty())
619 {
620 condition.SetElement(EClass.sources.elements.alias[source.aliasRef].id);
621 }
622 switch (act.id)
623 {
624 case 6902:
625 condition.SetRefVal(79, 267);
626 break;
627 case 8510:
628 case 8710:
629 condition.SetRefVal(79, (act.id == 8710) ? 222 : 221);
630 break;
631 }
632 n.AddText("_bullet".lang() + (condition.HasDuration ? "hintCon" : "hintCon2").lang(condition.Name, condition.EvaluateTurn(p).ToString() ?? ""));
633 condition._WriteNote(n, asChild: true);
634 }
635 else
636 {
637 string text3 = text2.Replace("#calc", Calc());
638 if (!source.aliasRef.IsEmpty())
639 {
640 text3 = text3.Replace("#ele", EClass.sources.elements.alias[source.aliasRef].GetName().ToLower());
641 }
642 n.AddText("_bullet".lang() + text3);
643 }
644 }
645 }
646 if (source.tag.Contains("syncRide"))
647 {
648 n.AddText("_bullet".lang() + "hintSyncRide".lang());
649 }
651 {
652 int i = id;
653 if (i != 8230 && i != 8232)
654 {
655 n.AddText("_bullet".lang() + "hintPartyAbility".lang());
656 }
657 }
658 if (!act.LocalAct)
659 {
660 n.Space();
661 n.AddText("isGlobalAct".lang());
662 }
663 if (cost.type == Act.CostType.None || cost.cost == 0)
664 {
665 return;
666 }
667 n.Space(4);
668 UIItem uIItem = n.AddExtra<UIItem>("costPrice");
669 int num = cost.cost;
670 if (cost.type == Act.CostType.MP)
671 {
672 if (c.Evalue(483) > 0)
673 {
674 num = cost.cost * 100 / (100 + (int)Mathf.Sqrt(c.Evalue(483) * 10) * 3);
675 }
676 if (c.IsPC && c.HasCondition<StanceManaCost>())
677 {
678 int num2 = c.Evalue(1657);
679 if (num2 > 0 && vPotential >= 2)
680 {
681 num = num * (100 - num2 * 20) / 100;
682 }
683 }
684 }
685 string text4 = cost.cost.ToString() ?? "";
686 if (num != cost.cost)
687 {
688 text4 = num + " (" + text4 + ")";
689 }
690 uIItem.text1.SetText(text4, (((cost.type == Act.CostType.MP) ? c.mana.value : c.stamina.value) >= num) ? FontColor.Good : FontColor.Bad);
691 uIItem.image1.sprite = ((cost.type == Act.CostType.MP) ? EClass.core.refs.icons.mana : EClass.core.refs.icons.stamina);
692 uIItem.image1.SetNativeSize();
693 string Calc()
694 {
695 Dice dice = Dice.Create(e, c);
696 if (dice == null)
697 {
698 return p.ToString() ?? "";
699 }
700 return dice.ToString();
701 }
702 }
703
705 {
706 UIItem uIItem = n.AddHeader("HeaderAbility", FullName.ToTitleCase(wholeText: true), GetSprite());
707 uIItem.text2.text = ((this is Spell) ? (vPotential.ToString() ?? "") : "-");
708 (this as Act)?.SetImage(uIItem.image1);
709 }
710
711 public void _WriteNote(UINote n, ElementContainer owner, Action<UINote> onWriteNote, bool isRef, bool addHeader = true)
712 {
713 if (addHeader)
714 {
715 if (isRef)
716 {
717 UIText.globalSizeMod = -2;
718 n.AddHeader("prevElement".lang(FullName));
719 }
720 else if (this is Act)
721 {
723 n.Space(8);
724 }
725 else
726 {
727 n.AddHeader(FullName.ToTitleCase(wholeText: true));
728 }
729 }
730 string detail = GetDetail();
731 if (!detail.IsEmpty())
732 {
733 n.AddText("NoteText_flavor_element", detail);
734 n.Space(6);
735 }
736 int num = vLink;
737 if (owner.Chara != null && owner.Chara.IsPCFaction)
738 {
740 }
741 bool flag = ShowValue;
742 bool flag2 = ShowRelativeAttribute;
743 if (source.category == "landfeat")
744 {
745 flag = false;
746 flag2 = false;
747 }
748 if (this is Act)
749 {
750 Act act = ACT.Create(source.id);
751 UIItem uIItem = n.AddItem("ItemAbility");
752 uIItem.text1.text = "vValue".lang(DisplayValue.ToString() ?? "", ValueWithoutLink + ((num == 0) ? "" : ((num > 0) ? (" + " + num) : (" - " + -num))));
753 uIItem.text2.text = act.TargetType.ToString().lang();
754 uIItem.text3.text = ((this is Spell) ? (owner.Chara.CalcCastingChance(owner.GetOrCreateElement(act.source.id)) + "%") : "-") ?? "";
755 }
756 else if (flag)
757 {
758 n.AddTopic("TopicLeft", "vCurrent".lang(), "vValue".lang(DisplayValue.ToString() ?? "", ValueWithoutLink + ((num == 0) ? "" : ((num > 0) ? (" + " + num) : (" - " + -num)))));
759 if (ShowPotential)
760 {
761 num = vTempPotential;
762 n.AddTopic("TopicLeft", "vPotential".lang(), "vValue".lang(Potential.ToString() ?? "", vPotential + vSourcePotential + MinPotential + ((num == 0) ? "" : ((num > 0) ? (" + " + num) : (" - " + -num)))));
763 }
765 }
766 if (flag2 && !source.aliasParent.IsEmpty())
767 {
768 Element element = Create(source.aliasParent);
769 UIItem uIItem2 = n.AddItem("ItemRelativeAttribute");
770 uIItem2.text1.SetText(element.Name);
771 element.SetImage(uIItem2.image1);
772 bool flag3 = source.lvFactor > 0 && this is Act;
773 uIItem2.text2.SetActive(flag3);
774 uIItem2.text3.SetActive(flag3);
775 if (flag3)
776 {
777 uIItem2.text2.SetText(GetPower(EClass.pc).ToString() ?? "");
778 }
779 }
780 OnWriteNote(n, owner);
782 {
783 n.AddTopic("TopicLeft", "Class:", GetType()?.ToString() ?? "");
784 n.AddTopic("TopicLeft", "vExp".lang(), vExp.ToString() ?? "");
785 n.AddTopic("TopicLeft", "vSource", vSource.ToString() ?? "");
786 n.AddTopic("TopicLeft", "vSourcePotential", vSourcePotential.ToString() ?? "");
787 n.AddTopic("TopicLeft", "vPotential", vPotential.ToString() ?? "");
788 n.AddTopic("TopicLeft", "Potential", Potential.ToString() ?? "");
789 }
791 onWriteNote?.Invoke(n);
792 if (ShowBonuses && owner.Chara != null)
793 {
794 BonusInfo bonusInfo = new BonusInfo();
795 bonusInfo.ele = this;
796 bonusInfo.n = n;
797 bonusInfo.c = owner.Chara;
798 bonusInfo.WriteNote();
799 }
800 UIText.globalSizeMod = 0;
801 }
802
803 public void AddEncNote(UINote n, Card Card, ElementContainer.NoteMode mode = ElementContainer.NoteMode.Default, Func<Element, string, string> funcText = null, Action<UINote, Element> onAddNote = null)
804 {
805 string text = "";
806 switch (mode)
807 {
808 case ElementContainer.NoteMode.Domain:
809 n.AddText(Name, FontColor.Default);
810 return;
811 case ElementContainer.NoteMode.Default:
812 case ElementContainer.NoteMode.BonusTrait:
813 {
814 bool flag = source.tag.Contains("common");
815 string categorySub = source.categorySub;
816 bool flag2 = false;
817 bool flag3 = (source.tag.Contains("neg") ? (Value > 0) : (Value < 0));
818 int num = Mathf.Abs(Value);
819 bool flag4 = Card?.ShowFoodEnc ?? false;
820 bool flag5 = Card != null && Card.IsWeapon && this is Ability;
821 if (IsTrait || (flag4 && IsFoodTrait))
822 {
823 string[] textArray = source.GetTextArray("textAlt");
824 int num2 = Mathf.Clamp(Value / 10 + 1, (Value < 0 || textArray.Length <= 2) ? 1 : 2, textArray.Length - 1);
825 text = "altEnc".lang(textArray[0].IsEmpty(Name), textArray[num2], EClass.debug.showExtra ? (Value + " " + Name) : "");
826 flag3 = num2 <= 1 || textArray.Length <= 2;
827 flag2 = true;
828 }
829 else if (flag5)
830 {
831 text = "isProc".lang(Name);
832 flag3 = false;
833 }
834 else if (categorySub == "resist")
835 {
836 text = ("isResist" + (flag3 ? "Neg" : "")).lang(Name);
837 }
838 else if (categorySub == "eleAttack")
839 {
840 text = "isEleAttack".lang(Name);
841 }
842 else if (!source.textPhase.IsEmpty() && Value > 0)
843 {
844 text = source.GetText("textPhase");
845 }
846 else
847 {
848 string name = Name;
849 bool flag6 = source.category == "skill" || (source.category == "attribute" && !source.textPhase.IsEmpty());
850 bool flag7 = source.category == "enchant";
851 if (source.tag.Contains("multiplier"))
852 {
853 flag6 = (flag7 = false);
854 name = EClass.sources.elements.alias[source.aliasRef].GetName();
855 }
856 flag2 = !(flag6 || flag7);
857 text = (flag6 ? "textEncSkill" : (flag7 ? "textEncEnc" : "textEnc")).lang(name, num + (source.tag.Contains("ratio") ? "%" : ""), ((Value > 0) ? "encIncrease" : "encDecrease").lang());
858 }
859 int num3 = ((!(this is Resistance)) ? 1 : 0);
860 int num4 = 5;
861 if (id == 484)
862 {
863 num3 = 0;
864 num4 = 1;
865 }
866 if (!flag && !flag2 && !source.tag.Contains("flag"))
867 {
868 text = text + " [" + "*".Repeat(Mathf.Clamp(num * source.mtp / num4 + num3, 1, 5)) + ((num * source.mtp / num4 + num3 > 5) ? "+" : "") + "]";
869 }
870 if (HasTag("hidden") && mode != ElementContainer.NoteMode.BonusTrait)
871 {
872 text = "(debug)" + text;
873 }
874 FontColor color = (flag ? FontColor.Default : (flag3 ? FontColor.Bad : FontColor.Good));
875 if (IsGlobalElement)
876 {
877 text = text + " " + (IsFactionWideElement ? "_factionWide" : "_partyWide").lang();
878 if (!IsActive(Card))
879 {
880 return;
881 }
882 color = FontColor.Myth;
883 }
884 if (flag4 && IsFoodTrait && !IsFoodTraitMain)
885 {
886 color = FontColor.FoodMisc;
887 }
888 if (id == 2 && Value >= 0)
889 {
890 color = FontColor.FoodQuality;
891 }
892 if (funcText != null)
893 {
894 text = funcText(this, text);
895 }
896 UIItem uIItem = n.AddText("NoteText_enc", text, color);
897 Sprite sprite = EClass.core.refs.icons.enc.enc;
898 Thing thing = Card?.Thing;
899 if (thing != null)
900 {
901 if (thing.material.HasEnc(id))
902 {
903 sprite = EClass.core.refs.icons.enc.mat;
904 }
905 foreach (int key in thing.source.elementMap.Keys)
906 {
907 if (key == id)
908 {
909 sprite = EClass.core.refs.icons.enc.card;
910 }
911 }
912 if (thing.ShowFoodEnc && IsFoodTrait)
913 {
915 }
916 if (id == thing.GetInt(107))
917 {
918 sprite = EClass.core.refs.icons.enc.cat;
919 }
920 if (thing.GetRuneEnc(id) != null)
921 {
922 sprite = EClass.core.refs.icons.enc.rune;
923 }
924 }
925 if ((bool)sprite)
926 {
927 uIItem.image1.SetActive(enable: true);
928 uIItem.image1.sprite = sprite;
929 }
930 uIItem.image2.SetActive(source.IsWeaponEnc);
931 onAddNote?.Invoke(n, this);
932 return;
933 }
934 }
935 UIItem uIItem2 = n.AddTopic("TopicAttribute", Name, "".TagColor((ValueWithoutLink > 0) ? SkinManager.CurrentColors.textGood : SkinManager.CurrentColors.textBad, ValueWithoutLink.ToString() ?? ""));
936 if ((bool)uIItem2.button1)
937 {
938 uIItem2.button1.tooltip.onShowTooltip = delegate(UITooltip t)
939 {
941 };
942 }
943 SetImage(uIItem2.image1);
944 Image image = uIItem2.image2;
945 int value = (Potential - 80) / 20;
946 image.enabled = Potential != 80;
947 image.sprite = EClass.core.refs.spritesPotential[Mathf.Clamp(Mathf.Abs(value), 0, EClass.core.refs.spritesPotential.Count - 1)];
948 image.color = ((Potential - 80 >= 0) ? Color.white : new Color(1f, 0.7f, 0.7f));
949 }
950
951 public virtual void OnWriteNote(UINote n, ElementContainer owner)
952 {
953 }
954
955 public virtual void OnChangeValue()
956 {
957 }
958
960 {
961 if (owner == null || source.levelBonus.IsEmpty())
962 {
963 return;
964 }
965 bool flag = n == null;
966 string[] array = (source.GetText("levelBonus", returnNull: true) ?? source.levelBonus).Split(Environment.NewLine.ToCharArray());
967 if (!flag)
968 {
969 n.Space(10);
970 }
971 string[] array2 = array;
972 foreach (string obj in array2)
973 {
974 string[] array3 = obj.Split(',');
975 int lv = array3[0].ToInt();
976 SourceElement.Row row = (EClass.sources.elements.alias.ContainsKey(array3[1]) ? EClass.sources.elements.alias[array3[1]] : null);
977 if (flag)
978 {
979 if (lv > ValueWithoutLink)
980 {
981 break;
982 }
983 if (row != null && !owner.Has(row.id) && owner is ElementContainerZone)
984 {
985 owner.Learn(row.id);
986 }
987 }
988 else
989 {
990 string s = ((row != null) ? row.GetName() : array3[1]);
991 n.AddText((" Lv " + lv).TagColor(FontColor.Topic) + " " + s.TagColorGoodBad(() => (row != null) ? owner.Has(row.id) : (lv <= ValueWithoutLink), () => false));
992 }
993 }
994 if (!flag)
995 {
996 n.Space(4);
997 }
998 }
999
1001 {
1002 switch (m)
1003 {
1004 case UIList.SortMode.ByCategory:
1005 return source.id + ((!source.aliasParent.IsEmpty()) ? (EClass.sources.elements.alias[source.aliasParent].id * 10000) : 0);
1006 case UIList.SortMode.ByNumber:
1007 return -vPotential * 10000 + source.id;
1008 case UIList.SortMode.ByElementParent:
1009 if (!source.aliasParent.IsEmpty())
1010 {
1011 return EClass.sources.elements.alias[source.aliasParent].sort;
1012 }
1013 return id;
1014 default:
1015 return source.id;
1016 }
1017 }
1018
1019 public virtual Act.Cost GetCost(Chara c)
1020 {
1021 if (source.cost[0] == 0)
1022 {
1023 Act.Cost result = default(Act.Cost);
1024 result.type = Act.CostType.None;
1025 return result;
1026 }
1027 Act.Cost result2 = default(Act.Cost);
1028 if (this is Spell)
1029 {
1030 result2.type = Act.CostType.MP;
1031 int num = EClass.curve(Value, 50, 10);
1032 result2.cost = source.cost[0] * (100 + ((!source.tag.Contains("noCostInc")) ? (num * 3) : 0)) / 100;
1033 }
1034 else
1035 {
1036 result2.type = Act.CostType.SP;
1037 result2.cost = source.cost[0];
1038 switch (source.id)
1039 {
1040 case 6020:
1041 result2.cost = c.stamina.max / 3 + 10;
1042 break;
1043 case 6664:
1044 {
1045 int num2 = -2;
1046 foreach (BodySlot slot in c.body.slots)
1047 {
1048 if (slot.thing != null && slot.thing.IsMeleeWeapon)
1049 {
1050 num2++;
1051 }
1052 }
1053 result2.cost += num2 * 2;
1054 break;
1055 }
1056 }
1057 }
1058 if (!c.IsPC && result2.cost > 2)
1059 {
1060 result2.cost /= 2;
1061 }
1062 return result2;
1063 }
1064
1065 public virtual int GetPower(Card c)
1066 {
1067 return 100;
1068 }
1069
1070 public virtual void SetTextValue(UIText text)
1071 {
1072 string text2 = DisplayValue.ToString() ?? "";
1073 if (ShowXP)
1074 {
1075 text2 += ".".TagSize((vExp / 10).ToString("D2") ?? "", 11);
1076 }
1077 if (vLink != 0)
1078 {
1079 string text3 = ((vLink > 0) ? "+" : "") + vLink;
1080 text2 = "<color=" + ((DisplayValue > ValueWithoutLink) ? SkinManager.CurrentColors.textGood : SkinManager.CurrentColors.textBad).ToHex() + ">" + text2 + (" (" + text3 + ")").TagSize(13) + "</color>";
1081 }
1082 text.text = text2;
1083 }
1084
1085 public virtual bool IsPurchaseFeatReqMet(ElementContainer owner, int lv = -1)
1086 {
1087 return false;
1088 }
1089
1090 public virtual void WritePurchaseReq(UINote n, int lv = 1)
1091 {
1092 }
1093
1094 public static Element Create(int id, int v = 0)
1095 {
1096 SourceElement.Row row = EClass.sources.elements.map.TryGetValue(id);
1097 if (row == null)
1098 {
1099 return null;
1100 }
1101 Element element = ClassCache.Create<Element>(row.type.IsEmpty("Element"), "Elin");
1102 element.id = id;
1103 element.vBase = v;
1104 element._source = row;
1105 return element;
1106 }
1107
1108 public static Element Create(string id, int v = 1)
1109 {
1110 return Create(EClass.sources.elements.alias[id].id, v);
1111 }
1112
1113 public static int GetId(string alias)
1114 {
1115 return EClass.sources.elements.alias[alias].id;
1116 }
1117
1118 public static int GetResistLv(int v)
1119 {
1120 int num = v / 5;
1121 if (num < -2)
1122 {
1123 num = -2;
1124 }
1125 if (num > 4)
1126 {
1127 num = 4;
1128 }
1129 return num;
1130 }
1131
1132 public static int GetResistDamage(int dmg, int v, int power = 0)
1133 {
1134 int num = GetResistLv(v);
1135 if (power > 0 && num > 0)
1136 {
1137 num = Mathf.Max(num - power, 0);
1138 }
1139 if (num >= 4)
1140 {
1141 return 0;
1142 }
1143 return num switch
1144 {
1145 3 => dmg / 4,
1146 2 => dmg / 3,
1147 1 => dmg / 2,
1148 0 => dmg,
1149 -1 => dmg * 3 / 2,
1150 -2 => dmg * 2,
1151 _ => dmg * 2,
1152 };
1153 }
1154}
FontColor
Definition: FontColor.cs:2
SourceValueType
Definition: ACT.cs:6
static Act Create(int id)
Definition: ACT.cs:36
Definition: ACT.cs:62
CostType
Definition: ACT.cs:64
virtual bool LocalAct
Definition: ACT.cs:169
virtual TargetType TargetType
Definition: ACT.cs:140
virtual bool HaveLongPressAction
Definition: ACT.cs:131
int GetInt(int id, int? defaultInt=null)
Definition: BaseCard.cs:25
void SetElement(int id)
virtual bool HasDuration
virtual string Name
override void _WriteNote(UINote n, bool asChild=false)
virtual int EvaluateTurn(int p)
ElementContainer elements
void SetRefVal(int a, int b)
int elementId
Definition: BodySlot.cs:6
Thing thing
Definition: BodySlot.cs:8
Definition: Card.cs:11
bool IsPCFactionOrMinion
Definition: Card.cs:2172
ElementContainerCard elements
Definition: Card.cs:37
string id
Definition: Card.cs:31
SourceMaterial.Row material
Definition: Card.cs:1951
string c_idDeity
Definition: Card.cs:1505
bool IsFurniture
Definition: Card.cs:2151
int encLV
Definition: Card.cs:310
SocketData GetRuneEnc(int idEle)
Definition: Card.cs:3415
bool IsMeleeWeapon
Definition: Card.cs:2141
virtual Thing Thing
Definition: Card.cs:1958
int Evalue(int ele)
Definition: Card.cs:2471
bool ShowFoodEnc
Definition: Card.cs:2090
List< BodySlot > slots
Definition: CharaBody.cs:8
Definition: Chara.cs:10
CharaBody body
Definition: Chara.cs:94
string idFaith
Definition: Chara.cs:221
Faction faction
Definition: Chara.cs:417
override bool IsPC
Definition: Chara.cs:602
ElementContainer tempElements
Definition: Chara.cs:36
List< Condition > conditions
Definition: Chara.cs:201
bool HasCondition(string alias)
Definition: Chara.cs:8666
int CalcCastingChance(Element e, int num=1)
Definition: Chara.cs:5593
override bool IsPCFaction
Definition: Chara.cs:661
Stats stamina
Definition: Chara.cs:960
ElementContainer faithElements
Definition: Chara.cs:38
void RefreshSpeed(Element.BonusInfo info=null)
Definition: Chara.cs:1628
Religion faith
Definition: Chara.cs:429
SourceRace.Row race
Definition: Chara.cs:454
static Condition Create(string alias, int power=100, Action< Condition > onCreate=null)
Definition: Condition.cs:46
bool showExtra
Definition: CoreDebug.cs:167
Sprite traitFood
Definition: CoreRef.cs:71
Sprite mana
Definition: CoreRef.cs:122
Sprite stamina
Definition: CoreRef.cs:124
List< Sprite > spritesPotential
Definition: CoreRef.cs:361
Icons icons
Definition: CoreRef.cs:341
CoreRef refs
Definition: Core.cs:51
Definition: Dice.cs:4
override string ToString()
Definition: Dice.cs:91
static Dice Create(Element ele, Card c)
Definition: Dice.cs:96
Definition: EClass.cs:5
static int curve(int a, int start, int step, int rate=75)
Definition: EClass.cs:63
static int rnd(int a)
Definition: EClass.cs:58
static Core core
Definition: EClass.cs:6
static SourceManager sources
Definition: EClass.cs:42
static Player player
Definition: EClass.cs:12
static Chara pc
Definition: EClass.cs:14
static CoreDebug debug
Definition: EClass.cs:48
const int stimulant
Definition: ELEMENT.cs:20
const int antidote
Definition: ELEMENT.cs:12
const int weight
Definition: ELEMENT.cs:42
const int growth
Definition: ELEMENT.cs:48
const int old_heal
Definition: ELEMENT.cs:64
const int race
Definition: ELEMENT.cs:70
const int comfort
Definition: ELEMENT.cs:26
const int cute
Definition: ELEMENT.cs:10
const int decay
Definition: ELEMENT.cs:52
const int purity
Definition: ELEMENT.cs:28
const int nutrition
Definition: ELEMENT.cs:40
const int _void
Definition: ELEMENT.cs:30
const int heat
Definition: ELEMENT.cs:50
const int rare
Definition: ELEMENT.cs:8
const int taste
Definition: ELEMENT.cs:54
const int size
Definition: ELEMENT.cs:44
const int quality
Definition: ELEMENT.cs:36
const int piety
Definition: ELEMENT.cs:72
const int nerve
Definition: ELEMENT.cs:14
const int poison
Definition: ELEMENT.cs:74
static readonly int[] IDS
Definition: ELEMENT.cs:76
const int hotspring
Definition: ELEMENT.cs:18
const int cure
Definition: ELEMENT.cs:68
const int roasted
Definition: ELEMENT.cs:24
const int water
Definition: ELEMENT.cs:56
const int fire
Definition: ELEMENT.cs:58
const int recharge
Definition: ELEMENT.cs:22
const int lv
Definition: ELEMENT.cs:34
const int old_detox
Definition: ELEMENT.cs:62
const int socket
Definition: ELEMENT.cs:38
const int old_antidote
Definition: ELEMENT.cs:66
const int blood
Definition: ELEMENT.cs:16
const int d
Definition: ELEMENT.cs:32
const int hardness
Definition: ELEMENT.cs:46
const int cut
Definition: ELEMENT.cs:60
Dictionary< int, Element > dict
void Learn(int ele, int v=1)
bool Has(int ele)
virtual Card Card
int Value(int ele)
virtual int ValueBonus(Element e)
Element GetOrCreateElement(Element ele)
virtual Chara Chara
Element GetElement(string alias)
void AddText(string text, FontColor col=FontColor.Warning)
Definition: ELEMENT.cs:107
void WriteNote()
Definition: ELEMENT.cs:137
void AddFix(int v, string text)
Definition: ELEMENT.cs:128
Element ele
Definition: ELEMENT.cs:88
void CheckFirst()
Definition: ELEMENT.cs:98
void AddText(int v, string text, string textBad=null)
Definition: ELEMENT.cs:113
bool IsFactionElement(Chara c)
Definition: ELEMENT.cs:489
virtual bool ShowPotential
Definition: ELEMENT.cs:328
virtual bool ShowMsgOnValueChanged
Definition: ELEMENT.cs:324
virtual bool CanGainExp
Definition: ELEMENT.cs:296
virtual Sprite GetSprite()
Definition: ELEMENT.cs:412
virtual int DisplayValue
Definition: ELEMENT.cs:284
virtual void OnChangeValue()
Definition: ELEMENT.cs:955
static Element Create(string id, int v=1)
Definition: ELEMENT.cs:1108
int ValueWithoutLink
Definition: ELEMENT.cs:290
static int[] List_Body
Definition: ELEMENT.cs:240
virtual bool ShowXP
Definition: ELEMENT.cs:313
virtual bool UseExpMod
Definition: ELEMENT.cs:306
static int GetResistDamage(int dmg, int v, int power=0)
Definition: ELEMENT.cs:1132
int Potential
Definition: ELEMENT.cs:294
int GetMaterialSourceValue(Thing t, int v)
Definition: ELEMENT.cs:417
virtual SourceElement.Row GetSource()
Definition: ELEMENT.cs:402
int id
Definition: ELEMENT.cs:246
int vBase
Definition: ELEMENT.cs:248
virtual void WritePurchaseReq(UINote n, int lv=1)
Definition: ELEMENT.cs:1090
SourceElement.Row source
Definition: ELEMENT.cs:269
int vExp
Definition: ELEMENT.cs:250
virtual int GetSourceValue(int v, int lv, SourceValueType type)
Definition: ELEMENT.cs:434
virtual bool IsPurchaseFeatReqMet(ElementContainer owner, int lv=-1)
Definition: ELEMENT.cs:1085
void _WriteNote(UINote n, Chara c, Act act)
Definition: ELEMENT.cs:602
int vPotential
Definition: ELEMENT.cs:252
static SourceElement.Row Get(int id)
Definition: ELEMENT.cs:397
virtual int GetSourcePotential(int v)
Definition: ELEMENT.cs:407
ElementContainer owner
Definition: ELEMENT.cs:262
virtual Sprite GetIcon(string suffix="")
Definition: ELEMENT.cs:444
static int GetResistLv(int v)
Definition: ELEMENT.cs:1118
virtual int MinValue
Definition: ELEMENT.cs:286
bool HasTag(string tag)
Definition: ELEMENT.cs:469
virtual int CostTrain
Definition: ELEMENT.cs:308
int vTempPotential
Definition: ELEMENT.cs:254
static List< SourceElement.Row > ListAttackElements
Definition: ELEMENT.cs:266
static int[] List_MainAttributes
Definition: ELEMENT.cs:236
static int GetId(string alias)
Definition: ELEMENT.cs:1113
virtual string FullName
Definition: ELEMENT.cs:302
void AddHeaderAbility(UINote n)
Definition: ELEMENT.cs:704
static Dictionary< int, int > GetElementMap(int[] list, Dictionary< int, int > map)
Definition: ELEMENT.cs:540
void AddEncNote(UINote n, Card Card, ElementContainer.NoteMode mode=ElementContainer.NoteMode.Default, Func< Element, string, string > funcText=null, Action< UINote, Element > onAddNote=null)
Definition: ELEMENT.cs:803
int GetSortVal(UIList.SortMode m)
Definition: ELEMENT.cs:1000
virtual int GetPower(Card c)
Definition: ELEMENT.cs:1065
void SetImage(Image i)
Definition: ELEMENT.cs:474
int Value
Definition: ELEMENT.cs:288
void CheckLevelBonus(ElementContainer owner, UINote n=null)
Definition: ELEMENT.cs:959
virtual bool ShowRelativeAttribute
Definition: ELEMENT.cs:334
void WriteNoteWithRef(UINote n, ElementContainer owner, Action< UINote > onWriteNote, Element refEle)
Definition: ELEMENT.cs:587
bool IsFoodTrait
Definition: ELEMENT.cs:360
virtual void SetTextValue(UIText text)
Definition: ELEMENT.cs:1070
virtual string Name
Definition: ELEMENT.cs:300
static Dictionary< int, int > GetElementMap(int[] list)
Definition: ELEMENT.cs:527
static Element Create(int id, int v=0)
Definition: ELEMENT.cs:1094
virtual bool CanLink(ElementContainer owner)
Definition: ELEMENT.cs:464
int vLink
Definition: ELEMENT.cs:256
virtual Act.Cost GetCost(Chara c)
Definition: ELEMENT.cs:1019
virtual bool ShowEncNumber
Definition: ELEMENT.cs:356
static string GetName(string alias)
Definition: ELEMENT.cs:392
static SourceElement.Row GetRandomElement(int lv=1)
Definition: ELEMENT.cs:552
static List< SourceElement.Row > ListElements
Definition: ELEMENT.cs:264
virtual bool ShowBonuses
Definition: ELEMENT.cs:336
virtual bool PotentialAsStock
Definition: ELEMENT.cs:332
int vSource
Definition: ELEMENT.cs:258
void WriteNote(UINote n, ElementContainer owner=null, Action< UINote > onWriteNote=null)
Definition: ELEMENT.cs:580
static Element Void
Definition: ELEMENT.cs:234
virtual bool UsePotential
Definition: ELEMENT.cs:330
int vSourcePotential
Definition: ELEMENT.cs:260
void _WriteNote(UINote n, ElementContainer owner, Action< UINote > onWriteNote, bool isRef, bool addHeader=true)
Definition: ELEMENT.cs:711
bool IsGlobalElement
Definition: ELEMENT.cs:341
bool IsPartyWideElement
Definition: ELEMENT.cs:354
bool IsTrait
Definition: ELEMENT.cs:358
bool IsFactionWideElement
Definition: ELEMENT.cs:352
static int[] List_Mind
Definition: ELEMENT.cs:242
virtual void OnWriteNote(UINote n, ElementContainer owner)
Definition: ELEMENT.cs:951
virtual string GetDetail()
Definition: ELEMENT.cs:484
Element GetParent(Card c)
Definition: ELEMENT.cs:518
virtual int MinPotential
Definition: ELEMENT.cs:292
virtual int CostLearn
Definition: ELEMENT.cs:310
SourceElement.Row _source
Definition: ELEMENT.cs:244
static int[] List_MainAttributesMajor
Definition: ELEMENT.cs:238
const int Div
Definition: ELEMENT.cs:232
Act act
Definition: ELEMENT.cs:390
bool IsFoodTraitMain
Definition: ELEMENT.cs:363
bool IsFlag
Definition: ELEMENT.cs:298
virtual bool ShowValue
Definition: ELEMENT.cs:326
bool IsMainAttribute
Definition: ELEMENT.cs:379
virtual int ExpToNext
Definition: ELEMENT.cs:304
bool IsActive(Card c)
Definition: ELEMENT.cs:449
virtual string ShortName
Definition: ELEMENT.cs:338
int SortVal(bool charaSheet=false)
Definition: ELEMENT.cs:458
ElementContainerFaction charaElements
Definition: FACTION.cs:144
int CountKeyItem(string alias)
Definition: Player.cs:1962
virtual string id
Definition: Religion.cs:26
static SkinColorProfile CurrentColors
Definition: SkinManager.cs:84
override string GetName()
SourceKeyItem keyItems
SourceElement elements
Definition: SPELL.cs:517
static Sprite Get(string id)
Definition: SpriteSheet.cs:28
virtual int value
Definition: Stats.cs:56
Definition: Thing.cs:8
SourceThing.Row source
Definition: Thing.cs:11
Definition: UIItem.cs:5
Image image2
Definition: UIItem.cs:16
UIText text3
Definition: UIItem.cs:10
UIButton button1
Definition: UIItem.cs:18
Image image1
Definition: UIItem.cs:14
UIText text2
Definition: UIItem.cs:8
UIText text1
Definition: UIItem.cs:6
Definition: UIList.cs:9
SortMode
Definition: UIList.cs:27
Definition: UINote.cs:6
void Clear()
Definition: UINote.cs:35
UIItem AddItem(string id)
Definition: UINote.cs:139
UIItem AddHeader(string text, Sprite sprite=null)
Definition: UINote.cs:79
UIItem AddTopic(string id, string text, string value=null)
Definition: UINote.cs:144
UIItem AddText(string text, FontColor color=FontColor.DontChange)
Definition: UINote.cs:113
void Space(int sizeY=0, int sizeX=1)
Definition: UINote.cs:62
void Build()
Definition: UINote.cs:49
Definition: UIText.cs:6
void SetText(string s)
Definition: UIText.cs:159
UINote note
Definition: UITooltip.cs:21
Definition: ACT.cs:71
CostType type
Definition: ACT.cs:74
int cost
Definition: ACT.cs:72