Elin Decompiled Documentation EA 23.153 Nightly
Loading...
Searching...
No Matches
Chara.cs
Go to the documentation of this file.
1using System;
2using System.Collections.Generic;
3using System.IO;
4using System.Linq;
5using Algorithms;
6using Newtonsoft.Json;
7using UnityEngine;
8
9public class Chara : Card, IPathfindWalker
10{
11 private static Point shared = new Point();
12
13 private static List<Hobby> listHobby = new List<Hobby>();
14
15 public static string[] IDTimeTable = new string[2] { "default", "owl" };
16
17 [JsonProperty]
18 public int contribution;
19
20 [JsonProperty]
21 public Point orgPos;
22
23 [JsonProperty]
24 public Quest quest;
25
26 [JsonProperty]
27 public Chara ride;
28
29 [JsonProperty]
31
32 [JsonProperty]
33 public Chara host;
34
35 [JsonProperty]
37
39
41
42 [JsonProperty(PropertyName = "T1")]
43 public Party party;
44
45 [JsonProperty(PropertyName = "T2")]
47
48 [JsonProperty(PropertyName = "T3")]
49 public List<int> _hobbies;
50
51 [JsonProperty(PropertyName = "T4")]
52 public List<int> _works;
53
54 [JsonProperty(PropertyName = "T5")]
56
57 [JsonProperty(PropertyName = "T6")]
58 public List<int> _cooldowns;
59
60 [JsonProperty(PropertyName = "T7")]
61 public List<int> _listAbility;
62
63 [JsonProperty(PropertyName = "T8")]
64 public List<List<string>> _historyFood;
65
66 [JsonProperty(PropertyName = "1")]
67 public PCCData pccData;
68
69 [JsonProperty(PropertyName = "2")]
70 public Card held;
71
72 [JsonProperty(PropertyName = "3")]
73 public int[] rawSlots;
74
75 [JsonProperty(PropertyName = "4")]
77
78 [JsonProperty(PropertyName = "8")]
79 public string[] _strs = new string[5];
80
81 [JsonProperty(PropertyName = "9")]
82 public int[] _cints = new int[30];
83
85
86 public Chara enemy;
87
88 public Chara master;
89
90 public Point lastPos = new Point();
91
93
94 public CharaBody body = new CharaBody();
95
97
98 public Thing ranged;
99
101
103
105
106 public Emo2 emoIcon;
107
108 public int happiness;
109
110 public int turnLastSeen = -100;
111
112 public int idleActTimer;
113
114 public int combatCount;
115
116 public int calmCheckTurn;
117
118 public int sharedCheckTurn;
119
120 public float idleTimer;
121
122 public bool isBerserk;
123
124 public bool isDrunk;
125
126 public bool isConfused;
127
128 public bool isFainted;
129
130 public bool isBlind;
131
132 public bool isParalyzed;
133
134 public bool _isLevitating;
135
136 public bool isCreated;
137
138 public bool canSeeInvisible;
139
140 public bool hasTelepathy;
141
142 public bool isWet;
143
144 public bool bossText;
145
146 public bool ignoreSPAbsorb;
147
148 public bool wasInWater;
149
151
153
155
157
159
161
162 public static List<SourceRace.Row> ListAdvRace = new List<SourceRace.Row>();
163
164 public static List<SourceJob.Row> ListAdvJob = new List<SourceJob.Row>();
165
166 public bool dirtySpeed = true;
167
168 private int _Speed;
169
170 private static Point _sharedPos = new Point();
171
172 private bool hasMovedThisTurn;
173
174 public float actTime = 0.3f;
175
176 public static bool consumeTurn;
177
178 public static bool preventRegen;
179
180 public static bool isOnCreate;
181
182 private static List<Chara> _pts = new List<Chara>();
183
184 public int stealthSeen;
185
186 private static List<Thing> _ListItems = new List<Thing>();
187
188 private static List<SourceThing.Row> _listFavFood = new List<SourceThing.Row>();
189
190 private static List<SourceCategory.Row> _listFavCat = new List<SourceCategory.Row>();
191
192 public static NoGoal _NoGoalPC = new NoGoal();
193
194 public static NoGoal _NoGoalRepeat = new NoGoal();
195
196 public GoalList goalList = new GoalList();
197
198 public AIAct ai = new NoGoal();
199
201
202 private static GoalWork _goalWork = new GoalWork();
203
204 private static GoalHobby _goalHobby = new GoalHobby();
205
206 [JsonProperty]
207 public List<Condition> conditions = new List<Condition>();
208
209 [JsonProperty]
210 public Dictionary<int, int> resistCon;
211
212 public string Aka => _alias.IsEmpty(source.GetText("aka", returnNull: true) ?? "");
213
214 public string _alias
215 {
216 get
217 {
218 return _strs[0];
219 }
220 set
221 {
222 _strs[0] = value;
223 }
224 }
225
226 public string idFaith
227 {
228 get
229 {
230 return _strs[1];
231 }
232 set
233 {
234 _strs[1] = value;
235 }
236 }
237
238 public string idFaction
239 {
240 get
241 {
242 return _strs[2];
243 }
244 set
245 {
246 _strs[2] = value;
247 }
248 }
249
251 {
252 get
253 {
254 return RefZone.Get(_cints[1]);
255 }
256 set
257 {
258 _cints[1] = RefZone.Set(value);
259 }
260 }
261
263 {
264 get
265 {
266 return RefZone.Get(_cints[2]);
267 }
268 set
269 {
270 _cints[2] = RefZone.Set(value);
271 }
272 }
273
275 {
276 get
277 {
278 return _cints[3].ToEnum<GoalListType>();
279 }
280 set
281 {
282 _cints[3] = (int)value;
283 }
284 }
285
287 {
288 get
289 {
290 return _cints[4].ToEnum<Hostility>();
291 }
292 set
293 {
294 _cints[4] = (int)value;
295 }
296 }
297
298 public int _affinity
299 {
300 get
301 {
302 return _cints[5];
303 }
304 set
305 {
306 _cints[5] = value;
307 }
308 }
309
310 public Affinity affinity => Affinity.Get(this);
311
312 public int interest
313 {
314 get
315 {
316 return _cints[6];
317 }
318 set
319 {
320 _cints[6] = value;
321 }
322 }
323
324 public int daysStarved
325 {
326 get
327 {
328 return _cints[7];
329 }
330 set
331 {
332 _cints[7] = value;
333 }
334 }
335
336 public int _idTimeTable
337 {
338 get
339 {
340 return _cints[9];
341 }
342 set
343 {
344 _cints[9] = value;
345 }
346 }
347
348 public int uidEditor
349 {
350 get
351 {
352 return _cints[10];
353 }
354 set
355 {
356 _cints[10] = value;
357 }
358 }
359
360 public int _maxStamina
361 {
362 get
363 {
364 return _cints[20];
365 }
366 set
367 {
368 _cints[20] = value;
369 }
370 }
371
372 public int corruption
373 {
374 get
375 {
376 return _cints[21];
377 }
378 set
379 {
380 _cints[21] = value;
381 }
382 }
383
384 public bool isDead
385 {
386 get
387 {
388 return _cbits1[0];
389 }
390 set
391 {
392 _cbits1[0] = value;
393 }
394 }
395
396 public bool isAlawysVisible
397 {
398 get
399 {
400 return _cbits1[1];
401 }
402 set
403 {
404 _cbits1[1] = value;
405 }
406 }
407
408 public bool knowFav
409 {
410 get
411 {
412 return _cbits1[3];
413 }
414 set
415 {
416 _cbits1[3] = value;
417 }
418 }
419
421
423 {
424 get
425 {
426 return _faction ?? (_faction = EClass.game.factions.dictAll.TryGetValue(idFaction));
427 }
428 set
429 {
430 idFaction = value?.uid;
431 }
432 }
433
435 {
436 get
437 {
438 return EClass.game.religions.dictAll.TryGetValue(idFaith) ?? EClass.game.religions.dictAll["eyth"];
439 }
440 set
441 {
442 idFaith = value?.id;
443 }
444 }
445
446 public override CardRow sourceCard => source;
447
448 public override CardRow sourceRenderCard
449 {
450 get
451 {
452 if (pccData != null && !(source.renderData is RenderDataPcc))
453 {
455 }
456 return source;
457 }
458 }
459
460 public SourceRace.Row race => _race ?? (_race = EClass.sources.races.map.TryGetValue(base.c_idRace.IsEmpty(source.race))) ?? EClass.sources.races.map["norland"];
461
462 public SourceJob.Row job => _job ?? (_job = EClass.sources.jobs.map.TryGetValue(base.c_idJob.IsEmpty(source.job))) ?? EClass.sources.jobs.map["none"];
463
465
467 {
468 get
469 {
470 if (EClass.pc == null || !IsPCFaction)
471 {
472 if (base.c_originalHostility == (Hostility)0)
473 {
474 if (!source.hostility.IsEmpty())
475 {
476 return source.hostility.ToEnum<Hostility>();
477 }
478 return Hostility.Enemy;
479 }
480 return base.c_originalHostility;
481 }
482 return Hostility.Ally;
483 }
484 }
485
486 public string IDPCCBodySet
487 {
488 get
489 {
490 if (source.idActor.Length <= 1)
491 {
492 return "female";
493 }
494 return source.idActor[1];
495 }
496 }
497
498 public new TraitChara trait
499 {
500 get
501 {
502 return base.trait as TraitChara;
503 }
504 set
505 {
506 base.trait = value;
507 }
508 }
509
510 public string NameBraced => GetName(NameStyle.Full);
511
512 public string NameTitled => (EClass.game.principal.permadeath ? "★" : "") + NameBraced;
513
514 public override string actorPrefab
515 {
516 get
517 {
518 if (IsPCC)
519 {
520 return "CharaActorPCC";
521 }
522 return "CharaActor";
523 }
524 }
525
526 public override int PrefIndex
527 {
528 get
529 {
530 if (sourceCard._tiles.Length != 0 || renderer.replacer != null)
531 {
532 if (base.dir != 1 && base.dir != 2)
533 {
534 return 0;
535 }
536 return 1;
537 }
538 return base.dir;
539 }
540 }
541
542 public override bool flipX
543 {
544 get
545 {
546 if (base.dir != 1)
547 {
548 return base.dir == 2;
549 }
550 return true;
551 }
552 }
553
554 public override string AliasMaterialOnCreate => race.material;
555
556 public override bool IsAliveInCurrentZone
557 {
558 get
559 {
560 if (!isDead)
561 {
562 return base.ExistsOnMap;
563 }
564 return false;
565 }
566 }
567
568 public override bool IsDeadOrSleeping
569 {
570 get
571 {
572 if (!isDead && conSleep == null && conSuspend == null)
573 {
574 return isFainted;
575 }
576 return true;
577 }
578 }
579
580 public override bool IsDisabled
581 {
582 get
583 {
584 if (!isDead && conSleep == null && !isFainted)
585 {
586 return isParalyzed;
587 }
588 return true;
589 }
590 }
591
592 public bool IsLevitating
593 {
594 get
595 {
596 if (ride != null)
597 {
598 return ride._isLevitating;
599 }
600 return _isLevitating;
601 }
602 }
603
604 public override bool IsMoving => idleTimer > 0f;
605
606 public override bool IsGlobal => global != null;
607
608 public override bool IsPC => this == EClass.player.chara;
609
610 public override bool IsPCParty
611 {
612 get
613 {
614 if (party != null)
615 {
616 return party.leader == EClass.pc;
617 }
618 return false;
619 }
620 }
621
622 public override bool IsMinion
623 {
624 get
625 {
626 if (master == null)
627 {
628 return base.c_uidMaster != 0;
629 }
630 return true;
631 }
632 }
633
634 public override bool IsPCPartyMinion
635 {
636 get
637 {
638 if (master != null)
639 {
640 if (!master.IsPCParty)
641 {
642 return master.IsPCPartyMinion;
643 }
644 return true;
645 }
646 return false;
647 }
648 }
649
650 public override bool IsPCFactionMinion
651 {
652 get
653 {
654 if (master != null)
655 {
656 if (!master.IsPCFaction)
657 {
659 }
660 return true;
661 }
662 return false;
663 }
664 }
665
666 public override bool IsPCFaction
667 {
668 get
669 {
670 if (EClass.pc != null)
671 {
672 return faction == EClass.pc.faction;
673 }
674 return false;
675 }
676 }
677
678 public override bool IsPCC => pccData != null;
679
680 public override bool isThing => false;
681
682 public override bool isChara => true;
683
684 public override bool HasHost => host != null;
685
686 public override bool isSynced
687 {
688 get
689 {
690 if (!renderer.isSynced)
691 {
692 if (host != null)
693 {
694 return host.renderer.isSynced;
695 }
696 return false;
697 }
698 return true;
699 }
700 }
701
702 public override bool IsMultisize => sourceCard.multisize;
703
704 public override int MaxHP => (int)Mathf.Clamp(((long)(base.END * 2 + base.STR + base.WIL / 2) * (long)Mathf.Min(base.LV, 25) / 25 + base.END + 10) * Evalue(60) / 100 * ((IsPCFaction ? 100 : (100 + (int)base.rarity * 300)) + (IsPC ? (EClass.player.lastEmptyAlly * Evalue(1646)) : 0)) / 100, 1f, 100000000f);
705
706 public override int WeightLimit => Mathf.Max((base.STR * 500 + base.END * 250 + Evalue(207) * 2000) * ((!HasElement(1411)) ? 1 : 5) + 45000, 1000);
707
708 public override int SelfWeight => bio.weight * 1000;
709
710 public int MaxSummon => Mathf.Max((int)Mathf.Sqrt(base.CHA), 1) + Evalue(1647) + ((!base.IsPCFactionOrMinion) ? ((int)base.rarity * 5) : 0);
711
713 {
714 get
715 {
716 if (base.c_idMainElement == 0)
717 {
718 return Element.Void;
719 }
720 return elements.GetElement(base.c_idMainElement);
721 }
722 }
723
724 public override int DV
725 {
726 get
727 {
728 if (IsPCFaction)
729 {
730 return WeaknessMod(elements.Value(64));
731 }
732 int num = base.LV;
733 if (num > 50)
734 {
735 num = 50 + (num - 50) / 10;
736 }
737 return WeaknessMod(num + elements.Value(64) * (100 + num + race.DV * 5) / 100);
738 int WeaknessMod(int a)
739 {
740 if (HasCondition<ConWeakness>())
741 {
742 if (a <= 0)
743 {
744 return a * 2;
745 }
746 return a / 2;
747 }
748 return a;
749 }
750 }
751 }
752
753 public override int PV
754 {
755 get
756 {
757 if (IsPCFaction)
758 {
759 return WeaknessMod(elements.Value(65));
760 }
761 int num = base.LV;
762 if (num > 50)
763 {
764 num = 50 + (num - 50) / 10;
765 }
766 return WeaknessMod(num + elements.Value(65) * (100 + num + race.PV * 5) / 100);
767 int WeaknessMod(int a)
768 {
769 if (HasCondition<ConWeakness>())
770 {
771 if (a <= 0)
772 {
773 return a * 2;
774 }
775 return a / 2;
776 }
777 return a;
778 }
779 }
780 }
781
782 public override SourcePref Pref
783 {
784 get
785 {
786 if (spriteReplacer != null)
787 {
789 }
790 if (base.idSkin > 0)
791 {
792 switch (sourceCard.tiles.TryGet(base.idSkin))
793 {
794 case 2319:
795 case 2619:
796 case 2621:
797 case 2623:
798 case 2625:
800 case 2320:
801 case 2611:
802 case 2620:
803 case 2622:
804 case 2624:
805 case 2626:
806 case 2828:
808 }
809 }
810 return sourceCard.pref;
811 }
812 }
813
814 public bool CanOpenDoor
815 {
816 get
817 {
818 if (base.INT < 5)
819 {
820 if (IsPCFaction)
821 {
822 return memberType == FactionMemberType.Default;
823 }
824 return false;
825 }
826 return true;
827 }
828 }
829
830 public Tactics tactics => _tactics ?? (_tactics = new Tactics(this));
831
833
835
836 public bool IsLocalChara
837 {
838 get
839 {
840 if (!IsGlobal && !base.isSubsetCard)
841 {
842 return homeZone == EClass._zone;
843 }
844 return false;
845 }
846 }
847
848 public bool IsIdle
849 {
850 get
851 {
852 if (!IsDeadOrSleeping)
853 {
854 return ai.Current.IsIdle;
855 }
856 return false;
857 }
858 }
859
860 public bool IsInCombat => ai is GoalCombat;
861
862 public int DestDist => tactics.DestDist;
863
864 public bool HasNoGoal => ai.IsNoGoal;
865
866 public bool CanWitness
867 {
868 get
869 {
870 if (!race.IsHuman && !race.IsFairy && !race.IsGod)
871 {
872 return race.id == "mutant";
873 }
874 return true;
875 }
876 }
877
878 public bool IsHuman => race.tag.Contains("human");
879
880 public bool IsHumanSpeak
881 {
882 get
883 {
884 if (!IsHuman)
885 {
886 return race.tag.Contains("humanSpeak");
887 }
888 return true;
889 }
890 }
891
892 public bool IsMaid
893 {
894 get
895 {
896 if (EClass.Branch != null)
897 {
898 return EClass.Branch.uidMaid == base.uid;
899 }
900 return false;
901 }
902 }
903
904 public bool IsPrisoner => false;
905
906 public bool IsAdventurer
907 {
908 get
909 {
910 if (global != null && faction != EClass.pc.faction)
911 {
912 return IsPCC;
913 }
914 return false;
915 }
916 }
917
918 public bool IsEyth => faith.id == "eyth";
919
920 public bool IsWealthy
921 {
922 get
923 {
924 if (!source.works.Contains("Rich"))
925 {
926 return source.hobbies.Contains("Rich");
927 }
928 return true;
929 }
930 }
931
933
934 public int MaxGeneSlot => race.geneCap - (HasElement(1237) ? 2 : 0);
935
937 {
938 get
939 {
940 if (base.c_genes != null)
941 {
942 return base.c_genes.GetGeneSlot(this);
943 }
944 return 0;
945 }
946 }
947
948 public int Speed
949 {
950 get
951 {
952 if (dirtySpeed)
953 {
954 RefreshSpeed();
955 }
956 return _Speed;
957 }
958 }
959
960 public bool IsMofuable => race.tag.Contains("mofu");
961
963 {
964 get
965 {
966 if (_baseWorkElements == null)
967 {
969 foreach (Hobby item in ListHobbies())
970 {
971 Build(item);
972 }
973 foreach (Hobby item2 in ListWorks())
974 {
975 Build(item2);
976 }
977 }
978 return _baseWorkElements;
979 void Build(Hobby h)
980 {
981 if (!h.source.elements.IsEmpty())
982 {
983 for (int i = 0; i < h.source.elements.Length; i += 2)
984 {
985 int ele = h.source.elements[i];
986 int v = h.source.elements[i + 1];
988 }
989 }
990 }
991 }
992 }
993
994 public Stats hunger => Stats.Hunger.Set(_cints, 10, this);
995
996 public Stats burden => Stats.Burden.Set(_cints, 11, this);
997
998 public Stats stamina => Stats.Stamina.Set(_cints, 12, this);
999
1001
1002 public Stats bladder => Stats.Bladder.Set(_cints, 14, this);
1003
1004 public Stats hygiene => Stats.Hygiene.Set(_cints, 15, this);
1005
1006 public Stats mana => Stats.Mana.Set(_cints, 16, this);
1007
1009
1010 public Stats SAN => Stats.SAN.Set(_cints, 18, this);
1011
1013 {
1014 get
1015 {
1016 if (base.rarity >= Rarity.Legendary)
1017 {
1018 return !IsPCFaction;
1019 }
1020 return false;
1021 }
1022 }
1023
1024 public override string ToString()
1025 {
1026 return base.Name + "(" + ai?.ToString() + ")" + pos?.ToString() + "/" + base.ExistsOnMap + "/" + isDead;
1027 }
1028
1029 public bool IsCriticallyWounded(bool includeRide = false)
1030 {
1031 if (host == null || includeRide)
1032 {
1033 if (Evalue(1421) <= 0)
1034 {
1035 return base.hp < MaxHP / 5;
1036 }
1037 return base.hp + mana.value < (MaxHP + mana.max) / 5;
1038 }
1039 return false;
1040 }
1041
1042 public bool HasHigherGround(Card c)
1043 {
1044 if (c == null)
1045 {
1046 return false;
1047 }
1048 float num = renderer.position.y - pos.Position(0).y + (_isLevitating ? 0.4f : 0f);
1049 float num2 = c.renderer.position.y - c.pos.Position(0).y + ((c.isChara && c.Chara._isLevitating) ? 0.4f : 0f);
1050 return num > num2 + 0.1f;
1051 }
1052
1053 public bool CanSeeSimple(Point p)
1054 {
1055 if (!p.IsValid || p.IsHidden)
1056 {
1057 return false;
1058 }
1059 if (IsPC)
1060 {
1061 if (fov != null)
1062 {
1063 return fov.lastPoints.ContainsKey(p.index);
1064 }
1065 return false;
1066 }
1067 return true;
1068 }
1069
1070 public bool CanSee(Card c)
1071 {
1072 if (c == this)
1073 {
1074 return true;
1075 }
1076 if (!c.pos.IsValid)
1077 {
1078 return false;
1079 }
1080 if (c.isChara)
1081 {
1082 if (hasTelepathy && c.Chara.race.visibleWithTelepathy)
1083 {
1084 return true;
1085 }
1086 if (c.isHidden && c != this && !canSeeInvisible)
1087 {
1088 return false;
1089 }
1090 }
1091 if (IsPC)
1092 {
1093 if (fov != null)
1094 {
1095 return fov.lastPoints.ContainsKey(c.pos.index);
1096 }
1097 return false;
1098 }
1099 return true;
1100 }
1101
1102 public bool CanSeeLos(Card c, int dist = -1)
1103 {
1104 if (c.isHidden && !canSeeInvisible && (!hasTelepathy || !c.Chara.race.visibleWithTelepathy))
1105 {
1106 return false;
1107 }
1108 return CanSeeLos(c.pos, dist);
1109 }
1110
1111 public bool CanSeeLos(Point p, int dist = -1)
1112 {
1113 if (dist == -1)
1114 {
1115 dist = pos.Distance(p);
1116 }
1117 if (dist > GetSightRadius())
1118 {
1119 return false;
1120 }
1121 if (IsPC)
1122 {
1123 if (fov != null)
1124 {
1125 return fov.lastPoints.ContainsKey(p.index);
1126 }
1127 return false;
1128 }
1129 return Los.IsVisible(pos, p);
1130 }
1131
1132 public bool HasAccess(Card c)
1133 {
1134 return HasAccess(c.pos);
1135 }
1136
1137 public bool HasAccess(Point p)
1138 {
1139 if (!EClass._zone.IsPCFaction || p.cell.room == null || IsPC)
1140 {
1141 return true;
1142 }
1143 return p.cell.room.data.accessType switch
1144 {
1145 BaseArea.AccessType.Resident => memberType == FactionMemberType.Default,
1146 BaseArea.AccessType.Private => false,
1147 _ => true,
1148 };
1149 }
1150
1151 public bool CanSleep()
1152 {
1153 if (EClass._zone.events.GetEvent<ZoneEventQuest>() != null)
1154 {
1155 return false;
1156 }
1157 if (!EClass.debug.godMode && sleepiness.GetPhase() == 0)
1158 {
1159 return stamina.GetPhase() <= 1;
1160 }
1161 return true;
1162 }
1163
1164 protected override void OnSerializing()
1165 {
1166 if (enemy != null)
1167 {
1168 SetInt(55, enemy.uid);
1169 }
1170 _cints[0] = (int)_cbits1.Bits;
1171 List<BodySlot> slots = body.slots;
1172 rawSlots = new int[slots.Count];
1173 for (int i = 0; i < slots.Count; i++)
1174 {
1175 rawSlots[i] = slots[i].elementId;
1176 }
1177 }
1178
1179 protected override void OnDeserialized()
1180 {
1181 isCreated = true;
1182 _cbits1.Bits = (uint)_cints[0];
1183 InitStats(onDeserialize: true);
1184 body.SetOwner(this, deserialized: true);
1185 elements.ApplyElementMap(base.uid, SourceValueType.Chara, job.elementMap, base.DefaultLV);
1186 elements.ApplyElementMap(base.uid, SourceValueType.Chara, race.elementMap, base.DefaultLV);
1187 if (global != null && global.goal != null)
1188 {
1189 global.goal.SetOwner(this);
1190 }
1191 if (IsPCC)
1192 {
1193 pccData.state = (base.isCensored ? PCCState.Naked : PCCState.Normal);
1194 }
1195 if (tempElements != null)
1196 {
1197 tempElements.SetParent(this);
1198 }
1199 UpdateAngle();
1201 Refresh();
1202 if (source.tag.Contains("boss"))
1203 {
1204 bossText = true;
1205 }
1206 sharedCheckTurn = EClass.rnd(200);
1207 }
1208
1209 public override string GetName(NameStyle style, int num = -1)
1210 {
1211 if (base.isBackerContent && EClass.core.config.backer.Show(base.c_idBacker))
1212 {
1213 if (id == "follower" && !IsGlobal)
1214 {
1215 return "_follower".lang(EClass.sources.backers.map[base.c_idBacker].Name, faith.Name);
1216 }
1217 return EClass.sources.backers.map[base.c_idBacker].Name;
1218 }
1219 string text = base.c_altName ?? source.GetName(this);
1220 text = text.Replace("#ele5", MainElement.source.GetAltname(3)).Replace("#ele4", MainElement.source.GetAltname(2)).Replace("#ele3", MainElement.source.GetAltname(1))
1221 .Replace("#ele2", MainElement.source.GetAltname(0))
1222 .Replace("#ele", MainElement.source.GetName().ToLower());
1223 if (base.c_bossType == BossType.Evolved)
1224 {
1225 text = "_evolved".lang(text.ToTitleCase(wholeText: true));
1226 }
1227 trait.SetName(ref text);
1228 if (text.Length > 0 && char.IsLower(text[0]))
1229 {
1230 if (base.rarity >= Rarity.Legendary)
1231 {
1232 text = text.ToTitleCase();
1233 }
1234 else if (num != 0)
1235 {
1236 text = text.AddArticle();
1237 }
1238 }
1239 if (style == NameStyle.Simple)
1240 {
1241 return text;
1242 }
1243 int num2 = ((base.rarity == Rarity.Mythical) ? 3 : ((base.rarity >= Rarity.Legendary) ? 2 : ((!_alias.IsEmpty()) ? 1 : (-1))));
1244 if (trait is TraitAdventurer)
1245 {
1246 num2 = 1;
1247 }
1248 text = (Aka.IsEmpty() ? text.Bracket(num2) : (num2 switch
1249 {
1250 -1 => "_aka",
1251 1 => "_aka3",
1252 _ => "_aka2",
1253 }).lang((num2 == -1) ? Aka : Aka.ToTitleCase(wholeText: true), text.Bracket(num2)));
1254 string text2 = (base.isSale ? "forSale".lang(Lang._currency(GetPrice(CurrencyType.Money, sell: true, PriceType.PlayerShop), "money")) : "");
1255 return text + text2;
1256 }
1257
1258 public override void ChangeRarity(Rarity r)
1259 {
1260 if (r != base.rarity)
1261 {
1262 base.rarity = r;
1263 if (renderer != null && renderer.isSynced)
1264 {
1266 }
1267 base.hp = MaxHP;
1268 }
1269 }
1270
1271 public void SetFaction(Faction f)
1272 {
1273 _faction = null;
1274 faction = f;
1276 }
1277
1278 public void SetHomeZone(Zone zone)
1279 {
1280 homeZone = zone;
1281 SetGlobal();
1282 }
1283
1284 public void OnBanish()
1285 {
1286 if (!IsGlobal)
1287 {
1288 return;
1289 }
1290 memberType = FactionMemberType.Default;
1291 foreach (Thing item in things.List((Thing a) => a.HasTag(CTAG.godArtifact)).ToList())
1292 {
1294 }
1295 UniqueData uniqueData = base.c_uniqueData;
1296 if (uniqueData != null)
1297 {
1298 Debug.Log(uniqueData.uidZone + "/" + EClass.game.spatials.map.ContainsKey(uniqueData.uidZone) + "/" + uniqueData.x + "/" + uniqueData.y);
1299 }
1300 if (uniqueData != null && EClass.game.spatials.map.ContainsKey(uniqueData.uidZone))
1301 {
1302 MoveHome(EClass.game.spatials.map[uniqueData.uidZone] as Zone, uniqueData.x, uniqueData.y);
1303 return;
1304 }
1305 Zone z = EClass.game.spatials.Find("somewhere");
1306 if (trait is TraitAdventurer)
1307 {
1308 z = EClass.world.region.ListTowns().RandomItem();
1309 SetHomeZone(z);
1310 }
1311 MoveZone(z, ZoneTransition.EnterState.RandomVisit);
1312 }
1313
1314 public Chara SetGlobal(Zone _home, int x, int z)
1315 {
1316 SetGlobal();
1317 homeZone = _home;
1318 _home.AddCard(this, x, z);
1319 global.transition = new ZoneTransition
1320 {
1321 state = ZoneTransition.EnterState.Exact,
1322 x = x,
1323 z = z
1324 };
1325 orgPos = new Point(x, z);
1326 return this;
1327 }
1328
1330 {
1331 if (!IsGlobal)
1332 {
1334 global = new GlobalData();
1335 base.isSubsetCard = false;
1336 enemy = null;
1337 base.c_uidMaster = 0;
1338 }
1339 return this;
1340 }
1341
1342 public void RemoveGlobal()
1343 {
1344 if (IsGlobal && !(trait is TraitUniqueChara) && !base.IsUnique && !EClass.game.cards.listAdv.Contains(this))
1345 {
1346 global = null;
1348 }
1349 }
1350
1351 public override void OnBeforeCreate()
1352 {
1353 if (source.job == "*r")
1354 {
1355 base.c_idJob = EClass.sources.jobs.rows.Where((SourceJob.Row j) => j.playable < 4).RandomItem().id;
1356 }
1357 if (bp.idJob != null)
1358 {
1359 base.c_idJob = bp.idJob;
1360 }
1361 if (bp.idRace != null)
1362 {
1363 base.c_idRace = bp.idRace;
1364 }
1365 }
1366
1367 public override void OnCreate(int genLv)
1368 {
1369 if (source.tag.Contains("boss"))
1370 {
1371 bossText = true;
1372 }
1373 int num = ((bp.lv != -999) ? bp.lv : base.LV);
1374 if (trait.AdvType == TraitChara.Adv_Type.Adv || trait.AdvType == TraitChara.Adv_Type.Adv_Fairy)
1375 {
1376 if (ListAdvRace.Count == 0)
1377 {
1378 ListAdvRace = EClass.sources.races.rows.Where((SourceRace.Row a) => a.playable <= 1 && a.id != "fairy").ToList();
1379 ListAdvJob = EClass.sources.jobs.rows.Where((SourceJob.Row a) => a.playable <= 4).ToList();
1380 }
1381 if (trait.AdvType == TraitChara.Adv_Type.Adv)
1382 {
1383 base.c_idRace = ListAdvRace.RandomItem().id;
1384 }
1385 base.c_idJob = ListAdvJob.RandomItem().id;
1386 _race = null;
1387 _job = null;
1388 num = 10 + EClass.rnd(40);
1389 ChangeMaterial(race.material, ignoreFixedMaterial: true);
1390 }
1391 bio = new Biography();
1392 bio.Generate(this);
1393 if (source.idActor.Length != 0 && source.idActor[0] == "pcc" && pccData == null)
1394 {
1395 pccData = PCCData.Create(IDPCCBodySet);
1396 if (source.idActor.Length > 2)
1397 {
1398 pccData.SetPart("body", IDPCCBodySet, source.idActor[2]);
1399 }
1400 else
1401 {
1402 pccData.Randomize(IDPCCBodySet);
1403 }
1404 }
1405 if (source.mainElement.Length != 0)
1406 {
1407 int _genLv = Mathf.Min(genLv, 100);
1408 List<Tuple<string, int, int>> list = new List<Tuple<string, int, int>>();
1409 string[] mainElement = source.mainElement;
1410 for (int i = 0; i < mainElement.Length; i++)
1411 {
1412 string[] array = mainElement[i].Split('/');
1413 SourceElement.Row row = EClass.sources.elements.alias["ele" + array[0]];
1414 int num2 = source.LV * row.eleP / 100;
1415 if (list.Count == 0 || num2 < _genLv || array[0] == bp.idEle)
1416 {
1417 list.Add(new Tuple<string, int, int>(array[0], (array.Length > 1) ? int.Parse(array[1]) : 0, num2));
1418 }
1419 }
1420 Tuple<string, int, int> tuple = list.RandomItemWeighted((Tuple<string, int, int> a) => 10000 / (100 + (_genLv - a.Item3) * 25));
1421 if (!bp.idEle.IsEmpty())
1422 {
1423 tuple = list.Where((Tuple<string, int, int> a) => a.Item1 == bp.idEle).FirstOrDefault() ?? tuple;
1424 }
1425 SetMainElement(tuple.Item1, (tuple.Item2 == 0) ? 10 : tuple.Item2, elemental: true);
1426 if (list.Count >= 2)
1427 {
1428 num = tuple.Item3 + base.LV - source.LV;
1429 }
1430 }
1431 if (source.name == "*r")
1432 {
1433 base.c_altName = NameGen.getRandomName();
1434 }
1435 if (source.GetText("aka") == "*r" || trait.UseRandomAlias)
1436 {
1437 _alias = AliasGen.GetRandomAlias();
1438 }
1439 happiness = EClass.rnd(100);
1440 contribution = EClass.rnd(100);
1441 RerollHobby();
1442 _idTimeTable = ((EClass.rnd(5) == 0) ? 1 : 0);
1443 ApplyRace();
1444 ApplyJob();
1445 if (num != source.LV)
1446 {
1447 SetLv(num);
1448 }
1449 if (base.LV > 5 && race.id == "mutant")
1450 {
1451 for (int j = 0; j < Mathf.Min(1 + base.LV / 5, 22); j++)
1452 {
1453 SetFeat(1644, j + 1);
1454 }
1455 }
1456 InitStats();
1457 body.SetOwner(this);
1459 if (race.EQ.Length != 0 || !source.equip.IsEmpty())
1460 {
1461 TryRestock(onCreate: true);
1462 }
1463 switch (id)
1464 {
1465 case "golem_wood":
1466 ChangeMaterial("pine");
1467 break;
1468 case "golem_steel":
1469 ChangeMaterial("steel");
1470 break;
1471 case "golem_gold":
1472 ChangeMaterial("gold");
1473 break;
1474 case "dodo":
1475 base.idSkin = EClass.rnd(4);
1476 break;
1477 case "putty_snow":
1478 if (EClass.rnd(100) == 0 || EClass.debug.enable)
1479 {
1480 base.idSkin = EClass.rnd(4);
1481 }
1482 break;
1483 case "snail":
1484 base.idSkin = 5;
1485 break;
1486 case "olderyoungersister":
1487 base.idSkin = 1;
1488 break;
1489 case "sister_undead":
1490 case "dog":
1491 case "cat":
1492 base.idSkin = EClass.rnd(sourceCard.tiles.Length);
1493 if (id == "sister_undead" && EClass.rnd(10) == 0)
1494 {
1496 if (row2 != null && (!EClass.player.doneBackers.Contains(row2.id) || EClass.core.config.test.ignoreBackerDestoryFlag))
1497 {
1498 ApplyBacker(row2.id);
1499 }
1500 }
1501 break;
1502 case "baby":
1503 case "ika":
1504 SetFeat(1232, 3);
1505 break;
1506 }
1507 if (HasTag(CTAG.random_color))
1508 {
1509 DyeRandom();
1510 }
1511 SetAI(new NoGoal());
1512 if (!source.faith.IsEmpty())
1513 {
1514 SetFaith(source.faith);
1515 }
1516 else if (EClass.game.activeZone != null && EClass.game.activeZone.id == "foxtown")
1517 {
1519 }
1520 else if (EClass.game.activeZone != null && EClass.game.activeZone.id == "foxtown_nefu")
1521 {
1523 }
1524 else
1525 {
1526 SetFaith(EClass.game.religions.GetRandomReligion(onlyJoinable: true, EClass.rnd(10) == 0));
1527 }
1528 _affinity = 0;
1529 interest = 100;
1532 Refresh();
1533 stamina.value = stamina.max;
1534 mana.value = mana.max;
1535 isCreated = true;
1536 }
1537
1538 public void SetFaith(string id)
1539 {
1541 }
1542
1543 public void SetFaith(Religion r)
1544 {
1545 faith = r;
1547 }
1548
1549 public void HealAll()
1550 {
1551 Cure(CureType.Death);
1552 base.hp = MaxHP;
1553 mana.value = mana.max;
1554 stamina.value = stamina.max;
1555 Refresh();
1556 }
1557
1558 public void Refresh(bool calledRecursive = false)
1559 {
1560 if (ride != null)
1561 {
1562 ride.Refresh(calledRecursive: true);
1563 }
1564 hasTelepathy = false;
1565 isWet = false;
1566 _isLevitating = HasElement(401) || (ride != null && ride._isLevitating);
1568 base.isHidden = HasElement(415);
1569 foreach (Condition condition in conditions)
1570 {
1571 condition.OnRefresh();
1572 }
1573 if (isWet)
1574 {
1575 base.isHidden = false;
1576 }
1577 SetDirtySpeed();
1578 if (host != null && !calledRecursive)
1579 {
1580 host.Refresh(calledRecursive: true);
1581 }
1582 }
1583
1585 {
1586 Chara chara = CharaGen.Create(id);
1587 chara.mana.value = mana.value;
1588 chara.stamina.value = stamina.value;
1589 foreach (KeyValuePair<int, Element> item in elements.dict)
1590 {
1591 Element orCreateElement = chara.elements.GetOrCreateElement(item.Key);
1592 orCreateElement.vBase = item.Value.ValueWithoutLink - orCreateElement.vSource;
1593 }
1594 chara.SetFaith(faith);
1595 chara.bio = IO.DeepCopy(bio);
1596 chara.LV = base.LV;
1597 chara.c_daysWithGod = base.c_daysWithGod;
1598 chara.RefreshFaithElement();
1599 chara.hp = (int)Mathf.Clamp((float)chara.MaxHP * ((float)base.hp / (float)MaxHP) * 0.99f, 0f, chara.MaxHP);
1600 chara.isCopy = true;
1601 if (HaveFur())
1602 {
1603 chara.c_fur = -1;
1604 }
1605 return chara;
1606 }
1607
1608 public int GetBurden(Card t = null, int num = -1)
1609 {
1610 int num2 = (base.ChildrenWeight + ((t != null) ? ((num == -1) ? t.ChildrenAndSelfWeight : (t.SelfWeight * num)) : 0)) * 100 / WeightLimit;
1611 if (num2 < 0)
1612 {
1613 num2 = 1000;
1614 }
1616 {
1617 num2 = 0;
1618 }
1619 int num3 = ((num2 >= 100) ? ((num2 - 100) / 10 + 1) : 0);
1620 if (num3 > 9)
1621 {
1622 num3 = 9;
1623 }
1624 return num3;
1625 }
1626
1627 public void CalcBurden()
1628 {
1629 int num = base.ChildrenWeight * 100 / Mathf.Max(1, WeightLimit);
1630 if (num < 0)
1631 {
1632 num = 1000;
1633 }
1635 {
1636 num = 0;
1637 }
1638 burden.Set(num);
1639 SetDirtySpeed();
1640 }
1641
1642 public void Stumble(int mtp = 100)
1643 {
1644 bool flag = EClass._map.FindThing((Thing t) => t.IsInstalled && t.pos.Equals(EClass.pc.pos) && t.trait is TraitStairsUp) != null;
1645 Say(flag ? "dmgBurdenStairs" : "dmgBurdenFallDown", this);
1646 int num = MaxHP;
1647 if (Evalue(1421) > 0)
1648 {
1649 num = mana.max;
1650 }
1651 int num2 = (num * (base.ChildrenWeight * 100 / WeightLimit) / (flag ? 100 : 200) + 1) * mtp / 100;
1652 if (base.hp <= 0)
1653 {
1654 num2 *= 2;
1655 }
1656 DamageHP(num2, flag ? AttackSource.BurdenStairs : AttackSource.BurdenFallDown);
1657 }
1658
1659 public void SetDirtySpeed()
1660 {
1661 dirtySpeed = true;
1662 if (host != null)
1663 {
1665 }
1666 }
1667
1668 public void RefreshSpeed(Element.BonusInfo info = null)
1669 {
1670 if (ride != null && !ride.IsDeadOrSleeping)
1671 {
1673 _Speed = ride._Speed;
1674 }
1675 else if (host != null)
1676 {
1677 if (host.ride == this)
1678 {
1679 _Speed = Evalue(79);
1680 _Speed = _Speed * 100 / Mathf.Clamp(100 + _Speed * ((!race.tag.Contains("noRide")) ? 1 : 5) - base.STR - host.EvalueRiding() * 2 - (race.tag.Contains("ride") ? 50 : 0), 100, 1000);
1681 }
1682 else
1683 {
1684 _Speed = (Evalue(79) + host.Evalue(79)) / 2;
1685 }
1686 }
1687 else
1688 {
1689 _Speed = Evalue(79) + Evalue(407) / 2;
1690 }
1691 if (body.GetSlot(37, onlyEmpty: false)?.thing != null && HasElement(1209))
1692 {
1693 _Speed -= 25;
1694 info?.AddText(-25, EClass.sources.elements.map[1209].GetName());
1695 }
1696 if (parasite != null)
1697 {
1698 _Speed = _Speed * 100 / Mathf.Clamp(120 + parasite.LV * 2 - base.STR - Evalue(227) * 2, 100, 1000);
1699 }
1700 if (_Speed < elements.ValueWithoutLink(79) / 3)
1701 {
1703 info?.AddText("minSpeed".lang((elements.ValueWithoutLink(79) / 3).ToString() ?? ""));
1704 }
1705 int num = 100;
1706 if (EClass._zone.map != null && EClass._zone.IsUnderwater)
1707 {
1708 int num2 = Evalue(200);
1709 num = 50 + Mathf.Clamp((int)Mathf.Sqrt(num2) * 5 - EClass._zone.DangerLv / 50, 0, 50) + Mathf.Clamp((int)Mathf.Sqrt(num2), 0, 25);
1710 if (info != null && num != 100)
1711 {
1712 info.AddFix(num - 100, EClass.sources.elements.map[200].GetName().ToTitleCase());
1713 }
1714 }
1715 if (IsPCFaction)
1716 {
1717 switch (burden.GetPhase())
1718 {
1719 case 1:
1720 num -= 10;
1721 info?.AddFix(-10, burden.GetPhaseStr());
1722 break;
1723 case 2:
1724 num -= 20;
1725 info?.AddFix(-20, burden.GetPhaseStr());
1726 break;
1727 case 3:
1728 num -= 30;
1729 info?.AddFix(-30, burden.GetPhaseStr());
1730 break;
1731 case 4:
1732 num -= (IsPC ? 50 : 100);
1733 info?.AddFix(IsPC ? (-50) : (-100), burden.GetPhaseStr());
1734 break;
1735 }
1736 if (IsPC)
1737 {
1738 switch (stamina.GetPhase())
1739 {
1740 case 1:
1741 num -= 10;
1742 info?.AddFix(-10, stamina.GetPhaseStr());
1743 break;
1744 case 0:
1745 num -= 20;
1746 info?.AddFix(-20, stamina.GetPhaseStr());
1747 break;
1748 }
1749 switch (sleepiness.GetPhase())
1750 {
1751 case 2:
1752 num -= 10;
1753 info?.AddFix(-10, sleepiness.GetPhaseStr());
1754 break;
1755 case 3:
1756 num -= 20;
1757 info?.AddFix(-20, sleepiness.GetPhaseStr());
1758 break;
1759 }
1760 switch (hunger.GetPhase())
1761 {
1762 case 3:
1763 case 4:
1764 num -= 10;
1765 info?.AddFix(-10, hunger.GetPhaseStr());
1766 break;
1767 case 5:
1768 num -= 30;
1769 info?.AddFix(-30, hunger.GetPhaseStr());
1770 break;
1771 }
1772 num += EClass.player.lastEmptyAlly * Evalue(1646);
1773 info?.AddFix(EClass.player.lastEmptyAlly * Evalue(1646), EClass.sources.elements.map[1646].GetName());
1774 }
1776 {
1777 num += EClass.player.lastEmptyAlly * 10 - 10;
1778 info?.AddFix(EClass.player.lastEmptyAlly * 10 - 10, "exceedParty".lang());
1779 }
1780 }
1781 else if (base.LV >= 1000 && !EClass.game.principal.disableVoidBlessing && !base.IsPCFactionOrMinion)
1782 {
1783 num += EClass.curve((base.LV - 900) / 100 * 10, 500, 100);
1784 info?.AddFix(EClass.curve((base.LV - 900) / 100 * 10, 500, 100), "enemySpeedBuff".lang());
1785 }
1786 if (HasCondition<ConGravity>())
1787 {
1788 num -= 30;
1789 info?.AddFix(-30, GetCondition<ConGravity>().Name);
1790 }
1791 if (_Speed < 10)
1792 {
1793 _Speed = 10;
1794 }
1795 _Speed = _Speed * num / 100;
1796 if (_Speed < 10)
1797 {
1798 _Speed = 10;
1799 info?.AddText("minSpeed".lang(10.ToString() ?? ""));
1800 }
1801 dirtySpeed = false;
1802 }
1803
1805 {
1806 int num = base.END;
1807 int num2 = 0;
1808 foreach (Element value in elements.dict.Values)
1809 {
1810 if (value.source.category == "skill")
1811 {
1812 num = ((!IsPC) ? (num + Mathf.Max(value.ValueWithoutLink, 0)) : (num + Mathf.Max(value.vBase, 0)));
1813 }
1814 }
1815 num2 = EClass.curve(num, 30, 10, 60);
1816 if (num2 < 10)
1817 {
1818 num2 = 10;
1819 }
1820 _maxStamina = num2 + 15;
1821 }
1822
1823 public override void ApplyEditorTags(EditorTag tag)
1824 {
1825 switch (tag)
1826 {
1827 case EditorTag.HostilityNeutral:
1828 {
1829 Hostility hostility2 = (base.c_originalHostility = Hostility.Neutral);
1830 this.hostility = hostility2;
1831 break;
1832 }
1833 case EditorTag.HostilityEnemy:
1834 {
1835 Hostility hostility2 = (base.c_originalHostility = Hostility.Enemy);
1836 this.hostility = hostility2;
1837 break;
1838 }
1839 case EditorTag.HostilityFriend:
1840 {
1841 Hostility hostility2 = (base.c_originalHostility = Hostility.Friend);
1842 this.hostility = hostility2;
1843 break;
1844 }
1845 case EditorTag.Male:
1846 bio.SetGender(2);
1847 base.c_idPortrait = Portrait.GetRandomPortrait(2, GetIdPortraitCat());
1848 break;
1849 case EditorTag.Female:
1850 bio.SetGender(1);
1851 base.c_idPortrait = Portrait.GetRandomPortrait(1, GetIdPortraitCat());
1852 break;
1853 case EditorTag.baby:
1854 SetFeat(1232);
1855 break;
1856 }
1857 base.ApplyEditorTags(tag);
1858 }
1859
1860 public override void SetSource()
1861 {
1862 source = EClass.sources.charas.map.TryGetValue(id);
1863 if (source == null)
1864 {
1865 Debug.LogWarning("Chara " + id + " not found");
1866 id = "chicken";
1867 source = EClass.sources.charas.map[id];
1868 }
1869 path.walker = this;
1870 }
1871
1872 public void SetMainElement(string id, int v = 0, bool elemental = false)
1873 {
1874 if (!id.StartsWith("ele"))
1875 {
1876 id = "ele" + id;
1877 }
1878 SetMainElement(EClass.sources.elements.alias[id].id, v, elemental);
1879 }
1880
1881 public void SetMainElement(int id, int v = 0, bool elemental = false)
1882 {
1883 if (base.c_idMainElement != 0)
1884 {
1885 SetElements(base.c_idMainElement, remove: true);
1886 base.c_idMainElement = 0;
1887 }
1888 if (id != 0)
1889 {
1890 _ = EClass.sources.elements.map[id];
1891 SetElements(id, remove: false);
1892 base.c_idMainElement = id;
1893 if (elemental)
1894 {
1895 base.isElemental = true;
1896 _colorInt = 0;
1897 Color colorSprite = EClass.setting.elements[MainElement.source.alias].colorSprite;
1898 base.c_lightColor = (byte)Mathf.Clamp(colorSprite.r * 3f, 1f, 31f) * 1024 + (byte)Mathf.Clamp(colorSprite.g * 3f, 1f, 31f) * 32 + (byte)Mathf.Clamp(colorSprite.b * 3f, 1f, 31f);
1899 }
1900 _ability = null;
1901 }
1902 void SetElements(int idEle, bool remove)
1903 {
1904 elements.SetBase(idEle, (!remove) ? ((v == 0) ? 10 : v) : 0);
1905 elements.ModBase(EClass.sources.elements.alias[EClass.sources.elements.map[idEle].aliasRef].id, remove ? (-20) : 20);
1906 switch (idEle)
1907 {
1908 case 910:
1909 elements.ModBase(951, remove ? 10 : (-10));
1910 break;
1911 case 911:
1912 elements.ModBase(950, remove ? 10 : (-10));
1913 break;
1914 case 912:
1915 elements.ModBase(953, remove ? 10 : (-10));
1916 break;
1917 case 913:
1918 elements.ModBase(952, remove ? 10 : (-10));
1919 break;
1920 case 916:
1921 elements.ModBase(960, remove ? 10 : (-10));
1922 break;
1923 case 919:
1924 elements.ModBase(956, remove ? 10 : (-10));
1925 break;
1926 case 925:
1927 elements.ModBase(962, remove ? 10 : (-10));
1928 break;
1929 case 922:
1930 elements.ModBase(965, remove ? 10 : (-10));
1931 break;
1932 case 921:
1933 elements.ModBase(971, remove ? 10 : (-10));
1934 break;
1935 case 926:
1936 elements.ModBase(961, remove ? 10 : (-10));
1937 break;
1938 case 914:
1939 case 915:
1940 case 917:
1941 case 918:
1942 case 920:
1943 case 923:
1944 case 924:
1945 break;
1946 }
1947 }
1948 }
1949
1950 public void ApplyJob(bool remove = false)
1951 {
1952 elements.ApplyElementMap(base.uid, SourceValueType.Chara, job.elementMap, base.DefaultLV, remove, applyFeat: true);
1953 if (IsPCC)
1954 {
1955 EClass.game.uniforms.Apply(pccData, job.id, base.IsMale, canUseOtherGender: true);
1956 }
1957 }
1958
1959 public void ChangeJob(string idNew)
1960 {
1961 ApplyJob(remove: true);
1962 base.c_idJob = idNew;
1963 _job = null;
1964 ApplyJob();
1965 if (IsPCC)
1966 {
1967 PCC.Get(pccData).Build();
1968 }
1969 }
1970
1971 private int ParseBodySlot(string s)
1972 {
1973 return s switch
1974 {
1975 "é ­" => 30,
1976 "首" => 31,
1977 "体" => 32,
1978 "背" => 33,
1979 "手" => 35,
1980 "指" => 36,
1981 "è…•" => 34,
1982 "è…°" => 37,
1983 "è¶³" => 39,
1984 _ => -1,
1985 };
1986 }
1987
1988 public void AddRandomBodyPart(bool msg = false)
1989 {
1990 int ele = new int[9] { 30, 31, 33, 35, 35, 36, 34, 37, 39 }.RandomItem();
1991 body.AddBodyPart(ele);
1992 if (msg)
1993 {
1994 Say("gain_bodyparts", this, Element.Get(ele).GetName().ToLower());
1995 PlaySound("offering");
1996 }
1997 }
1998
1999 public void RemoveLastBodyPart(bool msg = false)
2000 {
2001 if (body.slots.Count != 0)
2002 {
2003 BodySlot bodySlot = body.slots.LastItem();
2004 body.RemoveBodyPartAt(body.slots.Count - 1);
2005 if (msg)
2006 {
2007 Say("lose_bodyparts", this, Element.Get(bodySlot.elementId).GetName().ToLower());
2008 PlaySound("offering");
2009 }
2010 }
2011 }
2012
2013 public void ResetBody()
2014 {
2015 for (int num = body.slots.Count - 1; num >= 0; num--)
2016 {
2017 BodySlot bodySlot = body.slots[num];
2018 if (bodySlot.elementId == 45 || bodySlot.elementId == 40)
2019 {
2020 return;
2021 }
2022 body.RemoveBodyPart(num);
2023 }
2024 string[] array = race.figure.Split('|');
2025 foreach (string s in array)
2026 {
2027 int num2 = ParseBodySlot(s);
2028 if (num2 != -1)
2029 {
2030 body.AddBodyPart(num2);
2031 }
2032 }
2034 }
2035
2036 public void ApplyRace(bool remove = false)
2037 {
2038 string[] array = race.figure.Split('|');
2039 foreach (string s in array)
2040 {
2041 int num = ParseBodySlot(s);
2042 if (num != -1)
2043 {
2044 if (remove)
2045 {
2046 body.RemoveBodyPart(num);
2047 }
2048 else
2049 {
2050 body.AddBodyPart(num);
2051 }
2052 }
2053 }
2055 elements.ApplyElementMap(base.uid, SourceValueType.Chara, race.elementMap, base.DefaultLV, remove, applyFeat: true);
2056 }
2057
2058 public void ChangeRace(string idNew)
2059 {
2060 ApplyRace(remove: true);
2061 base.c_idRace = idNew;
2062 _race = null;
2063 ApplyRace();
2064 ChangeMaterial(race.material);
2065 }
2066
2067 public void MakePartyMemeber()
2068 {
2069 _MakeAlly();
2070 EClass.pc.party.AddMemeber(this);
2071 }
2072
2073 public void MakeAlly(bool msg = true)
2074 {
2075 if (IsLocalChara && !base.IsUnique)
2076 {
2077 Debug.Log("Creating Replacement NPC for:" + this);
2079 }
2080 _MakeAlly();
2081 if (msg)
2082 {
2083 EClass.pc.Say("hire", this);
2084 EClass.Sound.Play("good");
2085 }
2086 EClass.pc.party.AddMemeber(this);
2087 if (EClass._zone.IsTown)
2088 {
2090 }
2091 }
2092
2093 public void _MakeAlly()
2094 {
2095 if (EClass.pc.homeBranch != null)
2096 {
2098 }
2099 else
2100 {
2101 SetGlobal();
2103 }
2104 Hostility hostility2 = (base.c_originalHostility = Hostility.Ally);
2105 this.hostility = hostility2;
2106 orgPos = null;
2107 base.c_summonDuration = 0;
2108 base.isSummon = false;
2109 ReleaseMinion();
2110 SetInt(32);
2111 Refresh();
2112 }
2113
2114 public bool CanBeTempAlly(Chara c)
2115 {
2116 if (IsPCFaction || IsGlobal || IsMinion || IsMultisize || EClass._zone.CountMinions(c) > c.MaxSummon || base.rarity >= Rarity.Legendary)
2117 {
2118 return false;
2119 }
2120 if (HasElement(1222))
2121 {
2122 return false;
2123 }
2124 return true;
2125 }
2126
2127 public void MakeMinion(Chara _master, MinionType type = MinionType.Default)
2128 {
2129 ReleaseMinion();
2130 Hostility hostility2 = (base.c_originalHostility = (_master.IsPCFaction ? Hostility.Ally : _master.hostility));
2131 this.hostility = hostility2;
2132 base.c_uidMaster = _master.uid;
2133 base.c_minionType = type;
2134 master = _master;
2135 Refresh();
2136 }
2137
2138 public void ReleaseMinion()
2139 {
2140 base.c_uidMaster = 0;
2141 master = null;
2142 enemy = null;
2143 foreach (Chara chara in EClass._map.charas)
2144 {
2145 if (chara.enemy == this)
2146 {
2147 chara.SetEnemy();
2148 chara.ai.Cancel();
2149 }
2150 }
2151 ai.Cancel();
2152 Refresh();
2153 }
2154
2155 public void SetSummon(int duration)
2156 {
2157 base.c_summonDuration = duration;
2158 base.isSummon = true;
2159 }
2160
2162 {
2163 if (IsMinion)
2164 {
2165 master = EClass._map.FindChara(base.c_uidMaster);
2166 }
2167 return master;
2168 }
2169
2170 public bool IsEscorted()
2171 {
2172 if (!IsPCPartyMinion)
2173 {
2174 return false;
2175 }
2176 foreach (Quest item in EClass.game.quests.list)
2177 {
2178 if (item is QuestEscort questEscort && questEscort.uidChara == base.uid)
2179 {
2180 return true;
2181 }
2182 }
2183 return false;
2184 }
2185
2186 public bool CanDestroyPath()
2187 {
2188 if (!IsMultisize)
2189 {
2190 if (base.rarity >= Rarity.Superior && !base.IsPCFactionOrMinion && ai is GoalCombat && !EClass._zone.IsPCFaction)
2191 {
2192 return !(EClass._zone is Zone_Town);
2193 }
2194 return false;
2195 }
2196 return true;
2197 }
2198
2199 public bool CanMoveTo(Point p, bool allowDestroyPath = true)
2200 {
2201 if (!p.IsValid)
2202 {
2203 return false;
2204 }
2205 int num = ((p.z >= pos.z) ? ((p.x > pos.x) ? 1 : ((p.z > pos.z) ? 2 : 3)) : 0);
2206 if (allowDestroyPath && CanDestroyPath())
2207 {
2208 if (!p.IsInBounds)
2209 {
2210 return false;
2211 }
2212 }
2213 else
2214 {
2215 if (EClass._map.cells[p.x, p.z].blocked || EClass._map.cells[pos.x, pos.z].weights[num] == 0)
2216 {
2217 return false;
2218 }
2219 if (p.x != pos.x && p.z != pos.z)
2220 {
2221 Cell[,] cells = EClass._map.cells;
2222 int x = p.x;
2223 int z = pos.z;
2224 int num2 = ((z >= pos.z) ? ((x > pos.x) ? 1 : ((z > pos.z) ? 2 : 3)) : 0);
2225 if (cells[pos.x, pos.z].weights[num2] == 0)
2226 {
2227 return false;
2228 }
2229 if (cells[x, z].blocked)
2230 {
2231 return false;
2232 }
2233 num2 = ((z >= p.z) ? ((x > p.x) ? 1 : ((z > p.z) ? 2 : 3)) : 0);
2234 if (cells[p.x, p.z].weights[num2] == 0)
2235 {
2236 return false;
2237 }
2238 x = pos.x;
2239 z = p.z;
2240 num2 = ((z >= pos.z) ? ((x > pos.x) ? 1 : ((z > pos.z) ? 2 : 3)) : 0);
2241 if (cells[pos.x, pos.z].weights[num2] == 0)
2242 {
2243 return false;
2244 }
2245 if (cells[x, z].blocked)
2246 {
2247 return false;
2248 }
2249 num2 = ((z >= p.z) ? ((x > p.x) ? 1 : ((z > p.z) ? 2 : 3)) : 0);
2250 if (cells[p.x, p.z].weights[num2] == 0)
2251 {
2252 return false;
2253 }
2254 }
2255 }
2256 if (IsPC)
2257 {
2258 if (IsEnemyOnPath(p))
2259 {
2260 return false;
2261 }
2262 }
2263 else if (p.HasChara && !IsMultisize && !CanReplace(p.FirstChara))
2264 {
2265 return false;
2266 }
2267 return true;
2268 }
2269
2270 public bool IsEnemyOnPath(Point p, bool cancelAI = true)
2271 {
2272 if (!currentZone.IsRegion && p.IsValid)
2273 {
2274 CellDetail detail = p.detail;
2275 if (detail != null && detail.charas.Count > 0)
2276 {
2277 foreach (Chara chara in p.detail.charas)
2278 {
2279 if (chara.IsHostile(this) || chara.IsHostile() || !chara.trait.CanBePushed)
2280 {
2281 if (cancelAI && EClass.pc.ai is GoalManualMove)
2282 {
2283 EClass.pc.ai.Cancel();
2284 }
2285 return true;
2286 }
2287 }
2288 }
2289 }
2290 return false;
2291 }
2292
2293 public bool CanInteractTo(Card c)
2294 {
2295 return CanInteractTo(c.pos);
2296 }
2297
2298 public bool CanInteractTo(Point p)
2299 {
2300 if (!p.IsValid)
2301 {
2302 return false;
2303 }
2304 if (EClass._map.cells[p.x, p.z].blocked)
2305 {
2306 return true;
2307 }
2308 if (!IsMultisize)
2309 {
2310 int num = ((p.z >= pos.z) ? ((p.x > pos.x) ? 1 : ((p.z > pos.z) ? 2 : 3)) : 0);
2311 if (EClass._map.cells[pos.x, pos.z].weights[num] == 0)
2312 {
2313 return false;
2314 }
2315 if (p.x != pos.x && p.z != pos.z)
2316 {
2317 Cell[,] cells = EClass._map.cells;
2318 int x = p.x;
2319 int z = pos.z;
2320 int num2 = ((z >= pos.z) ? ((x > pos.x) ? 1 : ((z > pos.z) ? 2 : 3)) : 0);
2321 if (cells[pos.x, pos.z].weights[num2] == 0)
2322 {
2323 return false;
2324 }
2325 num2 = ((z >= p.z) ? ((x > p.x) ? 1 : ((z > p.z) ? 2 : 3)) : 0);
2326 if (cells[p.x, p.z].weights[num2] == 0)
2327 {
2328 return false;
2329 }
2330 x = pos.x;
2331 z = p.z;
2332 num2 = ((z >= pos.z) ? ((x > pos.x) ? 1 : ((z > pos.z) ? 2 : 3)) : 0);
2333 if (cells[pos.x, pos.z].weights[num2] == 0)
2334 {
2335 return false;
2336 }
2337 num2 = ((z >= p.z) ? ((x > p.x) ? 1 : ((z > p.z) ? 2 : 3)) : 0);
2338 if (cells[p.x, p.z].weights[num2] == 0)
2339 {
2340 return false;
2341 }
2342 }
2343 }
2344 return true;
2345 }
2346
2347 public Point GetFirstStep(Point newPoint, PathManager.MoveType moveType = PathManager.MoveType.Default)
2348 {
2349 return PathManager.Instance.GetFirstStep(pos, newPoint, this, IsPC ? 40 : 10, (!IsMultisize) ? moveType : PathManager.MoveType.Default);
2350 }
2351
2352 public bool MoveRandom()
2353 {
2354 Point randomNeighbor = pos.GetRandomNeighbor();
2355 if (!randomNeighbor.Equals(pos) && !randomNeighbor.HasChara && HasAccess(randomNeighbor))
2356 {
2357 if ((race.tag.Contains("water") || source.tag.Contains("water")) && pos.cell.IsTopWaterAndNoSnow && !randomNeighbor.IsDeepWater)
2358 {
2359 return false;
2360 }
2361 return TryMove(randomNeighbor) == MoveResult.Success;
2362 }
2363 return false;
2364 }
2365
2367 {
2368 List<Point> list = new List<Point>();
2369 pos.ForeachNeighbor(delegate(Point p)
2370 {
2371 list.Add(p.Copy());
2372 });
2373 list.Shuffle();
2374 foreach (Point item in list)
2375 {
2376 if (!item.Equals(pos) && !item.HasChara && TryMove(item) == MoveResult.Success)
2377 {
2378 return true;
2379 }
2380 }
2381 return false;
2382 }
2383
2384 public void MoveByForce(Point newPoint, Card c = null, bool checkWall = false)
2385 {
2386 if (!newPoint.sourceBlock.tileType.IsBlockPass && (!checkWall || (Dist(newPoint) <= 1 && CanMoveTo(newPoint, allowDestroyPath: false))) && _Move(newPoint, MoveType.Force) == MoveResult.Success && ai.Current.CancelWhenMoved)
2387 {
2388 ai.Current.TryCancel(c);
2389 }
2390 }
2391
2393 {
2394 if (p.Equals(pos))
2395 {
2396 return MoveResult.Success;
2397 }
2399 {
2400 return MoveResult.Fail;
2401 }
2402 bool flag = true;
2403 Point point = null;
2404 _sharedPos.Set(p);
2405 if (CanDestroyPath())
2406 {
2408 {
2409 return MoveResult.Success;
2410 }
2411 Debug.Log(CanMoveTo(pos));
2413 }
2414 int num = pos.Distance(p);
2415 PathProgress pathProgress = PathManager.Instance.RequestPathImmediate(pos, p, this, PathManager.MoveType.Default, num + 4, 1);
2416 if (pathProgress.HasPath && pathProgress.nodes.Count < num + 4)
2417 {
2418 PathFinderNode pathFinderNode = pathProgress.nodes[pathProgress.nodes.Count - 1];
2419 if (TryMove(new Point(pathFinderNode.X, pathFinderNode.Z)) == MoveResult.Success)
2420 {
2421 return MoveResult.Success;
2422 }
2423 }
2424 pathProgress = PathManager.Instance.RequestPathImmediate(pos, p, this, PathManager.MoveType.Combat, num + 4, 1);
2425 if (pathProgress.HasPath && pathProgress.nodes.Count < num + 4)
2426 {
2427 PathFinderNode pathFinderNode2 = pathProgress.nodes[pathProgress.nodes.Count - 1];
2428 if (TryMove(new Point(pathFinderNode2.X, pathFinderNode2.Z)) == MoveResult.Success)
2429 {
2430 return MoveResult.Success;
2431 }
2432 }
2433 pathProgress = PathManager.Instance.RequestPathImmediate(pos, p, this, PathManager.MoveType.Default, num + 25, 2);
2434 if (pathProgress.HasPath && pathProgress.nodes.Count < num + 25)
2435 {
2436 PathFinderNode pathFinderNode3 = pathProgress.nodes[pathProgress.nodes.Count - 1];
2437 if (TryMove(new Point(pathFinderNode3.X, pathFinderNode3.Z)) == MoveResult.Success)
2438 {
2439 return MoveResult.Success;
2440 }
2441 }
2442 pathProgress = PathManager.Instance.RequestPathImmediate(pos, p, this, PathManager.MoveType.Combat, num + 25, 2);
2443 if (pathProgress.HasPath && pathProgress.nodes.Count < num + 25)
2444 {
2445 PathFinderNode pathFinderNode4 = pathProgress.nodes[pathProgress.nodes.Count - 1];
2446 if (TryMove(new Point(pathFinderNode4.X, pathFinderNode4.Z)) == MoveResult.Success)
2447 {
2448 return MoveResult.Success;
2449 }
2450 }
2451 return MoveResult.Fail;
2452 }
2453
2455 {
2457 {
2458 return MoveResult.Fail;
2459 }
2460 Point point = p.Copy();
2461 int num = p.x - pos.x;
2462 int num2 = p.z - pos.z;
2463 if (num > 1)
2464 {
2465 num = 1;
2466 }
2467 else if (num < -1)
2468 {
2469 num = -1;
2470 }
2471 if (num2 > 1)
2472 {
2473 num2 = 1;
2474 }
2475 else if (num2 < -1)
2476 {
2477 num2 = -1;
2478 }
2479 if (num == 0 && num2 == 0)
2480 {
2481 num = EClass.rnd(3) - 1;
2482 num2 = EClass.rnd(3) - 1;
2483 }
2484 point.Set(pos);
2485 point.x -= num;
2486 point.z -= num2;
2487 if (point.IsValid && !point.HasChara)
2488 {
2489 return TryMove(point, allowDestroyPath: false);
2490 }
2491 return MoveResult.Fail;
2492 }
2493
2494 public MoveResult TryMove(Point newPoint, bool allowDestroyPath = true)
2495 {
2496 foreach (Condition condition in conditions)
2497 {
2498 if (!condition.TryMove(newPoint))
2499 {
2500 return MoveResult.Fail;
2501 }
2502 }
2503 if (base.isRestrained)
2504 {
2505 if (!IsPC)
2506 {
2507 return MoveResult.Fail;
2508 }
2509 base.isRestrained = false;
2510 }
2511 if (!CanMoveTo(newPoint, allowDestroyPath))
2512 {
2513 return MoveResult.Fail;
2514 }
2515 return _Move(newPoint);
2516 }
2517
2518 public override MoveResult _Move(Point newPoint, MoveType type = MoveType.Walk)
2519 {
2520 if (isDead)
2521 {
2522 return MoveResult.Fail;
2523 }
2524 if (IsPC)
2525 {
2526 float num = EClass.setting.defaultActPace;
2527 switch (burden.GetPhase())
2528 {
2529 case 3:
2530 num *= 1.5f;
2531 break;
2532 case 4:
2533 num *= 2f;
2534 break;
2535 }
2537 {
2538 int num2 = 30;
2539 if (!EClass.pc.HasElement(408))
2540 {
2542 {
2543 case Weather.Condition.Rain:
2544 num2 += 5;
2545 break;
2546 case Weather.Condition.RainHeavy:
2547 num2 += 10;
2548 num *= 1.5f;
2549 break;
2550 case Weather.Condition.Snow:
2551 num2 += 10;
2552 break;
2553 case Weather.Condition.SnowHeavy:
2554 num2 += 15;
2555 num *= 1.5f;
2556 break;
2557 }
2558 }
2559 if (newPoint.matFloor.id == 48)
2560 {
2561 num2 += 20;
2562 num *= 1.8f;
2563 }
2564 num2 = num2 * 100 / (100 + EvalueMax(240, -20) + EvalueMax(407, -5) * 5);
2565 EClass.world.date.AdvanceMin(num2 * 6);
2566 EClass.player.lastZonePos = null;
2568 int num3 = base.hp;
2569 for (int i = 0; i < num2 * 4; i++)
2570 {
2571 EClass.pc.party.members.ForeachReverse(delegate(Chara m)
2572 {
2573 if (!m.isDead)
2574 {
2575 m.TickConditions();
2576 }
2577 });
2578 if (base.hp < MaxHP / 5 && base.hp < num3 && !EClass.player.regionMoveWarned)
2579 {
2580 EClass.player.regionMoveWarned = true;
2581 Msg.Say("regionAbortMove");
2582 EInput.Consume(consumeAxis: true);
2583 SetAI(new NoGoal());
2584 return MoveResult.Fail;
2585 }
2586 }
2587 if (newPoint.cell.CanSuffocate())
2588 {
2589 AddCondition<ConSuffocation>((EClass.pc.Evalue(200) != 0) ? (2000 / (100 + EvalueMax(200, -5) * 10)) : 30, force: true);
2590 int num4 = GetCondition<ConSuffocation>()?.GetPhase() ?? 0;
2591 if (num4 >= 2)
2592 {
2593 DamageHP(EClass.rndHalf(10 + MaxHP / 5), AttackSource.Condition);
2594 }
2595 if (!isDead && !HasElement(429))
2596 {
2597 ModExp(200, 1 + num4 * 12);
2598 }
2599 }
2600 EClass.player.regionMoveWarned = false;
2601 if (isDead)
2602 {
2603 return MoveResult.Fail;
2604 }
2605 }
2606 if (num > EClass.setting.defaultActPace * 3f)
2607 {
2608 num = EClass.setting.defaultActPace * 3f;
2609 }
2610 actTime = num;
2611 }
2612 if (IsPCFaction && EClass.rnd(5) == 0 && newPoint.cell.CanSuffocate())
2613 {
2614 ModExp(200, EClass._zone.IsRegion ? 50 : 5);
2615 if (ride != null)
2616 {
2617 ride.ModExp(200, EClass._zone.IsRegion ? 50 : 5);
2618 }
2619 if (parasite != null)
2620 {
2621 parasite.ModExp(200, EClass._zone.IsRegion ? 50 : 5);
2622 }
2623 }
2624 Chara chara = ((ride == null) ? this : ride);
2625 if (!EClass._zone.IsRegion || chara.IsPC)
2626 {
2627 bool flag = (chara.isConfused && EClass.rnd(2) == 0) || (chara.isDrunk && EClass.rnd(IsIdle ? 2 : 8) == 0 && !chara.HasElement(1215));
2628 if (host != null && host.ride == this && ((host.isConfused && EClass.rnd(2) == 0) || (host.isDrunk && EClass.rnd(IsIdle ? 2 : 8) == 0 && !host.HasElement(1215))))
2629 {
2630 flag = true;
2631 }
2632 if (flag && newPoint.Distance(pos) <= 1)
2633 {
2634 Point randomNeighbor = pos.GetRandomNeighbor();
2635 if (CanMoveTo(randomNeighbor, allowDestroyPath: false))
2636 {
2637 newPoint = randomNeighbor;
2638 if (isDrunk)
2639 {
2640 Talk("drunk");
2641 }
2642 }
2643 }
2644 }
2645 if (newPoint.x != pos.x || newPoint.z != pos.z)
2646 {
2647 LookAt(newPoint);
2648 }
2649 CellEffect effect = base.Cell.effect;
2650 if (effect != null && effect.id == 7)
2651 {
2652 CellEffect effect2 = base.Cell.effect;
2653 if (race.height < 500 && !race.tag.Contains("webfree") && EClass.rnd(effect2.power + 25) > EClass.rnd(base.STR + base.DEX + 1))
2654 {
2655 Say("abWeb_caught", this);
2656 PlaySound("web");
2657 effect2.power = effect2.power * 3 / 4;
2658 renderer.PlayAnime(AnimeID.Shiver);
2659 return MoveResult.Fail;
2660 }
2661 Say("abWeb_pass", this);
2662 EClass._map.SetEffect(base.Cell.x, base.Cell.z);
2663 }
2664 if (IsPC)
2665 {
2666 if (EClass._zone.IsRegion)
2667 {
2669 }
2670 else if ((newPoint.x > pos.x && newPoint.z > pos.z) || (newPoint.x < pos.x && newPoint.z < pos.z))
2671 {
2673 }
2674 }
2675 if (newPoint.cell.hasDoor)
2676 {
2677 foreach (Thing thing in pos.Things)
2678 {
2679 if (thing.trait is TraitDoor traitDoor && traitDoor.owner.c_lockLv > 0)
2680 {
2681 if (base.INT < 10)
2682 {
2683 return MoveResult.Fail;
2684 }
2685 traitDoor.TryOpenLock(this);
2686 return MoveResult.Door;
2687 }
2688 }
2689 }
2690 Cell cell = newPoint.cell;
2691 Cell cell2 = pos.cell;
2692 bool flag2 = cell.HasLiquid && !IsLevitating;
2693 bool hasBridge = cell.HasBridge;
2694 bool hasRamp = cell.HasRamp;
2695 bool flag3 = EClass._zone.IsSnowCovered && !cell.HasRoof && !cell.isClearSnow;
2696 TileRow tileRow = (hasRamp ? ((TileRow)cell.sourceBlock) : ((TileRow)(hasBridge ? cell.sourceBridge : cell.sourceFloor)));
2697 SourceMaterial.Row row = (hasRamp ? cell.matBlock : (hasBridge ? cell.matBridge : cell.matFloor));
2698 bool flag4 = cell.IsTopWater && !cell.isFloating;
2699 if (!EClass._zone.IsRegion)
2700 {
2701 if (cell.hasDoorBoat)
2702 {
2703 tileRow = FLOOR.sourceWood;
2704 row = MATERIAL.sourceOak;
2705 flag4 = false;
2706 }
2707 else if (flag3 && !tileRow.ignoreSnow)
2708 {
2709 if (tileRow.tileType.IsWater)
2710 {
2711 tileRow = FLOOR.sourceIce;
2712 row = MATERIAL.sourceIce;
2713 }
2714 else
2715 {
2716 tileRow = FLOOR.sourceSnow;
2717 row = MATERIAL.sourceSnow;
2718 }
2719 flag4 = false;
2720 }
2721 }
2722 if ((pos.sourceFloor.isBeach || cell2.IsSnowTile) && !pos.HasObj)
2723 {
2724 EClass._map.SetFoormark(pos, 1, (int)Util.GetAngle(pos.x - newPoint.x, pos.z - newPoint.z), cell2.IsSnowTile ? 312 : 304);
2725 }
2726 if (isSynced)
2727 {
2728 string text = ((flag2 || flag4) ? "water" : tileRow.soundFoot.IsEmpty(row.soundFoot.IsEmpty("default")));
2729 if (cell.obj != 0 && cell.sourceObj.tileType.IsPlayFootSound && !cell.matObj.soundFoot.IsEmpty())
2730 {
2731 text = cell.matObj.soundFoot;
2732 }
2733 if (IsPC)
2734 {
2735 foreach (Thing thing2 in newPoint.Things)
2736 {
2737 if (thing2.IsInstalled && (thing2.trait.IsChangeFloorHeight || thing2.Pref.Surface))
2738 {
2739 text = thing2.material.soundFoot;
2740 }
2741 }
2742 }
2743 if (!text.IsEmpty())
2744 {
2745 SoundManager.altLastData = IsPC;
2746 PlaySound("Footstep/" + text, IsPC ? 1f : 0.9f);
2747 }
2748 if (!flag4)
2749 {
2751 PCOrbit pcOrbit = EClass.screen.pcOrbit;
2752 bool flag5 = scene.actionMode.gameSpeed > 1f;
2753 scene.psFoot.transform.position = renderer.position + pcOrbit.footPos;
2754 scene.psFoot.startColor = row.matColor;
2755 scene.psFoot.Emit(pcOrbit.emitFoot * ((!flag5) ? 1 : 2));
2756 if (flag5 && IsPC)
2757 {
2758 scene.psSmoke.transform.position = renderer.position + pcOrbit.smokePos;
2759 scene.psSmoke.Emit(pcOrbit.emitSmoke);
2760 }
2761 }
2762 if (flag2 || flag4)
2763 {
2764 Effect.Get("ripple").Play(0.4f * actTime * EClass.scene.actionMode.gameSpeed, newPoint);
2765 }
2766 }
2767 lastPos.Set(pos);
2768 if (type != MoveType.Force)
2769 {
2770 if (newPoint.HasChara && ai.Current.PushChara)
2771 {
2772 TryPush(newPoint);
2773 }
2774 if (newPoint.HasChara && newPoint.Charas.Count == 1)
2775 {
2776 Chara chara2 = newPoint.Charas[0];
2777 if (CanReplace(chara2))
2778 {
2779 chara2.MoveByForce(lastPos, this);
2780 if (chara.IsPC)
2781 {
2782 Say("replace_pc", chara, chara2);
2783 }
2784 }
2785 }
2786 }
2787 if (cell.hasDoor)
2788 {
2789 foreach (Thing thing3 in newPoint.Things)
2790 {
2791 if (thing3.trait is TraitDoor traitDoor2)
2792 {
2793 traitDoor2.TryOpen(this);
2794 }
2795 }
2796 }
2797 EClass._zone.map.MoveCard(newPoint, this);
2798 SyncRide();
2800 {
2801 foreach (Chara member in EClass.pc.party.members)
2802 {
2803 if (member.isLeashed && !member.IsPC && member.host == null && !member.IsDisabled && !member.HasCondition<ConEntangle>() && !member.IsInCombat && member.Dist(EClass.pc) > 1)
2804 {
2805 member.TryMoveTowards(EClass.pc.pos);
2806 }
2807 }
2808 }
2810 {
2812 }
2813 if (IsPC)
2814 {
2815 PlaySound("Footstep/Extra/pcfootstep");
2816 if (pos.HasThing)
2817 {
2818 foreach (Card item in pos.ListCards())
2819 {
2820 if (!item.isThing || item.placeState != 0 || item.ignoreAutoPick)
2821 {
2822 continue;
2823 }
2825 {
2827 ContainerFlag containerFlag = item.category.GetRoot().id.ToEnum<ContainerFlag>();
2828 if (containerFlag == ContainerFlag.none)
2829 {
2830 containerFlag = ContainerFlag.other;
2831 }
2832 if ((dataPick.noRotten && item.IsDecayed) || (dataPick.onlyRottable && item.trait.Decay == 0))
2833 {
2834 continue;
2835 }
2836 if (dataPick.userFilter)
2837 {
2838 switch (dataPick.IsFilterPass(item.GetName(NameStyle.Full, 1)))
2839 {
2840 case Window.SaveData.FilterResult.PassWithoutFurtherTest:
2841 Pick(item.Thing);
2842 continue;
2843 case Window.SaveData.FilterResult.Block:
2844 continue;
2845 }
2846 }
2847 if (dataPick.advDistribution)
2848 {
2849 foreach (int cat in dataPick.cats)
2850 {
2851 if (item.category.uid == cat)
2852 {
2853 Pick(item.Thing);
2854 }
2855 }
2856 }
2857 else if (!dataPick.flag.HasFlag(containerFlag))
2858 {
2859 Pick(item.Thing);
2860 }
2861 }
2862 else
2863 {
2864 Pick(item.Thing);
2865 }
2866 }
2867 }
2868 if (EClass._zone.IsRegion)
2869 {
2871 if (cell3?.zone != null && !cell3.zone.HiddenInRegionMap && (!(cell3.zone is Zone_Field) || cell3.zone.children.Count > 0 || cell3.zone.IsPCFaction))
2872 {
2873 Msg.Say((!cell3.zone.source.GetText("textFlavor").IsEmpty()) ? cell3.zone.source.GetText("textFlavor") : (cell3.zone.ShowDangerLv ? "seeZoneDanger" : "seeZone"), cell3.zone.Name, cell3.zone.DangerLv.ToString() ?? "");
2874 }
2875 if (pos.matFloor.alias == "snow" && EClass.rnd(3) == 0)
2876 {
2878 Msg.Say(Lang.GetList("walk_snow").RandomItem());
2879 }
2880 else if (EClass.world.weather.CurrentCondition == Weather.Condition.RainHeavy && EClass.rnd(3) == 0)
2881 {
2883 Msg.Say(Lang.GetList("walk_storm").RandomItem());
2884 }
2885 }
2887 }
2888 if (IsPCC)
2889 {
2890 int num5 = Mathf.Abs(cell2.topHeight - cell.topHeight);
2891 if ((num5 >= 3 && lastPos.sourceBlock.tileType.slopeHeight == 0 && newPoint.sourceBlock.tileType.slopeHeight == 0) || cell2.hasDoorBoat || cell.hasDoorBoat)
2892 {
2893 renderer.PlayAnime((cell2.topHeight >= cell.topHeight) ? AnimeID.JumpDown : ((num5 >= 6) ? AnimeID.Jump : AnimeID.JumpSmall));
2894 }
2895 else
2896 {
2897 float surfaceHeight = cell2.GetSurfaceHeight();
2898 float surfaceHeight2 = cell.GetSurfaceHeight();
2899 num5 = (int)Mathf.Abs((surfaceHeight - surfaceHeight2) * 100f);
2900 if (num5 >= 15)
2901 {
2902 renderer.PlayAnime((surfaceHeight >= surfaceHeight2) ? AnimeID.JumpDown : ((num5 >= 40) ? AnimeID.Jump : AnimeID.JumpSmall));
2903 }
2904 }
2905 }
2906 lastPos.Things.ForeachReverse(delegate(Thing t)
2907 {
2908 t.trait.OnSteppedOut(this);
2909 });
2910 if (!IsPC)
2911 {
2912 pos.Things.ForeachReverse(delegate(Thing t)
2913 {
2914 t.trait.OnStepped(this);
2915 });
2916 }
2917 if (CanDestroyPath())
2918 {
2920 }
2921 if (IsPC)
2922 {
2923 if (renderer.anime == null && renderer.replacer != null)
2924 {
2926 }
2928 {
2929 if (!FLOOR.IsTatami(pos.cell.sourceSurface.id) && pos.cell.room == null)
2930 {
2931 EClass.player.flags.isShoesOff = false;
2932 EClass.pc.Say("shoes_on", EClass.pc);
2933 EClass.pc.SetPCCState(PCCState.Normal);
2934 }
2935 }
2936 else if (FLOOR.IsTatami(pos.cell.sourceSurface.id) && pos.cell.room != null)
2937 {
2938 EClass.player.flags.isShoesOff = true;
2939 EClass.pc.Say("shoes_off", EClass.pc);
2940 EClass.pc.SetPCCState(PCCState.ShoesOff);
2941 }
2942 }
2943 hasMovedThisTurn = true;
2944 return MoveResult.Success;
2945 }
2946
2947 public void DestroyPath(Point pos)
2948 {
2949 bool broke = false;
2950 pos.ForeachMultiSize(base.W, base.H, delegate(Point _p, bool main)
2951 {
2952 if (_p.IsValid)
2953 {
2954 if (_p.HasBlock)
2955 {
2956 EClass._map.MineBlock(_p, recoverBlock: false, this);
2957 if (_p.HasObj)
2958 {
2959 EClass._map.MineObj(_p, null, this);
2960 }
2961 broke = true;
2962 }
2963 if (_p.HasObj && _p.IsBlocked)
2964 {
2965 EClass._map.MineObj(_p, null, this);
2966 broke = true;
2967 }
2968 _p.Things.ForeachReverse(delegate(Thing t)
2969 {
2970 if (t.IsInstalled && (t.trait.IsBlockPath || t.trait.IsDoor))
2971 {
2972 if (t.isNPCProperty && t.trait.CanBeDestroyed)
2973 {
2974 t.Destroy();
2975 }
2976 else if (!t.IsUnique && !t.trait.CanBeDestroyed)
2977 {
2978 t.SetPlaceState(PlaceState.roaming);
2979 }
2980 }
2981 });
2982 }
2983 });
2984 if (broke)
2985 {
2986 Msg.Say("stomp");
2987 Shaker.ShakeCam("stomp");
2988 }
2989 }
2990
2991 public void TryPush(Point point)
2992 {
2993 List<Chara> list = point.ListCharas();
2994 if (list.Count == 0)
2995 {
2996 return;
2997 }
2998 list.Copy().ForeachReverse(delegate(Chara c)
2999 {
3000 if (!c.ai.IsMoveAI && !c.IsPC && c.trait.CanBePushed && c != this && !c.noMove && (!EClass._zone.IsRegion || c.IsPCFactionOrMinion))
3001 {
3002 List<Point> list2 = new List<Point>();
3003 for (int i = point.x - 1; i <= point.x + 1; i++)
3004 {
3005 for (int j = point.z - 1; j <= point.z + 1; j++)
3006 {
3007 if (i != point.x || j != point.z)
3008 {
3009 Point point2 = new Point(i, j);
3010 if (point2.IsValid && !point2.HasChara && !point2.IsBlocked && !point2.cell.hasDoor && !point2.IsBlockByHeight(point))
3011 {
3012 list2.Add(point2);
3013 }
3014 }
3015 }
3016 }
3017 if (list2.Count > 0)
3018 {
3019 if (list2.Count > 1)
3020 {
3021 list2.ForeachReverse(delegate(Point p)
3022 {
3023 if (p.Equals(new Point(point.x + point.x - pos.x, point.z + point.z - pos.z)))
3024 {
3025 list2.Remove(p);
3026 }
3027 });
3028 }
3029 Point newPoint = list2.RandomItem();
3030 if (IsPC)
3031 {
3032 Say("displace", this, c);
3033 PlaySound("push");
3034 }
3035 else if (c.isSynced)
3036 {
3037 c.PlayEffect("push");
3038 }
3039 c.MoveByForce(newPoint, this, checkWall: true);
3040 if (!c.IsPC && c.trait is TraitRogue && EClass.rnd(3) == 0 && GetCurrency() > 20 && !HasElement(426))
3041 {
3042 int num = EClass.rndHalf(10 + Mathf.Min(GetCurrency() / 100, 1000));
3043 c.Talk("pushed");
3044 Say("pushed_money", this, c);
3045 ModCurrency(-num);
3046 c.ModCurrency(num);
3047 c.PlaySound("steal_money");
3048 }
3049 else if (IsPC && !c.IsPCParty && !c.IsUnique && c.IsHumanSpeak && EClass.rnd(5) == 0)
3050 {
3051 c.Talk("pushed");
3052 }
3053 }
3054 }
3055 });
3056 }
3057
3058 public bool CanReplace(Chara c)
3059 {
3060 if (c.IsMultisize || !c.trait.CanBePushed || c.isRestrained || c.noMove || IsHostile(c) || IsMinion || (EClass._zone.IsRegion && !c.IsPCFactionOrMinion))
3061 {
3062 return false;
3063 }
3064 if (IsPC)
3065 {
3066 return true;
3067 }
3068 if (c.IsPC || c.pos.Equals(EClass.pc.pos) || c.host != null)
3069 {
3070 return false;
3071 }
3072 if (!IsHostile(c))
3073 {
3074 if (c.c_uidMaster != 0 || c.isSummon || base.IsPowerful || IsEscorted())
3075 {
3076 return true;
3077 }
3078 if (DestDist < c.DestDist)
3079 {
3080 return true;
3081 }
3082 if (IsPCParty && !c.IsPCParty)
3083 {
3084 return true;
3085 }
3086 if (IsPCFaction && !c.IsPCParty)
3087 {
3088 return true;
3089 }
3090 }
3091 return false;
3092 }
3093
3094 public void MoveZone(string alias)
3095 {
3096 MoveZone(EClass.game.spatials.Find(alias));
3097 }
3098
3100 {
3101 MoveZone(z, new ZoneTransition
3102 {
3103 state = state
3104 });
3105 }
3106
3107 public void MoveZone(Zone z, ZoneTransition transition)
3108 {
3109 if (z == currentZone)
3110 {
3111 return;
3112 }
3113 if (HasCondition<ConInvulnerable>())
3114 {
3115 RemoveCondition<ConInvulnerable>();
3116 }
3117 if (IsPC)
3118 {
3119 EClass.player.nextZone = z;
3120 if (IsInActiveZone && !EClass.player.simulatingZone)
3121 {
3122 TryDropCarryOnly();
3123 if (z.instance == null && currentZone.instance == null && !EClass.player.deathZoneMove && !EClass.pc.isDead && (z.IsPCFaction || z.WillAutoSave) && z.GetTopZone() != EClass._zone.GetTopZone())
3124 {
3125 if (EClass.player.returnInfo != null)
3126 {
3127 EClass.player.returnInfo.turns += 5;
3128 }
3130 {
3131 EClass.game.Save(isAutoSave: true);
3132 }
3133 }
3134 EClass.player.deathZoneMove = false;
3135 }
3136 currentZone.events.OnLeaveZone();
3137 if (currentZone.instance != null)
3138 {
3139 ZoneInstance instance = currentZone.instance;
3140 z = EClass.game.spatials.Find(instance.uidZone) ?? EClass.pc.homeZone;
3141 transition = new ZoneTransition
3142 {
3143 state = instance.ReturnState,
3144 x = instance.x,
3145 z = instance.z
3146 };
3147 instance.OnLeaveZone();
3148 Debug.Log(z);
3149 }
3150 EInput.Consume(consumeAxis: true);
3151 EClass.player.uidLastZone = currentZone.uid;
3153 {
3154 if (currentZone.IsRegion)
3155 {
3156 Msg.Say("enterZone", z.Name);
3157 }
3158 else
3159 {
3160 if (z.IsRegion)
3161 {
3162 Msg.Say("leaveZone", currentZone.Name);
3163 }
3164 else if (z.id != currentZone.id)
3165 {
3166 Msg.Say("enterZone", z.Name);
3167 }
3168 EClass.player.lastZonePos = pos.Copy();
3169 }
3170 EClass.player.lastTransition = transition;
3171 }
3172 foreach (Chara item in EClass._map.charas.Where((Chara c) => c.IsPCPartyMinion && c.master != EClass.pc).ToList())
3173 {
3175 }
3176 EClass.player.listSummon = EClass._map.charas.Where((Chara c) => c.c_uidMaster != 0 && c.FindMaster() == EClass.pc && c.c_minionType == MinionType.Default).ToList();
3177 foreach (Chara item2 in EClass.player.listSummon)
3178 {
3179 EClass._zone.RemoveCard(item2);
3180 }
3181 }
3182 if (party != null && party.leader == this)
3183 {
3184 foreach (Chara member in party.members)
3185 {
3186 if (member != this && !member.isDead && member.parent is Zone)
3187 {
3188 member.MoveZone(z);
3189 }
3190 }
3191 }
3192 if (global == null)
3193 {
3194 Debug.Log(base.Name);
3195 return;
3196 }
3197 transition.uidLastZone = currentZone?.uid ?? 0;
3198 global.transition = transition;
3199 if (z.IsActiveZone)
3200 {
3201 Point spawnPos = z.GetSpawnPos(this);
3202 global.transition = null;
3203 if (IsPC)
3204 {
3205 EClass.player.lastTransition = null;
3206 }
3207 z.AddCard(this, spawnPos);
3208 if (IsBranchMember())
3209 {
3211 }
3212 }
3213 else
3214 {
3215 z.AddCard(this);
3216 }
3217 }
3218
3219 public void MoveHome(string id, int x = -1, int z = -1)
3220 {
3221 MoveHome(EClass.game.world.FindZone(id), x, z);
3222 }
3223
3224 public void MoveHome(Zone zone, int x = -1, int z = -1)
3225 {
3226 if (isDead)
3227 {
3228 Revive();
3229 }
3230 else
3231 {
3232 Cure(CureType.Death);
3233 }
3234 CureCondition<ConSuspend>();
3235 if (IsPCParty)
3236 {
3238 }
3239 FactionBranch factionBranch = homeBranch;
3240 if (x == -1)
3241 {
3242 x = 50;
3243 }
3244 if (z == -1)
3245 {
3246 z = 50;
3247 }
3248 Point point = new Point(x, z);
3249 if (zone.IsActiveZone)
3250 {
3251 point = point.GetNearestPoint(allowBlock: false, allowChara: false);
3252 }
3253 zone.AddCard(this, point);
3254 SetHomeZone(zone);
3255 global.transition = new ZoneTransition
3256 {
3257 state = ZoneTransition.EnterState.Dead,
3258 x = point.x,
3259 z = point.z
3260 };
3261 orgPos = new Point(x, z);
3262 if (factionBranch != null)
3263 {
3264 RefreshWorkElements();
3265 factionBranch.policies.Validate();
3266 }
3267 }
3268
3269 public void FallFromZone()
3270 {
3271 Msg.Say("skyFall", EClass.pc, EClass._zone.Name);
3272 Zone zone = (EClass._zone.isExternalZone ? null : EClass._zone.GetTopZone().FindZone(EClass._zone.lv - 1));
3273 zone = zone ?? EClass.world.region;
3274 MoveZone(zone ?? EClass.world.region, new ZoneTransition
3275 {
3276 state = ZoneTransition.EnterState.Fall,
3277 x = pos.x,
3278 z = pos.z
3279 });
3280 }
3281
3282 public override void SetDir(int d)
3283 {
3284 base.dir = d;
3285 UpdateAngle();
3286 renderer.RefreshSprite();
3287 }
3288
3289 public override void Rotate(bool reverse = false)
3290 {
3291 if (renderer.hasActor)
3292 {
3293 base.dir = (base.dir + ((!reverse) ? 1 : (-1))).Clamp(0, 3, loop: true);
3294 }
3295 else
3296 {
3297 base.dir = ((base.dir == 0) ? 1 : 0);
3298 }
3299 UpdateAngle();
3300 renderer.RefreshSprite();
3301 }
3302
3303 public override void LookAt(Card c)
3304 {
3305 LookAt(c.pos);
3306 }
3307
3308 public override void LookAt(Point p)
3309 {
3310 angle = Util.GetAngle(p.x - pos.x, p.z - pos.z);
3311 if (EClass._zone.IsRegion)
3312 {
3313 if (angle > 100f && angle < 170f)
3314 {
3315 base.dir = 2;
3316 }
3317 else if (angle > 170f && angle < 190f)
3318 {
3319 base.dir = 0;
3320 }
3321 else if (angle > 190f || (angle < -10f && angle > -100f))
3322 {
3323 base.dir = 3;
3324 }
3325 else
3326 {
3327 base.dir = 1;
3328 }
3329 angle -= 45f;
3330 }
3331 else if (angle > 170f && angle < 235f)
3332 {
3333 base.dir = 0;
3334 }
3335 else if (angle > 80f && angle < 145f)
3336 {
3337 base.dir = 1;
3338 }
3339 else if (angle > -100f && angle < -35f)
3340 {
3341 base.dir = 3;
3342 }
3343 else if (angle > -10f && angle < 55f)
3344 {
3345 base.dir = 2;
3346 }
3347 renderer.RefreshSprite();
3348 }
3349
3350 public void UpdateAngle()
3351 {
3352 if (IsPCC)
3353 {
3354 if (base.dir == 0)
3355 {
3356 angle = 225f;
3357 }
3358 else if (base.dir == 1)
3359 {
3360 angle = 135f;
3361 }
3362 else if (base.dir == 2)
3363 {
3364 angle = 45f;
3365 }
3366 else if (base.dir == 3)
3367 {
3368 angle = -45f;
3369 }
3370 }
3371 else if (base.dir == 0)
3372 {
3373 angle = 165f;
3374 }
3375 else if (base.dir == 1)
3376 {
3377 angle = 300f;
3378 }
3379 else if (base.dir == 2)
3380 {
3381 angle = 0f;
3382 }
3383 else if (base.dir == 3)
3384 {
3385 angle = 120f;
3386 }
3387 }
3388
3389 public int GetCurrentDir()
3390 {
3391 Debug.Log(angle);
3392 if (!renderer.hasActor)
3393 {
3394 if (angle == 0f || angle == 45f || angle == 90f)
3395 {
3396 return 2;
3397 }
3398 if (angle == -135f || angle == 180f || angle == -90f)
3399 {
3400 return 1;
3401 }
3402 if (angle == 135f)
3403 {
3404 return 0;
3405 }
3406 return 3;
3407 }
3408 return renderer.actor.currentDir;
3409 }
3410
3411 public void UpdateSight()
3412 {
3413 int num = 4;
3414 for (int i = -num; i < num + 1; i++)
3415 {
3416 for (int j = -num; j < num + 1; j++)
3417 {
3418 shared.Set(pos.x + i, pos.z + j);
3419 if (shared.IsValid && !shared.cell.isSeen && i >= -1 && i <= 1 && j >= -1)
3420 {
3421 _ = 1;
3422 }
3423 }
3424 }
3425 }
3426
3427 public bool WillConsumeTurn()
3428 {
3429 for (int num = conditions.Count - 1; num >= 0; num--)
3430 {
3431 if (conditions[num].ConsumeTurn)
3432 {
3433 return true;
3434 }
3435 }
3436 return false;
3437 }
3438
3439 public void TickConditions()
3440 {
3441 if (_cooldowns != null)
3442 {
3443 TickCooldown();
3444 }
3445 turn++;
3446 consumeTurn = false;
3447 preventRegen = false;
3448 emoIcon = Emo2.none;
3449 if (base.isSummon)
3450 {
3451 base.c_summonDuration--;
3452 if (base.c_summonDuration <= 0)
3453 {
3454 Die();
3455 return;
3456 }
3457 }
3458 if (EClass.world.weather.IsRaining && !EClass._map.IsIndoor && !pos.cell.HasRoof)
3459 {
3460 AddCondition<ConWet>(20);
3461 }
3462 switch (turn % 50)
3463 {
3464 case 0:
3465 happiness = (hunger.value + stamina.value + depression.value + bladder.value + hygiene.value) / 5;
3466 break;
3467 case 1:
3468 if (!IsPC || !EClass.debug.godMode)
3469 {
3470 if (EClass.rnd(2) == 0 && !HasCondition<ConAwakening>())
3471 {
3472 sleepiness.Mod(1);
3473 }
3474 if (EClass.rnd(3) == 0)
3475 {
3476 hunger.Mod(1);
3477 }
3478 if (IsPC && (sleepiness.GetPhase() != 0 || stamina.GetPhase() <= 1))
3479 {
3480 Tutorial.Play("sleep");
3481 }
3482 }
3483 break;
3484 case 2:
3485 if (parasite != null)
3486 {
3487 ModExp(227, (EClass._zone.IsRegion ? 5 : 40) * 100 / Mathf.Max(100, 100 + (elements.Base(227) - parasite.LV) * 25));
3488 }
3489 if (ride != null)
3490 {
3491 ModExp(226, (EClass._zone.IsRegion ? 5 : 40) * 100 / Mathf.Max(100, 100 + (elements.Base(226) - ride.LV) * 25));
3492 }
3493 break;
3494 case 3:
3495 {
3496 int phase = hygiene.GetPhase();
3497 int num = 0;
3498 num = ((!IsPC) ? ((phase > 3) ? 50 : 0) : ((phase > 3) ? 50 : 0));
3499 if (num > EClass.rnd(100))
3500 {
3501 hygiene.Mod(-1);
3502 }
3503 break;
3504 }
3505 }
3506 if (turn % 200 == 0)
3507 {
3508 DiminishTempElements();
3509 }
3510 if (IsPCParty)
3511 {
3512 if (dirtyWeight)
3513 {
3514 CalcBurden();
3515 }
3516 int phase2 = burden.GetPhase();
3517 int phase3 = hunger.GetPhase();
3518 if (phase3 >= 4)
3519 {
3520 preventRegen = true;
3521 }
3522 if (EClass.rnd(EClass._zone.IsRegion ? 100 : 30) == 0 && phase2 >= 3)
3523 {
3524 Say("dmgBurden", this);
3525 DamageHP(MaxHP * (base.ChildrenWeight * 100 / WeightLimit) / 1000 + 1, AttackSource.Burden);
3526 if (isDead)
3527 {
3528 return;
3529 }
3530 }
3531 if (EClass.rnd(12) == 0)
3532 {
3533 if (IsPC)
3534 {
3535 if (phase2 > 0)
3536 {
3537 ModExp(207, 1 + phase2 * phase2);
3538 }
3539 }
3540 else
3541 {
3542 ModExp(207, 4);
3543 }
3544 }
3545 if (IsPC)
3546 {
3547 if (phase3 >= 5)
3548 {
3549 if (!(ai is AI_Eat) && EClass.rnd(5) == 0)
3550 {
3551 DamageHP(1 + EClass.rnd(2) + MaxHP / 50, AttackSource.Hunger);
3552 }
3553 if (!isDead && EClass.rnd(3) == 0)
3554 {
3555 stamina.Mod(-1);
3556 }
3557 }
3558 if (isDead)
3559 {
3560 return;
3561 }
3562 phase3 = stamina.GetPhase();
3563 if (phase3 <= 0)
3564 {
3565 preventRegen = true;
3566 }
3567 if (currentZone.IsRegion && EClass.world.weather.CurrentCondition == Weather.Condition.RainHeavy && !EClass.pc.HasElement(408))
3568 {
3569 if (EClass.rnd(100) == 0 && !isConfused)
3570 {
3571 Msg.Say("rain_confuse");
3572 AddCondition<ConConfuse>(500);
3573 }
3574 if (EClass.rnd(300) == 0 && !isBlind)
3575 {
3576 Msg.Say("rain_confuse");
3577 AddCondition<ConBlind>(200);
3578 }
3579 }
3580 if (turn % (200000 / Mathf.Max(100 + Evalue(409) * 10, 50)) == 0)
3581 {
3582 ModCorruption(1);
3583 }
3584 }
3585 }
3586 if (!IsPC)
3587 {
3588 int num2 = Evalue(409);
3589 if (num2 > 0 && turn % (200000 / Mathf.Max(100 + num2 * 10, 50)) == 0)
3590 {
3591 ModCorruption(1);
3592 }
3593 }
3594 for (int num3 = conditions.Count - 1; num3 >= 0; num3--)
3595 {
3596 if (num3 < conditions.Count)
3597 {
3598 Condition condition = conditions[num3];
3599 if (!condition.TimeBased)
3600 {
3601 condition.Tick();
3602 }
3603 if (!condition.IsKilled)
3604 {
3605 if (condition.ConsumeTurn)
3606 {
3607 consumeTurn = true;
3608 }
3609 if (condition.PreventRegen)
3610 {
3611 preventRegen = true;
3612 }
3613 if (condition.EmoIcon != 0 && condition.EmoIcon > emoIcon)
3614 {
3615 emoIcon = condition.EmoIcon;
3616 }
3617 }
3618 if (isDead)
3619 {
3620 return;
3621 }
3622 }
3623 }
3624 if (id == "tsunami")
3625 {
3626 if (elements.Base(79) < 30)
3627 {
3628 Die();
3629 return;
3630 }
3631 if (IsInCombat)
3632 {
3633 elements.SetTo(79, elements.Base(79) * 3 / 4);
3634 }
3635 }
3636 if (!preventRegen)
3637 {
3638 if (EClass.rnd(25) == 0 && base.hp < MaxHP)
3639 {
3640 HealHP(EClass.rnd(Evalue(300) / 3 + 1) + 1);
3641 elements.ModExp(300, 8);
3642 }
3643 if (EClass.rnd(8) == 0 && mana.value < mana.max)
3644 {
3645 mana.Mod(EClass.rnd(Evalue(301) / 2 + 1) + 1);
3646 elements.ModExp(301, 8);
3647 }
3648 if (EClass.rnd(20) == 0 && !IsPC && stamina.value < stamina.max)
3649 {
3650 stamina.Mod(EClass.rnd(5) + 1);
3651 }
3652 }
3653 }
3654
3655 public void SyncRide()
3656 {
3657 if (host != null)
3658 {
3659 host.SyncRide();
3660 }
3661 if (ride != null)
3662 {
3663 SyncRide(ride);
3664 }
3665 if (parasite != null)
3666 {
3667 SyncRide(parasite);
3668 }
3669 }
3670
3671 public void SyncRide(Chara c)
3672 {
3673 if (!c.pos.Equals(pos))
3674 {
3675 if (!pos.IsValid)
3676 {
3677 Debug.LogError("exception: pos is not valid:" + pos?.ToString() + "/" + this);
3678 pos = new Point();
3679 }
3680 EClass._map.MoveCard(pos, c);
3681 }
3682 }
3683
3684 public override void Tick()
3685 {
3686 SyncRide();
3687 combatCount--;
3688 ignoreSPAbsorb = false;
3689 if (IsPC)
3690 {
3691 if (hasMovedThisTurn)
3692 {
3693 pos.Things.ForeachReverse(delegate(Thing t)
3694 {
3695 t.trait.OnStepped(this);
3696 });
3697 if (isDead)
3698 {
3699 return;
3700 }
3701 hasMovedThisTurn = false;
3703 {
3704 EClass.player.haltMove = false;
3705 ActionMode.Adv.TryCancelInteraction(sound: false);
3706 EInput.Consume(1);
3707 return;
3708 }
3709 if (EClass._zone.IsRegion)
3710 {
3712 {
3713 foreach (Chara member in EClass.pc.party.members)
3714 {
3715 if (member.hunger.value > 65)
3716 {
3717 member.InstantEat(null, sound: false);
3718 }
3719 }
3720 }
3721 Chara chara = null;
3723 if (cell2 != null && (cell2.zone == null || (cell2.zone is Zone_Field && !cell2.zone.IsPCFaction)))
3724 {
3725 foreach (Chara chara2 in EClass._map.charas)
3726 {
3727 if (!chara2.IsPCFactionOrMinion && !chara2.IsGlobal && chara2.pos.Equals(EClass.pc.pos))
3728 {
3729 chara = chara2;
3730 break;
3731 }
3732 }
3733 }
3734 if (chara != null)
3735 {
3737 {
3738 EClass.player.safeTravel = 5 + EClass.rnd(5);
3739 }
3740 EClass._zone.RemoveCard(chara);
3741 Msg.Say("encounter");
3742 EClass.player.EnterLocalZone(encounter: true, chara);
3743 }
3744 else if (EClass.player.safeTravel <= 0)
3745 {
3746 if (cell2 != null && cell2.zone == null && !EClass.debug.ignoreEncounter)
3747 {
3749 if (!tileInfo.shore)
3750 {
3751 bool num = EClass.pc.HasCondition<ConWardMonster>();
3752 bool flag = EClass.pc.HasCondition<ConDrawMonster>();
3753 bool flag2 = EClass.game.quests.Get<QuestEscort>() != null;
3754 int num2 = (tileInfo.isRoad ? 22 : 12);
3755 if (flag2)
3756 {
3757 num2 = (tileInfo.isRoad ? 16 : 10);
3758 }
3759 if (num)
3760 {
3761 num2 *= (flag2 ? 2 : 20);
3762 }
3763 if (flag)
3764 {
3765 num2 /= 2;
3766 }
3767 if (EClass.rnd(num2) == 0)
3768 {
3769 Msg.Say("encounter");
3770 if (!flag)
3771 {
3772 EClass.player.safeTravel = 5 + EClass.rnd(5);
3773 }
3774 EClass.player.EnterLocalZone(encounter: true);
3775 }
3776 }
3777 }
3778 }
3779 else
3780 {
3782 }
3783 }
3784 }
3785 EClass.player.pickupDelay = 0f;
3786 if (EClass.player.returnInfo != null)
3787 {
3789 if (EClass.player.returnInfo.turns <= 0)
3790 {
3792 {
3793 int uidDest = EClass.player.returnInfo.uidDest;
3794 Zone zone = null;
3795 if (uidDest != 0)
3796 {
3797 zone = EClass.game.spatials.map.TryGetValue(uidDest) as Zone;
3798 }
3799 if (zone == null || zone.destryoed)
3800 {
3801 zone = EClass.world.region;
3802 }
3804 {
3805 Msg.Say("returnFail");
3806 }
3807 else
3808 {
3809 Msg.Say("returnComplete");
3810 EClass.player.uidLastTravelZone = 0;
3812 EClass.player.lastZonePos = null;
3813 }
3814 EClass.player.returnInfo = null;
3815 return;
3816 }
3817 EClass.player.returnInfo = null;
3818 Msg.Say("returnOverweight");
3819 }
3820 }
3821 if ((HasNoGoal || !ai.IsRunning) && !WillConsumeTurn())
3822 {
3823 SetAI(_NoGoalPC);
3824 return;
3825 }
3828 {
3829 RecipeUpdater.dirty = true;
3830 }
3831 actTime = EClass.player.baseActTime;
3832 }
3833 else
3834 {
3835 actTime = EClass.player.baseActTime * Mathf.Max(0.1f, (float)EClass.pc.Speed / (float)Speed);
3836 hasMovedThisTurn = false;
3837 }
3838 TickConditions();
3839 if (!IsAliveInCurrentZone)
3840 {
3841 return;
3842 }
3843 renderer.RefreshStateIcon();
3844 if (host != null && !consumeTurn)
3845 {
3846 if (host.ride == this && ((host.hasMovedThisTurn && IsInCombat) || (enemy != null && turn % 3 != 0)))
3847 {
3848 consumeTurn = true;
3849 }
3850 if (host.parasite == this && enemy != null && EClass.rnd(10) > EClass.rnd(host.Evalue(227) + 10))
3851 {
3852 if (Dist(enemy) < 3 && EClass.rnd(2) == 0)
3853 {
3854 Say("parasite_fail", this, host);
3855 if (EClass.rnd(2) == 0 && GetInt(106) == 0)
3856 {
3857 Talk("parasite_fail");
3858 }
3859 }
3860 consumeTurn = true;
3861 }
3862 }
3863 if (consumeTurn)
3864 {
3865 if (IsPC)
3866 {
3868 }
3869 }
3870 else
3871 {
3872 if (base.isRestrained)
3873 {
3874 TryUnrestrain();
3875 }
3876 if (enemy != null)
3877 {
3879 {
3880 enemy = null;
3881 }
3882 else if (!IsPC && (ai.CancelOnAggro || !ai.IsRunning))
3883 {
3884 SetAIAggro();
3885 }
3886 }
3887 if (HasNoGoal || !ai.IsRunning)
3888 {
3889 ChooseNewGoal();
3890 }
3891 ai.Tick();
3892 }
3893 Cell cell = base.Cell;
3895 {
3896 AddCondition<ConWet>(50);
3897 if (pos.IsHotSpring)
3898 {
3899 hygiene.Mod(2);
3900 }
3901 }
3902 if (IsPC && !EClass._zone.IsRegion && cell.CanSuffocate() && !EClass.debug.godMode)
3903 {
3904 AddCondition<ConSuffocation>(800 / (100 + EvalueMax(200, -5) * 10), force: true);
3905 }
3906 CellEffect e;
3907 if (cell.effect != null)
3908 {
3909 e = cell.effect;
3910 switch (e.id)
3911 {
3912 case 1:
3913 case 2:
3914 case 4:
3915 if (IsLevitating)
3916 {
3917 Say("levitating");
3918 break;
3919 }
3920 AddCondition<ConWet>(50);
3921 ProcEffect();
3922 break;
3923 case 3:
3924 PlaySound("fire_step");
3925 AddCondition<ConBurning>(30);
3926 break;
3927 case 5:
3928 if (!isWet)
3929 {
3930 PlaySound("bubble");
3931 AddCondition<ConWet>(30);
3932 ProcEffect();
3933 }
3934 break;
3935 case 6:
3936 if (hasMovedThisTurn)
3937 {
3938 Say("abMistOfDarkness_step", this);
3939 }
3940 break;
3941 }
3942 }
3943 if (IsPC)
3944 {
3945 if (EClass.player.currentHotItem.Thing != null)
3946 {
3948 }
3950 }
3951 void ClearEffect()
3952 {
3953 EClass._map.SetLiquid(cell.x, cell.z, 0, 0);
3954 }
3955 void ProcEffect()
3956 {
3957 if (e.idEffect != 0)
3958 {
3959 ActEffect.ProcAt(e.idEffect, e.power, e.isBlessed ? BlessedState.Blessed : (e.isCursed ? BlessedState.Cursed : BlessedState.Normal), this, this, new Point(pos), e.isHostileAct, new ActRef
3960 {
3961 aliasEle = EClass.sources.elements.map[e.idEle].alias,
3962 n1 = e.n1
3963 });
3964 ClearEffect();
3965 }
3966 }
3967 }
3968
3969 public bool CanLift(Card c)
3970 {
3971 return true;
3972 }
3973
3974 public bool CanAutoPick(Card c)
3975 {
3976 return true;
3977 }
3978
3979 public bool CanPick(Card c)
3980 {
3981 if (c.isDestroyed)
3982 {
3983 return false;
3984 }
3985 Card rootCard = c.GetRootCard();
3986 if (rootCard.isDestroyed || (rootCard.ExistsOnMap && rootCard.pos.Distance(pos) > 1))
3987 {
3988 return false;
3989 }
3990 if (rootCard != this && things.IsFull(c.Thing))
3991 {
3992 return false;
3993 }
3994 return true;
3995 }
3996
3997 public void PickOrDrop(Point p, string idThing, int idMat = -1, int num = 1, bool msg = true)
3998 {
3999 if (num != 0)
4000 {
4001 PickOrDrop(p, ThingGen.Create(idThing, idMat).SetNum(num), msg);
4002 }
4003 }
4004
4005 public void PickOrDrop(Point p, Thing t, bool msg = true)
4006 {
4007 if (things.GetDest(t).IsValid)
4008 {
4009 Pick(t, msg);
4010 }
4011 else
4012 {
4013 EClass._zone.AddCard(t, p);
4014 }
4015 }
4016
4017 public Thing Pick(Thing t, bool msg = true, bool tryStack = true)
4018 {
4019 if (t.trait is TraitCard && t.isNew && EClass.game.config.autoCollectCard && !t.c_idRefCard.IsEmpty())
4020 {
4022 return t;
4023 }
4024 if (t.parent == this)
4025 {
4026 return t;
4027 }
4028 t = TryPoisonPotion(t);
4029 ThingContainer.DestData dest = things.GetDest(t, tryStack);
4030 if (!dest.IsValid)
4031 {
4032 if (t.parent != EClass._zone)
4033 {
4034 if (IsPC)
4035 {
4036 Say("backpack_full_drop", t);
4037 SE.Drop();
4038 }
4039 return EClass._zone.AddCard(t, pos).Thing;
4040 }
4041 if (IsPC)
4042 {
4043 Say("backpack_full", t);
4044 }
4045 return t;
4046 }
4047 if (dest.stack != null)
4048 {
4049 if (msg)
4050 {
4051 PlaySound("pick_thing");
4052 Say("pick_thing", this, t);
4053 }
4054 t.TryStackTo(dest.stack);
4055 return dest.stack;
4056 }
4057 TryAbsorbRod(t);
4058 if (msg)
4059 {
4060 PlaySound("pick_thing");
4061 Say("pick_thing", this, t);
4062 }
4063 TryReservePickupTutorial(t);
4064 return dest.container.AddThing(t, tryStack);
4065 }
4066
4068 {
4069 if (t.trait is TraitPotion && t.id != "1165" && !t.source.tag.Contains("neg") && EClass.rnd(2) == 0 && HasElement(1565))
4070 {
4071 string text = EClass.sources.things.rows.Where((SourceThing.Row a) => a._origin == "potion" && a.tag.Contains("neg") && a.chance > 100).ToList().RandomItemWeighted((SourceThing.Row a) => a.chance)
4072 .id;
4073 Say("poisonDrip", this);
4074 int num = t.Num;
4075 t.Destroy();
4076 t = ThingGen.Create(text).SetNum(num);
4077 }
4078 return t;
4079 }
4080
4081 public void TryAbsorbRod(Thing t)
4082 {
4083 if (!IsPC || !(t.trait is TraitRod) || t.c_charges <= 0 || !HasElement(1564))
4084 {
4085 return;
4086 }
4087 Say("absorbRod", this, t);
4088 TraitRod rod = t.trait as TraitRod;
4089 bool flag = false;
4090 if (rod.source != null)
4091 {
4092 using IEnumerator<SourceElement.Row> enumerator = EClass.sources.elements.rows.Where((SourceElement.Row a) => a.id == rod.source.id).GetEnumerator();
4093 if (enumerator.MoveNext())
4094 {
4095 SourceElement.Row current = enumerator.Current;
4096 if (IsPC)
4097 {
4098 GainAbility(current.id, t.c_charges * 100);
4099 flag = true;
4100 }
4101 }
4102 }
4103 if (!flag)
4104 {
4105 mana.Mod(-50 * t.c_charges);
4106 }
4107 t.c_charges = 0;
4109 }
4110
4112 {
4113 if (t.id == "axe")
4114 {
4115 Tutorial.Reserve("tool");
4116 }
4117 if (t.category.id == "mushroom")
4118 {
4119 Tutorial.Reserve("food");
4120 }
4121 if (t.category.id == "herb")
4122 {
4123 Tutorial.Reserve("herb");
4124 }
4125 if (t.id == "pasture")
4126 {
4127 Tutorial.Reserve("pasture");
4128 }
4129 if (t.id == "log")
4130 {
4131 Tutorial.Reserve("process");
4132 }
4133 }
4134
4135 public void TryPickGroundItem()
4136 {
4137 foreach (Card item in pos.ListCards())
4138 {
4139 if ((IsPC || !(EClass.pc.ai is AI_UseCrafter aI_UseCrafter) || !aI_UseCrafter.ings.Contains(item)) && item.isThing && item.placeState == PlaceState.roaming && CanPick(item))
4140 {
4141 Thing thing = Pick(item.Thing);
4142 if (thing != null && !IsPC)
4143 {
4144 thing.isNPCProperty = true;
4145 }
4146 break;
4147 }
4148 }
4149 }
4150
4151 public void TryPutShared(Thing t, List<Thing> containers = null, bool dropIfFail = true)
4152 {
4153 if (!EClass._zone.TryAddThingInSharedContainer(t, containers) && dropIfFail)
4154 {
4155 EClass._zone.AddCard(t, pos);
4156 }
4157 }
4158
4159 public bool TryHoldCard(Card t, int num = -1, bool pickHeld = false)
4160 {
4161 if (held == t)
4162 {
4163 return true;
4164 }
4165 if (t.isDestroyed || t.Num <= 0)
4166 {
4167 return false;
4168 }
4169 if (!CanPick(t))
4170 {
4171 if (t.parent == null)
4172 {
4173 EClass._zone.AddCard(t, pos);
4174 }
4175 return false;
4176 }
4177 HoldCard(t, num);
4178 return true;
4179 }
4180
4181 public void HoldCard(Card t, int num = -1)
4182 {
4183 if (held == t || t.isDestroyed || t.Num <= 0)
4184 {
4185 return;
4186 }
4187 if (IsPC && t.isNPCProperty)
4188 {
4189 t.isNPCProperty = false;
4191 pos.TryWitnessCrime(this);
4192 }
4193 PickHeld();
4194 if (t.isChara)
4195 {
4197 {
4198 t.ShowEmo(Emo.love);
4199 }
4200 EClass.player.altHeldPos = t.renderer.data.ForceAltHeldPosition || EClass.rnd(2) == 0;
4201 }
4202 else
4203 {
4204 if (num == -1 || num > t.Num)
4205 {
4206 num = t.Num;
4207 }
4208 if (num < t.Num)
4209 {
4210 t = t.Split(num);
4211 }
4212 }
4213 if (t.GetRootCard() != this)
4214 {
4215 t = Pick(t.Thing, msg: false, tryStack: false);
4216 if (t.GetRootCard() != this)
4217 {
4218 return;
4219 }
4220 }
4221 held = t;
4222 if (held.GetLightRadius() > 0)
4223 {
4224 RecalculateFOV();
4225 }
4226 if (IsPC)
4227 {
4229 WidgetHotbar.dirtyCurrentItem = true;
4230 }
4231 }
4232
4233 public void PickHeld(bool msg = false)
4234 {
4235 if (held == null)
4236 {
4237 return;
4238 }
4239 Card card = held;
4240 if (IsPC && held.invY == 1)
4241 {
4242 WidgetHotbar.dirtyCurrentItem = true;
4244 held = null;
4245 return;
4246 }
4247 if (held.isChara)
4248 {
4249 DropHeld();
4250 return;
4251 }
4252 if (IsPC && !held.IsHotItem && held.trait.CanOnlyCarry)
4253 {
4254 Say("canOnlyCarry", held);
4255 DropHeld();
4256 return;
4257 }
4258 bool flag = held != things.TryStack(held.Thing);
4259 if (!flag && things.IsOverflowing())
4260 {
4261 if (IsPC)
4262 {
4263 Say("backpack_full_drop", held);
4264 SE.Drop();
4265 }
4266 DropHeld();
4267 return;
4268 }
4269 if (msg)
4270 {
4271 PlaySound("pick_thing");
4272 Say("pick_held", this, card);
4273 if (IsPC && card.id == "statue_weird")
4274 {
4275 Say("statue_pick");
4276 }
4277 }
4278 if (IsPC)
4279 {
4280 WidgetHotbar.dirtyCurrentItem = true;
4281 if (!flag)
4282 {
4284 if (held.GetRootCard() != EClass.pc)
4285 {
4286 Pick(held.Thing, msg: false);
4287 }
4288 }
4289 }
4290 held = null;
4291 }
4292
4293 public Card SplitHeld(int a)
4294 {
4295 return held.Split(a);
4296 }
4297
4298 public void TryDropCarryOnly()
4299 {
4300 if (held != null && held.trait.CanOnlyCarry)
4301 {
4302 DropHeld();
4303 }
4304 foreach (Thing item in things.List((Thing t) => t.trait.CanOnlyCarry))
4305 {
4306 DropThing(item);
4307 }
4308 }
4309
4310 public Card DropHeld(Point dropPos = null)
4311 {
4312 if (held == null)
4313 {
4314 return null;
4315 }
4316 if (IsPC)
4317 {
4318 WidgetHotbar.dirtyCurrentItem = true;
4320 }
4321 Card card = EClass._zone.AddCard(held, dropPos ?? pos);
4322 card.OnLand();
4323 if (card.trait.CanOnlyCarry)
4324 {
4325 card.SetPlaceState(PlaceState.installed);
4326 }
4327 return card;
4328 }
4329
4330 public void DropThing(Thing t, int num = -1)
4331 {
4332 if (t.c_isImportant)
4333 {
4334 Msg.Say("markedImportant");
4335 return;
4336 }
4337 if (!t.trait.CanBeDropped)
4338 {
4339 Msg.Say("cantDrop", t);
4340 return;
4341 }
4342 if (t.trait is TraitAbility)
4343 {
4344 SE.Trash();
4345 t.Destroy();
4346 return;
4347 }
4348 Msg.Say("dropItem", t.Name);
4349 t.ignoreAutoPick = true;
4350 PlaySound("drop");
4351 EClass._zone.AddCard(t, pos);
4352 if (t.trait.CanOnlyCarry)
4353 {
4354 t.Install();
4355 }
4356 }
4357
4359 {
4360 int num = Evalue(131);
4361 int num2 = Evalue(130);
4362 int num3 = Evalue(123);
4363 if (num > num2 && num > num3)
4364 {
4365 return AttackStyle.TwoWield;
4366 }
4367 if (num2 > num && num2 > num3)
4368 {
4369 return AttackStyle.TwoHand;
4370 }
4371 if (num3 > num && num3 > num2)
4372 {
4373 return AttackStyle.Shield;
4374 }
4375 return AttackStyle.Default;
4376 }
4377
4379 {
4380 return elements.ListElements((Element e) => e.source.categorySub == "weapon" && !e.HasTag("ranged")).FindMax((Element a) => a.Value);
4381 }
4382
4384 {
4385 if (elements.Value(122) > elements.Value(120))
4386 {
4387 return elements.GetElement(122);
4388 }
4389 return elements.GetElement(120);
4390 }
4391
4392 public void TryRestock(bool onCreate)
4393 {
4394 isOnCreate = onCreate;
4395 if (onCreate || (!IsPCFaction && (base.IsUnique || trait is TraitAdventurer || trait is TraitGuard)))
4396 {
4397 RestockEquip((!EClass.core.IsGameStarted || !(EClass._zone is Zone_Music)) && onCreate);
4398 }
4399 RestockInventory(onCreate);
4400 }
4401
4402 public void RestockEquip(bool onCreate)
4403 {
4404 string equip = source.equip;
4405 if (equip.IsEmpty())
4406 {
4407 equip = job.equip;
4408 }
4409 if (equip == "none")
4410 {
4411 return;
4412 }
4413 switch (id)
4414 {
4415 case "kettle":
4416 case "quru":
4417 case "loytel":
4418 case "shojo":
4419 EQ_ID("staff_long", 1);
4420 EQ_CAT("head");
4421 EQ_CAT("torso");
4422 EQ_CAT("arm");
4423 return;
4424 case "adv_kiria":
4425 if (onCreate)
4426 {
4427 EQ_ID("sword_zephir");
4428 }
4429 break;
4430 case "adv_mesherada":
4431 if (onCreate)
4432 {
4433 EQ_ID("dagger_hathaway");
4434 }
4435 break;
4436 case "adv_verna":
4437 if (onCreate)
4438 {
4439 EQ_ID("staff_long", -1, Rarity.Legendary);
4440 }
4441 if (onCreate)
4442 {
4443 EQ_ID("cloak_wing", -1, Rarity.Mythical);
4444 }
4445 break;
4446 case "big_sister":
4447 if (onCreate)
4448 {
4449 EQ_ID("sword_muramasa");
4450 }
4451 break;
4452 case "adv_gaki":
4453 if (onCreate)
4454 {
4455 EQ_ID("dagger_gaki");
4456 }
4457 if (onCreate)
4458 {
4459 EQ_ID("dagger_ninto");
4460 }
4461 break;
4462 case "adv_ivory":
4463 EQ_ID("dagger", -1, Rarity.Legendary);
4464 AddThing("60");
4465 break;
4466 case "adv_wini":
4467 if (onCreate)
4468 {
4469 EQ_ID("staff_Cat", -1, Rarity.Mythical);
4470 }
4471 AddCard(ThingGen.CreateSpellbook(9150));
4472 if (onCreate)
4473 {
4474 AddThing("1071");
4475 }
4476 break;
4477 case "seeker":
4478 if (onCreate)
4479 {
4480 EQ_ID("helm_seeker");
4481 }
4482 EQ_ID("robe_pope");
4483 EQ_ID("sword_katana");
4484 EQ_ID("staff");
4485 EQ_ID("sword_katana");
4486 if (onCreate)
4487 {
4488 EQ_ID("boots_seven");
4489 }
4490 if (onCreate)
4491 {
4492 for (int i = 0; i < 20; i++)
4493 {
4494 AddThing(ThingGen.CreateFromCategory("book", 50));
4495 }
4496 EQ_Item("panty");
4497 AddThing("plat").SetNum(6);
4498 }
4499 break;
4500 case "ephrond":
4501 if (onCreate)
4502 {
4503 AddThing("guitar_efrond");
4504 }
4505 break;
4506 case "ashland":
4507 if (onCreate)
4508 {
4509 AddThing("guitar_ash");
4510 }
4511 break;
4512 case "swordkeeper":
4513 if (onCreate)
4514 {
4515 EQ_ID("EtherDagger");
4516 }
4517 break;
4518 }
4519 switch (equip)
4520 {
4521 case "archer":
4522 if (onCreate || !TryEquipRanged())
4523 {
4524 EQ_CAT((EClass.rnd(4) == 0) ? "crossbow" : "bow");
4525 }
4526 break;
4527 case "inquisitor":
4528 case "gunner":
4529 if (onCreate || !TryEquipRanged())
4530 {
4531 EQ_CAT("gun");
4532 }
4533 break;
4534 }
4535 int num = ((base.rarity >= Rarity.Mythical) ? (base.LV * 3) : ((base.rarity >= Rarity.Legendary) ? (base.LV * 2) : base.LV));
4536 if (trait is TraitAdventurer)
4537 {
4538 num *= 3;
4539 }
4540 if (race.id == "asura")
4541 {
4542 for (int j = 0; j < 4; j++)
4543 {
4544 EQ_CAT(job.weapon.RandomItem());
4545 }
4546 }
4547 for (int k = 0; k < ((!(race.id == "mutant")) ? 1 : (2 + base.LV / 30)); k++)
4548 {
4549 if (source.ContainsTag("boxer"))
4550 {
4551 EQ_CAT("martial");
4552 }
4553 else if (!job.weapon.IsEmpty())
4554 {
4555 if (race.id == "mutant" || (body.slotMainHand != null && body.slotMainHand.thing == null))
4556 {
4557 EQ_CAT(job.weapon.RandomItem());
4558 }
4559 if (race.id == "mutant" || (Evalue(131) > 0 && EClass.rnd(2) == 0))
4560 {
4561 EQ_CAT(job.weapon.RandomItem());
4562 }
4563 }
4564 EQ_CAT("torso");
4565 if (EClass.rnd(num) > 5)
4566 {
4567 EQ_CAT("arm");
4568 }
4569 if (EClass.rnd(num) > 10)
4570 {
4571 EQ_CAT("head");
4572 }
4573 if (EClass.rnd(num) > 15)
4574 {
4575 EQ_CAT("back");
4576 }
4577 if (EClass.rnd(num) > 20)
4578 {
4579 EQ_CAT("ring");
4580 }
4581 if (EClass.rnd(num) > 25)
4582 {
4583 EQ_CAT("amulet");
4584 }
4585 if (EClass.rnd(num) > 30)
4586 {
4587 EQ_CAT("foot");
4588 }
4589 if (EClass.rnd(num) > 35)
4590 {
4591 EQ_CAT("waist");
4592 }
4593 if (EClass.rnd(num) > 40)
4594 {
4595 EQ_CAT("ring");
4596 }
4597 }
4598 if (trait is TraitBard)
4599 {
4600 AddThing(ThingGen.Create("lute"));
4601 }
4602 }
4603
4604 public void RestockInventory(bool onCreate)
4605 {
4606 switch (id)
4607 {
4608 case "fiama":
4609 Restock("book_story", 1);
4610 break;
4611 case "rock_thrower":
4612 Restock("stone", 10 + EClass.rnd(10));
4613 break;
4614 case "giant":
4615 Restock("rock", 2 + EClass.rnd(10));
4616 break;
4617 case "farris":
4618 Restock("lute", 1);
4619 Restock("book_story_home", 1);
4620 break;
4621 case "begger":
4622 break;
4623 }
4624 void Restock(string id, int num)
4625 {
4626 if (things.Find(id) == null)
4627 {
4628 AddCard(ThingGen.Create(id).SetNum(num));
4629 }
4630 }
4631 }
4632
4633 private void SetEQQuality()
4634 {
4636 Rarity rarity = Rarity.Normal;
4637 int num = ((base.LV >= 1000) ? 7 : ((base.LV >= 500) ? 5 : ((base.LV >= 250) ? 3 : ((base.LV >= 100) ? 2 : ((base.LV >= 50) ? 1 : 0)))));
4638 Rarity rarity2 = base.rarity;
4639 if (id == "big_sister")
4640 {
4641 num = (isOnCreate ? 8 : 4);
4642 }
4643 if (!isOnCreate && EClass.rnd(10) != 0)
4644 {
4645 num /= 2;
4646 }
4647 if (rarity2 == Rarity.Superior && EClass.rnd(10) <= num)
4648 {
4649 rarity = Rarity.Superior;
4650 }
4651 else if (rarity2 == Rarity.Legendary)
4652 {
4653 rarity = ((EClass.rnd(10) <= num) ? Rarity.Legendary : ((EClass.rnd(5) <= num) ? Rarity.Superior : Rarity.Normal));
4654 }
4655 else if (rarity2 >= Rarity.Mythical)
4656 {
4657 rarity = ((EClass.rnd(30) <= num) ? Rarity.Mythical : ((EClass.rnd(10) > num) ? Rarity.Superior : Rarity.Legendary));
4658 }
4659 if (rarity == Rarity.Normal && EClass.rnd(1000) == 0)
4660 {
4661 rarity = Rarity.Legendary;
4662 }
4663 CardBlueprint.current.rarity = rarity;
4664 }
4665
4666 public Thing EQ_ID(string s, int mat = -1, Rarity r = Rarity.Random)
4667 {
4668 SetEQQuality();
4669 if (r != Rarity.Random)
4670 {
4671 CardBlueprint.current.rarity = r;
4672 }
4673 Thing thing = ThingGen.Create(s, mat, base.LV);
4674 if (body.GetSlot(thing, onlyEmpty: true) == null)
4675 {
4676 return thing;
4677 }
4678 AddThing(thing);
4679 if (!body.Equip(thing))
4680 {
4681 thing.Destroy();
4682 }
4683 return thing;
4684 }
4685
4686 public void EQ_CAT(string s)
4687 {
4688 int slot = EClass.sources.categories.map[s].slot;
4689 BodySlot bodySlot = ((slot == 0) ? null : body.GetSlot(slot));
4690 if ((slot == 0 || bodySlot != null) && (slot != 37 || !HasElement(1209)))
4691 {
4692 SetEQQuality();
4693 Thing thing = ThingGen.CreateFromCategory(s, base.LV);
4694 AddThing(thing);
4695 if (bodySlot != null && !body.Equip(thing, bodySlot))
4696 {
4697 thing.Destroy();
4698 }
4699 }
4700 }
4701
4702 public void EQ_Item(string s, int num = 1)
4703 {
4704 SetEQQuality();
4705 Thing t = ThingGen.Create(s, -1, base.LV).SetNum(num);
4706 AddThing(t);
4707 }
4708
4709 public void Drink(Card t)
4710 {
4711 Say("drink", this, t.Duplicate(1));
4712 Say("quaff");
4713 PlaySound("drink");
4714 hunger.Mod(-2);
4715 t.ModNum(-1);
4716 t.trait.OnDrink(this);
4717 _ = IsPC;
4718 }
4719
4720 public bool CanRevive()
4721 {
4722 return EClass.world.date.IsExpired(base.c_dateDeathLock);
4723 }
4724
4725 public void GetRevived()
4726 {
4727 Revive(EClass.pc.pos.GetNearestPoint(allowBlock: false, allowChara: false), msg: true);
4728 if (!IsPCFaction)
4729 {
4730 return;
4731 }
4732 if (!IsPC && (!trait.CanJoinPartyResident || !trait.CanJoinParty || memberType != 0))
4733 {
4734 if (homeZone != null && EClass._zone != homeZone)
4735 {
4736 Msg.Say("returnHome", this, homeZone.Name);
4737 MoveZone(homeZone);
4738 }
4739 }
4740 else if (!EClass._zone.IsPCFaction || homeBranch != EClass.Branch || base.c_wasInPcParty)
4741 {
4742 EClass.pc.party.AddMemeber(this, showMsg: true);
4743 }
4744 }
4745
4746 public void Revive(Point p = null, bool msg = false)
4747 {
4748 if (!isDead)
4749 {
4750 return;
4751 }
4752 isDead = false;
4753 base.hp = MaxHP / 3;
4754 mana.value = 0;
4755 stamina.value = 0;
4756 if (hunger.value > 30)
4757 {
4758 hunger.value = 30;
4759 }
4760 sleepiness.value = 0;
4761 hostility = OriginalHostility;
4762 RemoveCondition<StanceTaunt>();
4763 if (IsPC)
4764 {
4766 {
4767 Msg.Say("noDeathPenalty2", this);
4768 }
4770 {
4771 Msg.Say("noDeathPenalty", this);
4772 }
4773 else
4774 {
4776 }
4777 List<Thing> dropList = new List<Thing>();
4778 EClass.pc.things.Foreach(delegate(Thing t)
4779 {
4781 {
4782 t.ignoreAutoPick = true;
4783 dropList.Add(t);
4784 }
4785 }, onlyAccessible: false);
4786 foreach (Thing item in dropList)
4787 {
4789 Msg.Say("backpack_full_drop", item);
4790 }
4791 EClass.player.preventDeathPenalty = false;
4792 }
4793 if (IsPCFaction && homeBranch != null)
4794 {
4795 homeBranch.Log("bRevive", this);
4796 }
4797 if (p != null)
4798 {
4799 if (!p.IsInBounds)
4800 {
4802 }
4803 EClass._zone.AddCard(this, p);
4804 if (msg)
4805 {
4806 SE.Play("revive");
4807 Msg.Say("revive", this);
4808 PlayEffect("revive");
4809 }
4810 SetCensored(enable: false);
4811 }
4812 }
4813
4814 public void MakeGrave(string lastword)
4815 {
4816 if (!EClass._zone.IsRegion)
4817 {
4818 List<string> list = new List<string> { "930", "931", "947", "948", "949", "950", "951", "952" };
4819 if (IsPC && EClass.rnd(2) == 0 && EClass.pc.things.Find("letter_will") != null)
4820 {
4821 list = new List<string> { "944", "946", "backerGrave", "backerGrave2" };
4822 }
4823 Thing thing = ThingGen.Create(list.RandomItem());
4824 thing.MakeRefFrom(this);
4825 if (!lastword.IsEmpty())
4826 {
4827 thing.c_note = lastword;
4828 }
4829 thing.isModified = true;
4830 EClass._zone.AddCard(thing, pos).Install();
4831 }
4832 }
4833
4834 public void ApplyDeathPenalty()
4835 {
4836 if (!IsPC)
4837 {
4838 return;
4839 }
4840 int currency = GetCurrency();
4841 if (currency > 0)
4842 {
4843 int num = currency / 3 + EClass.rnd(currency / 3 + 1);
4844 if (num <= 0)
4845 {
4846 num = 1;
4847 }
4848 Msg.Say("panaltyMoney", this, Lang._currency(num));
4849 ModCurrency(-num);
4851 }
4852 foreach (Element value in EClass.pc.elements.dict.Values)
4853 {
4854 if (EClass.rnd(5) == 0 && value.IsMainAttribute)
4855 {
4856 EClass.pc.elements.ModExp(value.id, -500);
4857 }
4858 }
4859 }
4860
4861 public void Vomit()
4862 {
4863 base.c_vomit++;
4864 Say("vomit", this);
4865 PlaySound("vomit");
4866 if (!EClass._zone.IsRegion)
4867 {
4868 Thing thing = ThingGen.Create("731");
4870 {
4871 thing.MakeRefFrom(this);
4872 }
4873 EClass._zone.AddCard(thing, pos);
4874 }
4875 if (HasCondition<ConAnorexia>())
4876 {
4877 ModExp(70, -50);
4878 ModExp(71, -75);
4879 ModExp(77, -100);
4880 }
4881 else if (base.c_vomit > 10)
4882 {
4883 AddCondition<ConAnorexia>();
4884 }
4885 AddCondition<ConDim>();
4886 if (HasCondition<ConAnorexia>())
4887 {
4888 ModWeight(-1 * (1 + EClass.rnd(5)));
4889 }
4890 if (hunger.GetPhase() >= 4)
4891 {
4892 DamageHP(9999, AttackSource.Hunger);
4893 }
4894 hunger.Mod(30);
4895 }
4896
4897 public override void Die(Element e = null, Card origin = null, AttackSource attackSource = AttackSource.None)
4898 {
4899 combatCount = 0;
4900 if (isDead || host != null)
4901 {
4902 return;
4903 }
4904 bool isInActiveZone = IsInActiveZone;
4905 if (isInActiveZone)
4906 {
4907 if (IsPC)
4908 {
4910 }
4911 if (base.isSummon)
4912 {
4913 if (id == "tsunami")
4914 {
4915 pos.PlaySound("water");
4916 }
4917 else
4918 {
4919 Say("summon_vanish", this);
4920 pos.PlayEffect("vanish");
4921 pos.PlaySound("vanish");
4922 }
4923 Destroy();
4924 return;
4925 }
4926 if (attackSource == AttackSource.DeathSentense)
4927 {
4928 if (trait is TraitLittleOne)
4929 {
4930 MakeEgg();
4931 if (IsPCFaction)
4932 {
4934 }
4935 }
4936 PlayEffect("revive");
4937 PlaySound("chime_angel");
4938 }
4939 else
4940 {
4941 Effect.Get("blood").Play((parent is Chara) ? (parent as Chara).pos : pos).SetParticleColor(EClass.Colors.matColors[base.material.alias].main)
4942 .Emit(50);
4943 AddBlood(AI_Slaughter.slaughtering ? 12 : (2 + EClass.rnd(2)));
4944 PlaySound(base.material.GetSoundDead(source));
4945 }
4946 renderer.RefreshSprite();
4947 renderer.RefreshStateIcon();
4948 ClearFOV();
4949 }
4950 string text = "";
4951 "dead_in".langGame(EClass._zone.Name);
4952 string text2 = ((origin == null) ? "" : origin.GetName(NameStyle.Full));
4953 if (LangGame.Has("dead_" + attackSource))
4954 {
4955 text = "dead_" + attackSource;
4956 }
4957 else
4958 {
4959 if (e != Element.Void && e != null)
4960 {
4961 text = "dead_" + e.source.alias;
4962 }
4963 if (text == "" || !LangGame.Has(text))
4964 {
4965 text = "dead";
4966 }
4967 }
4968 if (IsPC)
4969 {
4970 EClass._zone.isDeathLocation = true;
4971 string s = ((origin == null) ? text : "dead_by");
4973 if (attackSource == AttackSource.Wrath)
4974 {
4976 }
4977 EClass.player.deathMsg = GameLang.Parse(s.langGame(), thirdPerson: true, EClass.pc.NameBraced, "dead_in".langGame(EClass._zone.Name), text2);
4979 if (EClass._zone.instance is ZoneInstanceRandomQuest zoneInstanceRandomQuest)
4980 {
4981 zoneInstanceRandomQuest.status = ZoneInstance.Status.Fail;
4982 }
4983 AI_PlayMusic.keepPlaying = false;
4984 }
4985 if (isInActiveZone)
4986 {
4987 if (attackSource == AttackSource.DeathSentense)
4988 {
4989 Msg.Say("goto_heaven", this);
4990 }
4991 else
4992 {
4993 if (origin == null || !origin.isSynced || (attackSource != AttackSource.Melee && attackSource != AttackSource.Range))
4994 {
4995 Msg.Say(text, this, "", text2);
4996 }
4997 string text3 = TalkTopic("dead");
4998 if (!text3.IsEmpty())
4999 {
5000 text3 = text3.StripBrackets();
5001 }
5002 bool flag = base.rarity >= Rarity.Legendary && !IsPCFaction;
5003 if (!IsPC && flag)
5004 {
5005 MakeGrave(text3);
5006 }
5007 Msg.SetColor();
5008 SpawnLoot(origin);
5009 }
5010 if (IsPC)
5011 {
5012 TryDropCarryOnly();
5013 }
5014 }
5015 if (IsPCFaction)
5016 {
5017 if (homeBranch != null)
5018 {
5019 homeBranch.Log(text, this, "");
5020 }
5021 WidgetPopText.Say("popDead".lang(base.Name), FontColor.Bad);
5022 if (!IsPC)
5023 {
5024 if (EClass.player.stats.allyDeath == 0)
5025 {
5026 Tutorial.Reserve("death_pet");
5027 }
5029 }
5030 }
5031 if (id == "mandrake")
5032 {
5033 Say("a_scream", this);
5034 ActEffect.ProcAt(EffectId.Scream, base.LV * 3 + 200, BlessedState.Normal, this, this, pos, isNeg: true);
5035 }
5036 daysStarved = 0;
5037 isDead = true;
5038 ClearTempElements();
5039 enemy = null;
5040 _cooldowns = null;
5041 base.isSale = false;
5042 EClass._map.props.sales.Remove(this);
5043 Cure(CureType.Death);
5044 SetAI(new NoGoal());
5045 TryDropBossLoot();
5046 if (isInActiveZone && EClass._zone.HasLaw && IsHuman && OriginalHostility >= Hostility.Neutral)
5047 {
5048 pos.TalkWitnesses(origin?.Chara, "witness", 3, WitnessType.crime, (Chara c) => !c.IsPCParty && !c.IsUnique);
5049 }
5050 if (IsPC)
5051 {
5052 EClass.player.returnInfo = null;
5053 EClass.player.uidLastTravelZone = 0;
5054 foreach (Chara chara2 in EClass._map.charas)
5055 {
5056 if (chara2.IsHostile())
5057 {
5058 chara2.hostility = chara2.OriginalHostility;
5059 }
5060 if (chara2.enemy == EClass.pc)
5061 {
5062 chara2.enemy = null;
5063 }
5064 }
5065 if (EClass.pc.things.Find("letter_will") != null && EClass.rnd(10) == 0)
5066 {
5067 EClass.player.preventDeathPenalty = true;
5068 }
5069 }
5070 else
5071 {
5072 bool flag2 = currentZone.IsActiveZone && IsLocalChara && !currentZone.IsPCFaction;
5073 if (currentZone is Zone_LittleGarden && id == "littleOne")
5074 {
5075 flag2 = false;
5076 }
5077 if (flag2)
5078 {
5079 EClass._map.deadCharas.Add(this);
5080 }
5081 currentZone.RemoveCard(this);
5082 }
5083 if ((origin != null && origin.IsPCParty) || IsPCFaction)
5084 {
5085 int a = -10;
5086 if (IsPCFaction && !IsPCParty && (origin == null || !origin.IsPCParty))
5087 {
5088 a = -5;
5089 }
5090 ModAffinity(EClass.pc, a, show: false);
5091 string text4 = id;
5092 if (!(text4 == "quru"))
5093 {
5094 if (text4 == "corgon")
5095 {
5096 EClass.game.cards.globalCharas.Find("quru")?.ModAffinity(EClass.pc, -20, show: false);
5097 }
5098 }
5099 else
5100 {
5101 EClass.game.cards.globalCharas.Find("corgon")?.ModAffinity(EClass.pc, -20, show: false);
5102 }
5103 }
5104 if (origin != null)
5105 {
5106 if (origin.IsPCParty || origin.IsPCPartyMinion)
5107 {
5108 int num = 0;
5109 if (OriginalHostility >= Hostility.Friend && IsHuman && !base.IsPCFactionOrMinion)
5110 {
5111 num = -5;
5112 }
5113 else if (race.id == "cat" && OriginalHostility >= Hostility.Neutral)
5114 {
5115 EClass.pc.Say("killcat");
5116 num = -1;
5117 }
5118 if (EClass.pc.party.HasElement(1563) && num < 0)
5119 {
5120 num = num * 30 / 100;
5121 }
5122 if (num != 0)
5123 {
5124 EClass.player.ModKarma(num);
5125 }
5126 }
5127 if (origin == EClass.pc)
5128 {
5129 EClass.pc.faith.Revelation("kill", 10);
5130 }
5131 else if (origin.IsPCFaction)
5132 {
5133 origin.Chara.ModAffinity(EClass.pc, 1, show: false);
5134 origin.Chara.ShowEmo(Emo.love);
5135 }
5136 }
5137 if (base.sourceBacker != null && origin != null && origin.IsPCParty)
5138 {
5139 EClass.player.doneBackers.Add(base.sourceBacker.id);
5140 }
5141 if (base.IsPCFactionOrMinion)
5142 {
5144 {
5145 Msg.Say("abort_allyDead");
5146 }
5147 }
5149 {
5150 Msg.Say("abort_enemyDead");
5151 }
5152 if (IsPCParty && !IsPC)
5153 {
5155 base.c_wasInPcParty = true;
5156 EClass.pc.Say("allyDead");
5157 }
5158 switch (id)
5159 {
5160 case "littleOne":
5161 if (attackSource != AttackSource.DeathSentense && !IsPCFaction)
5162 {
5163 EClass.player.flags.little_killed = true;
5165 }
5166 break;
5167 case "big_daddy":
5168 if (!IsPCFaction)
5169 {
5170 Chara t2 = CharaGen.Create("littleOne");
5171 EClass._zone.AddCard(t2, pos.Copy());
5172 Msg.Say("little_pop");
5173 }
5174 break;
5175 case "shark_sister":
5176 if (!IsPCFaction)
5177 {
5178 Chara t = CharaGen.Create("sister_shark");
5179 EClass._zone.AddCard(t, pos.Copy());
5180 Msg.Say("shark_pop");
5181 }
5182 break;
5183 }
5184 if (attackSource == AttackSource.Finish && origin != null && origin.Evalue(665) > 0)
5185 {
5186 Chara chara = CharaGen.CreateFromFilter("c_plant", base.LV);
5187 EClass._zone.AddCard(chara, pos.Copy());
5188 if (chara.LV < base.LV)
5189 {
5190 chara.SetLv(base.LV);
5191 }
5192 chara.MakeMinion((origin.IsPCParty || origin.IsPCPartyMinion) ? EClass.pc : origin.Chara, MinionType.Friend);
5193 Msg.Say("plant_pop", this, chara);
5194 }
5195 foreach (ZoneEvent item in EClass._zone.events.list)
5196 {
5197 item.OnCharaDie(this);
5198 }
5199 }
5200
5201 public void TryDropBossLoot()
5202 {
5203 if (IsPCFaction || IsPCFactionMinion)
5204 {
5205 return;
5206 }
5207 int num = 0;
5208 bool flag = false;
5209 bool flag2 = false;
5210 Point point = pos.GetNearestPoint(allowBlock: true, allowChara: false, allowInstalled: false, ignoreCenter: true) ?? pos;
5211 TreasureType type = TreasureType.BossQuest;
5212 if (EClass._zone.Boss == this)
5213 {
5214 type = TreasureType.BossNefia;
5215 num = 2 + EClass.rnd(2);
5216 flag = (flag2 = true);
5217 EClass._zone.Boss = null;
5218 Msg.Say("boss_win", EClass._zone.Name);
5220 {
5221 Msg.Say("boss_win_void", EClass._zone.Name);
5222 EClass.player.flags.KilledBossInVoid = true;
5223 }
5224 if (EClass._zone.IsNefia)
5225 {
5227 EClass.Sound.StopBGM(2f);
5228 SE.Play("Jingle/fanfare2");
5229 EClass._zone.SetBGM(114);
5230 }
5233 }
5234 switch (id)
5235 {
5236 case "vernis_boss":
5237 num = 5;
5238 flag = (flag2 = true);
5239 EClass.Sound.StopBGM(3f);
5240 EClass._zone.SetBGM(1, refresh: false);
5241 if (EClass.game.quests.GetPhase<QuestVernis>() == 8)
5242 {
5243 EClass.game.quests.Get<QuestVernis>().UpdateOnTalk();
5244 }
5245 break;
5246 case "melilith_boss":
5247 num = 5;
5248 flag = (flag2 = true);
5249 EClass.Sound.StopBGM(3f);
5250 EClass._zone.SetBGM(1, refresh: false);
5251 break;
5252 case "isygarad":
5253 {
5254 num = 5;
5255 flag = (flag2 = true);
5256 QuestExploration questExploration = EClass.game.quests.Get<QuestExploration>();
5257 if (questExploration != null)
5258 {
5259 SE.Play("kill_boss");
5260 questExploration.ChangePhase(3);
5261 EClass.Sound.StopBGM(3f);
5262 EClass._zone.SetBGM(1, refresh: false);
5263 }
5264 break;
5265 }
5266 case "swordkeeper":
5267 num = 10;
5268 flag = true;
5269 SE.Play("kill_boss");
5270 SoundManager.ForceBGM();
5271 LayerDrama.Activate("_event", "event", "swordkeeper_defeat");
5272 break;
5273 }
5274 if (flag)
5275 {
5276 SE.Play("kill_boss");
5277 }
5278 if (num != 0)
5279 {
5280 EClass.player.willAutoSave = true;
5281 Thing thing = ThingGen.CreateTreasure("chest_boss", base.LV, type);
5282 point.SetBlock();
5283 point.SetObj();
5284 EClass._zone.AddCard(thing, point).Install();
5285 ThingGen.TryLickChest(thing);
5286 }
5287 if (flag2)
5288 {
5290 }
5291 }
5292
5293 public void Kick(Point p, bool ignoreSelf = false)
5294 {
5295 foreach (Chara item in p.ListCharas())
5296 {
5297 Kick(item, ignoreSelf);
5298 }
5299 }
5300
5301 public void Kick(Chara t, bool ignoreSelf = false, bool karmaLoss = true, bool show = true)
5302 {
5303 if (!IsAliveInCurrentZone)
5304 {
5305 return;
5306 }
5307 if (t.IsPC)
5308 {
5310 }
5311 if (t.host != null)
5312 {
5313 return;
5314 }
5315 if (t == this)
5316 {
5317 if (!ignoreSelf)
5318 {
5319 Debug.Log(t.pos.GetNearestPoint());
5320 if (TryMove(t.pos.GetNearestPoint()) != MoveResult.Success)
5321 {
5322 t.MoveImmediate(pos.GetNearestPoint() ?? t.pos);
5323 }
5324 }
5325 return;
5326 }
5327 if (show)
5328 {
5329 Say("kick", this, t);
5330 }
5331 PlaySound("kick");
5332 if ((t.conSuspend == null || t.conSuspend.uidMachine != 0) && t.trait.CanBePushed && (!t.IsHostile() || EClass.rnd(2) == 0) && !t.noMove && !t.isRestrained)
5333 {
5334 t.MoveByForce(t.pos.GetNearestPoint(allowBlock: false, allowChara: false, allowInstalled: true, ignoreCenter: true), this, !t.pos.IsBlocked);
5335 }
5336 if (t.conSleep != null)
5337 {
5338 t.conSleep.Kill();
5339 }
5340 if (IsPC && t.IsFriendOrAbove() && !t.IsPCFactionOrMinion && karmaLoss)
5341 {
5343 }
5344 t.PlayEffect("kick");
5345 }
5346
5347 public bool UseAbility(string idAct, Card tc = null, Point pos = null, bool pt = false)
5348 {
5349 return UseAbility(elements.GetElement(idAct)?.act ?? ACT.Create(idAct), tc, pos, pt);
5350 }
5351
5352 public bool UseAbility(Act a, Card tc = null, Point pos = null, bool pt = false)
5353 {
5354 if (!IsPC && HasCooldown(a.id))
5355 {
5356 return false;
5357 }
5358 if (a.source.proc.TryGet(0) == "Heal" && HasElement(1422))
5359 {
5360 List<int> list = new List<int> { 8400, 8401, 8402, 8403, 8404, 8405 };
5361 int num = list.IndexOf(a.id);
5362 if (num != -1)
5363 {
5364 int num2 = list.TryGet(num + Evalue(1422));
5365 a = elements.GetElement(num2)?.act ?? ACT.Create(num2);
5366 }
5367 }
5368 int num3 = 1;
5369 Act.Cost cost = a.GetCost(this);
5370 a.GetPower(this);
5371 int i = 1;
5372 int num4 = 0;
5373 bool flag = a.IsTargetHostileParty();
5374 if (IsPC && HasCondition<StanceManaCost>())
5375 {
5376 num4 = Evalue(1657);
5377 }
5378 _pts.Clear();
5379 if (a.TargetType.ForceParty)
5380 {
5381 pt = true;
5382 }
5383 if (pt)
5384 {
5385 i = 0;
5386 if (flag)
5387 {
5388 ForeachEnemy(delegate
5389 {
5390 i++;
5391 });
5392 }
5393 else
5394 {
5395 ForeachParty(delegate
5396 {
5397 i++;
5398 });
5399 }
5400 }
5401 if (a is Spell && IsPC && a.vPotential < i)
5402 {
5403 i = 1;
5404 _pts.Clear();
5405 _pts.Add(this);
5406 pt = false;
5407 }
5408 int num5 = 100;
5409 if (!a.TargetType.ForceParty && i > 1)
5410 {
5411 num5 = (IsPC ? (i * 100) : (50 + i * 50));
5412 }
5413 int num6 = cost.cost * num5 / 100;
5414 if (cost.type == Act.CostType.MP && Evalue(483) > 0)
5415 {
5416 num6 = num6 * 100 / (100 + (int)Mathf.Sqrt(Evalue(483) * 10) * 3);
5417 }
5418 if (i == 0)
5419 {
5420 if (IsPC)
5421 {
5423 }
5424 return false;
5425 }
5426 if (!IsPC && cost.type == Act.CostType.MP && mana.value < 0 && (EClass.rnd(4) != 0 || IsPCFaction || (base.IsPowerful && mana.value < -20)))
5427 {
5428 return false;
5429 }
5430 if (IsPC)
5431 {
5432 if (!Dialog.warned && cost.type == Act.CostType.MP && cost.cost > 0 && mana.value < num6 && !EClass.debug.godMode)
5433 {
5434 ActPlan.warning = true;
5435 Dialog.TryWarnMana(delegate
5436 {
5437 if (UseAbility(a, tc, pos, pt))
5438 {
5440 }
5441 });
5442 return false;
5443 }
5444 EClass.ui.CloseLayers();
5445 }
5446 if ((isConfused && EClass.rnd(4) == 0) || (isBlind && (pt || (pos != null && !pos.Equals(base.pos)) || (tc != null && tc.pos != null && !tc.pos.Equals(base.pos))) && EClass.rnd(2) == 0))
5447 {
5448 Say("shakeHead", this);
5449 return true;
5450 }
5451 if (tc != null && tc != this)
5452 {
5453 LookAt(tc.pos);
5454 }
5455 if (pos != null && !base.pos.Equals(pos))
5456 {
5457 LookAt(pos);
5458 }
5459 if (a.CanRapidFire && HasElement(1648))
5460 {
5461 num3 = 1 + Evalue(1648);
5462 }
5463 if (IsPC && cost.cost > 0 && a.Value == 0)
5464 {
5466 return false;
5467 }
5468 if (a is Spell)
5469 {
5470 string s = (isConfused ? "_cast_confuse" : (HasCondition<ConDim>() ? "_cast_dim" : ""));
5471 if (!a.source.tag.Contains("useHand"))
5472 {
5473 Say(race.castStyle.IsEmpty("cast"), this, a.source.GetName().ToLower(), s.lang());
5474 }
5475 if (IsPC)
5476 {
5477 _ = (i + 1) / 2;
5478 if (a.vPotential < i)
5479 {
5480 Msg.Say("noSpellStock");
5481 EInput.Consume();
5482 return false;
5483 }
5484 if (num4 > 0 && a.vPotential >= i * 2)
5485 {
5486 a.vPotential -= i * 2;
5487 num6 = num6 * (100 - num4 * 20) / 100;
5488 }
5489 else
5490 {
5491 a.vPotential -= i;
5492 }
5494 }
5495 }
5496 else if (a.source.langAct.Length != 0 && tc != null)
5497 {
5498 string text = a.source.langAct[0];
5499 string text2 = ((a.source.langAct.Length >= 2) ? a.source.langAct[1] : "");
5500 if (text == "spell_hand")
5501 {
5502 string[] list2 = Lang.GetList("attack" + race.meleeStyle.IsEmpty("Touch"));
5503 string @ref = text2.lang(list2[4]);
5504 Say(tc.IsPCParty ? "cast_hand_ally" : "cast_hand", this, tc, @ref, tc.IsPCParty ? list2[1] : list2[2]);
5505 }
5506 else
5507 {
5508 Say(text, this, tc, text2.IsEmpty() ? "" : text2.lang());
5509 }
5510 if (a.source.id == 6630)
5511 {
5512 Talk("insult_" + (base.IsMale ? "m" : "f"));
5513 }
5514 }
5515 switch (cost.type)
5516 {
5517 case Act.CostType.MP:
5518 if (Evalue(1421) >= 2 && base.hp <= MaxHP / (9 - Evalue(1421) * 2))
5519 {
5520 num6 /= 2;
5521 }
5522 PlayEffect("cast");
5523 mana.Mod(-num6);
5524 if (isDead)
5525 {
5526 return true;
5527 }
5528 elements.ModExp(304, Mathf.Clamp(num6 * 2, 1, 200));
5529 break;
5530 case Act.CostType.SP:
5531 stamina.Mod(-num6);
5532 ignoreSPAbsorb = true;
5533 break;
5534 }
5535 if (a is Spell && GetCondition<ConSilence>() != null)
5536 {
5537 Say("cast_silence", this);
5538 return true;
5539 }
5540 if (isDead)
5541 {
5542 return true;
5543 }
5544 int spellExp = elements.GetSpellExp(this, a, num5);
5545 if (EClass.rnd(100) >= CalcCastingChance(a, i) && !EClass.debug.godMode)
5546 {
5547 Say("fizzle", this);
5548 PlayEffect("fizzle");
5549 PlaySound("fizzle");
5550 if (cost.cost > 0 && a.source.lvFactor > 0)
5551 {
5552 ModExp(a.id, spellExp / 5);
5553 }
5554 RemoveCondition<ConInvisibility>();
5555 return true;
5556 }
5557 bool flag2 = true;
5558 if (HasTalk("phrase_" + a.source.alias))
5559 {
5560 EClass.player.forceTalk = true;
5561 Talk("phrase_" + a.source.alias);
5562 }
5563 if (pt)
5564 {
5565 Act.forcePt = true;
5566 if (flag)
5567 {
5568 ForeachEnemy(delegate(Chara c)
5569 {
5570 a.Perform(this, c, c.pos);
5571 });
5572 }
5573 else
5574 {
5575 ForeachParty(delegate(Chara c)
5576 {
5577 a.Perform(this, c, c.pos);
5578 });
5579 }
5580 Act.forcePt = false;
5581 }
5582 else
5583 {
5584 for (int j = 0; j < num3; j++)
5585 {
5586 if (a.TargetType != TargetType.SelfParty && tc != null && !tc.IsAliveInCurrentZone)
5587 {
5588 break;
5589 }
5590 ActEffect.RapidCount = j;
5591 ActEffect.RapidDelay = a.RapidDelay;
5592 flag2 = a.Perform(this, tc, pos);
5593 }
5594 }
5595 if (flag2 && !isDead)
5596 {
5597 if (cost.cost > 0 && a.source.lvFactor > 0)
5598 {
5599 ModExp(a.id, spellExp);
5600 }
5601 if (a.source.alias.StartsWith("sword_"))
5602 {
5603 ModExp(101, 50);
5604 }
5605 }
5606 ActEffect.RapidCount = 0;
5607 if (!IsPC && a.source.cooldown > 0)
5608 {
5609 AddCooldown(a.id, a.source.cooldown);
5610 }
5611 if (flag2 && !a.source.tag.Contains("keepInvisi") && EClass.rnd(2) == 0)
5612 {
5613 RemoveCondition<ConInvisibility>();
5614 }
5615 return flag2;
5616 void ForeachEnemy(Action<Chara> action)
5617 {
5618 if (_pts.Count == 0)
5619 {
5620 for (int num10 = EClass._map.charas.Count - 1; num10 >= 0; num10--)
5621 {
5622 Chara chara3 = EClass._map.charas[num10];
5623 if (chara3 != this && CanSeeLos(chara3) && chara3.IsHostile(this))
5624 {
5625 _pts.Add(chara3);
5626 }
5627 }
5628 }
5629 for (int num11 = _pts.Count - 1; num11 >= 0; num11--)
5630 {
5631 action(_pts[num11]);
5632 }
5633 }
5634 void ForeachParty(Action<Chara> action)
5635 {
5636 if (_pts.Count == 0)
5637 {
5638 if (IsPCParty)
5639 {
5640 for (int num7 = EClass.pc.party.members.Count - 1; num7 >= 0; num7--)
5641 {
5642 Chara chara = EClass.pc.party.members[num7];
5643 if (chara == this || chara.host != null || CanSeeLos(chara))
5644 {
5645 _pts.Add(chara);
5646 }
5647 }
5648 }
5649 else
5650 {
5651 for (int num8 = EClass._map.charas.Count - 1; num8 >= 0; num8--)
5652 {
5653 Chara chara2 = EClass._map.charas[num8];
5654 if ((chara2 == this || (chara2.IsFriendOrAbove(this) && CanSeeLos(chara2))) && (chara2 == tc || _pts.Count < 3 || EClass.rnd(_pts.Count * _pts.Count) > 6))
5655 {
5656 _pts.Add(chara2);
5657 }
5658 }
5659 }
5660 }
5661 for (int num9 = _pts.Count - 1; num9 >= 0; num9--)
5662 {
5663 action(_pts[num9]);
5664 }
5665 }
5666 }
5667
5668 public int EvalueRiding()
5669 {
5670 if (ride != null && ride.HasCondition<ConTransmuteBroom>() && HasElement(1417))
5671 {
5672 return 25 + Evalue(226) * 125 / 100;
5673 }
5674 return Evalue(226);
5675 }
5676
5677 public int CalcCastingChance(Element e, int num = 1)
5678 {
5679 if (!(e is Spell))
5680 {
5681 return 100;
5682 }
5683 if (!IsPC)
5684 {
5685 int num2 = 95;
5686 if (host != null)
5687 {
5688 if (host.ride == this)
5689 {
5690 return num2 * 100 / (100 + 300 / Mathf.Max(5, 10 + host.EvalueRiding()));
5691 }
5692 if (host.parasite == this)
5693 {
5694 return num2 * 100 / (100 + 300 / Mathf.Max(5, 10 + host.Evalue(227)));
5695 }
5696 }
5697 return num2;
5698 }
5699 int num3 = Evalue(304);
5700 if (!IsPCFaction)
5701 {
5702 num3 = Mathf.Max(num3, base.LV + 5);
5703 }
5704 int num4 = 0;
5705 int num5 = 0;
5706 bool num6 = GetArmorSkill() == 122;
5707 AttackStyle attackStyle = body.GetAttackStyle();
5708 if (num6)
5709 {
5710 num4 = 20 - Evalue(122) / 5;
5711 num5 += 10 - Evalue(1654) * 4;
5712 }
5713 else
5714 {
5715 num4 = 10 - Evalue(120) / 5;
5716 }
5717 if (num4 < 5)
5718 {
5719 num4 = 5;
5720 }
5721 if (ride != null)
5722 {
5723 num4 += 5;
5724 }
5725 if (parasite != null)
5726 {
5727 num4 += 10;
5728 }
5729 if (attackStyle == AttackStyle.TwoWield)
5730 {
5731 num4 += 5;
5732 }
5733 if (attackStyle == AttackStyle.Shield)
5734 {
5735 num4 += 5;
5736 num5 += 10 - Evalue(1654) * 4;
5737 }
5738 if (isConfused)
5739 {
5740 num4 += 10000;
5741 }
5742 if (HasCondition<ConDim>())
5743 {
5744 num4 += ((Evalue(1654) >= 3) ? 1500 : 2500);
5745 }
5746 if (num > 1)
5747 {
5748 num4 += 5 * num;
5749 }
5750 if (num5 < 0)
5751 {
5752 num5 = 0;
5753 }
5754 return Mathf.Clamp(100 + e.Value - 10 - e.source.LV * e.source.cost[0] * num4 / (10 + num3 * 10), 0, 100 - num5);
5755 }
5756
5757 public void DoAI(int wait, Action onPerform)
5758 {
5759 SetAI(new DynamicAIAct("", delegate
5760 {
5761 onPerform();
5762 return true;
5763 })
5764 {
5765 wait = wait
5766 });
5767 }
5768
5769 public void Cuddle(Chara c, bool headpat = false)
5770 {
5771 Talk("goodBoy");
5772 Say(headpat ? "headpat" : "cuddle", this, c);
5773 c.ShowEmo(Emo.love);
5774 if (EClass.rnd(IsPC ? 100 : 5000) == 0)
5775 {
5776 c.MakeEgg();
5777 }
5778 if (headpat && this != c)
5779 {
5780 if (c.interest > 0)
5781 {
5782 c.ModAffinity(EClass.pc, 1 + EClass.rnd(3));
5783 c.interest -= 20 + EClass.rnd(10);
5784 }
5786 {
5787 foreach (Chara member in party.members)
5788 {
5789 if (!member.IsPC && CanSeeLos(member))
5790 {
5791 member.AddCondition<ConEuphoric>(100 + Evalue(6904) * 5);
5792 }
5793 }
5794 }
5795 }
5796 if (c.Evalue(1221) > 0)
5797 {
5798 int ele = ((c.MainElement == Element.Void) ? 924 : c.MainElement.id);
5799 if (c.id == "hedgehog_ether")
5800 {
5801 ele = 922;
5802 }
5803 Say("reflect_thorne", c, this);
5804 DamageHP(10, ele, Power, AttackSource.Condition);
5805 }
5806 }
5807
5808 public Chara SetEnemy(Chara c = null)
5809 {
5810 enemy = c;
5811 if (c == null)
5812 {
5813 if (ai is GoalCombat)
5814 {
5815 ai.Cancel();
5816 }
5817 }
5818 else
5819 {
5820 calmCheckTurn = 10 + EClass.rnd(30);
5821 }
5822 return c;
5823 }
5824
5825 public void TrySetEnemy(Chara c)
5826 {
5827 if ((!IsPC || !EClass.game.config.autoCombat.bDontChangeTarget) && (enemy == null || (EClass.rnd(5) == 0 && Dist(c) <= 1)) && ((!IsPCFaction && !IsPCFactionMinion) || (!c.IsPCFaction && !c.IsPCFactionMinion)) && (hostility != Hostility.Enemy || c.hostility != Hostility.Enemy) && (!c.IsPC || hostility < Hostility.Neutral))
5828 {
5829 SetEnemy(c);
5830 }
5831 }
5832
5833 private void GoHostile(Card _tg)
5834 {
5835 if (enemy == null && !IsPC)
5836 {
5837 if (GetInt(106) == 0)
5838 {
5839 TalkTopic("aggro");
5840 }
5841 if (OriginalHostility != Hostility.Enemy)
5842 {
5843 ShowEmo(Emo.angry);
5844 }
5845 SetEnemy(_tg.Chara);
5846 }
5847 if (!IsPCFaction && !IsPCFactionMinion && (_tg.IsPCFaction || _tg.IsPCFactionMinion))
5848 {
5849 if (hostility >= Hostility.Neutral)
5850 {
5851 Say("angry", this);
5852 }
5853 hostility = Hostility.Enemy;
5854 }
5855 }
5856
5857 public void DoHostileAction(Card _tg, bool immediate = false)
5858 {
5859 if (_tg == null || !_tg.isChara)
5860 {
5861 return;
5862 }
5863 Chara chara = _tg.Chara;
5864 if (chara.IsPC)
5865 {
5866 EClass.pc.combatCount = 10;
5867 }
5868 if (!chara.IsAliveInCurrentZone || !IsAliveInCurrentZone || chara == this)
5869 {
5870 return;
5871 }
5872 if ((IsPCFaction || IsPCFactionMinion) && (chara.IsPCFaction || chara.IsPCFactionMinion))
5873 {
5874 chara.Say("frown", this, chara);
5875 }
5876 else
5877 {
5878 if (EClass._zone.IsRegion)
5879 {
5880 return;
5881 }
5882 if (IsPC)
5883 {
5884 if (chara.IsFriendOrAbove() && !immediate)
5885 {
5886 chara.Say("frown", this, chara);
5887 chara.ShowEmo(Emo.sad);
5888 chara.hostility = Hostility.Neutral;
5889 return;
5890 }
5891 if (!chara.IsPCFaction && chara.hostility >= Hostility.Neutral && !EClass._zone.IsPCFaction)
5892 {
5893 bool flag = chara.id == "fanatic";
5894 if (EClass.rnd(4) == 0 || flag)
5895 {
5896 chara.Say("callHelp", chara);
5897 chara.CallHelp(this, flag);
5898 }
5899 }
5900 if (chara.hostility <= Hostility.Enemy)
5901 {
5902 foreach (Chara member in EClass.pc.party.members)
5903 {
5904 if (member != EClass.pc && member.enemy == null && member.CanSee(chara))
5905 {
5906 member.SetEnemy(chara);
5907 }
5908 }
5909 }
5910 }
5911 else if (chara.IsPC && hostility <= Hostility.Enemy)
5912 {
5913 foreach (Chara member2 in EClass.pc.party.members)
5914 {
5915 if (member2 != EClass.pc && member2.enemy == null && member2.CanSee(this))
5916 {
5917 member2.SetEnemy(this);
5918 }
5919 }
5920 }
5921 if (chara.calmCheckTurn <= 0 || IsPC)
5922 {
5923 chara.calmCheckTurn = (IsPC ? (20 + EClass.rnd(30)) : (10 + EClass.rnd(10)));
5924 }
5925 if (hostility != Hostility.Enemy || chara.hostility != Hostility.Enemy)
5926 {
5927 GoHostile(chara);
5928 chara.GoHostile(this);
5929 if (base.isHidden && !chara.CanSee(this) && !chara.IsDisabled && !chara.IsPCParty && !chara.IsPCPartyMinion && EClass.rnd(10 + Dist(chara) * 10) == 0)
5930 {
5931 Thing t = ThingGen.Create("49");
5932 ActThrow.Throw(chara, pos, t);
5933 Act.TC = chara;
5934 }
5935 }
5936 }
5937 }
5938
5939 public void CallHelp(Chara tg, bool fanatic = false)
5940 {
5941 foreach (Chara chara in EClass._map.charas)
5942 {
5943 if (!chara.IsPCFaction && chara.OriginalHostility == OriginalHostility && (fanatic || Dist(chara) <= 6) && (EClass.rnd(3) != 0 || fanatic))
5944 {
5945 chara.GoHostile(tg);
5946 }
5947 }
5948 }
5949
5950 public bool FindNewEnemy()
5951 {
5952 if (EClass._zone.isPeace && base.IsPCFactionOrMinion && !IsPC)
5953 {
5954 return false;
5955 }
5956 if (enemy != null && !enemy.IsAliveInCurrentZone)
5957 {
5958 enemy = null;
5959 }
5960 if (enemy != null)
5961 {
5962 return false;
5963 }
5964 if (IsPCParty && EClass.pc.isHidden && base.isHidden)
5965 {
5966 return false;
5967 }
5968 bool flag = enemy != null || ai is GoalCombat;
5969 int num = (base.PER + Evalue(210) * 2) * ((!flag) ? 1 : 2);
5970 bool flag2 = IsPCParty && !IsPC && EClass.game.config.tactics.dontWander;
5971 bool flag3 = !IsPCParty;
5972 Chara chara = null;
5973 int num2 = 9999;
5974 for (int i = 0; i < EClass._map.charas.Count; i++)
5975 {
5976 Chara chara2 = EClass._map.charas[i];
5977 if (chara2 == this || !IsHostile(chara2) || !CanSee(chara2))
5978 {
5979 continue;
5980 }
5981 int num3 = Dist(chara2);
5982 int num4 = GetSightRadius() + (flag ? 1 : 0);
5983 if (num3 > num4)
5984 {
5985 continue;
5986 }
5987 if (flag3 && EClass.rnd(chara2.Evalue(152) + 5) * (100 + num3 * num3 * 10) / 100 > EClass.rnd(num))
5988 {
5989 if (this == pos.FirstChara)
5990 {
5991 chara2.ModExp(152, Mathf.Clamp((num - chara2.Evalue(152)) / 2, 1, Mathf.Max(30 - stealthSeen * 2, 1)));
5992 }
5993 stealthSeen++;
5994 }
5995 else if (CanSeeLos(chara2) && (!flag2 || EClass.pc.isBlind || EClass.pc.CanSeeLos(chara2)) && (!IsPCFaction || EClass.pc.ai.ShouldAllyAttack(chara2)))
5996 {
5997 if (!IsPCParty)
5998 {
5999 DoHostileAction(chara2);
6000 enemy = chara2;
6001 return true;
6002 }
6003 if (num3 < num2)
6004 {
6005 num2 = num3;
6006 chara = chara2;
6007 }
6008 }
6009 }
6010 if (chara != null)
6011 {
6012 DoHostileAction(chara);
6013 enemy = chara;
6014 return true;
6015 }
6016 return false;
6017 }
6018
6020 {
6021 for (int i = 0; i < EClass._map.charas.Count; i++)
6022 {
6023 Chara chara = EClass._map.charas[i];
6024 if (chara != this && chara != enemy && IsHostile(chara) && Dist(chara) <= 1 && CanInteractTo(chara.pos))
6025 {
6026 DoHostileAction(chara);
6027 enemy = chara;
6028 return true;
6029 }
6030 }
6031 return false;
6032 }
6033
6034 public bool IsHostile()
6035 {
6036 return hostility <= Hostility.Enemy;
6037 }
6038
6039 public bool IsHostile(Chara c)
6040 {
6041 if (c == null)
6042 {
6043 return false;
6044 }
6045 if (base.IsPCFactionOrMinion)
6046 {
6047 if ((c == EClass.pc.enemy && !c.IsPCFactionOrMinion) || c.hostility <= Hostility.Enemy)
6048 {
6049 return true;
6050 }
6051 }
6052 else
6053 {
6054 if (trait is TraitGuard && c.IsPCParty && EClass.player.IsCriminal && EClass._zone.instance == null)
6055 {
6056 return true;
6057 }
6058 if (OriginalHostility >= Hostility.Friend)
6059 {
6060 if (c.hostility <= Hostility.Enemy && c.OriginalHostility == Hostility.Enemy)
6061 {
6062 return true;
6063 }
6064 }
6065 else if (OriginalHostility <= Hostility.Enemy && (c.IsPCFactionOrMinion || (c.OriginalHostility != Hostility.Enemy && c.hostility >= Hostility.Friend)))
6066 {
6067 return true;
6068 }
6069 }
6070 return false;
6071 }
6072
6073 public bool IsNeutral()
6074 {
6075 return hostility == Hostility.Neutral;
6076 }
6077
6078 public bool IsNeutralOrAbove()
6079 {
6080 return hostility >= Hostility.Neutral;
6081 }
6082
6083 public bool IsBranchMember()
6084 {
6085 if (faction == EClass.Home)
6086 {
6087 return homeZone == EClass.game.activeZone;
6088 }
6089 return false;
6090 }
6091
6092 public bool IsHomeMember()
6093 {
6094 return faction == EClass.Home;
6095 }
6096
6097 public bool IsInHomeZone()
6098 {
6099 return EClass.game.activeZone == currentZone;
6100 }
6101
6102 public bool IsInSpot<T>() where T : TraitSpot
6103 {
6104 foreach (T item in EClass._map.props.installed.traits.List<T>())
6105 {
6106 foreach (Point item2 in item.ListPoints())
6107 {
6108 if (pos.Equals(item2))
6109 {
6110 return true;
6111 }
6112 }
6113 }
6114 return false;
6115 }
6116
6117 public bool IsGuest()
6118 {
6119 return memberType == FactionMemberType.Guest;
6120 }
6121
6122 public bool IsFriendOrAbove()
6123 {
6124 return hostility >= Hostility.Friend;
6125 }
6126
6127 public bool IsFriendOrAbove(Chara c)
6128 {
6129 if (base.IsPCFactionOrMinion || IsFriendOrAbove())
6130 {
6132 {
6133 return true;
6134 }
6135 }
6136 else if (IsHostile() && c.IsHostile())
6137 {
6138 return true;
6139 }
6140 return false;
6141 }
6142
6144 {
6145 CardRenderer cardRenderer = renderer;
6146 CharaRenderer charaRenderer = new CharaRenderer();
6147 if (race.id == "spider" && source.tiles.Length > 1)
6148 {
6149 base.idSkin = (EClass.core.config.game.antiSpider ? 1 : 0);
6150 }
6151 if (host != null)
6152 {
6153 charaRenderer.pccData = PCCData.Create("ride");
6154 string idPart = base.c_idRidePCC.IsEmpty(EClass.core.pccs.sets["ride"].map["body"].map.Keys.First());
6155 charaRenderer.pccData.SetPart("body", "ride", idPart);
6156 charaRenderer.pccData.ride = EClass.core.pccs.GetRideData(idPart);
6157 }
6158 else
6159 {
6160 foreach (Condition condition in conditions)
6161 {
6162 RendererReplacer rendererReplacer = condition.GetRendererReplacer();
6163 if (rendererReplacer != null)
6164 {
6165 charaRenderer.replacer = rendererReplacer;
6166 charaRenderer.data = rendererReplacer.data;
6167 break;
6168 }
6169 }
6170 if (charaRenderer.replacer == null)
6171 {
6172 charaRenderer.pccData = pccData;
6173 }
6174 }
6175 renderer = charaRenderer;
6176 renderer.SetOwner(this);
6177 if (cardRenderer != null)
6178 {
6179 renderer.SetFirst(first: false, cardRenderer.position);
6180 }
6181 return charaRenderer;
6182 }
6183
6184 public void SetPCCState(PCCState state)
6185 {
6186 if (IsPCC)
6187 {
6188 PCC.Get(pccData).Build(state);
6189 }
6190 }
6191
6192 public override Sprite GetSprite(int dir = 0)
6193 {
6194 if (IsPCC)
6195 {
6196 PCC pCC = PCC.Get(pccData);
6197 pCC.Build();
6198 return pCC.variation.idle[0, 0];
6199 }
6200 if (spriteReplacer != null)
6201 {
6202 return spriteReplacer.data.GetSprite();
6203 }
6204 return sourceCard.GetSprite(0, (sourceCard._tiles.Length > 1) ? ((base.idSkin != 0 || source.staticSkin) ? base.idSkin : (base.uid % sourceCard._tiles.Length / 2 * 2 + ((!base.IsMale) ? 1 : 0))) : 0);
6205 }
6206
6207 public void SetTempHand(int right = 0, int left = 0)
6208 {
6209 if (IsPC && !IsPC)
6210 {
6211 pccData.tempRight = EClass.scene.screenElin.renderTempEQ.ConvertTile(right);
6212 pccData.tempLeft = EClass.scene.screenElin.renderTempEQ.ConvertTile(left);
6213 }
6214 }
6215
6216 public override SubPassData GetSubPassData()
6217 {
6218 if (IsPCC)
6219 {
6220 if (IsDeadOrSleeping || (!EClass.player.altHeldPos && parent is Chara))
6221 {
6223 }
6224 }
6225 else if (conSleep != null && host == null && pos.Equals(EClass.pc.pos) && IsHuman && GetBool(123))
6226 {
6227 return EClass.setting.pass.subDead;
6228 }
6229 return SubPassData.Default;
6230 }
6231
6232 public override void SetRenderParam(RenderParam p)
6233 {
6234 p.mat = base.material;
6235 p.matColor = base.colorInt;
6236 if (!renderer.usePass)
6237 {
6238 return;
6239 }
6240 if (renderer.replacer != null)
6241 {
6242 p.tile = renderer.replacer.tile * ((!flipX) ? 1 : (-1));
6243 }
6244 else if (source._tiles_snow.Length != 0 && EClass._zone.IsSnowCovered)
6245 {
6246 if (source._tiles_snow.Length > 1)
6247 {
6248 int num = ((base.idSkin != 0 || source.staticSkin) ? base.idSkin : (base.uid % source._tiles_snow.Length / 2 * 2 + ((!base.IsMale) ? 1 : 0)));
6249 p.tile = source._tiles_snow[(num < source._tiles_snow.Length) ? num : 0] * ((!flipX) ? 1 : (-1));
6250 }
6251 else
6252 {
6253 p.tile = source._tiles_snow[0] * ((!flipX) ? 1 : (-1));
6254 }
6255 }
6256 else if (sourceCard._tiles.Length > 1)
6257 {
6258 int num2 = ((base.idSkin != 0 || source.staticSkin) ? base.idSkin : (base.uid % sourceCard._tiles.Length / 2 * 2 + ((!base.IsMale) ? 1 : 0)));
6259 p.tile = sourceCard._tiles[(num2 >= 0 && num2 < sourceCard._tiles.Length) ? num2 : 0] * ((!flipX) ? 1 : (-1));
6260 }
6261 else
6262 {
6263 p.tile = sourceCard._tiles[0] * ((!flipX) ? 1 : (-1));
6264 }
6265 p.dir = base.dir;
6266 }
6267
6268 public override string GetHoverText()
6269 {
6270 string text = base.Name;
6271 if (IsFriendOrAbove())
6272 {
6273 text = text.TagColor(EClass.Colors.colorFriend);
6274 }
6275 else if (IsHostile())
6276 {
6277 text = text.TagColor(EClass.Colors.colorHostile);
6278 }
6279 int num = 2;
6280 int lV = EClass.pc.LV;
6281 if (base.LV >= lV * 5)
6282 {
6283 num = 0;
6284 }
6285 else if (base.LV >= lV * 2)
6286 {
6287 num = 1;
6288 }
6289 else if (base.LV <= lV / 4)
6290 {
6291 num = 4;
6292 }
6293 else if (base.LV <= lV / 2)
6294 {
6295 num = 3;
6296 }
6297 string text2 = Lang.GetList("lvComparison")[num];
6298 text2 = (" (" + text2 + ") ").TagSize(14).TagColor(EClass.Colors.gradientLVComparison.Evaluate(0.25f * (float)num));
6299 string s = (IsFriendOrAbove() ? "HostilityAlly" : (IsNeutral() ? "HostilityNeutral" : "HostilityEnemy"));
6300 s = (" (" + s.lang() + ") ").TagSize(14);
6301 s = "";
6302 if (memberType == FactionMemberType.Guest)
6303 {
6304 s += (" (" + "guest".lang() + ") ").TagSize(14);
6305 }
6306 else if (memberType == FactionMemberType.Livestock)
6307 {
6308 s += (" (" + "livestock".lang() + ") ").TagSize(14);
6309 }
6310 if (!EClass.pc.IsMoving)
6311 {
6312 if (EClass.pc.HasHigherGround(this))
6313 {
6314 text2 += "lowerGround".lang();
6315 }
6316 else if (HasHigherGround(EClass.pc))
6317 {
6318 text2 += "higherGround".lang();
6319 }
6320 }
6321 if (Evalue(1232) > 0)
6322 {
6323 text2 = "milkBaby".lang().TagSize(14) + text2;
6324 }
6325 if (Guild.Fighter.ShowBounty(this) && Guild.Fighter.HasBounty(this))
6326 {
6327 text2 = "hasBounty".lang().TagSize(14) + text2;
6328 }
6329 if (EClass.pc.HasElement(481))
6330 {
6331 text2 += ("(" + faith.Name + ")").TagSize(14);
6332 }
6333 return text + text2 + s;
6334 }
6335
6336 public override string GetHoverText2()
6337 {
6338 string text = "";
6339 if (knowFav)
6340 {
6341 text += Environment.NewLine;
6342 text = text + "<size=14>" + "favgift".lang(GetFavCat().GetName().ToLower(), GetFavFood().GetName()) + "</size>";
6343 }
6344 string text2 = "";
6346 {
6347 text2 += Environment.NewLine;
6348 text2 = text2 + "Lv:" + base.LV + " HP:" + base.hp + "/" + MaxHP + " MP:" + mana.value + "/" + mana.max + " DV:" + DV + " PV:" + PV + " Hunger:" + hunger.value;
6349 text2 += Environment.NewLine;
6350 text2 = text2 + "Global:" + IsGlobal + " AI:" + ai?.ToString() + " " + source.tactics.IsEmpty(EClass.sources.tactics.map.TryGetValue(id)?.id ?? EClass.sources.tactics.map.TryGetValue(job.id)?.id ?? "predator");
6351 text2 += Environment.NewLine;
6352 text2 = text2 + base.uid + IsMinion + "/" + base.c_uidMaster + "/" + master;
6353 text2 = text2 + " dir:" + base.dir + " skin:" + base.idSkin;
6354 }
6355 if (EClass.pc.held?.trait is TraitWhipLove && IsPCFaction)
6356 {
6357 text2 += Environment.NewLine;
6358 text2 += "<size=14>";
6359 foreach (Hobby item in ListWorks())
6360 {
6361 text2 = text2 + item.Name + ", ";
6362 }
6363 foreach (Hobby item2 in ListHobbies())
6364 {
6365 text2 = text2 + item2.Name + ", ";
6366 }
6367 text2 = text2.TrimEnd(", ".ToCharArray()) + "</size>";
6368 }
6369 string text3 = "";
6370 IEnumerable<BaseStats> enumerable = conditions.Concat((!IsPCFaction) ? new BaseStats[0] : new BaseStats[2] { hunger, stamina });
6371 if (enumerable.Count() > 0)
6372 {
6373 text3 += Environment.NewLine;
6374 text3 += "<size=14>";
6375 int num = 0;
6376 foreach (BaseStats item3 in enumerable)
6377 {
6378 string text4 = item3.GetPhaseStr();
6379 if (text4.IsEmpty() || text4 == "#")
6380 {
6381 continue;
6382 }
6383 Color c = Color.white;
6384 switch (item3.source.group)
6385 {
6386 case "Bad":
6387 case "Debuff":
6388 case "Disease":
6390 break;
6391 case "Buff":
6393 break;
6394 }
6396 {
6397 text4 = text4 + "(" + item3.GetValue() + ")";
6398 if (resistCon != null && resistCon.ContainsKey(item3.id))
6399 {
6400 text4 = text4 + "{" + resistCon[item3.id] + "}";
6401 }
6402 }
6403 num++;
6404 text3 = text3 + text4.TagColor(c) + ", ";
6405 }
6406 if (num == 0)
6407 {
6408 text3 = "";
6409 }
6410 else
6411 {
6412 text = "";
6413 text3 = text3.TrimEnd(", ".ToCharArray()) + "</size>";
6414 }
6415 }
6417 {
6418 text3 += Environment.NewLine;
6419 foreach (ActList.Item item4 in ability.list.items)
6420 {
6421 text3 = text3 + item4.act.Name + ", ";
6422 }
6423 text3 = text3.TrimEnd(", ".ToCharArray());
6424 }
6425 return text + text2 + text3;
6426 }
6427
6428 public string GetTopicText(string topic = "calm")
6429 {
6430 string key = source.idText.IsEmpty(id);
6431 if (id == "littleOne" && EClass._zone is Zone_LittleGarden)
6432 {
6433 key = "littleOne2";
6434 }
6435 SourceCharaText.Row row = EClass.sources.charaText.map.TryGetValue(key);
6436 if (row == null)
6437 {
6438 return null;
6439 }
6440 string text = row.GetText(topic, returnNull: true);
6441 if (text.IsEmpty())
6442 {
6443 return null;
6444 }
6445 if (text.StartsWith("@"))
6446 {
6447 row = EClass.sources.charaText.map.TryGetValue(text.Replace("@", ""));
6448 if (row == null)
6449 {
6450 return null;
6451 }
6452 text = row.GetText(topic, returnNull: true);
6453 if (text.IsEmpty())
6454 {
6455 return null;
6456 }
6457 }
6458 return text.Split(Environment.NewLine.ToCharArray()).RandomItem();
6459 }
6460
6461 public string TalkTopic(string topic = "calm")
6462 {
6463 if (host == null && !IsInActiveZone)
6464 {
6465 return null;
6466 }
6467 if (!isSynced && (host == null || !host.isSynced) && topic != "dead")
6468 {
6469 return null;
6470 }
6471 if (IsPCParty)
6472 {
6473 int num = EClass.pc.party.members.Count - 1;
6474 switch (topic)
6475 {
6476 case "calm":
6477 if (EClass.rnd(num * 5) != 0)
6478 {
6479 return null;
6480 }
6481 break;
6482 case "aggro":
6483 if (EClass.rnd(num * 10) != 0)
6484 {
6485 return null;
6486 }
6487 break;
6488 case "kill":
6489 if (EClass.rnd(num * 3) != 0)
6490 {
6491 return null;
6492 }
6493 break;
6494 case "fov":
6495 return null;
6496 }
6497 }
6498 string topicText = GetTopicText(topic);
6499 if (topicText.IsEmpty())
6500 {
6501 return null;
6502 }
6503 string text = "_bracketTalk".lang();
6504 bool flag = topicText.StartsWith("*");
6505 bool flag2 = topicText.StartsWith("(");
6506 bool flag3 = topicText.StartsWith(text) || (topicText.Length > 0 && topicText[0] == text[0]) || topicText[0] == '“';
6507 topicText = ApplyTone(topicText);
6508 topicText = topicText.Replace("~", "*");
6509 Msg.SetColor(flag2 ? Msg.colors.Thinking : (flag3 ? Msg.colors.Talk : Msg.colors.Ono));
6510 Msg.Say(topicText.Replace("&", ""));
6511 if (topic == "dead")
6512 {
6513 EClass.ui.popGame.PopText(ApplyNewLine(topicText.StripBrackets()), null, "PopTextDead", default(Color), pos.Position() + EClass.setting.render.tc.textPosDead);
6514 }
6515 else if (flag || flag3 || flag2)
6516 {
6517 (host ?? this).renderer.Say(ApplyNewLine(topicText.StripBrackets()), default(Color), IsPCParty ? 0.6f : 0f);
6518 }
6519 return topicText;
6520 }
6521
6522 public override Sprite GetImageSprite()
6523 {
6524 return GetSprite();
6525 }
6526
6528 {
6529 memberType = type;
6530 }
6531
6532 public void ShowDialog()
6533 {
6534 Zone_Nymelle zone_Nymelle = EClass._zone as Zone_Nymelle;
6535 if (conSuspend != null && IsPCParty)
6536 {
6537 RemoveCondition<ConSuspend>();
6538 }
6539 if (IsDeadOrSleeping)
6540 {
6541 ShowDialog("_chara", "sleep");
6542 }
6543 else if (base.isRestrained)
6544 {
6545 ShowDialog("_chara", "strain");
6546 }
6547 else if (EClass.pc.isHidden && !CanSee(EClass.pc))
6548 {
6549 ShowDialog("_chara", "invisible");
6550 }
6551 else if (IsEscorted())
6552 {
6553 ShowDialog("_chara", "escort");
6554 }
6555 else if (EClass._zone is Zone_Music)
6556 {
6557 ShowDialog("_chara", "party");
6558 }
6559 else
6560 {
6561 if (LayerDrama.forceJump == null && EClass.game.quests.OnShowDialog(this))
6562 {
6563 return;
6564 }
6565 switch (id)
6566 {
6567 case "loytel":
6568 {
6570 {
6571 EClass.game.quests.Get("pre_debt_runaway").Complete();
6572 EClass.player.flags.loytelEscaped = false;
6573 EClass.game.quests.Add("debt", "loytel");
6574 ShowDialog("loytel", "loytelEscaped");
6575 return;
6576 }
6577 QuestDebt questDebt = EClass.game.quests.Get<QuestDebt>();
6578 if (questDebt != null && questDebt.paid)
6579 {
6580 questDebt.stage++;
6581 if (questDebt.stage > 7)
6582 {
6583 questDebt.stage = 7;
6584 }
6585 ShowDialog("loytel", "debt" + questDebt.stage);
6586 return;
6587 }
6588 break;
6589 }
6590 case "farris":
6591 if (EClass._zone.id == "startVillage" || EClass._zone.id == "startVillage3")
6592 {
6593 ShowDialog("_chara");
6594 return;
6595 }
6596 switch (EClass.game.quests.GetPhase<QuestExploration>())
6597 {
6598 case -1:
6599 ShowDialog("farris", "nymelle_noQuest");
6600 break;
6601 case 0:
6602 ShowDialog("farris", "nymelle_first");
6603 break;
6604 case 1:
6605 ShowDialog("farris", "home_first");
6606 break;
6607 default:
6608 ShowDialog("_chara");
6609 break;
6610 }
6611 return;
6612 case "ashland":
6613 if (zone_Nymelle != null && zone_Nymelle.IsCrystalLv)
6614 {
6615 SoundManager.ForceBGM();
6616 LayerDrama.ActivateMain("mono", "nymelle_crystal");
6617 }
6618 else
6619 {
6620 ShowDialog("ashland");
6621 }
6622 return;
6623 case "fiama":
6624 if (zone_Nymelle != null && zone_Nymelle.IsCrystalLv)
6625 {
6626 SoundManager.ForceBGM();
6627 LayerDrama.ActivateMain("mono", "nymelle_crystal");
6628 }
6630 {
6632 {
6633 EClass.player.flags.fiamaFirstDream = true;
6634 ShowDialog("fiama", "firstDream");
6635 }
6637 {
6638 ShowDialog("fiama", "giveStoryBook").SetOnKill(delegate
6639 {
6640 EClass.player.flags.fiamaStoryBookGiven = true;
6641 EClass.player.DropReward(ThingGen.Create("book_story"));
6642 });
6643 }
6644 else
6645 {
6646 ShowDialog("fiama");
6647 }
6648 }
6649 else
6650 {
6651 ShowDialog("fiama");
6652 }
6653 return;
6654 case "big_sister":
6656 {
6657 ShowDialog("big_sister", "little_saved");
6658 EClass.player.flags.little_saved = false;
6659 return;
6660 }
6662 {
6663 ShowDialog("big_sister", "little_dead");
6664 EClass.player.flags.little_killed = false;
6665 return;
6666 }
6667 break;
6668 }
6669 if (trait is TraitGuildDoorman)
6670 {
6671 string tag = ((trait is TraitDoorman_Fighter) ? "fighter" : ((trait is TraitDoorman_Mage) ? "mage" : "thief"));
6672 ShowDialog("guild_doorman", "main", tag);
6673 return;
6674 }
6675 if (trait is TraitGuildClerk)
6676 {
6677 string tag2 = ((trait is TraitClerk_Fighter) ? "fighter" : ((trait is TraitClerk_Mage) ? "mage" : "thief"));
6678 ShowDialog("guild_clerk", "main", tag2);
6679 return;
6680 }
6681 bool flag = true;
6682 if (id == "parttimer_jure" && (!EClass._zone.IsFestival || !(EClass._zone is Zone_Noyel) || EClass.pc.faith == EClass.game.religions.Healing))
6683 {
6684 flag = false;
6685 }
6686 if (flag && File.Exists(CorePath.DramaData + id + ".xlsx"))
6687 {
6688 ShowDialog(id);
6689 }
6690 else
6691 {
6692 ShowDialog("_chara");
6693 }
6694 }
6695 }
6696
6697 public LayerDrama ShowDialog(string book, string step = "main", string tag = "")
6698 {
6699 return _ShowDialog(book, null, step, tag);
6700 }
6701
6702 private LayerDrama _ShowDialog(string book, string sheet, string step = "main", string tag = "")
6703 {
6704 EClass.Sound.Play("pop_drama");
6705 if (book == "_chara" && IsPC)
6706 {
6707 step = "pc";
6708 }
6709 return LayerDrama.Activate(book, sheet, step, this, null, tag);
6710 }
6711
6713 {
6714 return (ai.IsRunning ? ai.GetDestination() : pos).Copy();
6715 }
6716
6717 public int GetHireCost()
6718 {
6719 return base.LV / 2 + 4;
6720 }
6721
6722 public int GetHappiness()
6723 {
6724 int num = 50;
6725 if (FindBed() != null)
6726 {
6727 num += 50;
6728 }
6729 return num;
6730 }
6731
6732 public string GetTextHappiness()
6733 {
6734 return GetHappiness().ToString() ?? "";
6735 }
6736
6737 public string GetActionText()
6738 {
6739 string result = "?????";
6740 if (ai != null)
6741 {
6742 result = ai.GetCurrentActionText();
6743 }
6744 return result;
6745 }
6746
6747 public override void WriteNote(UINote n, Action<UINote> onWriteNote = null, IInspect.NoteMode mode = IInspect.NoteMode.Default, Recipe recipe = null)
6748 {
6749 n.Clear();
6750 UIItem uIItem = n.AddHeaderCard(base.Name.ToTitleCase());
6751 SetImage(uIItem.image2);
6752 uIItem.text2.SetText(race.GetText().ToTitleCase(wholeText: true) + " " + job.GetText().ToTitleCase(wholeText: true));
6753 n.AddText("");
6754 n.Build();
6755 }
6756
6758 {
6759 switch (m)
6760 {
6761 case UIList.SortMode.ByJob:
6762 sortVal = job._index * 10000 + sourceCard._index;
6763 break;
6764 case UIList.SortMode.ByRace:
6765 sortVal = race._index * 10000 * ((!IsHuman) ? 1 : (-1)) + sourceCard._index;
6766 break;
6767 case UIList.SortMode.ByFeat:
6768 sortVal = -GetTotalFeat();
6769 break;
6770 default:
6771 sortVal = sourceCard._index * ((!IsHuman) ? 1 : (-1));
6772 break;
6773 case UIList.SortMode.ByWorkk:
6774 break;
6775 }
6776 }
6777
6778 public void ClearBed(Map map = null)
6779 {
6780 if (map == null)
6781 {
6782 map = EClass._map;
6783 }
6784 foreach (Card item in map.props.installed.all)
6785 {
6786 if (item.trait is TraitBed traitBed && traitBed.IsHolder(this))
6787 {
6788 traitBed.RemoveHolder(this);
6789 }
6790 }
6791 }
6792
6794 {
6795 foreach (Card item in EClass._map.props.installed.all)
6796 {
6797 if (item.trait is TraitBed traitBed && traitBed.IsHolder(this))
6798 {
6799 return traitBed;
6800 }
6801 }
6802 return null;
6803 }
6804
6806 {
6807 if (!IsPCFaction && !IsGuest())
6808 {
6809 return null;
6810 }
6811 foreach (Card item in EClass._map.props.installed.all)
6812 {
6813 if (item.trait is TraitBed traitBed && traitBed.CanAssign(this))
6814 {
6815 traitBed.AddHolder(this);
6816 Msg.Say("claimBed", this);
6817 return traitBed;
6818 }
6819 }
6820 return null;
6821 }
6822
6823 public void TryPutSharedItems(IEnumerable<Thing> containers, bool msg = true)
6824 {
6825 if (GetInt(113) != 0)
6826 {
6827 return;
6828 }
6829 _ListItems.Clear();
6830 Thing bestRangedWeapon = GetBestRangedWeapon();
6831 foreach (Thing thing in things)
6832 {
6833 if (!thing.IsAmmo)
6834 {
6835 if (thing.category.slot != 0 && !thing.isEquipped && !thing.HasTag(CTAG.gift))
6836 {
6837 _ListItems.Add(thing);
6838 }
6839 else if (thing.IsRangedWeapon && thing.category.slot == 0 && bestRangedWeapon != thing)
6840 {
6841 _ListItems.Add(thing);
6842 }
6843 }
6844 }
6845 if (_ListItems.Count == 0)
6846 {
6847 return;
6848 }
6849 List<Thing> containers2 = containers.ToList();
6850 foreach (Thing listItem in _ListItems)
6851 {
6852 EClass._zone.TryAddThingInSharedContainer(listItem, containers2, add: true, msg: true, this);
6853 }
6854 }
6855
6856 public void TryPutSharedItems(bool msg = true)
6857 {
6858 TryPutSharedItems(EClass._map.props.installed.containers);
6859 }
6860
6861 public void TryTakeSharedItems(bool msg = true)
6862 {
6863 TryTakeSharedItems(EClass._map.props.installed.containers);
6864 }
6865
6866 public void TryTakeSharedItems(IEnumerable<Thing> containers, bool msg = true, bool shouldEat = true)
6867 {
6868 if (base.isSummon || (memberType == FactionMemberType.Livestock && homeBranch != null && !homeBranch.policies.IsActive(2715)))
6869 {
6870 return;
6871 }
6872 int num = 2;
6873 int num2 = 2;
6874 bool flag = GetInt(113) == 0;
6875 int num3 = 2;
6876 int num4 = 2;
6877 int num5 = 2;
6878 if (homeBranch != null && homeBranch.HasItemProtection && !IsPCParty)
6879 {
6880 num4 = 0;
6881 num5 = 0;
6882 }
6883 foreach (Thing thing3 in things)
6884 {
6885 if (CanEat(thing3, shouldEat))
6886 {
6887 num -= thing3.Num;
6888 }
6889 if (thing3.trait.GetHealAction(this) != null)
6890 {
6891 num2 -= thing3.Num;
6892 }
6893 if (thing3.id == "polish_powder")
6894 {
6895 num3 -= thing3.Num;
6896 }
6897 if (thing3.trait is TraitBlanketColdproof)
6898 {
6899 num4 -= thing3.Num;
6900 }
6901 if (thing3.trait is TraitBlanketFireproof)
6902 {
6903 num5 -= thing3.Num;
6904 }
6905 }
6906 _ListItems.Clear();
6907 foreach (Thing container in containers)
6908 {
6909 if (!container.IsSharedContainer)
6910 {
6911 continue;
6912 }
6913 foreach (Thing thing4 in container.things)
6914 {
6915 if (!thing4.c_isImportant && thing4.IsIdentified)
6916 {
6917 if (num3 > 0 && thing4.id == "polish_powder")
6918 {
6919 _ListItems.Add(thing4);
6920 num3 -= thing4.Num;
6921 }
6922 else if (num4 > 0 && !HasElement(1236) && thing4.trait is TraitBlanketColdproof)
6923 {
6924 _ListItems.Add(thing4);
6925 num4 -= thing4.Num;
6926 }
6927 else if (num5 > 0 && thing4.trait is TraitBlanketFireproof)
6928 {
6929 _ListItems.Add(thing4);
6930 num5 -= thing4.Num;
6931 }
6932 else if (num > 0 && CanEat(thing4, shouldEat) && !thing4.c_isImportant)
6933 {
6934 _ListItems.Add(thing4);
6935 num -= thing4.Num;
6936 }
6937 else if (num2 > 0 && thing4.trait.GetHealAction(this) != null)
6938 {
6939 _ListItems.Add(thing4);
6940 num2 -= thing4.Num;
6941 }
6942 else if (flag && thing4.IsEquipmentOrRanged && !thing4.HasTag(CTAG.gift) && ShouldEquip(thing4, useFav: true))
6943 {
6944 _ListItems.Add(thing4);
6945 }
6946 }
6947 }
6948 }
6949 if (_ListItems.Count == 0)
6950 {
6951 return;
6952 }
6953 _ListItems.ForeachReverse(delegate(Thing t)
6954 {
6955 if (t.IsEquipmentOrRanged)
6956 {
6957 bool flag3 = false;
6958 int slot = t.category.slot;
6959 int equipValue = t.GetEquipValue();
6960 foreach (Thing listItem in _ListItems)
6961 {
6962 if (listItem.category.slot == slot && listItem.GetEquipValue() > equipValue)
6963 {
6964 flag3 = true;
6965 break;
6966 }
6967 }
6968 if (flag3)
6969 {
6970 _ListItems.Remove(t);
6971 }
6972 }
6973 });
6974 bool flag2 = false;
6975 foreach (Thing listItem2 in _ListItems)
6976 {
6977 Thing thing = listItem2;
6978 if (things.IsFull(thing))
6979 {
6980 break;
6981 }
6982 Thing thing2 = listItem2.parent as Thing;
6983 if (thing.Num > 2)
6984 {
6985 thing = thing.Split(2);
6986 }
6987 if (msg)
6988 {
6989 Say("takeSharedItem", this, thing, thing2.GetName(NameStyle.Full));
6990 }
6991 AddCard(thing);
6992 if (ShouldEquip(thing, useFav: true) && thing.category.slot != 0)
6993 {
6994 TryEquip(thing, useFav: true);
6995 flag2 = true;
6996 }
6997 }
6998 if (flag2 && flag)
6999 {
7000 TryPutSharedItems(containers);
7001 }
7002 }
7003
7005 {
7006 Thing result = null;
7007 int num = -1;
7008 if (IsPC)
7009 {
7010 return null;
7011 }
7012 foreach (Thing item in things.List((Thing t) => CanEat(t, shouldEat: true) && !t.c_isImportant, onlyAccessible: true))
7013 {
7014 int num2 = CountNumEaten(item);
7015 int num3 = 100 - num2;
7016 if (num3 > num)
7017 {
7018 result = item;
7019 num = num3;
7020 }
7021 }
7022 return result;
7023 }
7024
7025 public void InstantEat(Thing t = null, bool sound = true)
7026 {
7027 if (t == null)
7028 {
7029 t = FindBestFoodToEat();
7030 }
7031 if (t == null)
7032 {
7033 t = things.Find((Thing a) => CanEat(a, shouldEat: true) && !a.c_isImportant);
7034 }
7035 if (t == null)
7036 {
7037 t = things.Find((Thing a) => CanEat(a) && !a.c_isImportant);
7038 }
7039 if (t != null)
7040 {
7041 Say("eat_start", this, t.Duplicate(1));
7042 if (sound)
7043 {
7044 PlaySound("eat");
7045 }
7046 FoodEffect.Proc(this, t);
7047 t.ModNum(-1);
7048 }
7049 }
7050
7051 public bool CanEat(Thing t, bool shouldEat = false)
7052 {
7053 if (t.IsDecayed && !HasElement(480))
7054 {
7055 return false;
7056 }
7057 if (shouldEat && (!(t.trait is TraitFoodPrepared) || t.c_isImportant))
7058 {
7059 return false;
7060 }
7061 if (!t.IsNegativeGift && !t.HasTag(CTAG.ignoreUse) && !t.isEquipped)
7062 {
7063 return t.trait.CanEat(this);
7064 }
7065 return false;
7066 }
7067
7068 public bool ShouldEquip(Thing t, bool useFav = false)
7069 {
7070 if (t.IsRangedWeapon && t.category.slot == 0)
7071 {
7072 if (!CanEquipRanged(t))
7073 {
7074 return false;
7075 }
7076 int num = 0;
7077 foreach (Thing thing in things)
7078 {
7079 if (thing.IsRangedWeapon)
7080 {
7081 if (thing.category.slot != 0 && thing.isEquipped)
7082 {
7083 return false;
7084 }
7085 if (CanEquipRanged(thing) && thing.GetEquipValue() > num)
7086 {
7087 num = thing.GetEquipValue();
7088 }
7089 }
7090 }
7091 if (t.GetEquipValue() > num)
7092 {
7093 return true;
7094 }
7095 return false;
7096 }
7097 BodySlot bodySlot = body.GetSlot(t);
7098 if (bodySlot == null)
7099 {
7100 return false;
7101 }
7102 if (useFav)
7103 {
7104 switch (GetFavAttackStyle())
7105 {
7106 case AttackStyle.Default:
7107 case AttackStyle.TwoHand:
7108 if (t.IsMeleeWeapon)
7109 {
7110 bodySlot = body.slotMainHand;
7111 }
7112 else if (bodySlot.elementId == 35)
7113 {
7114 return false;
7115 }
7116 break;
7117 case AttackStyle.Shield:
7118 if (t.IsMeleeWeapon)
7119 {
7120 bodySlot = body.slotMainHand;
7121 }
7122 else if (bodySlot.elementId == 35 && t.IsMeleeWeapon)
7123 {
7124 return false;
7125 }
7126 break;
7127 case AttackStyle.TwoWield:
7128 if (bodySlot.elementId == 35 && !t.IsMeleeWeapon)
7129 {
7130 return false;
7131 }
7132 break;
7133 }
7134 }
7135 if (!body.IsEquippable(t, bodySlot, text: false))
7136 {
7137 return false;
7138 }
7139 if (bodySlot.thing != null && (bodySlot.thing.blessedState <= BlessedState.Cursed || bodySlot.thing.GetEquipValue() >= t.GetEquipValue()))
7140 {
7141 return false;
7142 }
7143 if (t.HasTag(CTAG.gift))
7144 {
7145 return false;
7146 }
7147 return true;
7148 }
7149
7150 public bool TryEquip(Thing t, bool useFav = false)
7151 {
7152 if (!ShouldEquip(t, useFav))
7153 {
7154 return false;
7155 }
7156 if (t.category.slot == 0)
7157 {
7158 return false;
7159 }
7160 if (useFav)
7161 {
7162 BodySlot slot = body.GetSlot(t);
7163 switch (GetFavAttackStyle())
7164 {
7165 case AttackStyle.Default:
7166 case AttackStyle.TwoHand:
7167 if (t.IsMeleeWeapon)
7168 {
7169 slot = body.slotMainHand;
7170 }
7171 break;
7172 case AttackStyle.Shield:
7173 if (t.IsMeleeWeapon)
7174 {
7175 slot = body.slotMainHand;
7176 }
7177 break;
7178 }
7179 body.Equip(t, slot);
7180 }
7181 else
7182 {
7183 body.Equip(t);
7184 }
7185 Say("equip", this, t);
7186 return true;
7187 }
7188
7189 public bool CanEquipRanged(Thing t)
7190 {
7191 return !body.IsTooHeavyToEquip(t);
7192 }
7193
7195 {
7196 Thing dest = null;
7197 if (IsPC)
7198 {
7200 {
7201 return FindThrowable(hotbar: true);
7202 }
7203 return null;
7204 }
7205 things.Foreach(delegate(Thing t)
7206 {
7207 if (t.HasTag(CTAG.throwWeapon) || (!base.IsPCFactionOrMinion && t.HasTag(CTAG.throwWeaponEnemy)))
7208 {
7209 dest = t;
7210 }
7211 });
7212 return dest;
7213 Thing FindThrowable(bool hotbar)
7214 {
7215 things.Foreach(delegate(Thing t)
7216 {
7217 if (dest == null)
7218 {
7219 if (t.IsHotItem)
7220 {
7221 if (!hotbar)
7222 {
7223 return;
7224 }
7225 }
7226 else if (hotbar)
7227 {
7228 return;
7229 }
7230 if (t.HasTag(CTAG.throwWeapon))
7231 {
7232 dest = t;
7233 }
7234 }
7235 });
7236 return dest;
7237 }
7238 }
7239
7241 {
7242 TraitToolRange ranged = weapon.trait as TraitToolRange;
7243 Thing thing = (IsPC ? EClass.pc.things.Find<TraitQuiver>() : null);
7244 if (thing != null)
7245 {
7246 Thing thing2 = thing.things.Find((Thing t) => ranged.IsAmmo(t));
7247 if (thing2 != null)
7248 {
7249 return thing2;
7250 }
7251 }
7252 return things.Find((Thing t) => ranged.IsAmmo(t));
7253 }
7254
7256 {
7257 Thing result = null;
7258 int num = 0;
7259 foreach (Thing thing in things)
7260 {
7261 if (thing.IsRangedWeapon && CanEquipRanged(thing) && thing.GetEquipValue() > num)
7262 {
7263 num = thing.GetEquipValue();
7264 result = thing;
7265 }
7266 }
7267 return result;
7268 }
7269
7270 public bool TryEquipRanged()
7271 {
7272 if (IsPC)
7273 {
7275 if (thing?.trait is TraitToolRange && CanEquipRanged(thing))
7276 {
7277 ranged = thing;
7278 return true;
7279 }
7280 return false;
7281 }
7282 if (ranged != null && ranged.parent == this)
7283 {
7284 return true;
7285 }
7286 ranged = GetBestRangedWeapon();
7287 return ranged != null;
7288 }
7289
7290 public override int GetArmorSkill()
7291 {
7292 if (body.GetWeight(armorOnly: true) <= 30000)
7293 {
7294 return 120;
7295 }
7296 return 122;
7297 }
7298
7299 public bool TryUse(Thing t)
7300 {
7301 if (t.id == "338")
7302 {
7303 Thing thing = things.Find((Thing a) => a.IsEquipmentOrRanged && !a.isAcidproof);
7304 if (thing != null)
7305 {
7306 Say("dip", this, thing, t.GetName(NameStyle.Full, 1));
7307 SE.Change();
7308 t.trait.OnBlend(thing, this);
7309 return true;
7310 }
7311 return false;
7312 }
7313 if (t.IsNegativeGift || t.source.HasTag(CTAG.ignoreUse))
7314 {
7315 return false;
7316 }
7317 if (t.id == "cigar")
7318 {
7319 (t.trait as TraitItemProc).OnUse(this);
7320 return true;
7321 }
7322 if (t.trait.CanEat(this) && hunger.GetPhase() > ((IsPCFaction || IsPCFactionMinion) ? 2 : 0))
7323 {
7324 SetAIImmediate(new AI_Eat
7325 {
7326 target = t
7327 });
7328 return true;
7329 }
7330 if (t.trait.CanDrink(this))
7331 {
7332 Drink(t);
7333 return true;
7334 }
7335 if (t.trait.CanRead(this))
7336 {
7337 SetAIImmediate(new AI_Read
7338 {
7339 target = t
7340 });
7341 return true;
7342 }
7343 if (base.hp < MaxHP * 90 / 100)
7344 {
7345 Action healAction = t.trait.GetHealAction(this);
7346 if (healAction != null)
7347 {
7348 healAction();
7349 return true;
7350 }
7351 }
7352 return false;
7353 }
7354
7356 {
7357 return FindBed()?.owner.pos.cell.room;
7358 }
7359
7360 public void ModAffinity(Chara c, int a, bool show = true, bool showOnlyEmo = false)
7361 {
7362 if (c == this)
7363 {
7364 return;
7365 }
7366 if (IsPC)
7367 {
7368 c.ModAffinity(EClass.pc, a, show);
7369 return;
7370 }
7371 int num = StatsHygiene.GetAffinityMod(EClass.pc.hygiene.GetPhase()) + (HasElement(417) ? 30 : 0) + (EClass.pc.HasCondition<ConSmoking>() ? (-30) : 0);
7372 if (IsPCFaction && homeBranch != null)
7373 {
7374 num += (int)Mathf.Sqrt(homeBranch.Evalue(2117)) * 5;
7375 }
7376 bool flag = a > 0;
7377 if (flag)
7378 {
7379 a = a * num / 100;
7380 }
7381 if (show)
7382 {
7383 if (a == 0)
7384 {
7385 if (!showOnlyEmo)
7386 {
7387 Say("affinityNone", this, c);
7388 }
7389 }
7390 else
7391 {
7392 ShowEmo((!flag) ? Emo.angry : Emo.love);
7393 c.ShowEmo(flag ? Emo.love : Emo.sad);
7394 if (!showOnlyEmo)
7395 {
7396 Say(flag ? "affinityPlus" : "affinityMinus", this, c);
7397 }
7398 }
7399 }
7400 if (c.IsPC)
7401 {
7402 a = affinity.Mod(a);
7403 }
7404 }
7405
7406 public bool TryIdentify(Thing t, int count = 1, bool show = true)
7407 {
7408 int num = Evalue(289);
7409 if (num == 0)
7410 {
7411 return false;
7412 }
7413 int lV = t.LV;
7414 if (EClass.rnd(num * num + 5) > EClass.rnd(lV * lV) * 20)
7415 {
7416 t.Identify(show, (num >= 20) ? IDTSource.SkillHigh : IDTSource.Skill);
7417 int num2 = 50;
7418 if (lV > num)
7419 {
7420 num2 += (lV - num) * 10;
7421 }
7422 elements.ModExp(289, Mathf.Min(num2, 1000));
7423 return true;
7424 }
7425 return false;
7426 }
7427
7429 {
7430 Chara chara = CharaGen.Create(id);
7431 chara.c_originalHostility = base.c_originalHostility;
7432 if (chara.c_originalHostility != 0)
7433 {
7434 chara.hostility = chara.c_originalHostility;
7435 }
7436 if (orgPos != null)
7437 {
7438 chara.orgPos = orgPos.Copy();
7439 }
7440 chara.pos = pos.Copy();
7441 chara.isImported = true;
7442 chara.c_editorTags = base.c_editorTags;
7443 chara.c_editorTraitVal = base.c_editorTraitVal;
7444 chara.c_idTrait = base.c_idTrait;
7445 chara.homeZone = homeZone;
7446 return chara;
7447 }
7448
7450 {
7451 if (_listFavFood.Count == 0)
7452 {
7453 foreach (SourceThing.Row row in EClass.sources.things.rows)
7454 {
7455 if (row._origin == "dish" && row.value != 0)
7456 {
7457 _listFavFood.Add(row);
7458 }
7459 }
7460 }
7461 SourceThing.Row r = null;
7462 Rand.UseSeed(base.uid + EClass.game.seed, delegate
7463 {
7464 r = _listFavFood.RandomItem();
7465 });
7466 return r;
7467 }
7468
7470 {
7471 SourceCategory.Row r = null;
7472 if (_listFavCat.Count == 0)
7473 {
7474 foreach (SourceCategory.Row row in EClass.sources.categories.rows)
7475 {
7476 if (row.gift > 0)
7477 {
7478 _listFavCat.Add(row);
7479 }
7480 }
7481 }
7482 Rand.UseSeed(base.uid + EClass.game.seed, delegate
7483 {
7484 r = _listFavCat.RandomItem();
7485 });
7486 return r;
7487 }
7488
7489 public int GetTotalFeat()
7490 {
7491 int num = 0;
7492 if (base.c_upgrades != null)
7493 {
7494 num += base.c_upgrades.spent;
7495 }
7496 if (base.c_genes != null)
7497 {
7498 num += base.c_genes.GetTotalCost();
7499 }
7500 return num + base.feat;
7501 }
7502
7503 public bool CanInsult()
7504 {
7505 foreach (ActList.Item item in ability.list.items)
7506 {
7507 if (item.act.id == 6630)
7508 {
7509 return true;
7510 }
7511 }
7512 return false;
7513 }
7514
7515 public string GetIdPortraitCat()
7516 {
7517 string text = race.id;
7518 if ((text == "mifu" || text == "nefu") && EClass.rnd(2) == 0)
7519 {
7520 return "foxfolk";
7521 }
7522 if (trait is TraitGuard)
7523 {
7524 return "guard";
7525 }
7526 return "";
7527 }
7528
7529 public string GetIdPortrait()
7530 {
7531 if (id == "olderyoungersister")
7532 {
7533 if (base.idSkin != 2)
7534 {
7535 return "UN_olderyoungersister";
7536 }
7537 return "UN_olderyoungersister_alt";
7538 }
7539 if (Portrait.allIds.Contains("UN_" + id + ".png"))
7540 {
7541 return "UN_" + id;
7542 }
7543 return base.c_idPortrait;
7544 }
7545
7546 public Thing MakeGene(DNA.Type? type = null)
7547 {
7548 return DNA.GenerateGene(this, type);
7549 }
7550
7552 {
7553 return DNA.GenerateGene(this, DNA.Type.Brain);
7554 }
7555
7556 public void OnInsulted()
7557 {
7558 if (!isDead)
7559 {
7560 if (HasElement(1231))
7561 {
7562 Talk("insulted");
7563 AddCondition<ConEuphoric>(100 * Evalue(1231));
7564 }
7565 else if (EClass.rnd(20) == 0)
7566 {
7567 SetFeat(1231, 1, msg: true);
7568 }
7569 }
7570 }
7571
7572 public bool IsValidGiftWeight(Card t, int num = -1)
7573 {
7574 int num2 = ((!HasElement(1411)) ? 1 : 3);
7575 if (GetBurden(t, num) >= num2)
7576 {
7577 return false;
7578 }
7579 return true;
7580 }
7581
7582 public bool CanAcceptItem(Card t, int num = -1)
7583 {
7584 if (EClass.debug.enable)
7585 {
7586 return true;
7587 }
7588 if (!IsValidGiftWeight(t, num))
7589 {
7590 return false;
7591 }
7592 if (t.c_isImportant)
7593 {
7594 return false;
7595 }
7596 if ((t.category.IsChildOf("furniture") || t.category.IsChildOf("junk")) && !HasElement(1411))
7597 {
7598 return false;
7599 }
7600 return true;
7601 }
7602
7603 public bool CanAcceptGift(Chara c, Card t)
7604 {
7605 if (things.IsFull())
7606 {
7607 return false;
7608 }
7609 if (t.c_isImportant)
7610 {
7611 return false;
7612 }
7613 if (t.id == "1084")
7614 {
7615 return true;
7616 }
7617 if (t.trait is TraitBookSecret)
7618 {
7619 return true;
7620 }
7621 if (t.trait.CanOnlyCarry || !t.trait.CanBeDestroyed || t.trait.CanExtendBuild || t.rarity == Rarity.Artifact || t.IsContainer)
7622 {
7623 return false;
7624 }
7625 return true;
7626 }
7627
7628 public void GiveGift(Chara c, Thing t)
7629 {
7630 if (c.IsHostile() || c.IsDeadOrSleeping)
7631 {
7632 Msg.Say("affinityNone", c, this);
7633 return;
7634 }
7635 if (!t.isCopy && t.IsCursed && t.IsEquipmentOrRanged && !t.IsAmmo && c.HasElement(1414))
7636 {
7637 bool num = t.blessedState == BlessedState.Doomed;
7638 int num2 = 200 + t.LV * 3;
7639 if (t.rarity == Rarity.Legendary)
7640 {
7641 num2 *= 3;
7642 }
7643 if (t.rarity >= Rarity.Mythical)
7644 {
7645 num2 *= 5;
7646 }
7647 if (num)
7648 {
7649 num2 *= 2;
7650 }
7651 EClass.pc.PlayEffect("identify");
7652 EClass.pc.PlaySound("identify");
7653 c.PlayEffect("mutation");
7654 c.Say("draw_curse", c, t);
7655 t.Destroy();
7656 List<Element> list = new List<Element>();
7657 foreach (Element value in EClass.pc.elements.dict.Values)
7658 {
7659 if (value is Spell)
7660 {
7661 list.Add(value);
7662 }
7663 }
7664 if (list.Count == 0)
7665 {
7667 return;
7668 }
7669 Element element = list.RandomItem();
7670 EClass.pc.ModExp(element.id, num2);
7671 EClass.pc.Say("draw_curse2", EClass.pc, element.Name);
7672 c.AddExp(Mathf.Min(num2 / 3, c.ExpToNext));
7673 return;
7674 }
7675 if ((t.id == "lovepotion" || t.id == "dreambug") && !Application.isEditor)
7676 {
7677 GiveLovePotion(c, t);
7678 return;
7679 }
7680 if (t.trait is TraitErohon && c.id == t.c_idRefName)
7681 {
7682 c.OnGiveErohon(t);
7683 return;
7684 }
7685 if (t.trait is TraitTicketMassage)
7686 {
7687 t.ModNum(-1);
7688 c.Talk("ticket");
7689 switch (t.id)
7690 {
7691 case "ticket_massage":
7692 c.ModAffinity(EClass.pc, 10);
7694 {
7695 target = c
7696 });
7697 break;
7698 case "ticket_armpillow":
7699 c.ModAffinity(EClass.pc, 20);
7700 EClass.pc.AddCondition<ConSleep>(300, force: true);
7701 c.SetAI(new AI_ArmPillow
7702 {
7703 target = EClass.pc
7704 });
7705 break;
7706 case "ticket_champagne":
7707 c.ModAffinity(EClass.pc, 10);
7709 break;
7710 }
7711 return;
7712 }
7713 if (t.id == "flyer")
7714 {
7715 stamina.Mod(-1);
7716 if (c.things.Find((Thing a) => a.id == "flyer") != null)
7717 {
7718 c.Talk("flyer_miss");
7719 DoHostileAction(c);
7720 return;
7721 }
7722 if (EClass.rnd(20) != 0 && c.CHA > EClass.rnd(base.CHA + Evalue(291) * 3 + 10))
7723 {
7724 Msg.Say("affinityNone", c, this);
7725 t.Destroy();
7726 elements.ModExp(291, 10);
7727 return;
7728 }
7729 elements.ModExp(291, 50);
7730 }
7731 if (t.id == "statue_weird")
7732 {
7733 EClass.pc.Say("statue_sell");
7734 }
7735 t.isGifted = true;
7736 c.nextUse = c.affinity.OnGift(t);
7737 if (!t.isDestroyed)
7738 {
7739 EClass.game.quests.list.ForeachReverse(delegate(Quest q)
7740 {
7741 q.OnGiveItem(c, t);
7742 });
7743 if (c.TryEquip(t))
7744 {
7745 c.nextUse = null;
7746 }
7747 }
7748 }
7749
7750 public void OnGiveErohon(Thing t)
7751 {
7752 Say("give_erohon", this);
7753 AddCondition<ConParalyze>(50, force: true);
7754 AddCondition<ConConfuse>(50, force: true);
7755 AddCondition<ConFear>(1000, force: true);
7756 ModAffinity(EClass.pc, 100);
7757 t.Destroy();
7758 Talk("pervert");
7759 }
7760
7761 public void GiveLovePotion(Chara c, Thing t)
7762 {
7763 c.Say("give_love", c, t);
7764 c.PlaySound(t.material.GetSoundDead());
7765 c.ShowEmo(Emo.angry);
7766 c.ModAffinity(EClass.pc, -20, show: false);
7767 c.Talk("pervert");
7768 t.Destroy();
7769 }
7770
7771 public void RequestProtection(Chara attacker, Action<Chara> action)
7772 {
7773 if (HasCondition<StanceTaunt>() || base.isRestrained || attacker == this || (host != null && host.isRestrained) || (base.IsPCFactionOrMinion && attacker.IsPCFactionOrMinion))
7774 {
7775 return;
7776 }
7777 bool flag = false;
7778 foreach (Chara chara in EClass._map.charas)
7779 {
7780 if (chara == attacker || chara.enemy == this || chara == this || chara.host != null || chara.IsDisabled || !chara.IsFriendOrAbove(this) || chara.conSuspend != null || (chara.IsPCParty && !IsPCParty) || (IsPCFaction && !chara.IsPCFaction) || (attacker.IsPCFactionOrMinion && chara.IsPCFactionOrMinion))
7781 {
7782 continue;
7783 }
7784 bool flag2 = chara.HasElement(1225);
7785 if ((!flag2 && (flag || EClass.rnd(2) == 0 || !chara.HasCondition<StanceTaunt>())) || chara.HasCooldown(1225))
7786 {
7787 continue;
7788 }
7789 int num = Mathf.Max(chara.Evalue(1649), (!chara.IsPC) ? ((!flag2) ? 1 : 3) : 0);
7790 int num2 = Dist(chara);
7791 if (num2 > 25)
7792 {
7793 continue;
7794 }
7795 if (num2 > num || !chara.CanSeeLos(pos, num2))
7796 {
7797 if (!flag2)
7798 {
7799 continue;
7800 }
7801 if (Dist(chara) < 5)
7802 {
7803 chara.GoHostile(attacker);
7804 chara.SetEnemy(attacker);
7805 attacker.SetEnemy(chara);
7806 continue;
7807 }
7808 Point nearestPoint = pos.GetNearestPoint(allowBlock: false, allowChara: false, allowInstalled: true, ignoreCenter: true);
7809 if (!nearestPoint.IsValid)
7810 {
7811 continue;
7812 }
7813 chara.Teleport(nearestPoint);
7814 chara.AddCooldown(1225, 10);
7815 num2 = Dist(chara);
7816 Say("intercept_loyal", chara, this);
7817 chara.SetEnemy(attacker);
7818 attacker.SetEnemy(chara);
7819 if (num2 > num || !chara.CanSeeLos(pos, num2))
7820 {
7821 continue;
7822 }
7823 }
7824 if (!flag && !HasElement(1225))
7825 {
7826 Say("intercept", chara, this);
7827 if (EClass.rnd(10) == 0)
7828 {
7829 chara.Talk("intercept", base.NameSimple);
7830 }
7831 if (attacker.enemy == this)
7832 {
7833 attacker.SetEnemy(chara);
7834 }
7835 action(chara);
7836 flag = true;
7837 }
7838 }
7839 }
7840
7842 {
7843 if (IsPCFaction)
7844 {
7845 if (t.IsFood && t.category.id != "fish" && !t.IsDecayed)
7846 {
7847 return false;
7848 }
7849 if (t.trait.GetHealAction(this) != null)
7850 {
7851 return false;
7852 }
7853 if (t.IsThrownWeapon || t.IsRangedWeapon || t.IsAmmo)
7854 {
7855 return false;
7856 }
7857 if (t.trait is TraitBlanket || t.trait is TraitItemProc || t.trait is TraitBookSkill)
7858 {
7859 return false;
7860 }
7861 }
7862 if (t.isEquipped || t.rarity >= Rarity.Legendary || !t.trait.CanBeDestroyed)
7863 {
7864 return false;
7865 }
7866 if (t.trait is TraitCurrency || t.trait is TraitTool)
7867 {
7868 return false;
7869 }
7870 switch (type)
7871 {
7872 case ClearInventoryType.SellAtTown:
7873 if (!t.isGifted && !t.isNPCProperty)
7874 {
7875 return false;
7876 }
7877 break;
7878 case ClearInventoryType.Purge:
7879 switch (t.category.id)
7880 {
7881 case "fish":
7882 if (EClass.rnd(3) == 0)
7883 {
7884 return true;
7885 }
7886 break;
7887 case "junk":
7888 case "garbage":
7889 if (EClass.rnd(3) != 0)
7890 {
7891 return true;
7892 }
7893 break;
7894 }
7895 if (t.id == "flyer")
7896 {
7897 return true;
7898 }
7899 if (!t.IsDecayed && EClass.rnd(3) == 0)
7900 {
7901 return false;
7902 }
7903 if (!things.IsFull() && t.IsRangedWeapon)
7904 {
7905 return false;
7906 }
7907 break;
7908 }
7909 return true;
7910 }
7911
7913 {
7914 int num = 0;
7915 for (int num2 = things.Count - 1; num2 >= 0; num2--)
7916 {
7917 Thing thing = things[num2];
7918 if (ShouldThrowAway(thing, type))
7919 {
7920 num += thing.GetPrice(CurrencyType.Money, sell: true, PriceType.Default, this) * thing.Num;
7921 thing.Destroy();
7922 }
7923 }
7924 if (num > 0)
7925 {
7926 ModCurrency(num);
7927 if (type == ClearInventoryType.SellAtTown)
7928 {
7929 Msg.Say("party_sell", this, num.ToString() ?? "");
7930 PlaySound("pay");
7931 }
7932 }
7933 }
7934
7935 public void ResetUpgrade()
7936 {
7937 _ = base.c_upgrades;
7938 }
7939
7940 public void TryUpgrade(bool msg = true)
7941 {
7942 if (!EClass.debug.enable || IsPC || !IsGlobal || !IsPCFaction)
7943 {
7944 return;
7945 }
7946 for (int i = 0; i < 100; i++)
7947 {
7948 if (base.feat == 0)
7949 {
7950 break;
7951 }
7952 if (base.c_upgrades == null)
7953 {
7954 base.c_upgrades = new CharaUpgrade();
7955 }
7956 if (base.c_upgrades.halt)
7957 {
7958 break;
7959 }
7960 Rand.SetSeed(base.uid + base.c_upgrades.count);
7961 int num = EClass.rnd(100);
7962 int num2 = 0;
7963 int num3 = 1;
7964 int num4 = 0;
7965 bool flag = false;
7966 IEnumerable<SourceElement.Row> ie = EClass.sources.elements.rows.Where((SourceElement.Row a) => !elements.Has(a) && a.category == "skill" && !a.tag.Contains("noPet"));
7967 List<Element> list = ListAvailabeFeats(pet: true);
7968 if (num >= 90 && list.Count > 0)
7969 {
7970 Element element = list.RandomItem();
7971 num2 = element.id;
7972 num4 = element.CostLearn;
7973 }
7974 else if (num >= 60 && ie.Any())
7975 {
7976 num2 = ie.RandomItem().id;
7977 num4 = 3;
7978 }
7979 else
7980 {
7981 num2 = Element.List_MainAttributesMajor.RandomItem();
7982 num4 = 1;
7983 num3 = 2;
7984 flag = true;
7985 }
7986 Rand.SetSeed();
7987 if (num4 > base.feat)
7988 {
7989 break;
7990 }
7991 base.feat -= num4;
7992 base.c_upgrades.count++;
7993 base.c_upgrades.spent += num4;
7994 bool flag2 = false;
7995 if (flag)
7996 {
7997 foreach (CharaUpgrade.Item item in base.c_upgrades.items)
7998 {
7999 if (item.idEle == num2)
8000 {
8001 item.value += num3;
8002 item.cost += num4;
8003 flag2 = true;
8004 break;
8005 }
8006 }
8007 }
8008 if (!flag2)
8009 {
8010 base.c_upgrades.items.Add(new CharaUpgrade.Item
8011 {
8012 idEle = num2,
8013 value = num3,
8014 cost = num4
8015 });
8016 }
8017 SourceElement.Row row = EClass.sources.elements.map[num2];
8018 if (row.category == "feat")
8019 {
8020 SetFeat(num2, elements.ValueWithoutLink(num2) + 1, msg: true);
8021 }
8022 else if (elements.ValueWithoutLink(row.id) == 0)
8023 {
8024 elements.Learn(row.id);
8025 }
8026 else
8027 {
8028 elements.ModBase(num2, num3);
8029 }
8030 }
8031 }
8032
8033 public void AddCooldown(int idEle, int turns = 0)
8034 {
8035 if (_cooldowns == null)
8036 {
8037 _cooldowns = new List<int>();
8038 }
8039 if (turns != 0)
8040 {
8041 _cooldowns.Add(idEle * 1000 + turns);
8042 return;
8043 }
8044 SourceElement.Row row = EClass.sources.elements.map[idEle];
8045 if (row.cooldown > 0)
8046 {
8047 _cooldowns.Add(idEle * 1000 + row.cooldown);
8048 }
8049 }
8050
8051 public bool HasCooldown(int idEle)
8052 {
8053 if (_cooldowns != null)
8054 {
8055 for (int i = 0; i < _cooldowns.Count; i++)
8056 {
8057 if (_cooldowns[i] / 1000 == idEle)
8058 {
8059 return true;
8060 }
8061 }
8062 }
8063 return false;
8064 }
8065
8066 public void TickCooldown()
8067 {
8068 for (int num = _cooldowns.Count - 1; num >= 0; num--)
8069 {
8070 if (_cooldowns[num] % 1000 == 1)
8071 {
8072 _cooldowns.RemoveAt(num);
8073 }
8074 else
8075 {
8076 _cooldowns[num]--;
8077 }
8078 }
8079 if (_cooldowns.Count == 0)
8080 {
8081 _cooldowns = null;
8082 }
8083 }
8084
8085 public void ChooseNewGoal()
8086 {
8087 if (IsPC && EClass.AdvMode)
8088 {
8089 SetNoGoal();
8090 return;
8091 }
8092 if (IsPCParty || base.noMove)
8093 {
8094 SetAI(new GoalIdle());
8095 return;
8096 }
8097 if ((IsHomeMember() && IsInHomeZone()) || IsGuest())
8098 {
8099 Goal goalFromTimeTable = GetGoalFromTimeTable(EClass.world.date.hour);
8100 if (goalFromTimeTable != null)
8101 {
8102 SetAI(goalFromTimeTable);
8103 if (goalFromTimeTable is GoalWork)
8104 {
8105 goalFromTimeTable.Tick();
8106 }
8107 return;
8108 }
8109 }
8110 if (goalList.index == -2)
8111 {
8112 goalList.Refresh(this, goalListType);
8113 }
8114 SetAI(goalList.Next());
8115 }
8116
8118 {
8119 if (IsPC)
8120 {
8121 return null;
8122 }
8123 switch (TimeTable.GetSpan(idTimeTable, hour))
8124 {
8125 case TimeTable.Span.Sleep:
8126 if (sleepiness.value > 10 || EClass._zone.isSimulating)
8127 {
8128 return new GoalSleep();
8129 }
8130 break;
8131 case TimeTable.Span.Eat:
8132 return new GoalIdle();
8133 case TimeTable.Span.Work:
8134 if (IsGuest())
8135 {
8136 return new GoalIdle();
8137 }
8138 return GetGoalWork();
8139 case TimeTable.Span.Free:
8140 if (IsGuest())
8141 {
8142 return new GoalIdle();
8143 }
8144 return GetGoalHobby();
8145 }
8146 return null;
8147 }
8148
8150 {
8151 if (IsPrisoner)
8152 {
8153 return new GoalIdle();
8154 }
8155 if (memberType == FactionMemberType.Livestock)
8156 {
8157 return new GoalGraze();
8158 }
8159 return new GoalWork();
8160 }
8161
8163 {
8164 if (IsPrisoner)
8165 {
8166 return new GoalIdle();
8167 }
8168 if (memberType == FactionMemberType.Livestock)
8169 {
8170 return new GoalGraze();
8171 }
8172 return new GoalHobby();
8173 }
8174
8175 public void SetAIIdle()
8176 {
8177 }
8178
8179 public void SetAIAggro()
8180 {
8181 SetAI(new GoalCombat());
8182 }
8183
8185 {
8186 return SetAI(_NoGoalPC);
8187 }
8188
8190 {
8191 if (IsPC)
8192 {
8194 }
8195 if (ai.IsRunning)
8196 {
8197 if (ai == g && ai.IsNoGoal)
8198 {
8199 return g;
8200 }
8201 ai.Cancel();
8202 if (ai == g)
8203 {
8204 Debug.Log("goal is g:" + ai?.ToString() + "/" + this);
8205 return g;
8206 }
8207 }
8208 if (HasCondition<ConWait>())
8209 {
8210 RemoveCondition<ConWait>();
8211 }
8212 ai = g;
8213 ai.SetOwner(this);
8214 if (IsPC)
8215 {
8216 renderer.RefreshStateIcon();
8217 }
8218 return g;
8219 }
8220
8221 public void SetAIImmediate(AIAct g)
8222 {
8223 bool hasNoGoal = HasNoGoal;
8224 SetAI(g);
8225 if ((EClass.scene.actionMode != ActionMode.Sim || !EClass.scene.paused) && hasNoGoal && !(renderer as CharaRenderer).IsMoving)
8226 {
8227 Tick();
8228 }
8229 }
8230
8232 {
8233 BaseArea result = null;
8234 foreach (Hobby item in ListWorks())
8235 {
8236 AIWork aI = item.GetAI(this);
8237 if (aI.SetDestination())
8238 {
8239 if (aI.destArea != null)
8240 {
8241 result = aI.destArea;
8242 }
8243 else if (aI.destThing != null)
8244 {
8245 result = aI.destThing.pos.cell.room;
8246 }
8247 break;
8248 }
8249 }
8250 return result;
8251 }
8252
8253 public List<Hobby> ListWorks(bool useMemberType = true)
8254 {
8255 listHobby.Clear();
8256 if (useMemberType && memberType == FactionMemberType.Livestock)
8257 {
8258 listHobby.Add(new Hobby
8259 {
8260 id = 45
8261 });
8262 }
8263 else
8264 {
8265 if (_works == null)
8266 {
8267 RerollHobby();
8268 }
8269 foreach (int work in _works)
8270 {
8271 listHobby.Add(new Hobby
8272 {
8273 id = work
8274 });
8275 }
8276 }
8277 return listHobby;
8278 }
8279
8280 public List<Hobby> ListHobbies(bool useMemberType = true)
8281 {
8282 listHobby.Clear();
8283 if (!useMemberType || memberType != FactionMemberType.Livestock)
8284 {
8285 if (_hobbies == null)
8286 {
8287 RerollHobby();
8288 }
8289 foreach (int hobby in _hobbies)
8290 {
8291 listHobby.Add(new Hobby
8292 {
8293 id = hobby
8294 });
8295 }
8296 }
8297 return listHobby;
8298 }
8299
8300 public Hobby GetWork(string id)
8301 {
8302 foreach (Hobby item in ListWorks())
8303 {
8304 if (item.source.alias == id)
8305 {
8306 return item;
8307 }
8308 }
8309 foreach (Hobby item2 in ListHobbies())
8310 {
8311 if (item2.source.alias == id)
8312 {
8313 return item2;
8314 }
8315 }
8316 return null;
8317 }
8318
8319 public void RefreshWorkElements(ElementContainer parent = null)
8320 {
8321 if (workElements != null)
8322 {
8323 workElements.SetParent();
8324 }
8325 workElements = null;
8326 if (IsPCParty || homeBranch == null || homeBranch.owner == null)
8327 {
8328 return;
8329 }
8330 foreach (Hobby item in ListHobbies())
8331 {
8332 TryAdd(item);
8333 }
8334 foreach (Hobby item2 in ListWorks())
8335 {
8336 TryAdd(item2);
8337 }
8338 if (workElements != null)
8339 {
8340 workElements.SetParent(parent);
8341 }
8342 void TryAdd(Hobby h)
8343 {
8344 if (!h.source.elements.IsEmpty())
8345 {
8346 if (workElements == null)
8347 {
8348 workElements = new ElementContainer();
8349 }
8350 for (int i = 0; i < h.source.elements.Length; i += 2)
8351 {
8352 int num = h.source.elements[i];
8353 int num2 = h.source.elements[i + 1];
8354 int num3 = 100;
8355 if (num != 2115 && num != 2207)
8356 {
8357 num3 = h.GetEfficiency(this) * homeBranch.efficiency / 100;
8358 if (num3 <= 0)
8359 {
8360 continue;
8361 }
8362 }
8363 workElements.ModBase(num, (num2 < 0) ? (num2 / 10) : Mathf.Max(1, h.source.elements[i + 1] * num3 / 1000));
8364 }
8365 }
8366 }
8367 }
8368
8369 public string GetTextHobby(bool simple = false)
8370 {
8371 string text = (simple ? "" : ("hobby".lang() + ":"));
8372 foreach (Hobby item in ListHobbies())
8373 {
8374 text = text + " " + item.Name.TagColor((item.GetEfficiency(this) > 0) ? FontColor.Good : FontColor.Warning) + ",";
8375 }
8376 return text.TrimEnd(',');
8377 }
8378
8379 public string GetTextWork(bool simple = false)
8380 {
8381 string text = (simple ? "" : ("work".lang() + ":"));
8382 foreach (Hobby item in ListWorks())
8383 {
8384 text = text + " " + item.Name.TagColor((item.GetEfficiency(this) > 0) ? FontColor.Good : FontColor.Warning) + ",";
8385 }
8386 return text.TrimEnd(',');
8387 }
8388
8389 public void AddHobby(int id)
8390 {
8391 foreach (int hobby in _hobbies)
8392 {
8393 if (hobby == id)
8394 {
8395 return;
8396 }
8397 }
8398 _hobbies.Add(id);
8399 }
8400
8401 public void AddWork(int id)
8402 {
8403 foreach (int work in _works)
8404 {
8405 if (work == id)
8406 {
8407 return;
8408 }
8409 }
8410 _works.Add(id);
8411 }
8412
8413 public void RerollHobby(bool extraSlotChance = true)
8414 {
8415 if (_hobbies != null && _works != null)
8416 {
8417 _hobbies.Clear();
8418 _works.Clear();
8419 }
8420 else
8421 {
8422 _hobbies = new List<int>();
8423 _works = new List<int>();
8424 }
8425 if (source.hobbies.IsEmpty())
8426 {
8427 AddHobby(EClass.sources.hobbies.listHobbies.RandomItem().id);
8428 }
8429 else
8430 {
8431 string[] hobbies = source.hobbies;
8432 foreach (string key in hobbies)
8433 {
8434 AddHobby(EClass.sources.hobbies.alias[key].id);
8435 }
8436 }
8437 if (source.works.IsEmpty())
8438 {
8439 AddWork(EClass.sources.hobbies.listWorks.RandomItem().id);
8440 }
8441 else
8442 {
8443 string[] hobbies = source.works;
8444 foreach (string key2 in hobbies)
8445 {
8446 AddWork(EClass.sources.hobbies.alias[key2].id);
8447 }
8448 }
8449 GetWorkSummary().Reset();
8450 }
8451
8453 {
8454 if (_workSummary == null)
8455 {
8456 _workSummary = new WorkSummary();
8457 }
8458 return _workSummary;
8459 }
8460
8461 public void TickWork(VirtualDate date)
8462 {
8463 TimeTable.Span span = TimeTable.GetSpan(idTimeTable, date.hour);
8464 if (span != TimeTable.Span.Work && span != 0)
8465 {
8466 return;
8467 }
8468 WorkSummary workSummary = GetWorkSummary();
8469 if (span == TimeTable.Span.Work)
8470 {
8471 if (workSummary.work != null)
8472 {
8473 PerformWork(workSummary.work, isHobby: false, date.IsRealTime);
8474 }
8475 }
8476 else if (workSummary.hobbies.Count > 0)
8477 {
8478 PerformWork(workSummary.hobbies.RandomItem(), isHobby: true, date.IsRealTime);
8479 }
8480 }
8481
8482 public bool TryWorkOutside(SourceHobby.Row sourceWork)
8483 {
8484 if (EClass.world.date.IsExpired(GetInt(51)))
8485 {
8486 Expedition expedition = Expedition.Create(this, sourceWork.expedition.ToEnum<ExpeditionType>());
8487 SetInt(51, EClass.world.date.GetRaw() + 60 * (expedition.hours + 24));
8488 homeBranch.expeditions.Add(expedition);
8489 return true;
8490 }
8491 return false;
8492 }
8493
8494 public void PerformWork(WorkSession session, bool isHobby = false, bool IsRealTime = false)
8495 {
8496 Hobby hobby = new Hobby();
8497 hobby.id = session.id;
8498 WorkSummary workSummary = _workSummary;
8499 hobby.GetAI(this).OnPerformWork(IsRealTime);
8500 if (!isHobby)
8501 {
8502 workSummary.progress += EClass.rnd(5) + 5;
8503 }
8504 int num = PerformWork(hobby, 0, isHobby);
8505 int num2 = PerformWork(hobby, 1, isHobby);
8506 int num3 = PerformWork(hobby, 2, isHobby);
8507 int num4 = PerformWork(hobby, 3, isHobby);
8508 workSummary.money += num;
8509 workSummary.food += num2;
8510 workSummary.knowledge += num3;
8511 workSummary.material += num4;
8512 int PerformWork(Hobby work, int idx, bool isHobby)
8513 {
8514 if (idx >= work.source.resources.Length)
8515 {
8516 return 0;
8517 }
8518 int num5 = work.source.resources[idx];
8519 int num6 = num5;
8520 num5 = Rand.Range(num5 * (100 - work.source.resources[idx]) / 100, num5);
8521 num5 = num5 * (isHobby ? 50 : 100) * session.efficiency / 10000;
8522 if (num6 > 0 && num5 <= 0)
8523 {
8524 num5 = 1;
8525 }
8526 return num5;
8527 }
8528 }
8529
8530 public void ValidateWorks()
8531 {
8532 _goalWork.FindWork(this, setAI: false);
8533 _goalHobby.ValidateHobby(this);
8534 }
8535
8536 public void InitStats(bool onDeserialize = false)
8537 {
8538 if (!onDeserialize)
8539 {
8540 _cints[10] = 20;
8541 _cints[11] = 70;
8542 _cints[13] = 70;
8543 _cints[14] = 70;
8544 _cints[15] = 70;
8545 _cints[17] = 0;
8546 _cints[18] = 0;
8547 }
8548 foreach (Condition condition in conditions)
8549 {
8550 condition.SetOwner(this, onDeserialize);
8551 }
8552 }
8553
8554 public Condition AddCondition<T>(int p = 100, bool force = false) where T : Condition
8555 {
8556 return AddCondition(typeof(T).Name, p, force);
8557 }
8558
8559 public Condition AddCondition(string id, int p = 100, bool force = false)
8560 {
8561 return AddCondition(Condition.Create(id, p), force);
8562 }
8563
8564 public Condition AddCondition(Condition c, bool force = false)
8565 {
8566 c.owner = this;
8567 if (!(c is ConBurning))
8568 {
8569 if (c is ConBleed && ResistLv(964) >= 3)
8570 {
8571 return null;
8572 }
8573 }
8574 else if (ResistLv(950) >= 3)
8575 {
8576 return null;
8577 }
8578 if (c.GainResistFactor > 0 && CanGainConResist)
8579 {
8580 if (c.GainResistFactor >= 400)
8581 {
8582 c.power /= 2;
8583 }
8584 ResistCon(c);
8585 if (c.power <= 0)
8586 {
8587 return null;
8588 }
8589 }
8590 if (!force)
8591 {
8592 if (c.source.negate.Length != 0)
8593 {
8594 string[] negate = c.source.negate;
8595 foreach (string text in negate)
8596 {
8597 if (HasElement(text))
8598 {
8599 return null;
8600 }
8601 }
8602 }
8603 Element defenseAttribute = c.GetDefenseAttribute(this);
8604 if (defenseAttribute != null)
8605 {
8606 c.power = 100 * c.power / Mathf.Max(100 + defenseAttribute.Value, 1);
8607 }
8608 if (c.source.resistance.Length != 0)
8609 {
8610 int num = ResistLv(EClass.sources.elements.alias[c.source.resistance[0]].id);
8611 if (num > 0)
8612 {
8613 c.power /= num * num + 1;
8614 if (c.power <= 40)
8615 {
8616 return null;
8617 }
8618 }
8619 }
8620 c.power = c.EvaluatePower(c.power);
8621 if (c.power <= 0)
8622 {
8623 return null;
8624 }
8625 }
8626 for (int j = 0; j < conditions.Count; j++)
8627 {
8628 if (conditions[j].id != c.id)
8629 {
8630 continue;
8631 }
8632 if (c.Type == ConditionType.Stance || c.IsToggle)
8633 {
8634 conditions[j].Kill();
8635 return null;
8636 }
8637 if (conditions[j].CanStack(c))
8638 {
8639 if (conditions[j].WillOverride)
8640 {
8641 conditions[j].Kill(silent: true);
8642 continue;
8643 }
8644 if (CanGainConResist)
8645 {
8646 AddResistCon(c);
8647 }
8648 conditions[j].OnStacked(c.power);
8649 conditions[j].OnStartOrStack();
8650 conditions[j].PlayEffect();
8651 }
8652 if (!conditions[j].AllowMultipleInstance)
8653 {
8654 return null;
8655 }
8656 }
8657 foreach (Condition condition in conditions)
8658 {
8659 if (condition.TryNullify(c))
8660 {
8661 return null;
8662 }
8663 }
8664 int num2 = c.EvaluateTurn(c.power);
8665 if (num2 == 0)
8666 {
8667 return null;
8668 }
8669 c.value = num2;
8670 conditions.Add(c);
8671 if (CanGainConResist)
8672 {
8673 AddResistCon(c);
8674 }
8675 c.SetOwner(this);
8676 c.Start();
8677 SetDirtySpeed();
8678 if (c.ShouldRefresh)
8679 {
8680 Refresh();
8681 }
8682 if (c.CancelAI)
8683 {
8684 ai.Cancel();
8685 }
8686 if (IsPC && c.ConsumeTurn && !EClass.pc.isRestrained)
8687 {
8689 }
8690 if (c.SyncRide && (ride != null || parasite != null))
8691 {
8692 if (ride != null)
8693 {
8694 ride.AddCondition(Condition.Create(c.source.alias, c.power));
8695 }
8696 if (parasite != null)
8697 {
8698 parasite.AddCondition(Condition.Create(c.source.alias, c.power));
8699 }
8700 }
8701 return c;
8702 }
8703
8704 public override bool HasCondition<T>()
8705 {
8706 for (int i = 0; i < conditions.Count; i++)
8707 {
8708 if (conditions[i] is T)
8709 {
8710 return true;
8711 }
8712 }
8713 return false;
8714 }
8715
8716 public bool HasCondition(string alias)
8717 {
8718 for (int i = 0; i < conditions.Count; i++)
8719 {
8720 if (conditions[i].source.alias == alias)
8721 {
8722 return true;
8723 }
8724 }
8725 return false;
8726 }
8727
8728 public Element GetBuffStats(string alias)
8729 {
8730 return GetBuffStats(EClass.sources.elements.alias[alias].id);
8731 }
8732
8733 public Element GetBuffStats(int ele)
8734 {
8735 for (int i = 0; i < conditions.Count; i++)
8736 {
8737 if (conditions[i] is ConBuffStats conBuffStats && conBuffStats.refVal == ele)
8738 {
8739 return conBuffStats.elements.GetElement(ele);
8740 }
8741 }
8742 return null;
8743 }
8744
8745 public void CureCondition<T>(int v = 99999) where T : Condition
8746 {
8747 T condition = GetCondition<T>();
8748 if (condition != null)
8749 {
8750 condition.value -= v;
8751 if (condition.value <= 0)
8752 {
8753 condition.Kill();
8754 }
8755 }
8756 }
8757
8758 public T GetCondition<T>() where T : Condition
8759 {
8760 for (int i = 0; i < conditions.Count; i++)
8761 {
8762 if (conditions[i] is T)
8763 {
8764 return conditions[i] as T;
8765 }
8766 }
8767 return null;
8768 }
8769
8770 public void RemoveCondition<T>() where T : Condition
8771 {
8772 for (int num = conditions.Count - 1; num >= 0; num--)
8773 {
8774 if (conditions[num] is T)
8775 {
8776 conditions[num].Kill();
8777 break;
8778 }
8779 }
8780 }
8781
8782 public void CureHost(CureType type, int p = 100, BlessedState state = BlessedState.Normal)
8783 {
8784 if (parasite != null)
8785 {
8786 parasite.Cure(type, p, state);
8787 }
8788 if (ride != null)
8789 {
8790 ride.Cure(type, p, state);
8791 }
8792 Cure(type, p, state);
8793 }
8794
8795 public void Cure(CureType type, int p = 100, BlessedState state = BlessedState.Normal)
8796 {
8797 bool flag = state == BlessedState.Blessed;
8798 switch (type)
8799 {
8800 case CureType.Heal:
8801 case CureType.Prayer:
8802 CureCondition<ConFear>();
8803 CureCondition<ConBlind>(2 * p / 100 + 5);
8804 CureCondition<ConPoison>(5 * p / 100 + 5);
8805 CureCondition<ConConfuse>(10 * p / 100 + 10);
8806 CureCondition<ConDim>(p / 100 + 5);
8807 CureCondition<ConBleed>(2 * p / 100 + 10);
8808 if (flag)
8809 {
8810 SAN.Mod(-15);
8811 }
8812 break;
8813 case CureType.CureBody:
8814 CureCondition<ConBlind>(5 * p / 100 + 15);
8815 CureCondition<ConPoison>(10 * p / 100 + 15);
8816 CureCondition<ConBleed>(5 * p / 100 + 20);
8817 CureTempElements(p, body: true, mind: false);
8818 break;
8819 case CureType.CureMind:
8820 CureCondition<ConFear>();
8821 CureCondition<ConDim>(3 * p / 100 + 10);
8822 CureTempElements(p, body: false, mind: true);
8823 break;
8824 case CureType.Sleep:
8825 {
8826 for (int num2 = conditions.Count - 1; num2 >= 0; num2--)
8827 {
8828 Condition condition2 = conditions[num2];
8829 if (!(condition2 is ConSleep) && !(condition2 is ConFaint))
8830 {
8831 if (condition2.isPerfume)
8832 {
8833 condition2.Mod(-1, force: true);
8834 }
8835 else if (condition2.Type == ConditionType.Bad || condition2.Type == ConditionType.Debuff)
8836 {
8837 condition2.Kill();
8838 }
8839 }
8840 }
8841 CureCondition<ConWait>();
8842 CureCondition<ConDisease>((EClass.rnd(20) + 10) * p / 100);
8843 bool flag2 = HasCondition<ConAnorexia>();
8844 base.c_vomit -= (flag2 ? 3 : 2) * p / 100;
8845 if (base.c_vomit < 0)
8846 {
8847 base.c_vomit = 0;
8848 if (flag2)
8849 {
8850 RemoveCondition<ConAnorexia>();
8851 }
8852 }
8853 break;
8854 }
8855 case CureType.HealComplete:
8856 case CureType.Death:
8857 case CureType.Jure:
8858 case CureType.Boss:
8859 {
8860 CureTempElements(p * 100, body: true, mind: true);
8861 for (int num = conditions.Count - 1; num >= 0; num--)
8862 {
8863 Condition condition = conditions[num];
8864 if (!(condition is ConAnorexia) || type == CureType.Death)
8865 {
8866 if (condition.Type == ConditionType.Bad || condition.Type == ConditionType.Debuff || condition.Type == ConditionType.Disease)
8867 {
8868 condition.Kill();
8869 }
8870 else if (type == CureType.Death && condition.isPerfume)
8871 {
8872 condition.Kill();
8873 }
8874 }
8875 }
8876 CureCondition<ConWait>();
8877 CureCondition<ConSleep>();
8878 if (type == CureType.Death || type == CureType.Boss)
8879 {
8880 SAN.Mod(-20);
8881 RemoveCondition<ConBrightnessOfLife>();
8882 }
8883 if (type == CureType.Jure)
8884 {
8885 SAN.Mod(-999);
8886 if (HasElement(1206))
8887 {
8888 SetFeat(1206, 0, msg: true);
8889 }
8890 }
8891 break;
8892 }
8893 }
8894 }
8895
8896 public bool TryNeckHunt(Chara TC, int power, bool harvest = false)
8897 {
8898 if (TC == null || TC.HasCondition<ConInvulnerable>() || TC.Evalue(1421) > 0 || !TC.ExistsOnMap)
8899 {
8900 return false;
8901 }
8902 if (TC.hp > TC.MaxHP * Mathf.Min(5 + (int)Mathf.Sqrt(power), harvest ? 35 : 25) / 100)
8903 {
8904 return false;
8905 }
8906 if (TC.HasElement(427))
8907 {
8908 return false;
8909 }
8910 if (TC.IsPC && EClass.player.invlunerable)
8911 {
8912 return false;
8913 }
8914 PlaySound("hit_finish");
8915 Say("finish");
8916 Say("finish2", this, TC);
8917 TC.DamageHP(TC.MaxHP, AttackSource.Finish, this);
8918 return false;
8919 }
8920
8921 public void AddResistCon(Condition con)
8922 {
8923 if (con.power > 0 && con.GainResistFactor > 0)
8924 {
8925 int key = con.id;
8926 if (resistCon == null)
8927 {
8928 resistCon = new Dictionary<int, int>();
8929 }
8930 if (resistCon.ContainsKey(key))
8931 {
8932 resistCon[key] += con.power * con.GainResistFactor / 100;
8933 }
8934 else
8935 {
8936 resistCon[key] = con.power * con.GainResistFactor / 100;
8937 }
8938 }
8939 }
8940
8941 public void ResistCon(Condition con)
8942 {
8943 if (con.power > 0 && resistCon != null)
8944 {
8945 int a = ClassExtension.TryGetValue<int, int>((IDictionary<int, int>)resistCon, con.id, 0);
8946 if (1000 < EClass.rnd(a))
8947 {
8948 con.power = 0;
8949 }
8950 else if (500 < EClass.rnd(a))
8951 {
8952 con.power /= 5;
8953 }
8954 else if (200 < EClass.rnd(a))
8955 {
8956 con.power /= 2;
8957 }
8958 }
8959 }
8960
8961 public void Sleep(Thing bed = null, Thing pillow = null, bool pickup = false, ItemPosition posBed = null, ItemPosition posPillow = null)
8962 {
8963 RemoveCondition<ConAwakening>();
8964 AddCondition(Condition.Create(100, delegate(ConSleep con)
8965 {
8966 con.pcSleep = 15;
8967 con.pcBed = bed;
8968 con.pcPillow = pillow;
8969 con.pickup = pickup;
8970 con.posBed = posBed;
8971 con.posPillow = posPillow;
8972 }), force: true);
8973 }
8974
8975 public void OnSleep(Thing bed = null, int days = 1)
8976 {
8977 TraitPillow traitPillow = pos.FindThing<TraitPillow>();
8978 int num = bed?.Power ?? 20;
8979 if (traitPillow != null)
8980 {
8981 num += traitPillow.owner.Power / 2;
8982 }
8983 if (bed != null)
8984 {
8985 num += bed.Evalue(750) * 5;
8986 }
8987 OnSleep(num, days);
8988 }
8989
8990 public void OnSleep(int power, int days = 1)
8991 {
8992 if (days < 1)
8993 {
8994 days = 1;
8995 }
8996 int num = power * days;
8997 if (stamina.value < 0)
8998 {
8999 stamina.Set(1);
9000 }
9001 HealHP(num);
9002 stamina.Mod(10 + 25 * num / 100 * (100 + elements.GetFeatRef(1642)) / 100);
9003 mana.Mod(num);
9004 if (IsPCFaction)
9005 {
9006 hunger.Mod(20);
9007 }
9008 sleepiness.Set(0);
9009 if (!IsMinion)
9010 {
9011 interest = 100;
9012 }
9013 Cure(CureType.Sleep, power);
9014 }
9015
9016 public void ModHeight(int a)
9017 {
9018 int height = bio.height;
9019 height = height * (100 + a) / 100 + ((a > 0) ? 1 : (-1));
9020 if (height < 1)
9021 {
9022 height = 1;
9023 }
9024 if (height != bio.height)
9025 {
9026 bio.height = height;
9027 Say((a > 0) ? "height_gain" : "height_lose", this);
9028 }
9029 }
9030
9031 public void ModWeight(int a, bool ignoreLimit = false)
9032 {
9033 if (a == 0)
9034 {
9035 return;
9036 }
9037 int weight = bio.weight;
9038 int height = bio.height;
9039 int num = height * height * 18 / 25000;
9040 int num2 = height * height * 24 / 10000;
9041 if (ignoreLimit || (weight > num && weight < num2))
9042 {
9043 weight = weight * (100 + a) / 100 + ((a > 0) ? 1 : (-1));
9044 if (weight < 1)
9045 {
9046 weight = 1;
9047 }
9048 if (weight != bio.weight)
9049 {
9050 bio.weight = weight;
9051 Say((a > 0) ? "weight_gain" : "weight_lose", this);
9052 }
9053 }
9054 }
9055
9056 public void ModCorruption(int a)
9057 {
9058 if (a > 0)
9059 {
9060 if (ResistLv(962) > 0 && EClass.rnd(ResistLv(962) + 1) != 0)
9061 {
9062 return;
9063 }
9064 int num = Evalue(412);
9065 if (num != 0)
9066 {
9067 float num2 = (float)a * 100f / (float)Mathf.Max(100 + num * 2, 10);
9068 a = (int)num2 + ((EClass.rndf(1f) < num2 % 1f) ? 1 : 0);
9069 }
9070 }
9071 if (a == 0)
9072 {
9073 return;
9074 }
9075 int num3 = (corruption + a) / 100 - corruption / 100;
9076 for (int i = 0; i < Mathf.Abs(num3); i++)
9077 {
9078 if (!MutateRandom((num3 > 0) ? 1 : (-1), 100, ether: true))
9079 {
9080 break;
9081 }
9082 }
9083 corruption += a;
9084 int num4 = 0;
9085 foreach (Element value in elements.dict.Values)
9086 {
9087 if (value.source.category == "ether")
9088 {
9089 num4 += value.Value;
9090 }
9091 }
9092 if (num4 > 0 && IsPC)
9093 {
9094 Tutorial.Reserve("ether");
9095 }
9096 corruption = num4 * 100 + corruption % 100;
9097 }
9098
9099 public List<Element> ListAvailabeFeats(bool pet = false, bool showAll = false)
9100 {
9101 List<Element> list = new List<Element>();
9102 foreach (SourceElement.Row item in EClass.sources.elements.rows.Where((SourceElement.Row a) => a.group == "FEAT" && a.cost[0] != -1 && !a.categorySub.IsEmpty()))
9103 {
9104 Feat feat = elements.GetOrCreateElement(item.id) as Feat;
9105 int num = ((feat.ValueWithoutLink <= 0) ? 1 : (feat.ValueWithoutLink + 1));
9106 if (num <= feat.source.max && !feat.HasTag("class") && !feat.HasTag("hidden") && !feat.HasTag("innate") && (!pet || !feat.HasTag("noPet")) && (showAll || feat.IsPurchaseFeatReqMet(elements)))
9107 {
9108 list.Add(Element.Create(feat.id, num) as Feat);
9109 }
9110 }
9111 return list;
9112 }
9113
9114 public void SetFeat(int id, int value = 1, bool msg = false)
9115 {
9116 Feat feat = elements.GetElement(id) as Feat;
9117 int num = 0;
9118 if (feat != null && feat.Value > 0)
9119 {
9120 if (value == feat.Value)
9121 {
9122 return;
9123 }
9124 num = feat.Value;
9125 feat.Apply(-feat.Value, elements);
9126 }
9127 if (value > 0)
9128 {
9129 feat = elements.SetBase(id, value - (feat?.vSource ?? 0)) as Feat;
9130 feat.Apply(feat.Value, elements);
9131 }
9132 else
9133 {
9134 elements.Remove(id);
9135 }
9137 {
9138 Refresh();
9139 CalculateMaxStamina();
9140 }
9141 if (!msg)
9142 {
9143 return;
9144 }
9145 if (feat.source.textInc.IsEmpty())
9146 {
9147 PlaySound("ding_skill");
9149 Say("gainFeat", this, feat.FullName);
9150 }
9151 else
9152 {
9153 bool flag = value < num;
9154 if (feat.source.tag.Contains("neg"))
9155 {
9156 flag = !flag;
9157 }
9158 PlaySound("mutation");
9160 Say((value > num) ? feat.source.GetText("textInc") : feat.source.GetText("textDec"), this, feat.FullName);
9161 }
9162 elements.CheckSkillActions();
9163 }
9164
9165 public void SetMutation(int idEle, int a = 0)
9166 {
9167 SourceElement.Row row = EClass.sources.elements.map[idEle];
9169 Element element = elements.GetElement(idEle);
9170 Element element2 = elements.GetElement(row2.id);
9171 int num = element?.Value ?? 0;
9172 if (a < 0)
9173 {
9174 a = 0;
9175 }
9176 if (a > row.max)
9177 {
9178 a = row.max;
9179 }
9180 bool flag = (row.tag.Contains("neg") ? (a > num) : (a < num));
9181 if (a == 0 && (element == null || element.Value == 0))
9182 {
9183 SayNothingHappans();
9184 return;
9185 }
9186 if (element != null && element.Value == a)
9187 {
9188 SayNothingHappans();
9189 return;
9190 }
9191 if (element2 != null && element2.Value > 0)
9192 {
9193 SetFeat(element2.id, 0);
9194 }
9195 SetFeat(idEle, a);
9196 PlaySound("mutation");
9197 PlayEffect("mutation");
9199 Say(row.GetText(flag ? "textDec" : "textInc", returnNull: true) ?? row.alias, this);
9200 }
9201
9202 public bool MutateRandom(int vec = 0, int tries = 100, bool ether = false, BlessedState state = BlessedState.Normal)
9203 {
9204 if (!ether && vec >= 0 && HasElement(406) && EClass.rnd(5) != 0)
9205 {
9206 Say("resistMutation", this);
9207 return false;
9208 }
9209 IEnumerable<SourceElement.Row> ie = EClass.sources.elements.rows.Where((SourceElement.Row a) => a.category == (ether ? "ether" : "mutation") && !a.tag.Contains("noRandomMutation"));
9210 for (int i = 0; i < tries; i++)
9211 {
9212 SourceElement.Row row = ie.RandomItem();
9213 if (i == 0 && vec < 0 && ether && base.c_corruptionHistory != null && base.c_corruptionHistory.Count > 0)
9214 {
9215 row = EClass.sources.elements.map[base.c_corruptionHistory.LastItem()];
9216 base.c_corruptionHistory.RemoveAt(base.c_corruptionHistory.Count - 1);
9217 if (base.c_corruptionHistory.Count == 0)
9218 {
9219 base.c_corruptionHistory = null;
9220 }
9221 }
9222 Element element = elements.GetElement(row.id);
9223 int num = 1;
9224 if ((vec > 0 && ((row.id == 1563 && corruption < 300) || (row.id == 1562 && corruption < 1000 && base.IsPowerful))) || (vec < 0 && (element == null || element.Value <= 0)) || (vec > 0 && element != null && element.Value >= row.max))
9225 {
9226 continue;
9227 }
9228 if (element == null && !row.aliasParent.IsEmpty() && elements.Has(row.aliasParent))
9229 {
9230 row = EClass.sources.elements.alias[row.aliasParent];
9231 element = elements.GetElement(row.id);
9232 }
9233 bool flag = row.tag.Contains("neg");
9234 if (vec > 0)
9235 {
9236 if ((state >= BlessedState.Blessed && flag) || (state <= BlessedState.Cursed && !flag))
9237 {
9238 continue;
9239 }
9240 }
9241 else if (vec < 0 && ((state >= BlessedState.Blessed && !flag) || (state <= BlessedState.Cursed && flag)))
9242 {
9243 continue;
9244 }
9245 bool flag2 = true;
9246 if (element != null)
9247 {
9248 num = element.Value + ((vec != 0) ? vec : ((EClass.rnd(2) == 0) ? 1 : (-1)));
9249 if (num > element.source.max)
9250 {
9251 num = element.source.max - 1;
9252 }
9253 flag = (flag && num > element.Value) || (!flag && num < element.Value);
9254 flag2 = num > element.Value;
9255 if (vec > 0 && !flag2)
9256 {
9257 continue;
9258 }
9259 }
9260 Say(flag2 ? "mutation_gain" : "mutation_loose", this);
9261 SetFeat(row.id, num);
9262 if (flag2 && ether)
9263 {
9264 if (base.c_corruptionHistory == null)
9265 {
9266 base.c_corruptionHistory = new List<int>();
9267 }
9268 base.c_corruptionHistory.Add(row.id);
9269 if (IsPCFaction)
9270 {
9271 Element element2 = elements.GetElement(row.id);
9272 WidgetPopText.Say("popEther".lang(element2.Name, base.Name));
9273 }
9274 if (IsPC && !EClass.player.flags.gotEtherDisease)
9275 {
9276 EClass.player.flags.gotEtherDisease = true;
9277 Thing thing = ThingGen.Create("parchment");
9278 thing.SetStr(53, "letter_ether");
9279 Thing thing2 = ThingGen.Create("1165");
9280 thing2.SetBlessedState(BlessedState.Normal);
9281 Thing p = ThingGen.CreateParcel(null, thing2, thing);
9283 }
9284 }
9285 if (EClass.core.IsGameStarted && pos != null)
9286 {
9287 PlaySound(ether ? "mutation_ether" : "mutation");
9288 PlayEffect("mutation");
9290 Say(row.GetText(flag ? "textDec" : "textInc", returnNull: true) ?? row.alias, this);
9291 }
9292 return true;
9293 }
9294 Say("nothingHappens");
9295 return false;
9296 }
9297
9298 public void GainAbility(int ele, int mtp = 100)
9299 {
9300 Element orCreateElement = elements.GetOrCreateElement(ele);
9301 if (orCreateElement.ValueWithoutLink == 0)
9302 {
9303 elements.ModBase(orCreateElement.id, 1);
9304 }
9305 if (orCreateElement is Spell)
9306 {
9307 int num = mtp * orCreateElement.source.charge * (100 + Evalue(307) + (HasElement(307) ? 20 : 0)) / 100 / 100;
9308 if (orCreateElement.source.charge == 1)
9309 {
9310 num = 1;
9311 }
9312 orCreateElement.vPotential += Mathf.Max(1, num / 2 + EClass.rnd(num / 2 + 1));
9313 }
9314 Say("spell_gain", this, orCreateElement.Name);
9315 LayerAbility.SetDirty(orCreateElement);
9316 }
9317
9318 public bool TryNullifyCurse()
9319 {
9320 if (IsPCParty)
9321 {
9322 foreach (Chara member in EClass.pc.party.members)
9323 {
9324 if (member.HasElement(1641) && EClass.rnd(3) != 0)
9325 {
9326 Msg.Say("curse_nullify", member);
9327 return true;
9328 }
9329 }
9330 }
9331 else if (HasElement(1641) && EClass.rnd(3) != 0)
9332 {
9333 Say("curse_nullify", this);
9334 return true;
9335 }
9336 if (GetCondition<ConHolyVeil>() != null && EClass.rnd(5) != 0)
9337 {
9338 Say("curse_nullify", this);
9339 return true;
9340 }
9341 return false;
9342 }
9343
9344 public void OnAdvanceDay()
9345 {
9346 if (_historyFood != null)
9347 {
9348 while (_historyFood.Count > 5)
9349 {
9350 _historyFood.RemoveAt(_historyFood.Count - 1);
9351 }
9352 if (_historyFood[0].Count > 0)
9353 {
9354 _historyFood.Insert(0, new List<string>());
9355 }
9356 }
9357 }
9358
9360 {
9361 if (!IsPCFaction || !IsGlobal)
9362 {
9363 _historyFood = null;
9364 return;
9365 }
9366 if (_historyFood == null)
9367 {
9368 _historyFood = new List<List<string>>
9369 {
9370 new List<string>()
9371 };
9372 }
9373 if (_historyFood[0].Count < 5)
9374 {
9375 _historyFood[0].Add(food.id);
9376 }
9377 }
9378
9380 {
9381 if (_historyFood == null)
9382 {
9383 return -1;
9384 }
9385 int num = 0;
9386 foreach (List<string> item in _historyFood)
9387 {
9388 foreach (string item2 in item)
9389 {
9390 if (item2 == food.id)
9391 {
9392 num++;
9393 }
9394 }
9395 }
9396 return num;
9397 }
9398
9399 public int GetPietyValue()
9400 {
9401 if (base._IsPC)
9402 {
9403 return 10 + (int)(Mathf.Sqrt(base.c_daysWithGod) * 2f + (float)Evalue(85)) / 2;
9404 }
9405 return 10 + (int)(Mathf.Sqrt(base.LV) * 5f + (float)Evalue(306)) / 2;
9406 }
9407
9409 {
9410 if (faithElements != null)
9411 {
9412 faithElements.SetParent();
9413 }
9414 faithElements = new ElementContainer();
9415 if (idFaith == "eyth" && !HasElement(1228))
9416 {
9417 return;
9418 }
9419 SourceReligion.Row row = EClass.sources.religions.map.TryGetValue(idFaith);
9420 if (row == null)
9421 {
9422 return;
9423 }
9424 faithElements = new ElementContainer();
9425 SourceElement.Row row2 = EClass.sources.elements.alias.TryGetValue("featGod_" + row.id + "1");
9426 if (row2 != null)
9427 {
9428 faithElements.SetBase(row2.id, 1);
9429 }
9430 if (!HasCondition<ConExcommunication>())
9431 {
9432 int[] array = row.elements;
9433 int num = GetPietyValue() * (120 + Evalue(1407) * 15) / 100;
9434 for (int i = 0; i < array.Length; i += 2)
9435 {
9436 int num2 = array[i + 1] * num / 50;
9437 if (array[i] == 79)
9438 {
9439 num2 = EClass.curve(num2, array[i + 1] * 2, 10, 50);
9440 }
9441 if (num2 >= 20 && array[i] >= 950 && array[i] < 970)
9442 {
9443 num2 = 20;
9444 }
9445 faithElements.SetBase(array[i], Mathf.Max(num2, 1));
9446 }
9447 }
9448 faithElements.SetParent(this);
9449 }
9450
9451 public void ModTempElement(int ele, int a, bool naturalDecay = false, bool onlyRenew = false)
9452 {
9453 if (a < 0 && !naturalDecay && HasElement(EClass.sources.elements.alias["sustain_" + EClass.sources.elements.map[ele].alias]?.id ?? 0))
9454 {
9455 return;
9456 }
9457 bool flag = HasElement(1215);
9458 if (tempElements == null)
9459 {
9460 tempElements = new ElementContainer();
9461 tempElements.SetParent(this);
9462 }
9463 if (a > 0 && flag)
9464 {
9465 a = a * 150 / 100;
9466 }
9467 int num = elements.ValueWithoutLink(ele);
9468 int num2 = Mathf.Abs(num) + 100;
9469 int num3 = num2 / (flag ? 2 : 4);
9470 int num4 = -num - 100;
9471 int num5 = tempElements.Base(ele);
9472 int num6 = num5 + a;
9473 if (onlyRenew)
9474 {
9475 num3 = Mathf.Min(a, num3);
9476 num4 = Mathf.Max(a, -num2 / 3);
9477 }
9478 if (a > 0 && num6 > num3)
9479 {
9480 a = ((num3 > num5) ? (num3 - num5) : 0);
9481 }
9482 if (a < 0 && num6 < num4)
9483 {
9484 a = ((num4 < num5) ? (num4 - num5) : 0);
9485 }
9486 Element element = tempElements.ModBase(ele, a);
9487 if (element.vBase == 0)
9488 {
9489 tempElements.Remove(element.id);
9490 if (tempElements.dict.Count == 0)
9491 {
9492 tempElements = null;
9493 }
9494 }
9495 }
9496
9497 public void DamageTempElements(int p, bool body, bool mind, bool onlyRenew = false)
9498 {
9499 if (body)
9500 {
9501 DamageTempElement(Element.List_Body.RandomItem(), p, onlyRenew);
9502 }
9503 if (mind)
9504 {
9505 DamageTempElement(Element.List_Mind.RandomItem(), p, onlyRenew);
9506 }
9507 }
9508
9509 public void DamageTempElement(int ele, int p, bool onlyRenew = false)
9510 {
9511 ModTempElement(ele, onlyRenew ? (-p / 20) : (-(p / 100 + EClass.rnd(p / 100 + 1) + 1)), naturalDecay: false, onlyRenew);
9512 }
9513
9514 public void EnhanceTempElements(int p, bool body, bool mind, bool onlyRenew = false)
9515 {
9516 int[] array = (body ? Element.List_Body : Element.List_Mind);
9517 foreach (int ele in array)
9518 {
9519 EnhanceTempElement(ele, p, onlyRenew);
9520 }
9521 }
9522
9523 public void EnhanceTempElement(int ele, int p, bool onlyRenew = false)
9524 {
9525 ModTempElement(ele, onlyRenew ? (p / 20) : (p / 100 + EClass.rnd(p / 100 + 1)), naturalDecay: false, onlyRenew);
9526 }
9527
9528 public void DiminishTempElements(int a = 1)
9529 {
9530 if (tempElements == null)
9531 {
9532 return;
9533 }
9534 foreach (Element item in tempElements.dict.Values.ToList())
9535 {
9536 if (item.vBase > 0)
9537 {
9538 ModTempElement(item.id, -Mathf.Min(item.vBase * 5 / 100 + 1, item.vBase), naturalDecay: true);
9539 }
9540 }
9541 }
9542
9543 public void CureTempElements(int p, bool body, bool mind)
9544 {
9545 if (tempElements != null)
9546 {
9547 if (body)
9548 {
9549 Cure(Element.List_Body);
9550 }
9551 if (mind)
9552 {
9553 Cure(Element.List_Mind);
9554 }
9555 }
9556 void Cure(int[] eles)
9557 {
9558 foreach (int ele in eles)
9559 {
9560 if (tempElements == null)
9561 {
9562 break;
9563 }
9564 Element element = tempElements.GetElement(ele);
9565 if (element != null && element.vBase < 0)
9566 {
9567 ModTempElement(ele, Mathf.Clamp(p / 20 + EClass.rnd(p / 20), 1, -element.vBase));
9568 }
9569 }
9570 }
9571 }
9572
9573 public void ClearTempElements()
9574 {
9575 if (tempElements != null)
9576 {
9577 tempElements.SetParent();
9578 tempElements = null;
9579 }
9580 }
9581}
AnimeID
Definition: AnimeID.cs:2
AttackSource
Definition: AttackSource.cs:2
AttackStyle
Definition: AttackStyle.cs:2
BlessedState
Definition: BlessedState.cs:2
BossType
Definition: BossType.cs:2
CTAG
Definition: CTAG.cs:2
@ currency
ClearInventoryType
ConditionType
Definition: ConditionType.cs:2
ContainerFlag
Definition: ContainerFlag.cs:5
CureType
Definition: CureType.cs:2
CurrencyType
Definition: CurrencyType.cs:2
EditorTag
Definition: EditorTag.cs:2
EffectId
Definition: EffectId.cs:2
@ ChangeMaterial
Emo2
Definition: Emo2.cs:2
Emo
Definition: Emo.cs:2
@ harvest
ExpeditionType
FactionMemberType
FontColor
Definition: FontColor.cs:2
GoalListType
Definition: GoalListType.cs:2
Hostility
Definition: Hostility.cs:2
IDTSource
Definition: IDTSource.cs:2
MinionType
Definition: MinionType.cs:2
NameStyle
Definition: NameStyle.cs:2
PlaceState
Definition: PlaceState.cs:2
PriceType
Definition: PriceType.cs:2
Rarity
Definition: Rarity.cs:2
SourceValueType
TreasureType
Definition: TreasureType.cs:2
list. Refresh()
if(item3.idFile==idFirstFile &&item3.id==idFirstTopic)
Definition: UIBook.cs:627
WitnessType
Definition: WitnessType.cs:2
Definition: ACT.cs:6
static Act Create(int id)
Definition: ACT.cs:36
Definition: AIAct.cs:6
Status Tick()
Definition: AIAct.cs:352
virtual bool IsIdle
Definition: AIAct.cs:78
AIAct Current
Definition: AIAct.cs:103
bool TryCancel(Card c)
Definition: AIAct.cs:266
bool IsMoveAI
Definition: AIAct.cs:55
virtual bool IsRunning
Definition: AIAct.cs:31
virtual bool PushChara
Definition: AIAct.cs:82
virtual Status Cancel()
Definition: AIAct.cs:291
virtual bool ShouldAllyAttack(Chara tg)
Definition: AIAct.cs:134
virtual bool IsNoGoal
Definition: AIAct.cs:74
virtual bool CancelOnAggro
Definition: AIAct.cs:80
void SetOwner(Chara c)
Definition: AIAct.cs:179
override string ToString()
Definition: AIAct.cs:124
virtual bool CancelWhenMoved
Definition: AIAct.cs:96
string GetCurrentActionText()
Definition: AIAct.cs:157
virtual Point GetDestination()
Definition: AIAct.cs:139
Definition: AIWork.cs:5
Thing destThing
Definition: AIWork.cs:16
bool SetDestination()
Definition: AIWork.cs:55
virtual void OnPerformWork(bool realtime)
Definition: AIWork.cs:145
BaseArea destArea
Definition: AIWork.cs:12
Definition: AI_Eat.cs:5
static bool slaughtering
Definition: AI_Slaughter.cs:6
bool TryCancelInteraction(bool sound=true)
Definition: AM_Adv.cs:1069
void ClearPlans()
Definition: AM_Adv.cs:426
void SetTurbo(int mtp=-1)
Definition: AM_Adv.cs:1040
static void ProcAt(EffectId id, int power, BlessedState state, Card cc, Card tc, Point tp, bool isNeg, ActRef actRef=default(ActRef))
Definition: ActEffect.cs:407
List< Item > items
Definition: ActList.cs:14
static EffectIRenderer Throw(Card c, Point p, Thing t, ThrowMethod method=ThrowMethod.Default, float failChance=0f)
Definition: ActThrow.cs:93
static void Search(Chara c, bool manual=false)
Definition: ActWait.cs:43
Definition: ACT.cs:62
CostType
Definition: ACT.cs:64
virtual bool Perform()
Definition: ACT.cs:266
virtual TargetType TargetType
Definition: ACT.cs:142
virtual float RapidDelay
Definition: ACT.cs:175
bool IsTargetHostileParty()
Definition: ACT.cs:241
virtual bool CanRapidFire
Definition: ACT.cs:173
static AM_Sim Sim
Definition: ActionMode.cs:11
virtual float gameSpeed
Definition: ActionMode.cs:119
static AM_Adv Adv
Definition: ActionMode.cs:15
static Affinity Get(Chara c)
Definition: Affinity.cs:36
int Mod(int a)
Definition: Affinity.cs:162
Thing OnGift(Thing t)
Definition: Affinity.cs:103
static int indexSister
void SetStr(int id, string value=null)
Definition: BaseCard.cs:63
void SetInt(int id, int value=0)
Definition: BaseCard.cs:39
virtual bool IsToggle
virtual RendererReplacer GetRendererReplacer()
virtual bool PreventRegen
virtual int EvaluatePower(int p)
virtual int GainResistFactor
virtual bool TryMove(Point p)
virtual bool ConsumeTurn
Element GetDefenseAttribute(Chara c=null)
bool TryNullify(Condition c)
virtual bool TimeBased
virtual void OnRefresh()
void Mod(int a, bool force=false)
virtual void SetOwner(Chara _owner, bool onDeserialize=false)
virtual void OnEndPlayerTurn()
virtual ConditionType Type
Definition: BaseStats.cs:19
virtual string GetPhaseStr()
Definition: BaseStats.cs:47
SourceStat.Row source
Definition: BaseStats.cs:15
virtual Emo2 EmoIcon
Definition: BaseStats.cs:17
int id
Definition: BaseStats.cs:11
virtual int GetValue()
Definition: BaseStats.cs:52
void SetGender(int g)
Definition: Biography.cs:454
void Generate(Chara c)
Definition: Biography.cs:308
int elementId
Definition: BodySlot.cs:6
Thing thing
Definition: BodySlot.cs:8
virtual bool isPCC
Definition: CardActor.cs:39
static void Set(CardBlueprint _bp)
static CardBlueprint CharaGenEQ
Chara Find(string id)
Definition: CardManager.cs:20
List< Chara > listAdv
Definition: CardManager.cs:64
GlobalCharaList globalCharas
Definition: CardManager.cs:46
void PlayAnime(AnimeID id, bool force)
RendererReplacer replacer
Definition: CardRenderer.cs:29
Vector3 position
Definition: CardRenderer.cs:21
TransAnime anime
Definition: CardRenderer.cs:23
virtual void NextFrame()
void RefreshExtra()
CardActor actor
Definition: CardRenderer.cs:11
Definition: Card.cs:11
bool IsNegativeGift
Definition: Card.cs:2332
bool isDestroyed
Definition: Card.cs:71
MinionType c_minionType
Definition: Card.cs:960
bool IsPCFactionOrMinion
Definition: Card.cs:2208
void Teleport(Point point, bool silent=false, bool force=false)
Definition: Card.cs:5505
bool IsDecayed
Definition: Card.cs:2223
bool IsAmmo
Definition: Card.cs:2183
bool isSummon
Definition: Card.cs:694
void MakeRefFrom(string id)
Definition: Card.cs:5386
virtual Chara Chara
Definition: Card.cs:2006
Thing Split(int a)
Definition: Card.cs:3345
int EvalueMax(int ele, int min=0)
Definition: Card.cs:2521
ElementContainerCard elements
Definition: Card.cs:37
string id
Definition: Card.cs:31
bool isNPCProperty
Definition: Card.cs:538
int GetSightRadius()
Definition: Card.cs:6021
bool IsUnique
Definition: Card.cs:2027
Hostility c_originalHostility
Definition: Card.cs:948
void DamageHP(int dmg, AttackSource attackSource=AttackSource.None, Card origin=null)
Definition: Card.cs:3908
bool HasElement(int ele, int req=1)
Definition: Card.cs:5566
bool isRestrained
Definition: Card.cs:550
bool IsThrownWeapon
Definition: Card.cs:2181
int ExpToNext
Definition: Card.cs:1944
CardBlueprint bp
Definition: Card.cs:73
SourceMaterial.Row material
Definition: Card.cs:1987
SoundSource PlaySound(string id, float v=1f, bool spatial=true)
Definition: Card.cs:5776
bool isCopy
Definition: Card.cs:862
void ClampInitialSkill()
Definition: Card.cs:2858
virtual int GetPrice(CurrencyType currency=CurrencyType.Money, bool sell=false, PriceType priceType=PriceType.Default, Chara c=null)
Definition: Card.cs:6875
int c_lockLv
Definition: Card.cs:936
int GetEquipValue()
Definition: Card.cs:6776
Fov fov
Definition: Card.cs:53
int invY
Definition: Card.cs:1891
bool IsCursed
Definition: Card.cs:2191
int c_uidMaster
Definition: Card.cs:1409
Biography bio
Definition: Card.cs:40
Thing AddThing(string id, int lv=-1)
Definition: Card.cs:3020
void Talk(string idTopic, string ref1=null, string ref2=null, bool forceSync=false)
Definition: Card.cs:6326
Card SetLv(int a)
Definition: Card.cs:2821
Rarity rarity
Definition: Card.cs:298
string Name
Definition: Card.cs:2073
bool IsRangedWeapon
Definition: Card.cs:2179
int CHA
Definition: Card.cs:2283
ICardParent parent
Definition: Card.cs:51
bool ExistsOnMap
Definition: Card.cs:2021
bool IsHotItem
Definition: Card.cs:115
Thing SetNum(int a)
Definition: Card.cs:3356
bool IsFood
Definition: Card.cs:2111
virtual void SetBlessedState(BlessedState s)
Definition: Card.cs:3740
bool isAcidproof
Definition: Card.cs:670
bool HasTag(CTAG tag)
Definition: Card.cs:2531
Point pos
Definition: Card.cs:55
void DyeRandom()
Definition: Card.cs:5627
int uid
Definition: Card.cs:118
Effect PlayEffect(string id, bool useRenderPos=true, float range=0f, Vector3 fix=default(Vector3))
Definition: Card.cs:5810
bool IsEquipmentOrRanged
Definition: Card.cs:2154
void TryStack(Thing t)
Definition: Card.cs:6582
void ShowEmo(Emo _emo=Emo.none, float duration=0f, bool skipSame=true)
Definition: Card.cs:5744
Trait trait
Definition: Card.cs:49
void ModCurrency(int a, string id="money")
Definition: Card.cs:3806
virtual bool IsAliveInCurrentZone
Definition: Card.cs:2063
MoveType
Definition: Card.cs:20
void SayNothingHappans()
Definition: Card.cs:6418
bool isNew
Definition: Card.cs:466
void Destroy()
Definition: Card.cs:4783
bool c_isImportant
Definition: Card.cs:996
MoveResult
Definition: Card.cs:13
bool noMove
Definition: Card.cs:754
bool HaveFur()
Definition: Card.cs:7440
ThingContainer things
Definition: Card.cs:34
bool IsInstalled
Definition: Card.cs:2317
bool IsMeleeWeapon
Definition: Card.cs:2177
virtual bool isChara
Definition: Card.cs:2019
virtual Thing Thing
Definition: Card.cs:1994
Card GetRootCard()
Definition: Card.cs:3287
int Evalue(int ele)
Definition: Card.cs:2507
int Dist(Card c)
Definition: Card.cs:7235
bool isHidden
Definition: Card.cs:514
int idSkin
Definition: Card.cs:346
void MoveImmediate(Point p, bool focus=true, bool cancelAI=true)
Definition: Card.cs:5479
virtual bool IsPCFaction
Definition: Card.cs:2205
bool isGifted
Definition: Card.cs:766
BlessedState blessedState
Definition: Card.cs:262
Thing Duplicate(int num)
Definition: Card.cs:3305
int _colorInt
Definition: Card.cs:63
bool TryStackTo(Thing to)
Definition: Card.cs:3258
virtual bool IsPCFactionMinion
Definition: Card.cs:2091
Card Install()
Definition: Card.cs:3590
void ApplyBacker(int bid)
Definition: Card.cs:6599
Card parentCard
Definition: Card.cs:99
void ModExp(string alias, int a)
Definition: Card.cs:2584
string c_idRefName
Definition: Card.cs:1601
int GetLightRadius()
Definition: Card.cs:6030
int Num
Definition: Card.cs:154
SourceCategory.Row category
Definition: Card.cs:1985
void AddExp(int a)
Definition: Card.cs:2866
void ModNum(int a, bool notify=true)
Definition: Card.cs:3376
bool isLeashed
Definition: Card.cs:826
bool IsIdentified
Definition: Card.cs:2313
bool IsContainer
Definition: Card.cs:2025
int c_charges
Definition: Card.cs:1241
CardRenderer renderer
Definition: Card.cs:57
int LV
Definition: Card.cs:370
void Say(string lang, string ref1=null, string ref2=null)
Definition: Card.cs:6423
string c_idRefCard
Definition: Card.cs:1697
Thing MakeEgg(bool effect=true, int num=1, bool addToZone=true, int fertChance=20, BlessedState? state=null)
Definition: Card.cs:5403
List< Chara > charas
Definition: CellDetail.cs:13
bool isHostileAct
Definition: CellEffect.cs:74
EffectId idEffect
Definition: CellEffect.cs:38
bool isCursed
Definition: CellEffect.cs:98
bool isBlessed
Definition: CellEffect.cs:86
Definition: Cell.cs:7
Room room
Definition: Cell.cs:102
SourceBlock.Row sourceBlock
Definition: Cell.cs:1052
bool IsSnowTile
Definition: Cell.cs:782
SourceFloor.Row sourceFloor
Definition: Cell.cs:1054
CellEffect effect
Definition: Cell.cs:94
bool hasDoorBoat
Definition: Cell.cs:498
bool HasBridge
Definition: Cell.cs:671
bool IsTopWaterAndNoSnow
Definition: Cell.cs:712
bool isClearSnow
Definition: Cell.cs:450
bool isFloating
Definition: Cell.cs:474
SourceMaterial.Row matObj
Definition: Cell.cs:1036
byte topHeight
Definition: Cell.cs:78
SourceFloor.Row sourceBridge
Definition: Cell.cs:1056
byte z
Definition: Cell.cs:58
SourceMaterial.Row matFloor
Definition: Cell.cs:1032
bool isSeen
Definition: Cell.cs:282
byte obj
Definition: Cell.cs:38
SourceObj.Row sourceObj
Definition: Cell.cs:1072
byte x
Definition: Cell.cs:56
bool HasRamp
Definition: Cell.cs:837
bool hasDoor
Definition: Cell.cs:258
SourceFloor.Row sourceSurface
Definition: Cell.cs:1059
float GetSurfaceHeight()
Definition: Cell.cs:1688
bool CanSuffocate()
Definition: Cell.cs:1111
ActList list
Definition: CharaAbility.cs:12
void RemoveBodyPartAt(int idx)
Definition: CharaBody.cs:322
void SetOwner(Chara chara, bool deserialized=false)
Definition: CharaBody.cs:18
void AddBodyPart(int ele, Thing thing=null)
Definition: CharaBody.cs:261
List< BodySlot > slots
Definition: CharaBody.cs:8
BodySlot slotMainHand
Definition: CharaBody.cs:10
bool IsTooHeavyToEquip(Thing thing)
Definition: CharaBody.cs:156
AttackStyle GetAttackStyle()
Definition: CharaBody.cs:433
bool IsEquippable(Thing thing, BodySlot slot, bool text=true)
Definition: CharaBody.cs:106
int GetWeight(bool armorOnly=false)
Definition: CharaBody.cs:390
bool Equip(Thing thing, BodySlot slot=null, bool msg=true)
Definition: CharaBody.cs:182
BodySlot GetSlot(Thing t, bool onlyEmpty=false, bool secondSlot=false)
Definition: CharaBody.cs:347
void RefreshBodyParts()
Definition: CharaBody.cs:287
void RemoveBodyPart(int ele)
Definition: CharaBody.cs:316
static Chara CreateFromFilter(string id, int lv=-1, int levelRange=-1)
Definition: CharaGen.cs:22
static Chara Create(string id, int lv=-1)
Definition: CharaGen.cs:17
override void SetOwner(Card c)
PCCData pccData
Definition: Chara.cs:10
void OnInsulted()
Definition: Chara.cs:7556
SourceCategory.Row GetFavCat()
Definition: Chara.cs:7469
void GetRevived()
Definition: Chara.cs:4725
string[] _strs
Definition: Chara.cs:79
bool IsHumanSpeak
Definition: Chara.cs:881
void DamageTempElement(int ele, int p, bool onlyRenew=false)
Definition: Chara.cs:9509
Stats depression
Definition: Chara.cs:1000
bool UseAbility(string idAct, Card tc=null, Point pos=null, bool pt=false)
Definition: Chara.cs:5347
void Refresh(bool calledRecursive=false)
Definition: Chara.cs:1558
void ChangeRace(string idNew)
Definition: Chara.cs:2058
override SourcePref Pref
Definition: Chara.cs:783
void SetHomeZone(Zone zone)
Definition: Chara.cs:1278
static List< Chara > _pts
Definition: Chara.cs:182
string IDPCCBodySet
Definition: Chara.cs:487
void TickConditions()
Definition: Chara.cs:3439
override string actorPrefab
Definition: Chara.cs:515
bool wasInWater
Definition: Chara.cs:148
void UpdateSight()
Definition: Chara.cs:3411
int _affinity
Definition: Chara.cs:299
Stats sleepiness
Definition: Chara.cs:1008
static Point _sharedPos
Definition: Chara.cs:170
override bool IsAliveInCurrentZone
Definition: Chara.cs:557
void SetDirtySpeed()
Definition: Chara.cs:1659
bool IsFriendOrAbove(Chara c)
Definition: Chara.cs:6127
int GetBurden(Card t=null, int num=-1)
Definition: Chara.cs:1608
override void ApplyEditorTags(EditorTag tag)
Definition: Chara.cs:1823
Element MainElement
Definition: Chara.cs:713
Thing FindBestFoodToEat()
Definition: Chara.cs:7004
new TraitChara trait
Definition: Chara.cs:499
Hostility OriginalHostility
Definition: Chara.cs:467
void ResetBody()
Definition: Chara.cs:2013
CharaBody body
Definition: Chara.cs:94
LayerDrama _ShowDialog(string book, string sheet, string step="main", string tag="")
Definition: Chara.cs:6702
Card held
Definition: Chara.cs:70
bool IsEyth
Definition: Chara.cs:918
bool isAlawysVisible
Definition: Chara.cs:397
bool CanAcceptGift(Chara c, Card t)
Definition: Chara.cs:7603
bool IsLevitating
Definition: Chara.cs:593
WorkSummary GetWorkSummary()
Definition: Chara.cs:8452
float idleTimer
Definition: Chara.cs:120
override void Rotate(bool reverse=false)
Definition: Chara.cs:3289
AIAct ai
Definition: Chara.cs:198
void RemoveGlobal()
Definition: Chara.cs:1342
Chara CreateReplacement()
Definition: Chara.cs:7428
bool TryUse(Thing t)
Definition: Chara.cs:7299
override Sprite GetImageSprite()
Definition: Chara.cs:6522
MoveResult TryMoveFrom(Point p)
Definition: Chara.cs:2454
void ValidateWorks()
Definition: Chara.cs:8530
void MoveHome(Zone zone, int x=-1, int z=-1)
Definition: Chara.cs:3224
void TryPickGroundItem()
Definition: Chara.cs:4135
void ChangeMemberType(FactionMemberType type)
Definition: Chara.cs:6527
void TickCooldown()
Definition: Chara.cs:8066
void CureTempElements(int p, bool body, bool mind)
Definition: Chara.cs:9543
bool TryNeckHunt(Chara TC, int power, bool harvest=false)
Definition: Chara.cs:8896
void SetFaction(Faction f)
Definition: Chara.cs:1271
Element GetBuffStats(string alias)
Definition: Chara.cs:8728
bool IsWealthy
Definition: Chara.cs:921
bool isWet
Definition: Chara.cs:142
static NoGoal _NoGoalPC
Definition: Chara.cs:192
void Cuddle(Chara c, bool headpat=false)
Definition: Chara.cs:5769
ConSuspend conSuspend
Definition: Chara.cs:104
bool IsCriticallyWounded(bool includeRide=false)
Definition: Chara.cs:1029
void ModTempElement(int ele, int a, bool naturalDecay=false, bool onlyRenew=false)
Definition: Chara.cs:9451
bool CanRevive()
Definition: Chara.cs:4720
bool CanPick(Card c)
Definition: Chara.cs:3979
void SetAIIdle()
Definition: Chara.cs:8175
string idFaith
Definition: Chara.cs:227
bool CanInteractTo(Point p)
Definition: Chara.cs:2298
override void SetSortVal(UIList.SortMode m, CurrencyType currency=CurrencyType.Money)
Definition: Chara.cs:6757
void TryPutShared(Thing t, List< Thing > containers=null, bool dropIfFail=true)
Definition: Chara.cs:4151
void CureHost(CureType type, int p=100, BlessedState state=BlessedState.Normal)
Definition: Chara.cs:8782
int[] _cints
Definition: Chara.cs:82
int stealthSeen
Definition: Chara.cs:184
bool canSeeInvisible
Definition: Chara.cs:138
int sharedCheckTurn
Definition: Chara.cs:118
int _Speed
Definition: Chara.cs:168
void RefreshWorkElements(ElementContainer parent=null)
Definition: Chara.cs:8319
bool MutateRandom(int vec=0, int tries=100, bool ether=false, BlessedState state=BlessedState.Normal)
Definition: Chara.cs:9202
void InstantEat(Thing t=null, bool sound=true)
Definition: Chara.cs:7025
Goal GetGoalFromTimeTable(int hour)
Definition: Chara.cs:8117
Condition AddCondition(string id, int p=100, bool force=false)
Definition: Chara.cs:8559
override Sprite GetSprite(int dir=0)
Definition: Chara.cs:6192
bool IsHostile(Chara c)
Definition: Chara.cs:6039
Faction _faction
Definition: Chara.cs:152
Thing FindAmmo(Thing weapon)
Definition: Chara.cs:7240
Faction faction
Definition: Chara.cs:423
override bool isThing
Definition: Chara.cs:680
int Speed
Definition: Chara.cs:949
void ModAffinity(Chara c, int a, bool show=true, bool showOnlyEmo=false)
Definition: Chara.cs:7360
override bool IsPC
Definition: Chara.cs:608
string idFaction
Definition: Chara.cs:239
int combatCount
Definition: Chara.cs:114
GoalListType goalListType
Definition: Chara.cs:275
void OnSleep(int power, int days=1)
Definition: Chara.cs:8990
override CardRow sourceRenderCard
Definition: Chara.cs:449
void _MakeAlly()
Definition: Chara.cs:2093
override int GetArmorSkill()
Definition: Chara.cs:7290
void EnhanceTempElement(int ele, int p, bool onlyRenew=false)
Definition: Chara.cs:9523
static bool consumeTurn
Definition: Chara.cs:176
bool isDrunk
Definition: Chara.cs:124
Chara host
Definition: Chara.cs:33
bool knowFav
Definition: Chara.cs:409
void SetFaith(Religion r)
Definition: Chara.cs:1543
Thing MakeBraineCell()
Definition: Chara.cs:7551
bool IsValidGiftWeight(Card t, int num=-1)
Definition: Chara.cs:7572
Condition AddCondition(Condition c, bool force=false)
Definition: Chara.cs:8564
SourceJob.Row job
Definition: Chara.cs:462
Point GetFirstStep(Point newPoint, PathManager.MoveType moveType=PathManager.MoveType.Default)
Definition: Chara.cs:2347
void Kick(Chara t, bool ignoreSelf=false, bool karmaLoss=true, bool show=true)
Definition: Chara.cs:5301
List< int > _cooldowns
Definition: Chara.cs:58
static List< SourceCategory.Row > _listFavCat
Definition: Chara.cs:190
void SetFeat(int id, int value=1, bool msg=false)
Definition: Chara.cs:9114
void ResetUpgrade()
Definition: Chara.cs:7935
bool CanSeeLos(Card c, int dist=-1)
Definition: Chara.cs:1102
AIAct SetNoGoal()
Definition: Chara.cs:8184
bool IsMofuable
Definition: Chara.cs:960
bool IsMaid
Definition: Chara.cs:893
override bool IsGlobal
Definition: Chara.cs:606
override bool IsPCParty
Definition: Chara.cs:611
static Point shared
Definition: Chara.cs:11
int DestDist
Definition: Chara.cs:862
void ShowDialog()
Definition: Chara.cs:6532
override void WriteNote(UINote n, Action< UINote > onWriteNote=null, IInspect.NoteMode mode=IInspect.NoteMode.Default, Recipe recipe=null)
Definition: Chara.cs:6747
override string ToString()
Definition: Chara.cs:1024
Party party
Definition: Chara.cs:43
void TryTakeSharedItems(IEnumerable< Thing > containers, bool msg=true, bool shouldEat=true)
Definition: Chara.cs:6866
bool CanDestroyPath()
Definition: Chara.cs:2186
ElementContainer tempElements
Definition: Chara.cs:36
void TryPutSharedItems(bool msg=true)
Definition: Chara.cs:6856
void SetMainElement(int id, int v=0, bool elemental=false)
Definition: Chara.cs:1881
Stats hygiene
Definition: Chara.cs:1004
int interest
Definition: Chara.cs:313
void ApplyRace(bool remove=false)
Definition: Chara.cs:2036
bool CanAcceptItem(Card t, int num=-1)
Definition: Chara.cs:7582
int corruption
Definition: Chara.cs:373
void OnAdvanceDay()
Definition: Chara.cs:9344
int GetHappiness()
Definition: Chara.cs:6722
void ModHeight(int a)
Definition: Chara.cs:9016
PathProgress path
Definition: Chara.cs:92
bool isParalyzed
Definition: Chara.cs:132
void ReleaseMinion()
Definition: Chara.cs:2138
int EvalueRiding()
Definition: Chara.cs:5668
bool IsInCombat
Definition: Chara.cs:860
bool TryWorkOutside(SourceHobby.Row sourceWork)
Definition: Chara.cs:8482
TraitBed TryAssignBed()
Definition: Chara.cs:6805
void UpdateAngle()
Definition: Chara.cs:3350
override void OnSerializing()
Definition: Chara.cs:1164
List< Condition > conditions
Definition: Chara.cs:207
int MaxGeneSlot
Definition: Chara.cs:934
bool IsBranchMember()
Definition: Chara.cs:6083
void SetMutation(int idEle, int a=0)
Definition: Chara.cs:9165
void HoldCard(Card t, int num=-1)
Definition: Chara.cs:4181
void PickHeld(bool msg=false)
Definition: Chara.cs:4233
static bool isOnCreate
Definition: Chara.cs:180
bool HasCondition(string alias)
Definition: Chara.cs:8716
SpriteReplacer spriteReplacer
Definition: Chara.cs:150
override void Die(Element e=null, Card origin=null, AttackSource attackSource=AttackSource.None)
Definition: Chara.cs:4897
static List< Thing > _ListItems
Definition: Chara.cs:186
AIAct SetAI(AIAct g)
Definition: Chara.cs:8189
bool IsIdle
Definition: Chara.cs:849
void SetMainElement(string id, int v=0, bool elemental=false)
Definition: Chara.cs:1872
void HealAll()
Definition: Chara.cs:1549
override bool IsDisabled
Definition: Chara.cs:581
int CurrentGeneSlot
Definition: Chara.cs:937
Thing GetBestRangedWeapon()
Definition: Chara.cs:7255
TraitBed FindBed()
Definition: Chara.cs:6793
bool IsPrisoner
Definition: Chara.cs:904
bool IsNeutralOrAbove()
Definition: Chara.cs:6078
bool IsAdventurer
Definition: Chara.cs:907
bool _isLevitating
Definition: Chara.cs:134
bool hasMovedThisTurn
Definition: Chara.cs:172
int happiness
Definition: Chara.cs:108
void DiminishTempElements(int a=1)
Definition: Chara.cs:9528
int uidEditor
Definition: Chara.cs:349
Stats hunger
Definition: Chara.cs:994
int GetCurrentDir()
Definition: Chara.cs:3389
override string GetName(NameStyle style, int num=-1)
Definition: Chara.cs:1209
override bool IsMinion
Definition: Chara.cs:623
int GetHireCost()
Definition: Chara.cs:6717
Chara SetGlobal(Zone _home, int x, int z)
Definition: Chara.cs:1314
void EnhanceTempElements(int p, bool body, bool mind, bool onlyRenew=false)
Definition: Chara.cs:9514
override string GetHoverText()
Definition: Chara.cs:6268
override int WeightLimit
Definition: Chara.cs:706
override void OnDeserialized()
Definition: Chara.cs:1179
override void SetSource()
Definition: Chara.cs:1860
int contribution
Definition: Chara.cs:18
bool TryHoldCard(Card t, int num=-1, bool pickHeld=false)
Definition: Chara.cs:4159
override bool isSynced
Definition: Chara.cs:687
static List< Hobby > listHobby
Definition: Chara.cs:13
Point orgPos
Definition: Chara.cs:21
int CalcCastingChance(Element e, int num=1)
Definition: Chara.cs:5677
bool ShouldEquip(Thing t, bool useFav=false)
Definition: Chara.cs:7068
bool CanMoveTo(Point p, bool allowDestroyPath=true)
Definition: Chara.cs:2199
Emo2 emoIcon
Definition: Chara.cs:106
bool IsHuman
Definition: Chara.cs:878
WorkSummary _workSummary
Definition: Chara.cs:55
override bool HasHost
Definition: Chara.cs:684
bool MoveRandom()
Definition: Chara.cs:2352
void DestroyPath(Point pos)
Definition: Chara.cs:2947
int daysStarved
Definition: Chara.cs:325
override CardRenderer _CreateRenderer()
Definition: Chara.cs:6143
void PickOrDrop(Point p, string idThing, int idMat=-1, int num=1, bool msg=true)
Definition: Chara.cs:3997
void TryPutSharedItems(IEnumerable< Thing > containers, bool msg=true)
Definition: Chara.cs:6823
override bool IsPCFaction
Definition: Chara.cs:667
override bool IsPCPartyMinion
Definition: Chara.cs:635
bool TryNullifyCurse()
Definition: Chara.cs:9318
override int SelfWeight
Definition: Chara.cs:708
void CalculateMaxStamina()
Definition: Chara.cs:1804
int MaxSummon
Definition: Chara.cs:710
Thing TryGetThrowable()
Definition: Chara.cs:7194
void MoveZone(Zone z, ZoneTransition transition)
Definition: Chara.cs:3107
void TryUpgrade(bool msg=true)
Definition: Chara.cs:7940
void Kick(Point p, bool ignoreSelf=false)
Definition: Chara.cs:5293
int calmCheckTurn
Definition: Chara.cs:116
void MakeMinion(Chara _master, MinionType type=MinionType.Default)
Definition: Chara.cs:2127
override void LookAt(Point p)
Definition: Chara.cs:3308
void OnBanish()
Definition: Chara.cs:1284
override bool flipX
Definition: Chara.cs:543
string NameBraced
Definition: Chara.cs:510
bool CanSee(Card c)
Definition: Chara.cs:1070
bool HasAccess(Card c)
Definition: Chara.cs:1132
Goal GetGoalWork()
Definition: Chara.cs:8149
override int DV
Definition: Chara.cs:725
ConSleep conSleep
Definition: Chara.cs:102
List< Element > ListAvailabeFeats(bool pet=false, bool showAll=false)
Definition: Chara.cs:9099
override bool IsPCFactionMinion
Definition: Chara.cs:651
void Vomit()
Definition: Chara.cs:4861
void AddWork(int id)
Definition: Chara.cs:8401
bool IsFriendOrAbove()
Definition: Chara.cs:6122
override MoveResult _Move(Point newPoint, MoveType type=MoveType.Walk)
Definition: Chara.cs:2518
bool CanEat(Thing t, bool shouldEat=false)
Definition: Chara.cs:7051
float actTime
Definition: Chara.cs:174
Tactics _tactics
Definition: Chara.cs:160
bool ShouldThrowAway(Thing t, ClearInventoryType type)
Definition: Chara.cs:7841
void SetAIAggro()
Definition: Chara.cs:8179
ElementContainer _baseWorkElements
Definition: Chara.cs:200
MoveResult TryMove(Point newPoint, bool allowDestroyPath=true)
Definition: Chara.cs:2494
Chara Duplicate()
Definition: Chara.cs:1584
void MakePartyMemeber()
Definition: Chara.cs:2067
void SetAIImmediate(AIAct g)
Definition: Chara.cs:8221
void PerformWork(WorkSession session, bool isHobby=false, bool IsRealTime=false)
Definition: Chara.cs:8494
void PickOrDrop(Point p, Thing t, bool msg=true)
Definition: Chara.cs:4005
static GoalHobby _goalHobby
Definition: Chara.cs:204
void ClearTempElements()
Definition: Chara.cs:9573
override int MaxHP
Definition: Chara.cs:704
Zone currentZone
Definition: Chara.cs:251
bool HasAccess(Point p)
Definition: Chara.cs:1137
override bool isChara
Definition: Chara.cs:682
string Aka
Definition: Chara.cs:212
override bool IsDeadOrSleeping
Definition: Chara.cs:569
Stats bladder
Definition: Chara.cs:1002
bool CanReplace(Chara c)
Definition: Chara.cs:3058
List< Hobby > ListHobbies(bool useMemberType=true)
Definition: Chara.cs:8280
Thing ranged
Definition: Chara.cs:98
Stats SAN
Definition: Chara.cs:1010
void MakeAlly(bool msg=true)
Definition: Chara.cs:2073
void RemoveLastBodyPart(bool msg=false)
Definition: Chara.cs:1999
Point lastPos
Definition: Chara.cs:90
ElementContainer baseWorkElements
Definition: Chara.cs:963
void TickWork(VirtualDate date)
Definition: Chara.cs:8461
Goal GetGoalHobby()
Definition: Chara.cs:8162
int _maxStamina
Definition: Chara.cs:361
void Stumble(int mtp=100)
Definition: Chara.cs:1642
void ClearInventory(ClearInventoryType type)
Definition: Chara.cs:7912
SourceChara.Row source
Definition: Chara.cs:154
bool isCreated
Definition: Chara.cs:136
Stats mana
Definition: Chara.cs:1006
void MoveByForce(Point newPoint, Card c=null, bool checkWall=false)
Definition: Chara.cs:2384
bool FindNewEnemy()
Definition: Chara.cs:5950
FactionMemberType memberType
Definition: Chara.cs:46
string TalkTopic(string topic="calm")
Definition: Chara.cs:6461
int _idTimeTable
Definition: Chara.cs:337
void TryDropBossLoot()
Definition: Chara.cs:5201
override int PV
Definition: Chara.cs:754
string GetIdPortraitCat()
Definition: Chara.cs:7515
SourceRace.Row _race
Definition: Chara.cs:156
Stats stamina
Definition: Chara.cs:998
bool CanGainConResist
Definition: Chara.cs:1013
string NameTitled
Definition: Chara.cs:512
bool HasHigherGround(Card c)
Definition: Chara.cs:1042
void TryRestock(bool onCreate)
Definition: Chara.cs:4392
void RestockInventory(bool onCreate)
Definition: Chara.cs:4604
List< List< string > > _historyFood
Definition: Chara.cs:64
bool MoveNeighborDefinitely()
Definition: Chara.cs:2366
bool CanSleep()
Definition: Chara.cs:1151
Stats burden
Definition: Chara.cs:996
void AddHobby(int id)
Definition: Chara.cs:8389
void ChangeJob(string idNew)
Definition: Chara.cs:1959
GlobalData global
Definition: Chara.cs:76
SourceThing.Row GetFavFood()
Definition: Chara.cs:7449
override bool IsMoving
Definition: Chara.cs:604
void SetTempHand(int right=0, int left=0)
Definition: Chara.cs:6207
int[] rawSlots
Definition: Chara.cs:73
void GoHostile(Card _tg)
Definition: Chara.cs:5833
void ApplyJob(bool remove=false)
Definition: Chara.cs:1950
bool IsHomeMember()
Definition: Chara.cs:6092
Chara parasite
Definition: Chara.cs:30
void AddRandomBodyPart(bool msg=false)
Definition: Chara.cs:1988
string GetActionText()
Definition: Chara.cs:6737
void SyncRide(Chara c)
Definition: Chara.cs:3671
Chara master
Definition: Chara.cs:88
List< Hobby > ListWorks(bool useMemberType=true)
Definition: Chara.cs:8253
Card DropHeld(Point dropPos=null)
Definition: Chara.cs:4310
void Revive(Point p=null, bool msg=false)
Definition: Chara.cs:4746
void GainAbility(int ele, int mtp=100)
Definition: Chara.cs:9298
void TryReservePickupTutorial(Thing t)
Definition: Chara.cs:4111
Chara ride
Definition: Chara.cs:27
LayerDrama ShowDialog(string book, string step="main", string tag="")
Definition: Chara.cs:6697
Zone homeZone
Definition: Chara.cs:263
void RefreshFaithElement()
Definition: Chara.cs:9408
ElementContainer faithElements
Definition: Chara.cs:38
override void ChangeRarity(Rarity r)
Definition: Chara.cs:1258
void GiveLovePotion(Chara c, Thing t)
Definition: Chara.cs:7761
void AddCooldown(int idEle, int turns=0)
Definition: Chara.cs:8033
bool IsGuest()
Definition: Chara.cs:6117
int GetTotalFeat()
Definition: Chara.cs:7489
Hobby GetWork(string id)
Definition: Chara.cs:8300
GoalList goalList
Definition: Chara.cs:196
SourceJob.Row _job
Definition: Chara.cs:158
bool CanOpenDoor
Definition: Chara.cs:815
void SetEQQuality()
Definition: Chara.cs:4633
void RerollHobby(bool extraSlotChance=true)
Definition: Chara.cs:8413
Thing MakeGene(DNA.Type? type=null)
Definition: Chara.cs:7546
void RefreshSpeed(Element.BonusInfo info=null)
Definition: Chara.cs:1668
static List< SourceRace.Row > ListAdvRace
Definition: Chara.cs:162
bool IsLocalChara
Definition: Chara.cs:837
bool CanBeTempAlly(Chara c)
Definition: Chara.cs:2114
override string AliasMaterialOnCreate
Definition: Chara.cs:554
void ModWeight(int a, bool ignoreLimit=false)
Definition: Chara.cs:9031
bool ignoreSPAbsorb
Definition: Chara.cs:146
void AddFoodHistory(Thing food)
Definition: Chara.cs:9359
override CardRow sourceCard
Definition: Chara.cs:446
BaseArea GetRoomWork()
Definition: Chara.cs:8231
bool CanInteractTo(Card c)
Definition: Chara.cs:2293
Thing nextUse
Definition: Chara.cs:100
Affinity affinity
Definition: Chara.cs:310
string GetTopicText(string topic="calm")
Definition: Chara.cs:6428
static NoGoal _NoGoalRepeat
Definition: Chara.cs:194
void ModCorruption(int a)
Definition: Chara.cs:9056
void RestockEquip(bool onCreate)
Definition: Chara.cs:4402
override void SetDir(int d)
Definition: Chara.cs:3282
MoveResult TryMoveTowards(Point p)
Definition: Chara.cs:2392
bool isBerserk
Definition: Chara.cs:122
Religion faith
Definition: Chara.cs:435
List< int > _hobbies
Definition: Chara.cs:49
bool FindNearestNewEnemy()
Definition: Chara.cs:6019
string GetIdPortrait()
Definition: Chara.cs:7529
bool HasNoGoal
Definition: Chara.cs:864
Element GetFavWeaponSkill()
Definition: Chara.cs:4378
void DropThing(Thing t, int num=-1)
Definition: Chara.cs:4330
Chara enemy
Definition: Chara.cs:86
void GiveGift(Chara c, Thing t)
Definition: Chara.cs:7628
void EQ_Item(string s, int num=1)
Definition: Chara.cs:4702
BitArray32 _cbits1
Definition: Chara.cs:84
string GetTextHappiness()
Definition: Chara.cs:6732
CharaAbility ability
Definition: Chara.cs:420
bool IsInActiveZone
Definition: Chara.cs:834
override void Tick()
Definition: Chara.cs:3684
Quest quest
Definition: Chara.cs:24
Chara FindMaster()
Definition: Chara.cs:2161
override bool IsMultisize
Definition: Chara.cs:702
Chara SetEnemy(Chara c=null)
Definition: Chara.cs:5808
void SyncRide()
Definition: Chara.cs:3655
void CallHelp(Chara tg, bool fanatic=false)
Definition: Chara.cs:5939
void DoHostileAction(Card _tg, bool immediate=false)
Definition: Chara.cs:5857
bool isBlind
Definition: Chara.cs:130
bool CanSeeSimple(Point p)
Definition: Chara.cs:1053
void RequestProtection(Chara attacker, Action< Chara > action)
Definition: Chara.cs:7771
bool dirtySpeed
Definition: Chara.cs:166
Thing EQ_ID(string s, int mat=-1, Rarity r=Rarity.Random)
Definition: Chara.cs:4666
void ClearBed(Map map=null)
Definition: Chara.cs:6778
override void SetRenderParam(RenderParam p)
Definition: Chara.cs:6232
void AddResistCon(Condition con)
Definition: Chara.cs:8921
void MoveZone(Zone z, ZoneTransition.EnterState state=ZoneTransition.EnterState.Auto)
Definition: Chara.cs:3099
bool UseAbility(Act a, Card tc=null, Point pos=null, bool pt=false)
Definition: Chara.cs:5352
bool TryEquip(Thing t, bool useFav=false)
Definition: Chara.cs:7150
Room FindRoom()
Definition: Chara.cs:7355
override SubPassData GetSubPassData()
Definition: Chara.cs:6216
bool CanSeeLos(Point p, int dist=-1)
Definition: Chara.cs:1111
int CountNumEaten(Thing food)
Definition: Chara.cs:9379
Point GetDestination()
Definition: Chara.cs:6712
int turnLastSeen
Definition: Chara.cs:110
static bool preventRegen
Definition: Chara.cs:178
void ResistCon(Condition con)
Definition: Chara.cs:8941
void SetSummon(int duration)
Definition: Chara.cs:2155
string _alias
Definition: Chara.cs:215
FactionBranch homeBranch
Definition: Chara.cs:932
Element GetFavArmorSkill()
Definition: Chara.cs:4383
int GetPietyValue()
Definition: Chara.cs:9399
void ChooseNewGoal()
Definition: Chara.cs:8085
void DamageTempElements(int p, bool body, bool mind, bool onlyRenew=false)
Definition: Chara.cs:9497
bool IsEnemyOnPath(Point p, bool cancelAI=true)
Definition: Chara.cs:2270
void FallFromZone()
Definition: Chara.cs:3269
void Drink(Card t)
Definition: Chara.cs:4709
Hostility hostility
Definition: Chara.cs:287
void InitStats(bool onDeserialize=false)
Definition: Chara.cs:8536
bool isFainted
Definition: Chara.cs:128
void MoveHome(string id, int x=-1, int z=-1)
Definition: Chara.cs:3219
Tactics tactics
Definition: Chara.cs:830
bool CanWitness
Definition: Chara.cs:867
Card SplitHeld(int a)
Definition: Chara.cs:4293
void TryDropCarryOnly()
Definition: Chara.cs:4298
bool IsHostile()
Definition: Chara.cs:6034
bool IsInHomeZone()
Definition: Chara.cs:6097
bool isDead
Definition: Chara.cs:385
bool TryIdentify(Thing t, int count=1, bool show=true)
Definition: Chara.cs:7406
Thing TryPoisonPotion(Thing t)
Definition: Chara.cs:4067
void TryTakeSharedItems(bool msg=true)
Definition: Chara.cs:6861
override void LookAt(Card c)
Definition: Chara.cs:3303
bool isConfused
Definition: Chara.cs:126
static List< SourceThing.Row > _listFavFood
Definition: Chara.cs:188
bool TryEquipRanged()
Definition: Chara.cs:7270
void SetFaith(string id)
Definition: Chara.cs:1538
PCCData pccData
Definition: Chara.cs:67
void ApplyDeathPenalty()
Definition: Chara.cs:4834
void Cure(CureType type, int p=100, BlessedState state=BlessedState.Normal)
Definition: Chara.cs:8795
static string[] IDTimeTable
Definition: Chara.cs:15
TimeTable.Span CurrentSpan
Definition: Chara.cs:832
Thing Pick(Thing t, bool msg=true, bool tryStack=true)
Definition: Chara.cs:4017
bool CanLift(Card c)
Definition: Chara.cs:3969
List< int > _listAbility
Definition: Chara.cs:61
void TrySetEnemy(Chara c)
Definition: Chara.cs:5825
string idTimeTable
Definition: Chara.cs:464
override void OnCreate(int genLv)
Definition: Chara.cs:1367
void TryAbsorbRod(Thing t)
Definition: Chara.cs:4081
bool CanAutoPick(Card c)
Definition: Chara.cs:3974
List< int > _works
Definition: Chara.cs:52
string GetTextWork(bool simple=false)
Definition: Chara.cs:8379
override bool IsPCC
Definition: Chara.cs:678
void TryPush(Point point)
Definition: Chara.cs:2991
string GetTextHobby(bool simple=false)
Definition: Chara.cs:8369
Dictionary< int, int > resistCon
Definition: Chara.cs:210
void OnSleep(Thing bed=null, int days=1)
Definition: Chara.cs:8975
bool hasTelepathy
Definition: Chara.cs:140
CharaAbility _ability
Definition: Chara.cs:96
Chara SetGlobal()
Definition: Chara.cs:1329
bool CanInsult()
Definition: Chara.cs:7503
void EQ_CAT(string s)
Definition: Chara.cs:4686
bool bossText
Definition: Chara.cs:144
override string GetHoverText2()
Definition: Chara.cs:6336
bool IsEscorted()
Definition: Chara.cs:2170
int ParseBodySlot(string s)
Definition: Chara.cs:1971
bool CanEquipRanged(Thing t)
Definition: Chara.cs:7189
void Sleep(Thing bed=null, Thing pillow=null, bool pickup=false, ItemPosition posBed=null, ItemPosition posPillow=null)
Definition: Chara.cs:8961
void OnGiveErohon(Thing t)
Definition: Chara.cs:7750
override int PrefIndex
Definition: Chara.cs:527
AttackStyle GetFavAttackStyle()
Definition: Chara.cs:4358
bool HasCooldown(int idEle)
Definition: Chara.cs:8051
static GoalWork _goalWork
Definition: Chara.cs:202
int idleActTimer
Definition: Chara.cs:112
void DoAI(int wait, Action onPerform)
Definition: Chara.cs:5757
ElementContainer workElements
Definition: Chara.cs:40
bool WillConsumeTurn()
Definition: Chara.cs:3427
bool IsNeutral()
Definition: Chara.cs:6073
static List< SourceJob.Row > ListAdvJob
Definition: Chara.cs:164
void MoveZone(string alias)
Definition: Chara.cs:3094
void CalcBurden()
Definition: Chara.cs:1627
void SetPCCState(PCCState state)
Definition: Chara.cs:6184
SourceRace.Row race
Definition: Chara.cs:460
Element GetBuffStats(int ele)
Definition: Chara.cs:8733
void MakeGrave(string lastword)
Definition: Chara.cs:4814
override void OnBeforeCreate()
Definition: Chara.cs:1351
Color colorHostile
Color colorDebuff
Color colorFriend
UD_String_MatData matColors
Gradient gradientLVComparison
int uidMachine
Definition: ConSuspend.cs:6
virtual bool IsKilled
Definition: Condition.cs:7
void Kill(bool silent=false)
Definition: Condition.cs:91
override void Tick()
Definition: Condition.cs:70
static Condition Create(string alias, int power=100, Action< Condition > onCreate=null)
Definition: Condition.cs:46
bool allyKeepDistance
Definition: ConfigTactics.cs:6
static void Collect(Thing t)
bool ignoreBackerDestoryFlag
Definition: CoreConfig.cs:553
new GameConfig game
Definition: CoreConfig.cs:600
BackerContentConfig backer
Definition: CoreConfig.cs:604
bool ignoreWeight
Definition: CoreDebug.cs:186
bool godMode
Definition: CoreDebug.cs:172
bool showExtra
Definition: CoreDebug.cs:167
bool ignoreEncounter
Definition: CoreDebug.cs:200
bool enable
Definition: CoreDebug.cs:285
bool ignoreAutoSave
Definition: CoreDebug.cs:125
static string DramaData
Definition: CorePath.cs:178
SourcePref snowputit2
Definition: CoreRef.cs:324
SourcePref sonwputit1
Definition: CoreRef.cs:322
SourcePref replacer1
Definition: CoreRef.cs:328
PrefData prefs
Definition: CoreRef.cs:405
CoreRef refs
Definition: Core.cs:51
bool IsGameStarted
Definition: Core.cs:84
PCCManager pccs
Definition: Core.cs:41
CoreConfig config
Definition: Core.cs:70
Definition: DNA.cs:8
Type
Definition: DNA.cs:10
static Thing GenerateGene(Chara c, Type? type=null)
Definition: DNA.cs:104
int hour
Definition: Date.cs:74
int GetRaw(int offsetHours=0)
Definition: Date.cs:322
bool IsExpired(int time)
Definition: Date.cs:332
Definition: Dialog.cs:7
static bool warned
Definition: Dialog.cs:49
static void TryWarnMana(Action action)
Definition: Dialog.cs:391
Definition: EClass.cs:5
static Game game
Definition: EClass.cs:8
static Scene scene
Definition: EClass.cs:30
static Faction Home
Definition: EClass.cs:26
static ColorProfile Colors
Definition: EClass.cs:38
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 Zone _zone
Definition: EClass.cs:20
static World world
Definition: EClass.cs:40
static Map _map
Definition: EClass.cs:18
static SourceManager sources
Definition: EClass.cs:42
static bool AdvMode
Definition: EClass.cs:10
static float rndf(float a)
Definition: EClass.cs:87
static FactionBranch Branch
Definition: EClass.cs:22
static BaseGameScreen screen
Definition: EClass.cs:32
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
static SoundManager Sound
Definition: EClass.cs:46
static UI ui
Definition: EClass.cs:16
static GameSetting setting
Definition: EClass.cs:34
Definition: EInput.cs:8
static void Consume(int _skipFrame)
Definition: EInput.cs:656
Definition: Effect.cs:7
static Effect Get(Effect original)
Definition: Effect.cs:85
void Play(float delay, Point from, float fixY=0f, Point to=null, Sprite sprite=null)
Definition: Effect.cs:100
Dictionary< int, Element > dict
void SetParent(Card c)
int Value(int ele)
int ValueWithoutLink(int ele)
void ModExp(int ele, int a, bool chain=false)
Element ModBase(int ele, int v)
void ApplyElementMap(int uid, SourceValueType type, Dictionary< int, int > map, int lv, bool invert=false, bool applyFeat=false)
Element SetBase(string alias, int v, int potential=0)
void Remove(int id)
Element GetElement(string alias)
int ValueWithoutLink
Definition: ELEMENT.cs:292
static int[] List_Body
Definition: ELEMENT.cs:242
int id
Definition: ELEMENT.cs:248
int vBase
Definition: ELEMENT.cs:250
SourceElement.Row source
Definition: ELEMENT.cs:271
int vPotential
Definition: ELEMENT.cs:254
static SourceElement.Row Get(int id)
Definition: ELEMENT.cs:399
bool HasTag(string tag)
Definition: ELEMENT.cs:471
virtual int GetPower(Card c)
Definition: ELEMENT.cs:1068
int Value
Definition: ELEMENT.cs:290
virtual string Name
Definition: ELEMENT.cs:302
static Element Create(int id, int v=0)
Definition: ELEMENT.cs:1097
virtual Act.Cost GetCost(Chara c)
Definition: ELEMENT.cs:1021
static List< SourceElement.Row > ListElements
Definition: ELEMENT.cs:266
int vSource
Definition: ELEMENT.cs:260
static Element Void
Definition: ELEMENT.cs:236
static int[] List_Mind
Definition: ELEMENT.cs:244
virtual int CostLearn
Definition: ELEMENT.cs:312
static int[] List_MainAttributesMajor
Definition: ELEMENT.cs:240
Act act
Definition: ELEMENT.cs:392
bool IsMainAttribute
Definition: ELEMENT.cs:381
Zone zone
Definition: EloMap.cs:11
bool shore
Definition: EloMap.cs:50
Cell GetCell(Point pos)
Definition: EloMap.cs:273
TileInfo GetTileInfo(int gx, int gy)
Definition: EloMap.cs:287
void Add(Expedition ex)
static Expedition Create(Chara c, ExpeditionType type)
Definition: Expedition.cs:112
int hours
Definition: Expedition.cs:6
Definition: FLOOR.cs:2
static SourceFloor.Row sourceSnow
Definition: FLOOR.cs:31
static SourceFloor.Row sourceIce
Definition: FLOOR.cs:35
static bool IsTatami(int id)
Definition: FLOOR.cs:39
static SourceFloor.Row sourceWood
Definition: FLOOR.cs:37
ExpeditionManager expeditions
int Evalue(int ele)
void RemoveMemeber(Chara c)
PolicyManager policies
string Log(string idLang, string ref1=null, string ref2=null, string ref3=null, string ref4=null)
bool HasItemProtection
void AddMemeber(Chara c)
Dictionary< string, Faction > dictAll
Hostility GetHostility()
Definition: FACTION.cs:255
Definition: FEAT.cs:255
List< string > Apply(int a, ElementContainer owner, bool hint=false)
Definition: FEAT.cs:335
override string FullName
Definition: FEAT.cs:265
override bool IsPurchaseFeatReqMet(ElementContainer owner, int lv=-1)
Definition: FEAT.cs:309
static void Proc(Chara c, Thing food)
Definition: FoodEffect.cs:6
Dictionary< int, byte > lastPoints
Definition: Fov.cs:36
void AdvanceMin(int a)
Definition: GameDate.cs:22
static string Parse(string text, bool thirdPerson, string val1, string val2=null, string val3=null, string val4=null)
Definition: GameLang.cs:124
bool disableVoidBlessing
bool disableDeathPenaltyProtection
RenderData renderTempEQ
Definition: GameScreen.cs:7
float defaultActPace
Definition: GameSetting.cs:327
PassSetting pass
Definition: GameSetting.cs:303
RenderSetting render
Definition: GameSetting.cs:301
UD_String_ElementRef elements
Definition: GameSetting.cs:315
bool autoCollectCard
Definition: Game.cs:51
ConfigPreference preference
Definition: Game.cs:96
ConfigTactics tactics
Definition: Game.cs:90
ConfigAutoCombat autoCombat
Definition: Game.cs:93
ReligionManager religions
Definition: Game.cs:158
GamePrincipal principal
Definition: Game.cs:221
bool Save(bool isAutoSave=false, bool silent=false)
Definition: Game.cs:948
SpatialManager spatials
Definition: Game.cs:152
PCCUniformManager uniforms
Definition: Game.cs:191
CardManager cards
Definition: Game.cs:155
Zone activeZone
Definition: Game.cs:245
new World world
Definition: Game.cs:173
Config config
Definition: Game.cs:215
QuestManager quests
Definition: Game.cs:179
int seed
Definition: Game.cs:197
FactionManager factions
Definition: Game.cs:161
GlobalGoal goal
Definition: GlobalData.cs:9
void SetOwner(Chara c)
Definition: GlobalGoal.cs:10
int index
Definition: GoalList.cs:5
void Refresh(Chara owner, GoalListType type)
Definition: GoalList.cs:9
Goal Next()
Definition: GoalList.cs:39
void ValidateHobby(Chara c)
Definition: GoalWork.cs:21
bool FindWork(Chara c, bool setAI=true)
Definition: GoalWork.cs:55
Definition: Goal.cs:4
bool ShowBounty(Chara c)
Definition: GuildFighter.cs:39
bool HasBounty(Chara c)
Definition: GuildFighter.cs:44
Definition: Guild.cs:2
static GuildFighter Fighter
Definition: Guild.cs:23
Definition: Hobby.cs:4
SourceHobby.Row source
Definition: Hobby.cs:7
int GetEfficiency(Chara c)
Definition: Hobby.cs:30
AIWork GetAI(Chara c)
Definition: Hobby.cs:11
virtual Thing Thing
Definition: HotItem.cs:38
static bool Has(string id)
Definition: LangGame.cs:46
Definition: Lang.cs:6
static string[] GetList(string id)
Definition: Lang.cs:114
static string _currency(object a, string IDCurrency)
Definition: Lang.cs:162
static void SetDirty(Element a)
static LayerDrama Activate(string book, string idSheet, string idStep, Chara target=null, Card ref1=null, string tag="")
Definition: LayerDrama.cs:66
static string forceJump
Definition: LayerDrama.cs:18
static LayerDrama ActivateMain(string idSheet, string idStep=null, Chara target=null, Card ref1=null, string tag="")
Definition: LayerDrama.cs:61
static void SetDirty(Thing t)
Definition: Los.cs:5
static bool IsVisible(Point p1, Point p2, Action< Point, bool > _onVisit=null)
Definition: Los.cs:167
static SourceMaterial.Row sourceOak
Definition: MATERIAL.cs:39
static SourceMaterial.Row sourceSnow
Definition: MATERIAL.cs:33
static SourceMaterial.Row sourceIce
Definition: MATERIAL.cs:35
Point GetCenterPos()
Definition: MapBounds.cs:52
Definition: Map.cs:13
bool IsIndoor
Definition: Map.cs:131
Thing FindThing(Func< Thing, bool > func)
Definition: Map.cs:2570
Chara FindChara(string id)
Definition: Map.cs:2546
void MoveCard(Point p, Card t)
Definition: Map.cs:835
void SetLiquid(int x, int z, CellEffect effect=null)
Definition: Map.cs:1464
void SetFoormark(Point pos, int id, int angle, int offset=0)
Definition: Map.cs:2038
List< Chara > deadCharas
Definition: Map.cs:46
PropsManager props
Definition: Map.cs:91
RoomManager rooms
Definition: Map.cs:31
Cell[,] cells
Definition: Map.cs:85
void SetEffect(int x, int z, CellEffect effect=null)
Definition: Map.cs:1495
List< Chara > charas
Definition: Map.cs:81
Color Negative
Definition: MsgColors.cs:15
Color Thinking
Definition: MsgColors.cs:17
Color MutateBad
Definition: MsgColors.cs:21
Color Talk
Definition: MsgColors.cs:7
Color Ono
Definition: MsgColors.cs:13
Color Ding
Definition: MsgColors.cs:11
Color MutateGood
Definition: MsgColors.cs:19
Definition: Msg.cs:5
static MsgColors colors
Definition: Msg.cs:20
static ThirstPersonInfo thirdPerson1
Definition: Msg.cs:6
static string SayNothingHappen()
Definition: Msg.cs:96
static string Say(string idLang, string ref1, string ref2=null, string ref3=null, string ref4=null)
Definition: Msg.cs:58
static void SetColor()
Definition: Msg.cs:22
Definition: NoGoal.cs:4
int emitFoot
Definition: PCOrbit.cs:9
int emitSmoke
Definition: PCOrbit.cs:11
Vector3 smokePos
Definition: PCOrbit.cs:15
Vector3 footPos
Definition: PCOrbit.cs:13
Definition: Party.cs:6
void RemoveMember(Chara c)
Definition: Party.cs:89
Chara leader
Definition: Party.cs:30
bool HasElement(int ele)
Definition: Party.cs:168
List< Chara > members
Definition: Party.cs:18
void AddMemeber(Chara c, bool showMsg=false)
Definition: Party.cs:56
void RequestPathImmediate(PathProgress progress)
Definition: PathManager.cs:41
Point GetFirstStep(Point origin, Point _dest, IPathfindWalker walker, int maxDist=20, MoveType moveType=MoveType.Default)
Definition: PathManager.cs:67
static PathManager Instance
Definition: PathManager.cs:16
List< PathFinderNode > nodes
Definition: PathProgress.cs:16
bool KilledBossInVoid
Definition: Player.cs:306
bool gotEtherDisease
Definition: Player.cs:354
bool loytelEscaped
Definition: Player.cs:366
int storyFiama
Definition: Player.cs:486
bool little_saved
Definition: Player.cs:330
bool fiamaStoryBookGiven
Definition: Player.cs:186
bool fiamaFirstDream
Definition: Player.cs:198
bool little_killed
Definition: Player.cs:342
bool isShoesOff
Definition: Player.cs:234
int turns
Definition: Player.cs:74
int allyDeath
Definition: Player.cs:90
int days
Definition: Player.cs:68
int distanceTravel
Definition: Player.cs:712
bool IsCriminal
Definition: Player.cs:1153
Flags flags
Definition: Player.cs:910
bool TooHeavyToMove()
Definition: Player.cs:2353
bool preventDeathPenalty
Definition: Player.cs:983
bool deathZoneMove
Definition: Player.cs:985
void ModFame(int a)
Definition: Player.cs:1900
void ModKarma(int a)
Definition: Player.cs:2311
Stats stats
Definition: Player.cs:832
bool haltMove
Definition: Player.cs:987
bool EnableDreamStory
Definition: Player.cs:1084
bool invlunerable
Definition: Player.cs:989
float baseActTime
Definition: Player.cs:1015
void EndTurn(bool consume=true)
Definition: Player.cs:1887
void EnterLocalZone(bool encounter=false, Chara mob=null)
Definition: Player.cs:1752
int little_dead
Definition: Player.cs:745
HashSet< int > doneBackers
Definition: Player.cs:889
Window.SaveData dataPick
Definition: Player.cs:850
HotItem currentHotItem
Definition: Player.cs:916
List< Chara > listSummon
Definition: Player.cs:1037
int safeTravel
Definition: Player.cs:739
Thing DropReward(Thing t, bool silent=false)
Definition: Player.cs:2342
ReturnInfo returnInfo
Definition: Player.cs:685
bool regionMoveWarned
Definition: Player.cs:973
Chara chara
Definition: Player.cs:1019
bool TryAbortAutoCombat(bool immediate=true)
Definition: Player.cs:2205
bool simulatingZone
Definition: Player.cs:995
int lastEmptyAlly
Definition: Player.cs:1009
bool altHeldPos
Definition: Player.cs:969
QueueManager queues
Definition: Player.cs:1025
string deathMsg
Definition: Player.cs:1001
Definition: Point.cs:9
int eloY
Definition: Point.cs:81
SourceMaterial.Row matFloor
Definition: Point.cs:57
int index
Definition: Point.cs:49
SourceBlock.Row sourceBlock
Definition: Point.cs:63
void ForeachMultiSize(int w, int h, Action< Point, bool > action)
Definition: Point.cs:1365
void SetObj(int id=0, int value=1, int dir=0)
Definition: Point.cs:908
ref Vector3 Position(int height)
Definition: Point.cs:536
List< Card > ListCards(bool includeMasked=false)
Definition: Point.cs:1031
Point Copy()
Definition: Point.cs:479
override string ToString()
Definition: Point.cs:512
Point Set(int _x, int _z)
Definition: Point.cs:491
void ForeachNeighbor(Action< Point > action, bool diagonal=true)
Definition: Point.cs:1377
CellDetail detail
Definition: Point.cs:71
bool IsBlocked
Definition: Point.cs:351
List< Thing > Things
Definition: Point.cs:326
int x
Definition: Point.cs:36
int z
Definition: Point.cs:39
List< Chara > Charas
Definition: Point.cs:328
int eloX
Definition: Point.cs:79
Point GetPointTowards(Point dest)
Definition: Point.cs:785
bool HasThing
Definition: Point.cs:239
bool Equals(int _x, int _z)
Definition: Point.cs:940
List< Chara > ListCharas()
Definition: Point.cs:1151
SourceFloor.Row sourceFloor
Definition: Point.cs:65
void SetBlock(int idMat=0, int idBlock=0)
Definition: Point.cs:898
bool IsValid
Definition: Point.cs:88
bool HasObj
Definition: Point.cs:137
int Distance(Point p)
Definition: Point.cs:969
bool IsHidden
Definition: Point.cs:335
Chara FirstChara
Definition: Point.cs:276
bool IsInBounds
Definition: Point.cs:104
Cell cell
Definition: Point.cs:51
Point GetRandomNeighbor()
Definition: Point.cs:743
Point GetNearestPoint(bool allowBlock=false, bool allowChara=true, bool allowInstalled=true, bool ignoreCenter=false)
Definition: Point.cs:607
bool HasChara
Definition: Point.cs:226
bool IsDeepWater
Definition: Point.cs:264
bool IsActive(int id, int days=-1)
static string GetRandomPortrait(string idDict)
Definition: Portrait.cs:105
static HashSet< string > allIds
Definition: Portrait.cs:20
PropsInstalled installed
Definition: PropsManager.cs:8
List< Card > sales
Definition: PropsManager.cs:14
TraitManager traits
Definition: Props.cs:18
List< Thing > containers
Definition: Props.cs:22
PropSet all
Definition: Props.cs:8
bool paid
Definition: QuestDebt.cs:10
int stage
Definition: QuestDebt.cs:13
int uidChara
Definition: QuestEscort.cs:6
List< Quest > list
Definition: QuestManager.cs:11
bool OnShowDialog(Chara c)
Quest Add(string id, string idGlobalChara=null)
Definition: QuestManager.cs:29
Quest Get(string id)
Definition: Quest.cs:7
virtual void OnGiveItem(Chara c, Thing t)
Definition: Quest.cs:531
void ChangePhase(int a)
Definition: Quest.cs:572
void Complete()
Definition: Quest.cs:468
void OnSetGoal(AIAct newGoal)
Definition: QueueManager.cs:23
Definition: Rand.cs:4
static int Range(int min, int max)
Definition: Rand.cs:42
static void UseSeed(int seed, Action action)
Definition: Rand.cs:22
static void SetSeed(int a=-1)
Definition: Rand.cs:37
Definition: Recipe.cs:7
static int Set(Zone zone)
Definition: RefZone.cs:12
static Zone Get(int uid)
Definition: RefZone.cs:3
List< Zone > ListTowns()
Definition: Region.cs:252
Dictionary< string, Religion > dictAll
ReligionMoonShadow MoonShadow
ReligionTrickery Trickery
ReligionHealing Healing
Religion GetRandomReligion(bool onlyJoinable=true, bool includeMinor=false)
string Name
Definition: Religion.cs:30
static Religion recentWrath
Definition: Religion.cs:22
void Revelation(string idTalk, int chance=100)
Definition: Religion.cs:145
string NameShort
Definition: Religion.cs:34
int ConvertTile(int tile)
Definition: RenderData.cs:110
bool multisize
Definition: RenderRow.cs:64
SourcePref pref
Definition: RenderRow.cs:68
bool ContainsTag(string _tag)
Definition: RenderRow.cs:148
TileType tileType
Definition: RenderRow.cs:77
int[] _tiles
Definition: RenderRow.cs:12
int[] tiles
Definition: RenderRow.cs:10
Sprite GetSprite(int dir=0, int skin=0, bool snow=false)
Definition: RenderRow.cs:261
void AssignCharas()
Definition: RoomManager.cs:39
Definition: Room.cs:4
Definition: Scene.cs:8
ParticleSystem psSmoke
Definition: Scene.cs:113
GameScreen screenElin
Definition: Scene.cs:93
ActionMode actionMode
Definition: Scene.cs:79
ParticleSystem psFoot
Definition: Scene.cs:111
EloMap elomap
Definition: Scene.cs:149
bool paused
Definition: Scene.cs:140
Definition: Shaker.cs:5
static void ShakeCam(string id="default", float magnitude=1f)
Definition: Shaker.cs:25
List< Row > listSister
Definition: SourceBacker.cs:79
string[] works
Definition: SourceChara.cs:47
string[] hobbies
Definition: SourceChara.cs:49
static Row rowDefaultPCC
Definition: SourceChara.cs:131
List< Row > listWorks
Definition: SourceHobby.cs:64
List< Row > listHobbies
Definition: SourceHobby.cs:61
string[] weapon
Definition: SourceJob.cs:37
string equip
Definition: SourceJob.cs:39
string id
Definition: SourceJob.cs:9
SourceRace races
SourceThing things
SourceHobby hobbies
SourceCharaText charaText
SourceBacker backers
SourceCategory categories
SourceElement elements
SourceChara charas
SourceJob jobs
SourceReligion religions
SourceTactics tactics
bool Surface
Definition: SourcePref.cs:314
string meleeStyle
Definition: SourceRace.cs:75
string castStyle
Definition: SourceRace.cs:77
Zone Find(string id)
GlobalSpatialList map
int lv
Definition: Spatial.cs:142
virtual bool ShowDangerLv
Definition: Spatial.cs:489
virtual bool IsRegion
Definition: Spatial.cs:501
virtual string Name
Definition: Spatial.cs:495
virtual bool IsSnowCovered
Definition: Spatial.cs:531
SourceZone.Row source
Definition: Spatial.cs:441
bool destryoed
Definition: Spatial.cs:45
string id
Definition: Spatial.cs:13
bool isConquered
Definition: Spatial.cs:382
bool isPeace
Definition: Spatial.cs:406
List< Spatial > children
Definition: Spatial.cs:37
Zone FindZone(int lv)
Definition: Spatial.cs:714
Definition: SPELL.cs:527
Sprite GetSprite(bool snow=false)
Definition: SpriteData.cs:56
SpriteData data
static int GetAffinityMod(int phase)
Definition: StatsHygiene.cs:19
Definition: Stats.cs:5
static StatsSAN SAN
Definition: Stats.cs:46
static StatsSleepiness Sleepiness
Definition: Stats.cs:21
virtual void Mod(int a)
Definition: Stats.cs:135
static StatsHygiene Hygiene
Definition: Stats.cs:36
static StatsBurden Burden
Definition: Stats.cs:11
Stats Set(int[] _raw, int _rawIndex, Chara _CC)
Definition: Stats.cs:109
override int GetPhase()
Definition: Stats.cs:117
static StatsMana Mana
Definition: Stats.cs:41
virtual int value
Definition: Stats.cs:56
static StatsStamina Stamina
Definition: Stats.cs:16
static Stats Depression
Definition: Stats.cs:26
static StatsHunger Hunger
Definition: Stats.cs:6
virtual int max
Definition: Stats.cs:68
static Stats Bladder
Definition: Stats.cs:31
static SubPassData Default
Definition: SubPassData.cs:7
Definition: TC.cs:4
int DestDist
Definition: Tactics.cs:24
static TargetTypeSelfParty SelfParty
Definition: TargetType.cs:9
virtual bool ForceParty
Definition: TargetType.cs:41
List< Thing > List(Func< Thing, bool > func, bool onlyAccessible=false)
Thing Find(int uid)
void Foreach(Action< Thing > action, bool onlyAccessible=true)
static void TryLickChest(Thing chest)
Definition: ThingGen.cs:362
static Thing CreateTreasure(string id, int lv, TreasureType type=TreasureType.Map)
Definition: ThingGen.cs:217
static Thing CreateParcel(string idLang=null, params Thing[] things)
Definition: ThingGen.cs:42
static Thing CreateSpellbook(string alias, int num=1)
Definition: ThingGen.cs:151
static Thing CreateFromCategory(string idCat, int lv=-1)
Definition: ThingGen.cs:75
static Thing CreateScroll(int ele, int num=1)
Definition: ThingGen.cs:170
static Thing CreateCurrency(int a, string id="money")
Definition: ThingGen.cs:37
static Thing Create(string id, int idMat=-1, int lv=-1)
Definition: ThingGen.cs:53
Definition: Thing.cs:8
SourceThing.Row source
Definition: Thing.cs:11
bool isEquipped
Definition: Thing.cs:17
override int SelfWeight
Definition: Thing.cs:62
override string GetName(NameStyle style, int _num=-1)
Definition: Thing.cs:498
override SourcePref Pref
Definition: Thing.cs:50
bool IsSharedContainer
Definition: Thing.cs:92
Thing Identify(bool show=true, IDTSource idtSource=IDTSource.Identify)
Definition: Thing.cs:1980
void Set(string n)
bool ignoreSnow
Definition: TileRow.cs:6
string soundFoot
Definition: TileRow.cs:14
virtual bool IsWater
Definition: TileType.cs:163
static Span GetSpan(string id, int hour)
Definition: TimeTable.cs:45
void AddHolder(Chara c)
Definition: TraitBed.cs:101
bool IsHolder(Chara c)
Definition: TraitBed.cs:129
bool CanAssign(Chara c)
Definition: TraitBed.cs:154
virtual Adv_Type AdvType
Definition: TraitChara.cs:99
virtual bool UseRandomAlias
Definition: TraitChara.cs:129
virtual bool CanBePushed
Definition: TraitChara.cs:115
virtual bool IsAmmo(Thing t)
virtual bool CanExtendBuild
Definition: Trait.cs:165
virtual bool IsBlockPath
Definition: Trait.cs:52
virtual void OnTickHeld()
Definition: Trait.cs:1038
virtual void OnSteppedOut(Chara c)
Definition: Trait.cs:1068
virtual bool CanBeDestroyed
Definition: Trait.cs:289
virtual bool CanRead(Chara c)
Definition: Trait.cs:957
virtual bool IsDoor
Definition: Trait.cs:56
virtual bool CanEat(Chara c)
Definition: Trait.cs:966
virtual bool IsChangeFloorHeight
Definition: Trait.cs:72
virtual void OnStepped(Chara c)
Definition: Trait.cs:1064
Card owner
Definition: Trait.cs:26
virtual void OnDrink(Chara c)
Definition: Trait.cs:980
virtual bool CanBeDropped
Definition: Trait.cs:295
virtual Action GetHealAction(Chara c)
Definition: Trait.cs:591
virtual void SetName(ref string s)
Definition: Trait.cs:689
virtual bool CanDrink(Chara c)
Definition: Trait.cs:975
virtual bool CanOnlyCarry
Definition: Trait.cs:287
virtual void OnBlend(Thing t, Chara c)
Definition: Trait.cs:601
static void Reserve(string idStep, Action onBeforePlay=null)
Definition: Tutorial.cs:55
static void Play(string idStep)
Definition: Tutorial.cs:7
Definition: UIItem.cs:5
Image image2
Definition: UIItem.cs:16
UIText text2
Definition: UIItem.cs:8
Definition: UIList.cs:9
SortMode
Definition: UIList.cs:27
Definition: UINote.cs:6
UIItem AddHeaderCard(string text, Sprite sprite=null)
Definition: UINote.cs:84
void Clear()
Definition: UINote.cs:35
UIItem AddText(string text, FontColor color=FontColor.DontChange)
Definition: UINote.cs:113
void Build()
Definition: UINote.cs:49
void SetText(string s)
Definition: UIText.cs:159
int uidZone
Definition: UniqueData.cs:12
bool IsRealTime
Definition: VirtualDate.cs:7
Condition
Definition: Weather.cs:16
Condition CurrentCondition
Definition: Weather.cs:79
bool IsRaining
Definition: Weather.cs:117
static void Say(string text, FontColor fontColor=FontColor.Default, Sprite sprite=null)
FilterResult IsFilterPass(string text)
Definition: Window.cs:498
ContainerFlag flag
Definition: Window.cs:267
HashSet< int > cats
Definition: Window.cs:119
bool userFilter
Definition: Window.cs:132
bool noRotten
Definition: Window.cs:439
bool advDistribution
Definition: Window.cs:427
Definition: Window.cs:13
int efficiency
Definition: WorkSession.cs:28
WorkSession work
Definition: WorkSummary.cs:10
List< WorkSession > hobbies
Definition: WorkSummary.cs:13
Region region
Definition: World.cs:23
GameDate date
Definition: World.cs:6
void SendPackage(Thing p)
Definition: World.cs:68
Weather weather
Definition: World.cs:12
List< ZoneEvent > list
virtual ZoneTransition.EnterState ReturnState
Definition: ZoneInstance.cs:26
virtual void OnLeaveZone()
Definition: ZoneInstance.cs:36
bool IsCrystalLv
Definition: Zone_Nymelle.cs:25
Definition: Zone.cs:12
bool isSimulating
Definition: Zone.cs:72
void SetBGM(List< int > ids, bool refresh=true)
Definition: Zone.cs:2810
ZoneEventManager events
Definition: Zone.cs:40
virtual bool IsNefia
Definition: Zone.cs:280
int CountMinions(Chara c)
Definition: Zone.cs:3524
Zone GetTopZone()
Definition: Zone.cs:1871
FactionBranch branch
Definition: Zone.cs:34
virtual bool HasLaw
Definition: Zone.cs:226
Chara Boss
Definition: Zone.cs:83
bool TryAddThingInSharedContainer(Thing t, List< Thing > containers=null, bool add=true, bool msg=false, Chara chara=null, bool sharedOnly=true)
Definition: Zone.cs:2053
virtual bool IsFestival
Definition: Zone.cs:206
virtual bool IsTown
Definition: Zone.cs:220
void RemoveCard(Card t)
Definition: Zone.cs:1950
bool IsActiveZone
Definition: Zone.cs:488
virtual bool PetFollow
Definition: Zone.cs:282
override int DangerLv
Definition: Zone.cs:107
bool IsPCFaction
Definition: Zone.cs:466
void ResetHostility()
Definition: Zone.cs:2611
virtual bool IsUnderwater
Definition: Zone.cs:264
ZoneInstance instance
Definition: Zone.cs:52
virtual bool WillAutoSave
Definition: Zone.cs:258
virtual bool KeepAllyDistance
Definition: Zone.cs:297
virtual bool HiddenInRegionMap
Definition: Zone.cs:408
void RefreshListCitizen()
Definition: Zone.cs:3389
Card AddCard(Card t, Point point)
Definition: Zone.cs:1910
Map map
Definition: Zone.cs:60
Point GetSpawnPos(Chara c, ZoneTransition.EnterState destState=ZoneTransition.EnterState.Auto)
Definition: Zone.cs:1299
NoteMode
Definition: IInspect.cs:7
Definition: ActRef.cs:2
Definition: ACT.cs:71
CostType type
Definition: ACT.cs:74
int cost
Definition: ACT.cs:72
uint Bits
Definition: BitArray32.cs:6