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