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