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