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