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