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