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