Elin Decompiled Documentation EA 23.244 Nightly
Loading...
Searching...
No Matches
Card.cs
Go to the documentation of this file.
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Runtime.Serialization;
5using System.Text;
6using Newtonsoft.Json;
7using UnityEngine;
8using UnityEngine.UI;
9
11{
12 public enum MoveResult
13 {
14 Fail,
15 Success,
16 Door
17 }
18
19 public enum MoveType
20 {
21 Walk,
22 Force
23 }
24
25 public const int MaxWeight = 10000000;
26
27 public const int SocketDiv = 1000;
28
29 public const int DamageLimit = 99999999;
30
31 [JsonProperty(PropertyName = "A")]
32 public int[] _ints = new int[30];
33
34 [JsonProperty(PropertyName = "B")]
35 public string id = "";
36
37 [JsonProperty(PropertyName = "C")]
39
40 [JsonProperty(PropertyName = "D")]
42
43 [JsonProperty(PropertyName = "E")]
44 public Biography bio;
45
46 [JsonProperty(PropertyName = "SC")]
47 public List<int> sockets;
48
50
51 public Props props;
52
53 public Trait trait;
54
56
57 public Fov fov;
58
59 public Point pos = new Point();
60
62
63 public CardRow hat;
64
65 public int turn;
66
67 public int _colorInt;
68
69 public float roundTimer;
70
71 public float angle = 180f;
72
73 public float animeCounter;
74
75 public bool isDestroyed;
76
78
80
82
84
85 public bool dirtyWeight = true;
86
87 private int _childrenWeight;
88
90
92
93 private static Color _randColor;
94
95 public Emo lastEmo;
96
98
99 private Sprite _paintSprite;
100
101 public int sortVal;
102
104
106
107 public int colorInt
108 {
109 get
110 {
111 if (_colorInt == 0)
112 {
113 RefreshColor();
114 }
115 return _colorInt;
116 }
117 }
118
119 public bool IsHotItem => invY == 1;
120
121 public int uid
122 {
123 get
124 {
125 return _ints[1];
126 }
127 set
128 {
129 _ints[1] = value;
130 }
131 }
132
133 public int idMaterial
134 {
135 get
136 {
137 return _ints[4];
138 }
139 set
140 {
141 _ints[4] = value;
142 }
143 }
144
145 public int dir
146 {
147 get
148 {
149 return _ints[5];
150 }
151 set
152 {
153 _ints[5] = value;
154 }
155 }
156
157 public int Num
158 {
159 get
160 {
161 return _ints[6];
162 }
163 set
164 {
165 _ints[6] = value;
166 }
167 }
168
169 public int _x
170 {
171 get
172 {
173 return _ints[7];
174 }
175 set
176 {
177 _ints[7] = value;
178 }
179 }
180
181 public int _z
182 {
183 get
184 {
185 return _ints[9];
186 }
187 set
188 {
189 _ints[9] = value;
190 }
191 }
192
193 public int genLv
194 {
195 get
196 {
197 return _ints[10];
198 }
199 set
200 {
201 _ints[10] = value;
202 }
203 }
204
205 public int refVal
206 {
207 get
208 {
209 return _ints[11];
210 }
211 set
212 {
213 _ints[11] = value;
214 }
215 }
216
217 public int decay
218 {
219 get
220 {
221 return _ints[12];
222 }
223 set
224 {
225 _ints[12] = value;
226 }
227 }
228
229 public int altitude
230 {
231 get
232 {
233 return _ints[13];
234 }
235 set
236 {
237 _ints[13] = value;
238 }
239 }
240
241 public int hp
242 {
243 get
244 {
245 return _ints[14];
246 }
247 set
248 {
249 _ints[14] = value;
250 }
251 }
252
253 public float fx
254 {
255 get
256 {
257 return 0.001f * (float)_ints[15];
258 }
259 set
260 {
261 _ints[15] = (int)(value * 1000f);
262 }
263 }
264
265 public float fy
266 {
267 get
268 {
269 return 0.001f * (float)_ints[16];
270 }
271 set
272 {
273 _ints[16] = (int)(value * 1000f);
274 }
275 }
276
278 {
279 get
280 {
281 return _ints[17].ToEnum<BlessedState>();
282 }
283 set
284 {
285 _ints[17] = (int)value;
286 }
287 }
288
290 {
291 get
292 {
293 return _ints[18].ToEnum<PlaceState>();
294 }
295 set
296 {
297 _ints[18] = (int)value;
298 }
299 }
300
301 public int rarityLv
302 {
303 get
304 {
305 return _ints[19];
306 }
307 set
308 {
309 _ints[19] = value;
310 }
311 }
312
314 {
315 get
316 {
317 return (_ints[19] / 100).ToEnum<Rarity>();
318 }
319 set
320 {
321 _ints[19] = (int)value * 100;
322 }
323 }
324
325 public int encLV
326 {
327 get
328 {
329 return _ints[20];
330 }
331 set
332 {
333 _ints[20] = value;
334 }
335 }
336
337 public int posInvX
338 {
339 get
340 {
341 return _ints[21];
342 }
343 set
344 {
345 _ints[21] = value;
346 }
347 }
348
349 public int posInvY
350 {
351 get
352 {
353 return _ints[22];
354 }
355 set
356 {
357 _ints[22] = value;
358 }
359 }
360
361 public int idSkin
362 {
363 get
364 {
365 return _ints[23];
366 }
367 set
368 {
369 _ints[23] = value;
370 }
371 }
372
373 public int feat
374 {
375 get
376 {
377 return _ints[24];
378 }
379 set
380 {
381 _ints[24] = value;
382 }
383 }
384
385 public int LV
386 {
387 get
388 {
389 return _ints[25];
390 }
391 set
392 {
393 _ints[25] = value;
394 }
395 }
396
397 public int exp
398 {
399 get
400 {
401 return _ints[26];
402 }
403 set
404 {
405 _ints[26] = value;
406 }
407 }
408
409 public int tier
410 {
411 get
412 {
413 return _ints[27];
414 }
415 set
416 {
417 _ints[27] = value;
418 }
419 }
420
421 public int version
422 {
423 get
424 {
425 return _ints[29];
426 }
427 set
428 {
429 _ints[29] = value;
430 }
431 }
432
433 public bool isCensored
434 {
435 get
436 {
437 return _bits1[1];
438 }
439 set
440 {
441 _bits1[1] = value;
442 }
443 }
444
446 {
447 get
448 {
449 return _bits1[2];
450 }
451 set
452 {
453 _bits1[2] = value;
454 }
455 }
456
457 public bool isDyed
458 {
459 get
460 {
461 return _bits1[3];
462 }
463 set
464 {
465 _bits1[3] = value;
466 }
467 }
468
469 public bool isModified
470 {
471 get
472 {
473 return _bits1[4];
474 }
475 set
476 {
477 _bits1[4] = value;
478 }
479 }
480
481 public bool isNew
482 {
483 get
484 {
485 return _bits1[5];
486 }
487 set
488 {
489 _bits1[5] = value;
490 }
491 }
492
494 {
495 get
496 {
497 return _bits1[6];
498 }
499 set
500 {
501 _bits1[6] = value;
502 }
503 }
504
505 public bool ignoreAutoPick
506 {
507 get
508 {
509 return _bits1[7];
510 }
511 set
512 {
513 _bits1[7] = value;
514 }
515 }
516
517 public bool freePos
518 {
519 get
520 {
521 return _bits1[8];
522 }
523 set
524 {
525 _bits1[8] = value;
526 }
527 }
528
529 public bool isHidden
530 {
531 get
532 {
533 return _bits1[9];
534 }
535 set
536 {
537 _bits1[9] = value;
538 }
539 }
540
541 public bool isOn
542 {
543 get
544 {
545 return _bits1[10];
546 }
547 set
548 {
549 _bits1[10] = value;
550 }
551 }
552
553 public bool isNPCProperty
554 {
555 get
556 {
557 return _bits1[11];
558 }
559 set
560 {
561 _bits1[11] = value;
562 }
563 }
564
565 public bool isRestrained
566 {
567 get
568 {
569 return _bits1[12];
570 }
571 set
572 {
573 _bits1[12] = value;
574 }
575 }
576
577 public bool isRoofItem
578 {
579 get
580 {
581 return _bits1[13];
582 }
583 set
584 {
585 _bits1[13] = value;
586 }
587 }
588
589 public bool isMasked
590 {
591 get
592 {
593 return _bits1[14];
594 }
595 set
596 {
597 _bits1[14] = value;
598 }
599 }
600
602 {
603 get
604 {
605 return _bits1[15];
606 }
607 set
608 {
609 _bits1[15] = value;
610 }
611 }
612
613 public bool isImported
614 {
615 get
616 {
617 return _bits1[16];
618 }
619 set
620 {
621 _bits1[16] = value;
622 }
623 }
624
625 public bool autoRefuel
626 {
627 get
628 {
629 return _bits1[17];
630 }
631 set
632 {
633 _bits1[17] = value;
634 }
635 }
636
638 {
639 get
640 {
641 return _bits1[18];
642 }
643 set
644 {
645 _bits1[18] = value;
646 }
647 }
648
649 public bool isFloating
650 {
651 get
652 {
653 return _bits1[19];
654 }
655 set
656 {
657 _bits1[19] = value;
658 }
659 }
660
661 public bool isWeightChanged
662 {
663 get
664 {
665 return _bits1[20];
666 }
667 set
668 {
669 _bits1[20] = value;
670 }
671 }
672
673 public bool isFireproof
674 {
675 get
676 {
677 return _bits1[21];
678 }
679 set
680 {
681 _bits1[21] = value;
682 }
683 }
684
685 public bool isAcidproof
686 {
687 get
688 {
689 return _bits1[22];
690 }
691 set
692 {
693 _bits1[22] = value;
694 }
695 }
696
697 public bool isReplica
698 {
699 get
700 {
701 return _bits1[23];
702 }
703 set
704 {
705 _bits1[23] = value;
706 }
707 }
708
709 public bool isSummon
710 {
711 get
712 {
713 return _bits1[24];
714 }
715 set
716 {
717 _bits1[24] = value;
718 }
719 }
720
721 public bool isElemental
722 {
723 get
724 {
725 return _bits1[25];
726 }
727 set
728 {
729 _bits1[25] = value;
730 }
731 }
732
733 public bool isBroken
734 {
735 get
736 {
737 return _bits1[26];
738 }
739 set
740 {
741 _bits1[26] = value;
742 }
743 }
744
745 public bool isSubsetCard
746 {
747 get
748 {
749 return _bits1[27];
750 }
751 set
752 {
753 _bits1[27] = value;
754 }
755 }
756
757 public bool noSnow
758 {
759 get
760 {
761 return _bits1[28];
762 }
763 set
764 {
765 _bits1[28] = value;
766 }
767 }
768
769 public bool noMove
770 {
771 get
772 {
773 return _bits1[29];
774 }
775 set
776 {
777 _bits1[29] = value;
778 }
779 }
780
781 public bool isGifted
782 {
783 get
784 {
785 return _bits1[30];
786 }
787 set
788 {
789 _bits1[30] = value;
790 }
791 }
792
793 public bool isCrafted
794 {
795 get
796 {
797 return _bits1[31];
798 }
799 set
800 {
801 _bits1[31] = value;
802 }
803 }
804
805 public bool isLostProperty
806 {
807 get
808 {
809 return _bits2[0];
810 }
811 set
812 {
813 _bits2[0] = value;
814 }
815 }
816
817 public bool noShadow
818 {
819 get
820 {
821 return _bits2[1];
822 }
823 set
824 {
825 _bits2[1] = value;
826 }
827 }
828
829 public bool noSell
830 {
831 get
832 {
833 return _bits2[2];
834 }
835 set
836 {
837 _bits2[2] = value;
838 }
839 }
840
841 public bool isLeashed
842 {
843 get
844 {
845 return _bits2[3];
846 }
847 set
848 {
849 _bits2[3] = value;
850 }
851 }
852
853 public bool isStolen
854 {
855 get
856 {
857 return _bits2[4];
858 }
859 set
860 {
861 _bits2[4] = value;
862 }
863 }
864
865 public bool isSale
866 {
867 get
868 {
869 return _bits2[5];
870 }
871 set
872 {
873 _bits2[5] = value;
874 }
875 }
876
877 public bool isCopy
878 {
879 get
880 {
881 return _bits2[6];
882 }
883 set
884 {
885 _bits2[6] = value;
886 }
887 }
888
889 public bool isRestocking
890 {
891 get
892 {
893 return _bits2[7];
894 }
895 set
896 {
897 _bits2[7] = value;
898 }
899 }
900
901 public bool hasSpawned
902 {
903 get
904 {
905 return _bits2[8];
906 }
907 set
908 {
909 _bits2[8] = value;
910 }
911 }
912
913 public bool isScaled
914 {
915 get
916 {
917 return _bits2[9];
918 }
919 set
920 {
921 _bits2[9] = value;
922 }
923 }
924
925 public bool isBackerContent => c_idBacker != 0;
926
928 {
929 get
930 {
931 if (!isBackerContent)
932 {
933 return null;
934 }
935 return EClass.sources.backers.map.TryGetValue(c_idBacker);
936 }
937 }
938
940 {
941 get
942 {
943 return GetInt(9).ToEnum<BedType>();
944 }
945 set
946 {
947 SetInt(9, (int)value);
948 }
949 }
950
951 public int c_equippedSlot
952 {
953 get
954 {
955 return GetInt(6);
956 }
957 set
958 {
959 SetInt(6, value);
960 }
961 }
962
963 public int c_lockLv
964 {
965 get
966 {
967 return GetInt(50);
968 }
969 set
970 {
971 SetInt(50, value);
972 }
973 }
974
976 {
977 get
978 {
979 return GetInt(12).ToEnum<Hostility>();
980 }
981 set
982 {
983 SetInt(12, (int)value);
984 }
985 }
986
988 {
989 get
990 {
991 return GetInt(61).ToEnum<MinionType>();
992 }
993 set
994 {
995 SetInt(61, (int)value);
996 }
997 }
998
999 public int c_vomit
1000 {
1001 get
1002 {
1003 return GetInt(13);
1004 }
1005 set
1006 {
1007 SetInt(13, value);
1008 }
1009 }
1010
1011 public bool c_wasInPcParty
1012 {
1013 get
1014 {
1015 return GetInt(103) != 0;
1016 }
1017 set
1018 {
1019 SetInt(103, value ? 1 : 0);
1020 }
1021 }
1022
1023 public bool c_isImportant
1024 {
1025 get
1026 {
1027 return GetInt(109) != 0;
1028 }
1029 set
1030 {
1031 SetInt(109, value ? 1 : 0);
1032 }
1033 }
1034
1035 public bool c_lockedHard
1036 {
1037 get
1038 {
1039 return GetInt(63) != 0;
1040 }
1041 set
1042 {
1043 SetInt(63, value ? 1 : 0);
1044 }
1045 }
1046
1047 public bool c_revealLock
1048 {
1049 get
1050 {
1051 return GetInt(64) != 0;
1052 }
1053 set
1054 {
1055 SetInt(64, value ? 1 : 0);
1056 }
1057 }
1058
1059 public bool c_isTrained
1060 {
1061 get
1062 {
1063 return GetInt(120) != 0;
1064 }
1065 set
1066 {
1067 SetInt(120, value ? 1 : 0);
1068 }
1069 }
1070
1071 public bool c_isPrayed
1072 {
1073 get
1074 {
1075 return GetInt(121) != 0;
1076 }
1077 set
1078 {
1079 SetInt(121, value ? 1 : 0);
1080 }
1081 }
1082
1084 {
1085 get
1086 {
1087 return GetInt(122) != 0;
1088 }
1089 set
1090 {
1091 SetInt(122, value ? 1 : 0);
1092 }
1093 }
1094
1095 public int c_lightColor
1096 {
1097 get
1098 {
1099 return GetInt(5);
1100 }
1101 set
1102 {
1103 Mod();
1104 SetInt(5, value);
1105 }
1106 }
1107
1108 public Color LightColor => new Color((float)(c_lightColor / 1024 * 8) / 256f, (float)(c_lightColor % 1024 / 32 * 8) / 256f, (float)(c_lightColor % 32 * 8) / 256f, 1f);
1109
1110 public int c_uidZone
1111 {
1112 get
1113 {
1114 return GetInt(10);
1115 }
1116 set
1117 {
1118 Mod();
1119 SetInt(10, value);
1120 }
1121 }
1122
1123 public int c_uidRefCard
1124 {
1125 get
1126 {
1127 return GetInt(11);
1128 }
1129 set
1130 {
1131 Mod();
1132 SetInt(11, value);
1133 }
1134 }
1135
1136 public int c_priceFix
1137 {
1138 get
1139 {
1140 return GetInt(21);
1141 }
1142 set
1143 {
1144 SetInt(21, value);
1145 }
1146 }
1147
1148 public int c_priceAdd
1149 {
1150 get
1151 {
1152 return GetInt(29);
1153 }
1154 set
1155 {
1156 SetInt(29, value);
1157 }
1158 }
1159
1160 public int c_priceCopy
1161 {
1162 get
1163 {
1164 return GetInt(124);
1165 }
1166 set
1167 {
1168 SetInt(124, value);
1169 }
1170 }
1171
1172 public int c_fixedValue
1173 {
1174 get
1175 {
1176 return GetInt(131);
1177 }
1178 set
1179 {
1180 SetInt(131, value);
1181 }
1182 }
1183
1184 public int c_dyeMat
1185 {
1186 get
1187 {
1188 return GetInt(3);
1189 }
1190 set
1191 {
1192 SetInt(3, value);
1193 }
1194 }
1195
1197 {
1198 get
1199 {
1200 return GetInt(4).ToEnum<VisitorState>();
1201 }
1202 set
1203 {
1204 SetInt(4, (int)value);
1205 }
1206 }
1207
1209 {
1210 get
1211 {
1212 return GetInt(53).ToEnum<RescueState>();
1213 }
1214 set
1215 {
1216 SetInt(53, (int)value);
1217 }
1218 }
1219
1221 {
1222 get
1223 {
1224 return GetInt(65).ToEnum<BossType>();
1225 }
1226 set
1227 {
1228 SetInt(65, (int)value);
1229 }
1230 }
1231
1233 {
1234 get
1235 {
1236 return GetInt(22);
1237 }
1238 set
1239 {
1240 SetInt(22, value);
1241 }
1242 }
1243
1245 {
1246 get
1247 {
1248 return GetInt(130);
1249 }
1250 set
1251 {
1252 SetInt(130, value);
1253 }
1254 }
1255
1256 public int c_IDTState
1257 {
1258 get
1259 {
1260 return GetInt(2);
1261 }
1262 set
1263 {
1264 SetInt(2, value);
1265 }
1266 }
1267
1268 public int c_charges
1269 {
1270 get
1271 {
1272 return GetInt(7);
1273 }
1274 set
1275 {
1276 SetInt(7, value);
1277 }
1278 }
1279
1280 public int c_bill
1281 {
1282 get
1283 {
1284 return GetInt(23);
1285 }
1286 set
1287 {
1288 SetInt(23, value);
1289 }
1290 }
1291
1292 public int c_invest
1293 {
1294 get
1295 {
1296 return GetInt(28);
1297 }
1298 set
1299 {
1300 SetInt(28, value);
1301 }
1302 }
1303
1304 public int c_seed
1305 {
1306 get
1307 {
1308 return GetInt(33);
1309 }
1310 set
1311 {
1312 SetInt(33, value);
1313 }
1314 }
1315
1316 public int c_allowance
1317 {
1318 get
1319 {
1320 return GetInt(114);
1321 }
1322 set
1323 {
1324 SetInt(114, value);
1325 }
1326 }
1327
1328 public int c_fur
1329 {
1330 get
1331 {
1332 return GetInt(62);
1333 }
1334 set
1335 {
1336 SetInt(62, value);
1337 }
1338 }
1339
1340 public int c_dateCooked
1341 {
1342 get
1343 {
1344 return GetInt(66);
1345 }
1346 set
1347 {
1348 SetInt(66, value);
1349 }
1350 }
1351
1352 public int c_lockedAge
1353 {
1354 get
1355 {
1356 return GetInt(38);
1357 }
1358 set
1359 {
1360 SetInt(38, value);
1361 }
1362 }
1363
1365 {
1366 get
1367 {
1368 return GetInt(8);
1369 }
1370 set
1371 {
1372 SetInt(8, value);
1373 }
1374 }
1375
1376 public int c_weight
1377 {
1378 get
1379 {
1380 return GetInt(1);
1381 }
1382 set
1383 {
1384 SetInt(1, value);
1385 }
1386 }
1387
1388 public int c_diceDim
1389 {
1390 get
1391 {
1392 return GetInt(14);
1393 }
1394 set
1395 {
1396 SetInt(14, value);
1397 }
1398 }
1399
1401 {
1402 get
1403 {
1404 return GetInt(15);
1405 }
1406 set
1407 {
1408 SetInt(15, value);
1409 }
1410 }
1411
1413 {
1414 get
1415 {
1416 return GetInt(16);
1417 }
1418 set
1419 {
1420 SetInt(16, value);
1421 }
1422 }
1423
1425 {
1426 get
1427 {
1428 return GetInt(17);
1429 }
1430 set
1431 {
1432 SetInt(17, value);
1433 }
1434 }
1435
1436 public int c_idBacker
1437 {
1438 get
1439 {
1440 return GetInt(52);
1441 }
1442 set
1443 {
1444 SetInt(52, value);
1445 }
1446 }
1447
1448 public int c_uidMaster
1449 {
1450 get
1451 {
1452 return GetInt(54);
1453 }
1454 set
1455 {
1456 SetInt(54, value);
1457 }
1458 }
1459
1460 public int c_ammo
1461 {
1462 get
1463 {
1464 return GetInt(27);
1465 }
1466 set
1467 {
1468 SetInt(27, value);
1469 }
1470 }
1471
1472 public int c_daysWithGod
1473 {
1474 get
1475 {
1476 return GetInt(57);
1477 }
1478 set
1479 {
1480 SetInt(57, value);
1481 }
1482 }
1483
1484 public int c_daysWithPC
1485 {
1486 get
1487 {
1488 return GetInt(67);
1489 }
1490 set
1491 {
1492 SetInt(67, value);
1493 }
1494 }
1495
1496 public string c_idPortrait
1497 {
1498 get
1499 {
1500 return GetStr(9);
1501 }
1502 set
1503 {
1504 SetStr(9, value);
1505 }
1506 }
1507
1508 public string c_idRace
1509 {
1510 get
1511 {
1512 return GetStr(3);
1513 }
1514 set
1515 {
1516 SetStr(3, value);
1517 }
1518 }
1519
1520 public string c_idJob
1521 {
1522 get
1523 {
1524 return GetStr(4);
1525 }
1526 set
1527 {
1528 SetStr(4, value);
1529 }
1530 }
1531
1532 public string c_idTone
1533 {
1534 get
1535 {
1536 return GetStr(22);
1537 }
1538 set
1539 {
1540 SetStr(22, value);
1541 }
1542 }
1543
1544 public string c_color
1545 {
1546 get
1547 {
1548 return GetStr(8);
1549 }
1550 set
1551 {
1552 SetStr(8, value);
1553 }
1554 }
1555
1557 {
1558 get
1559 {
1560 return GetStr(13);
1561 }
1562 set
1563 {
1564 SetStr(13, value);
1565 }
1566 }
1567
1568 public string c_idTalk
1569 {
1570 get
1571 {
1572 return GetStr(21);
1573 }
1574 set
1575 {
1576 SetStr(21, value);
1577 }
1578 }
1579
1580 public string c_idDeity
1581 {
1582 get
1583 {
1584 return GetStr(26);
1585 }
1586 set
1587 {
1588 SetStr(26, value);
1589 }
1590 }
1591
1592 public string c_altName
1593 {
1594 get
1595 {
1596 return GetStr(1);
1597 }
1598 set
1599 {
1600 SetStr(1, value);
1601 }
1602 }
1603
1604 public string c_altName2
1605 {
1606 get
1607 {
1608 return GetStr(2);
1609 }
1610 set
1611 {
1612 SetStr(2, value);
1613 }
1614 }
1615
1616 public string c_extraNameRef
1617 {
1618 get
1619 {
1620 return GetStr(12);
1621 }
1622 set
1623 {
1624 SetStr(12, value);
1625 }
1626 }
1627
1628 public string c_refText
1629 {
1630 get
1631 {
1632 return GetStr(10);
1633 }
1634 set
1635 {
1636 SetStr(10, value);
1637 }
1638 }
1639
1640 public string c_idRefName
1641 {
1642 get
1643 {
1644 return GetStr(7);
1645 }
1646 set
1647 {
1648 SetStr(7, value);
1649 }
1650 }
1651
1652 public string c_idRidePCC
1653 {
1654 get
1655 {
1656 return GetStr(55);
1657 }
1658 set
1659 {
1660 SetStr(55, value);
1661 }
1662 }
1663
1664 public string c_idAbility
1665 {
1666 get
1667 {
1668 return GetStr(50);
1669 }
1670 set
1671 {
1672 SetStr(50, value);
1673 }
1674 }
1675
1676 public string c_context
1677 {
1678 get
1679 {
1680 return GetStr(20);
1681 }
1682 set
1683 {
1684 SetStr(20, value);
1685 }
1686 }
1687
1688 public string c_idEditor
1689 {
1690 get
1691 {
1692 return GetStr(27);
1693 }
1694 set
1695 {
1696 SetStr(27, value);
1697 }
1698 }
1699
1700 public string c_editorTags
1701 {
1702 get
1703 {
1704 return GetStr(28);
1705 }
1706 set
1707 {
1708 SetStr(28, value);
1709 }
1710 }
1711
1712 public string c_editorTraitVal
1713 {
1714 get
1715 {
1716 return GetStr(25);
1717 }
1718 set
1719 {
1720 SetStr(25, value);
1721 }
1722 }
1723
1724 public string c_idTrait
1725 {
1726 get
1727 {
1728 return GetStr(29);
1729 }
1730 set
1731 {
1732 SetStr(29, value);
1733 }
1734 }
1735
1736 public string c_idRefCard
1737 {
1738 get
1739 {
1740 return GetStr(5);
1741 }
1742 set
1743 {
1744 SetStr(5, value);
1745 }
1746 }
1747
1748 public string c_idRefCard2
1749 {
1750 get
1751 {
1752 return GetStr(6);
1753 }
1754 set
1755 {
1756 SetStr(6, value);
1757 }
1758 }
1759
1760 public string c_note
1761 {
1762 get
1763 {
1764 return GetStr(51);
1765 }
1766 set
1767 {
1768 SetStr(51, value);
1769 }
1770 }
1771
1773 {
1774 get
1775 {
1776 return GetObj<UniqueData>(6);
1777 }
1778 set
1779 {
1780 SetObj(6, value);
1781 }
1782 }
1783
1785 {
1786 get
1787 {
1788 return GetObj<Thing>(9);
1789 }
1790 set
1791 {
1792 SetObj(9, value);
1793 }
1794 }
1795
1796 public List<SocketData> socketList
1797 {
1798 get
1799 {
1800 return GetObj<List<SocketData>>(17);
1801 }
1802 set
1803 {
1804 SetObj(17, value);
1805 }
1806 }
1807
1809 {
1810 get
1811 {
1812 return GetObj<Thing>(10);
1813 }
1814 set
1815 {
1816 SetObj(10, value);
1817 }
1818 }
1819
1821 {
1822 get
1823 {
1824 return GetObj<Window.SaveData>(2);
1825 }
1826 set
1827 {
1828 SetObj(2, value);
1829 }
1830 }
1831
1833 {
1834 get
1835 {
1836 return GetObj<CharaUpgrade>(11);
1837 }
1838 set
1839 {
1840 SetObj(11, value);
1841 }
1842 }
1843
1845 {
1846 get
1847 {
1848 return GetObj<CharaGenes>(15);
1849 }
1850 set
1851 {
1852 SetObj(15, value);
1853 }
1854 }
1855
1856 public List<int> c_corruptionHistory
1857 {
1858 get
1859 {
1860 return GetObj<List<int>>(16);
1861 }
1862 set
1863 {
1864 SetObj(16, value);
1865 }
1866 }
1867
1869 {
1870 get
1871 {
1872 return GetObj<ContainerUpgrade>(12) ?? (c_containerUpgrade = new ContainerUpgrade());
1873 }
1874 set
1875 {
1876 SetObj(12, value);
1877 }
1878 }
1879
1880 public DNA c_DNA
1881 {
1882 get
1883 {
1884 return GetObj<DNA>(14);
1885 }
1886 set
1887 {
1888 SetObj(14, value);
1889 }
1890 }
1891
1893 {
1894 get
1895 {
1896 return GetObj<CharaList>(13);
1897 }
1898 set
1899 {
1900 SetObj(13, value);
1901 }
1902 }
1903
1905 {
1906 get
1907 {
1908 return GetObj<MixedFoodData>(18);
1909 }
1910 set
1911 {
1912 SetObj(18, value);
1913 }
1914 }
1915
1917 {
1918 get
1919 {
1920 return GetObj<Thing>(19);
1921 }
1922 set
1923 {
1924 SetObj(19, value);
1925 }
1926 }
1927
1928 public byte[] c_textureData
1929 {
1930 get
1931 {
1932 return GetObj<byte[]>(4);
1933 }
1934 set
1935 {
1936 SetObj(4, value);
1937 }
1938 }
1939
1941
1942 public int invX
1943 {
1944 get
1945 {
1946 return pos.x;
1947 }
1948 set
1949 {
1950 pos.x = value;
1951 }
1952 }
1953
1954 public int invY
1955 {
1956 get
1957 {
1958 return pos.z;
1959 }
1960 set
1961 {
1962 pos.z = value;
1963 }
1964 }
1965
1967 {
1968 get
1969 {
1970 object obj;
1971 if (!c_idRefCard.IsEmpty())
1972 {
1973 obj = EClass.sources.cards.map.TryGetValue(c_idRefCard);
1974 if (obj == null)
1975 {
1976 return EClass.sources.cards.map["ash3"];
1977 }
1978 }
1979 else
1980 {
1981 obj = null;
1982 }
1983 return (CardRow)obj;
1984 }
1985 }
1986
1988 {
1989 get
1990 {
1991 object obj;
1992 if (!c_idRefCard2.IsEmpty())
1993 {
1994 obj = EClass.sources.cards.map.TryGetValue(c_idRefCard2);
1995 if (obj == null)
1996 {
1997 return EClass.sources.cards.map["ash3"];
1998 }
1999 }
2000 else
2001 {
2002 obj = null;
2003 }
2004 return (CardRow)obj;
2005 }
2006 }
2007
2008 public int ExpToNext => (50 + LV * 30) * (100 - Evalue(403)) / 100;
2009
2010 public int DefaultLV => sourceCard.LV;
2011
2013 {
2014 get
2015 {
2016 if (dirtyWeight)
2017 {
2018 _childrenWeight = 0;
2019 if (!(trait is TraitMagicChest))
2020 {
2021 foreach (Thing thing in things)
2022 {
2024 }
2025 dirtyWeight = false;
2026 (parent as Card)?.SetDirtyWeight();
2027 if (isChara && IsPCFaction)
2028 {
2029 Chara.CalcBurden();
2030 }
2031 if (_childrenWeight < 0 || _childrenWeight > 10000000)
2032 {
2033 _childrenWeight = 10000000;
2034 }
2035 }
2036 }
2037 return _childrenWeight * Mathf.Max(100 - Evalue(404), 0) / 100;
2038 }
2039 }
2040
2042
2044
2045 public virtual int SelfWeight => 1000;
2046
2047 public virtual int WeightLimit => 500000;
2048
2050
2052
2053 public virtual string AliasMaterialOnCreate => DefaultMaterial.alias;
2054
2055 public Cell Cell => pos.cell;
2056
2057 public virtual Thing Thing
2058 {
2059 get
2060 {
2061 if (!isThing)
2062 {
2063 return null;
2064 }
2065 return (Thing)this;
2066 }
2067 }
2068
2069 public virtual Chara Chara
2070 {
2071 get
2072 {
2073 if (!isChara)
2074 {
2075 return null;
2076 }
2077 return (Chara)this;
2078 }
2079 }
2080
2081 public virtual bool isThing => false;
2082
2083 public virtual bool isChara => false;
2084
2085 public bool ExistsOnMap => parent == EClass._zone;
2086
2087 public virtual bool isSynced => renderer.isSynced;
2088
2090
2091 public bool IsUnique => rarity == Rarity.Artifact;
2092
2093 public bool IsPowerful
2094 {
2095 get
2096 {
2097 if (rarity >= Rarity.Legendary || trait is TraitAdventurer)
2098 {
2099 return !IsPCFactionOrMinion;
2100 }
2101 return false;
2102 }
2103 }
2104
2105 public bool IsImportant => sourceCard.HasTag(CTAG.important);
2106
2107 public virtual SourcePref Pref => sourceCard.pref;
2108
2109 public virtual bool IsDeadOrSleeping => false;
2110
2111 public virtual bool IsDisabled => false;
2112
2113 public virtual bool IsMoving => false;
2114
2115 public virtual bool flipX
2116 {
2117 get
2118 {
2119 if (Tiles.Length == 1)
2120 {
2121 return dir % 2 == 1;
2122 }
2123 return false;
2124 }
2125 }
2126
2127 public virtual bool IsAliveInCurrentZone => ExistsOnMap;
2128
2129 public virtual string actorPrefab => "ThingActor";
2130
2131 public virtual CardRow sourceCard => null;
2132
2134
2136
2137 public string Name => GetName(NameStyle.Full);
2138
2139 public string NameSimple => GetName(NameStyle.Simple);
2140
2141 public string NameOne => GetName(NameStyle.Full, 1);
2142
2143 public virtual bool IsPC => false;
2144
2145 public bool _IsPC => GetInt(56) != 0;
2146
2147 public virtual bool IsPCC => false;
2148
2149 public virtual bool IsPCParty => false;
2150
2151 public virtual bool IsMinion => false;
2152
2153 public virtual bool IsPCPartyMinion => false;
2154
2155 public virtual bool IsPCFactionMinion => false;
2156
2157 public virtual bool IsMultisize
2158 {
2159 get
2160 {
2162 {
2163 return IsInstalled;
2164 }
2165 return false;
2166 }
2167 }
2168
2169 public bool IsToolbelt => category.slot == 44;
2170
2171 public bool IsLightsource => category.slot == 45;
2172
2173 public bool IsEquipment => category.slot != 0;
2174
2175 public bool IsFood => category.IsChildOf("food");
2176
2178 {
2179 get
2180 {
2181 if (!IsFood && !category.IsChildOf("seed") && !category.IsChildOf("drink") && !(id == "pasture"))
2182 {
2183 return id == "grass";
2184 }
2185 return true;
2186 }
2187 }
2188
2189 public bool ShowFoodEnc
2190 {
2191 get
2192 {
2194 {
2195 if (Evalue(10) > 0)
2196 {
2198 }
2199 return false;
2200 }
2201 return true;
2202 }
2203 }
2204
2205 public bool IsWeapon
2206 {
2207 get
2208 {
2209 if (!IsMeleeWeapon)
2210 {
2211 return IsRangedWeapon;
2212 }
2213 return true;
2214 }
2215 }
2216
2218 {
2219 get
2220 {
2221 if (category.slot == 0)
2222 {
2223 return IsRangedWeapon;
2224 }
2225 return true;
2226 }
2227 }
2228
2230 {
2231 get
2232 {
2233 if (category.slot == 0 && !IsRangedWeapon)
2234 {
2235 return IsAmmo;
2236 }
2237 return true;
2238 }
2239 }
2240
2241 public bool IsMeleeWeapon => category.IsChildOf("melee");
2242
2244
2245 public bool IsThrownWeapon => sourceCard.HasTag(CTAG.throwWeapon);
2246
2247 public bool IsAmmo => trait is TraitAmmo;
2248
2249 public bool IsAgent => this == EClass.player.Agent;
2250
2251 public bool IsFurniture => category.IsChildOf("furniture");
2252
2253 public bool IsBlessed => blessedState >= BlessedState.Blessed;
2254
2255 public bool IsCursed => blessedState <= BlessedState.Cursed;
2256
2258 {
2259 get
2260 {
2261 if (isRestrained)
2262 {
2263 return IsPCFaction;
2264 }
2265 return false;
2266 }
2267 }
2268
2269 public virtual bool IsPCFaction => false;
2270
2272 {
2273 get
2274 {
2275 if (!IsPCFaction)
2276 {
2277 return IsPCFactionMinion;
2278 }
2279 return true;
2280 }
2281 }
2282
2283 public virtual bool IsGlobal => false;
2284
2285 public virtual int MaxDecay => 1000;
2286
2287 public bool IsDecayed => decay > MaxDecay;
2288
2289 public bool IsRotting => decay >= MaxDecay / 4 * 3;
2290
2291 public bool IsFresn => decay < MaxDecay / 4;
2292
2293 public virtual int MaxHP => 100;
2294
2295 public virtual int Power => Mathf.Max(20, EClass.curve(GetTotalQuality() * 10, 400, 100));
2296
2297 public int FameLv
2298 {
2299 get
2300 {
2301 if (!IsPC)
2302 {
2303 return LV;
2304 }
2305 return Mathf.Min(EClass.player.fame / 100 + 1, 21474836);
2306 }
2307 }
2308
2309 public virtual int[] Tiles => sourceCard._tiles;
2310
2311 public virtual int PrefIndex
2312 {
2313 get
2314 {
2315 if (Tiles.Length < 3)
2316 {
2317 return dir % 2;
2318 }
2319 return dir;
2320 }
2321 }
2322
2323 public bool IsVariation => sourceCard.origin != null;
2324
2325 public virtual int DV => elements.Value(64);
2326
2327 public virtual int PV => elements.Value(65);
2328
2329 public int HIT => elements.Value(66);
2330
2331 public int DMG => elements.Value(67);
2332
2333 public int STR => elements.Value(70);
2334
2335 public int DEX => elements.Value(72);
2336
2337 public int END => elements.Value(71);
2338
2339 public int PER => elements.Value(73);
2340
2341 public int LER => elements.Value(74);
2342
2343 public int WIL => elements.Value(75);
2344
2345 public int MAG => elements.Value(76);
2346
2347 public int CHA => elements.Value(77);
2348
2349 public int INT => elements.Value(80);
2350
2351 public int LUC => elements.Value(78);
2352
2353 public int W
2354 {
2355 get
2356 {
2357 if (dir % 2 != 0)
2358 {
2359 return sourceCard.H;
2360 }
2361 return sourceCard.W;
2362 }
2363 }
2364
2365 public int H
2366 {
2367 get
2368 {
2369 if (dir % 2 != 0)
2370 {
2371 return sourceCard.W;
2372 }
2373 return sourceCard.H;
2374 }
2375 }
2376
2377 public bool IsIdentified => c_IDTState == 0;
2378
2379 public string TextRarity => Lang.GetList("quality")[Mathf.Clamp((int)(rarity + 1), 0, 5)];
2380
2381 public bool IsInstalled => placeState == PlaceState.installed;
2382
2383 public bool IsMale
2384 {
2385 get
2386 {
2387 if (bio != null)
2388 {
2389 return bio.gender == 2;
2390 }
2391 return false;
2392 }
2393 }
2394
2395 public bool IsNegativeGift
2396 {
2397 get
2398 {
2399 if (!HasTag(CTAG.neg))
2400 {
2401 return blessedState <= BlessedState.Cursed;
2402 }
2403 return true;
2404 }
2405 }
2406
2408
2410 {
2411 get
2412 {
2413 if (!IsPC)
2414 {
2415 return null;
2416 }
2418 }
2419 }
2420
2422
2423 public virtual bool HasHost => false;
2424
2425 public int Quality => Evalue(2);
2426
2427 public int QualityLv => Quality / 10;
2428
2430 {
2431 get
2432 {
2433 if (_LightData == null)
2434 {
2435 return _LightData = ((!sourceCard.lightData.IsEmpty()) ? EClass.Colors.lightColors[sourceCard.lightData] : null);
2436 }
2437 return _LightData;
2438 }
2439 }
2440
2442 {
2443 get
2444 {
2445 if (!isChara || Chara.host == null)
2446 {
2447 return renderer;
2448 }
2449 return Chara.host.renderer;
2450 }
2451 }
2452
2453 public bool ShouldShowMsg
2454 {
2455 get
2456 {
2457 if (IsPC || parent == EClass.pc || isSynced)
2458 {
2459 if (isChara)
2460 {
2461 return !Chara.isDead;
2462 }
2463 return true;
2464 }
2465 return false;
2466 }
2467 }
2468
2469 public bool CanInspect
2470 {
2471 get
2472 {
2473 if (!isDestroyed)
2474 {
2475 return ExistsOnMap;
2476 }
2477 return false;
2478 }
2479 }
2480
2481 public string InspectName => Name;
2482
2484
2486
2487 public override string ToString()
2488 {
2489 return Name + "/" + pos?.ToString() + "/" + parent;
2490 }
2491
2492 public bool CanReserve(AIAct act)
2493 {
2494 if (reservedAct != null && reservedAct != act)
2495 {
2496 return !reservedAct.IsRunning;
2497 }
2498 return true;
2499 }
2500
2501 public bool TryReserve(AIAct act)
2502 {
2503 if (CanReserve(act))
2504 {
2505 reservedAct = act;
2506 return true;
2507 }
2508 return false;
2509 }
2510
2511 public void Mod()
2512 {
2513 isModified = true;
2514 }
2515
2517 {
2518 if (IsPC)
2519 {
2520 return Window.dictData.TryGetValue("LayerInventoryFloatMain0");
2521 }
2523 {
2524 return Window.dictData.TryGetValue("ChestMerchant");
2525 }
2526 return c_windowSaveData;
2527 }
2528
2530 {
2531 if ((IsUnique && ing.id != id && !ing.idOther.Contains(id)) || c_isImportant)
2532 {
2533 return true;
2534 }
2535 if (parent is Card card)
2536 {
2537 if (card.trait is TraitChestMerchant)
2538 {
2539 return true;
2540 }
2541 if (card.isSale || !card.trait.CanUseContent)
2542 {
2543 return true;
2544 }
2545 Window.SaveData windowSaveData = card.GetWindowSaveData();
2546 if (windowSaveData != null)
2547 {
2548 return windowSaveData.excludeCraft;
2549 }
2550 }
2551 return false;
2552 }
2553
2554 public void SetDirtyWeight()
2555 {
2557 {
2558 EClass.player.wasDirtyWeight = true;
2559 }
2560 dirtyWeight = true;
2561 (parent as Card)?.SetDirtyWeight();
2562 }
2563
2564 public void ChangeWeight(int a)
2565 {
2566 c_weight = a;
2567 isWeightChanged = true;
2569 }
2570
2571 public int Evalue(int ele)
2572 {
2573 return elements.Value(ele);
2574 }
2575
2576 public int Evalue(int ele, bool ignoreGlobalElement)
2577 {
2578 if (!ignoreGlobalElement || !HasGlobalElement(ele))
2579 {
2580 return elements.Value(ele);
2581 }
2582 return 0;
2583 }
2584
2585 public int EvalueMax(int ele, int min = 0)
2586 {
2587 return Mathf.Max(elements.Value(ele), min);
2588 }
2589
2590 public int Evalue(string alias)
2591 {
2592 return elements.Value(EClass.sources.elements.alias[alias].id);
2593 }
2594
2595 public bool HasTag(CTAG tag)
2596 {
2597 return sourceCard.tag.Contains(tag.ToString());
2598 }
2599
2600 public bool HasEditorTag(EditorTag tag)
2601 {
2602 return c_editorTags?.Contains(tag.ToString()) ?? false;
2603 }
2604
2605 public void AddEditorTag(EditorTag tag)
2606 {
2607 c_editorTags = (c_editorTags.IsEmpty() ? tag.ToString() : (c_editorTags + "," + tag));
2608 }
2609
2611 {
2612 c_editorTags = (c_editorTags.IsEmpty() ? null : c_editorTags.Replace(tag.ToString(), "").Replace(",,", ","));
2613 }
2614
2615 public virtual string GetName(NameStyle style, int num = -1)
2616 {
2617 return "Card";
2618 }
2619
2620 public virtual string GetExtraName()
2621 {
2622 return "";
2623 }
2624
2625 public virtual string GetDetail()
2626 {
2627 return sourceCard.GetText("detail", returnNull: true);
2628 }
2629
2630 public int GetBestAttribute()
2631 {
2632 int num = 1;
2633 foreach (Element item in elements.dict.Values.Where((Element a) => Element.List_MainAttributesMajor.Contains(a.id)))
2634 {
2635 int num2 = item.Value;
2636 if (isChara && Chara.tempElements != null)
2637 {
2638 num2 -= Chara.tempElements.Value(item.id);
2639 }
2640 if (num2 > num)
2641 {
2642 num = num2;
2643 }
2644 }
2645 return num;
2646 }
2647
2648 public void ModExp(string alias, int a)
2649 {
2650 ModExp(EClass.sources.elements.alias[alias].id, a);
2651 }
2652
2653 public void ModExp(int ele, int a)
2654 {
2655 if (isChara)
2656 {
2657 elements.ModExp(ele, a);
2658 }
2659 }
2660
2661 public bool IsChildOf(Card c)
2662 {
2663 return GetRootCard() == c;
2664 }
2665
2666 public T FindTool<T>() where T : Trait
2667 {
2668 if (IsPC)
2669 {
2670 return Tool?.trait as T;
2671 }
2672 return things.Find<T>()?.trait as T;
2673 }
2674
2676 private void _OnSerializing(StreamingContext context)
2677 {
2678 _x = pos.x;
2679 _z = pos.z;
2680 _ints[0] = _bits1.ToInt();
2681 _ints[2] = _bits2.ToInt();
2683 OnSerializing();
2684 }
2685
2686 protected virtual void OnSerializing()
2687 {
2688 }
2689
2691 private void _OnDeserialized(StreamingContext context)
2692 {
2693 if (version < 2 && sockets != null)
2694 {
2695 for (int i = 0; i < sockets.Count; i++)
2696 {
2697 sockets[i] = sockets[i] / 100 * 1000 + sockets[i] % 100;
2698 }
2699 }
2700 _bits1.SetInt(_ints[0]);
2701 _bits2.SetInt(_ints[2]);
2703 pos.Set(_x, _z);
2704 SetSource();
2705 things.SetOwner(this);
2706 elements.SetOwner(this, applyFeat: false);
2708 ApplyTrait();
2709 ApplyMaterialElements(remove: false);
2711 foreach (Thing thing in things)
2712 {
2713 thing.parent = this;
2714 }
2715 if (isThing && Num <= 0)
2716 {
2717 isDestroyed = true;
2718 }
2719 if (version < 4)
2720 {
2721 if (version < 3 && isChara && HasElement(1210))
2722 {
2723 elements.ModBase(960, -5 * Evalue(1210));
2724 }
2725 if (version < 4 && isChara && HasElement(1210))
2726 {
2727 elements.ModBase(423, Evalue(1210));
2728 }
2729 version = 4;
2730 }
2731 }
2732
2733 protected virtual void OnDeserialized()
2734 {
2735 }
2736
2737 public string ReferenceId()
2738 {
2739 return "c" + uid;
2740 }
2741
2742 public void Create(string _id, int _idMat = -1, int genLv = -1)
2743 {
2744 if (CardBlueprint.current != null)
2745 {
2747 CardBlueprint.current = null;
2748 }
2749 else
2750 {
2752 }
2753 id = _id;
2754 Num = 1;
2755 autoRefuel = true;
2756 EClass.game.cards.AssignUID(this);
2757 this.genLv = genLv;
2758 isNew = true;
2759 version = 3;
2760 SetSource();
2762 if (sourceCard.quality != 0)
2763 {
2764 rarity = sourceCard.quality.ToEnum<Rarity>();
2765 }
2766 else if (bp.rarity != Rarity.Random)
2767 {
2768 rarity = bp.rarity;
2769 }
2770 else if (category.slot != 0 && category.slot != 45 && category.slot != 44)
2771 {
2772 if (EClass.rnd(10) == 0)
2773 {
2774 rarity = Rarity.Crude;
2775 }
2776 else if (EClass.rnd(10) == 0)
2777 {
2778 rarity = Rarity.Superior;
2779 }
2780 else if (EClass.rnd(80) == 0)
2781 {
2782 rarity = Rarity.Legendary;
2783 }
2784 else if (EClass.rnd(250) == 0)
2785 {
2786 rarity = Rarity.Mythical;
2787 }
2788 }
2789 if (rarity != 0 && category.tag.Contains("fixedRarity"))
2790 {
2791 rarity = Rarity.Normal;
2792 }
2793 LV = DefaultLV;
2794 if (bp.lv != -999)
2795 {
2796 LV = bp.lv;
2797 }
2798 if (id == "microchip")
2799 {
2800 Debug.Log(id + "/" + _idMat + "/" + sourceCard.fixedMaterial);
2801 }
2803 {
2805 }
2806 else
2807 {
2808 bool flag = (bp != null && bp.fixedMat) || sourceCard.quality == 4 || sourceCard.tierGroup.IsEmpty();
2809 if (_idMat != -1)
2810 {
2811 _material = EClass.sources.materials.rows[_idMat];
2812 }
2813 else if (!flag)
2814 {
2815 if (sourceCard.tierGroup == "wood")
2816 {
2817 Debug.Log(id);
2818 }
2820 }
2821 else
2822 {
2824 }
2825 }
2826 idMaterial = _material.id;
2827 things.SetOwner(this);
2828 elements.SetOwner(this, applyFeat: true);
2829 ApplyTrait();
2831 {
2832 tier = Mathf.Clamp(EClass.rnd(5) + 1, 1, 3);
2833 LV = LV + tier * 10 + (LV - 1) * (125 + tier * 25) / 100;
2834 }
2835 ApplyMaterial();
2836 OnCreate(genLv);
2839 hp = MaxHP;
2840 if (HasTag(CTAG.hidden))
2841 {
2842 SetHidden();
2843 }
2845 }
2846
2847 public virtual void OnBeforeCreate()
2848 {
2849 }
2850
2851 public virtual void OnCreate(int genLv)
2852 {
2853 }
2854
2855 public virtual void SetSource()
2856 {
2857 }
2858
2859 public virtual void ApplyEditorTags(EditorTag tag)
2860 {
2861 switch (tag)
2862 {
2863 case EditorTag.Hidden:
2864 SetHidden();
2865 break;
2866 case EditorTag.Empty:
2867 RemoveThings();
2868 break;
2869 case EditorTag.IsOn:
2870 isOn = true;
2871 break;
2872 case EditorTag.IsOff:
2873 isOn = false;
2874 break;
2875 case EditorTag.NoSnow:
2876 noSnow = true;
2877 break;
2878 case EditorTag.Boss:
2879 EClass._zone.Boss = Chara;
2880 break;
2881 }
2882 }
2883
2884 public void ApplyTrait()
2885 {
2886 string str = c_idTrait;
2887 if (str.IsEmpty())
2888 {
2889 if (sourceCard.trait.IsEmpty())
2890 {
2891 trait = (isChara ? new TraitChara() : new Trait());
2892 }
2893 else
2894 {
2895 trait = ClassCache.Create<Trait>("Trait" + sourceCard.trait[0], "Elin");
2896 }
2897 }
2898 else
2899 {
2900 trait = ClassCache.Create<Trait>(str, "Elin");
2901 }
2902 trait.SetOwner(this);
2903 }
2904
2905 public Card SetLv(int a)
2906 {
2907 bool flag = a > LV;
2908 LV = a;
2909 if (!isChara)
2910 {
2911 return this;
2912 }
2913 isScaled = true;
2914 Rand.SetSeed(uid);
2915 ElementContainer elementContainer = new ElementContainer();
2916 elementContainer.ApplyElementMap(uid, SourceValueType.Chara, Chara.job.elementMap, LV);
2917 elementContainer.ApplyElementMap(uid, SourceValueType.Chara, Chara.race.elementMap, LV);
2918 elementContainer.ApplyElementMap(uid, SourceValueType.Chara, Chara.source.elementMap, 1, invert: false, applyFeat: true);
2919 foreach (Element value in elements.dict.Values)
2920 {
2921 int num = elementContainer.Value(value.id);
2922 if (num != 0)
2923 {
2924 int num2 = num - value.ValueWithoutLink;
2925 if (num2 != 0)
2926 {
2927 elements.ModBase(value.id, num2);
2928 }
2929 }
2930 }
2931 if (flag)
2932 {
2934 }
2935 Rand.SetSeed();
2936 hp = MaxHP;
2937 Chara.mana.value = Chara.mana.max;
2940 return this;
2941 }
2942
2943 public void ClampInitialSkill()
2944 {
2945 if (elements.Base(286) > 50)
2946 {
2947 elements.SetTo(286, 50 + (int)Mathf.Sqrt(elements.Base(286) - 50));
2948 }
2949 }
2950
2951 public void AddExp(int a, bool applyMod = true)
2952 {
2953 if (applyMod)
2954 {
2955 a = a * GetExpMtp() / 100;
2956 }
2957 exp += a;
2958 while (exp >= ExpToNext && exp > 0 && ExpToNext > 0)
2959 {
2960 exp -= ExpToNext;
2961 LevelUp();
2962 }
2963 }
2964
2965 public int GetExpMtp()
2966 {
2967 int num = 100;
2968 if (!IsPC)
2969 {
2970 num *= 2;
2971 if (IsPCFaction)
2972 {
2973 num = num * GetAffinityExpBonus() / 100;
2975 {
2976 num = num * (50 + EClass.game.principal.petFeatExpMtp * 50) / 100;
2977 }
2978 }
2979 }
2980 return num * (100 + Evalue(1237) * 30 + Evalue(1273) * 50) / 100;
2981 }
2982
2984 {
2985 return Mathf.Clamp(100 + Chara.affinity.value / 10, 50, 200);
2986 }
2987
2989 {
2991 {
2992 return 100;
2993 }
2994 return 100 + EClass.curve(c_daysWithPC / 100 * 3, 100, 20, 70);
2995 }
2996
2997 public void LevelUp()
2998 {
2999 if (IsPC)
3000 {
3002 {
3003 Msg.Say("demoLimit");
3004 return;
3005 }
3007 Tutorial.Reserve("feat");
3008 }
3009 feat++;
3010 LV++;
3011 Say("dingExp", this);
3012 PlaySound("jingle_lvup");
3013 PlayEffect("aura_heaven");
3014 if (HasElement(1415) && Evalue(1415) < 9 && LV >= Evalue(1415) * 5 + 10)
3015 {
3016 Chara.SetFeat(1415, Evalue(1415) + 1, msg: true);
3017 }
3018 if (IsPC || !(Chara.race.id == "mutant"))
3019 {
3020 return;
3021 }
3022 int num = Mathf.Min(1 + LV / 5, 20);
3023 for (int i = 0; i < num; i++)
3024 {
3025 if (Evalue(1644) < i + 1)
3026 {
3027 Chara.SetFeat(1644, i + 1, msg: true);
3028 }
3029 }
3030 }
3031
3032 public virtual void ApplyMaterialElements(bool remove)
3033 {
3034 }
3035
3036 public virtual void ApplyMaterial(bool remove = false)
3037 {
3038 _colorInt = 0;
3039 }
3040
3041 public Card ChangeMaterial(int idNew, bool ignoreFixedMaterial = false)
3042 {
3043 return ChangeMaterial(EClass.sources.materials.map.TryGetValue(idNew, 1), ignoreFixedMaterial);
3044 }
3045
3046 public Card ChangeMaterial(string idNew, bool ignoreFixedMaterial = false)
3047 {
3048 return ChangeMaterial(EClass.sources.materials.alias.TryGetValue(idNew, "oak"), ignoreFixedMaterial);
3049 }
3050
3051 public Card ChangeMaterial(SourceMaterial.Row row, bool ignoreFixedMaterial = false)
3052 {
3053 if (sourceCard.fixedMaterial && !ignoreFixedMaterial)
3054 {
3055 return this;
3056 }
3057 ApplyMaterial(remove: true);
3058 _material = row;
3059 idMaterial = row.id;
3060 decay = 0;
3061 dirtyWeight = true;
3062 Card rootCard = GetRootCard();
3063 if (rootCard != null && rootCard.IsPC)
3064 {
3066 }
3067 if (isThing)
3068 {
3070 }
3071 ApplyMaterial();
3072 return this;
3073 }
3074
3075 public void SetReplica(bool on)
3076 {
3077 isReplica = true;
3078 ChangeMaterial("granite");
3079 }
3080
3081 public Thing Add(string id, int num = 1, int lv = 1)
3082 {
3083 if (num == 0)
3084 {
3085 num = 1;
3086 }
3087 return AddCard(ThingGen.Create(id, -1, lv).SetNum(num)) as Thing;
3088 }
3089
3091 {
3092 return AddThing(c as Thing);
3093 }
3094
3095 public void RemoveCard(Card c)
3096 {
3097 RemoveThing(c as Thing);
3098 }
3099
3100 public void NotifyAddThing(Thing t, int num)
3101 {
3102 }
3103
3104 public Thing AddThing(string id, int lv = -1)
3105 {
3106 return AddThing(ThingGen.Create(id, -1, (lv == -1) ? LV : lv));
3107 }
3108
3109 public Thing AddThing(Thing t, bool tryStack = true, int destInvX = -1, int destInvY = -1)
3110 {
3111 if (t.Num == 0 || t.isDestroyed)
3112 {
3113 Debug.LogWarning("tried to add destroyed thing:" + t.Num + "/" + t.isDestroyed + "/" + t?.ToString() + "/" + this);
3114 return t;
3115 }
3116 if (t.parent == this)
3117 {
3118 Debug.LogWarning("already child:" + t);
3119 return t;
3120 }
3121 if (things.Contains(t))
3122 {
3123 Debug.Log("already in the list" + t);
3124 return t;
3125 }
3126 _ = t.parent;
3127 _ = EClass._zone;
3128 bool flag = IsPC && t.GetRootCard() == EClass.pc;
3129 if (t.parent != null)
3130 {
3131 t.parent.RemoveCard(t);
3132 }
3133 if (t.trait.ToggleType == ToggleType.Fire && destInvY == 0)
3134 {
3135 t.trait.Toggle(on: false);
3136 }
3137 t.isMasked = false;
3138 t.ignoreAutoPick = false;
3139 t.parent = this;
3140 t.noShadow = false;
3141 t.isSale = false;
3142 if (t.IsContainer)
3143 {
3144 t.RemoveEditorTag(EditorTag.PreciousContainer);
3145 }
3146 t.invX = -1;
3147 if (destInvY == -1)
3148 {
3149 t.invY = 0;
3150 }
3151 if (t.IsUnique && t.HasTag(CTAG.godArtifact) && t.GetRootCard() is Chara { IsPCFactionOrMinion: not false })
3152 {
3154 }
3155 Thing thing = (tryStack ? things.TryStack(t, destInvX, destInvY) : t);
3156 if (t == thing)
3157 {
3158 things.Add(t);
3159 things.OnAdd(t);
3160 }
3161 if (thing == t && IsPC && EClass.core.IsGameStarted && EClass._map != null && parent == EClass.game.activeZone && pos.IsValid && !flag)
3162 {
3163 NotifyAddThing(t, t.Num);
3164 }
3165 if (t == thing && isThing && parent == EClass._zone && placeState != 0)
3166 {
3168 }
3171 {
3173 LayerInventory.SetDirty(thing);
3174 }
3175 if (IsPC)
3176 {
3177 goto IL_029f;
3178 }
3179 if (IsContainer)
3180 {
3181 Card rootCard = GetRootCard();
3182 if (rootCard != null && rootCard.IsPC)
3183 {
3184 goto IL_029f;
3185 }
3186 }
3187 goto IL_0345;
3188 IL_0345:
3189 return thing;
3190 IL_029f:
3191 t.isNPCProperty = false;
3192 t.isGifted = false;
3193 int count = 0;
3194 HashSet<string> ings = EClass.player.recipes.knownIngredients;
3195 TryAdd(t);
3196 if (t.CanSearchContents)
3197 {
3198 t.things.Foreach(delegate(Thing _t)
3199 {
3200 TryAdd(_t);
3201 });
3202 }
3203 if (count > 0 && EClass.core.IsGameStarted)
3204 {
3205 Msg.Say((count == 1) ? "newIng" : "newIngs", count.ToString() ?? "");
3206 }
3207 goto IL_0345;
3208 void TryAdd(Thing a)
3209 {
3210 if (!ings.Contains(a.id))
3211 {
3212 ings.Add(a.id);
3213 count++;
3214 if (a.sourceCard.origin != null && !ings.Contains(a.sourceCard.origin.id))
3215 {
3216 ings.Add(a.sourceCard.origin.id);
3217 }
3218 }
3219 }
3220 }
3221
3223 {
3224 if (af.isReplica)
3225 {
3226 return;
3227 }
3228 List<Chara> list = new List<Chara>();
3229 foreach (FactionBranch child in EClass.pc.faction.GetChildren())
3230 {
3231 foreach (Chara member in child.members)
3232 {
3233 list.Add(member);
3234 }
3235 }
3236 foreach (Chara chara in EClass._map.charas)
3237 {
3238 list.Add(chara);
3239 }
3240 if (EClass.pc.IsEyth && EClass.pc.HasElement(1228) && af.c_idDeity == EClass.pc.faith.id)
3241 {
3242 foreach (Chara item in list)
3243 {
3244 if (item.IsPCFactionOrMinion)
3245 {
3246 List<Thing> list2 = item.things.List((Thing t) => t.HasTag(CTAG.godArtifact) && t != af && !t.isReplica && t.c_idDeity == EClass.pc.faith.id);
3247 if (list2.Count != 0)
3248 {
3249 foreach (Thing item2 in list2)
3250 {
3251 Msg.Say("destroyed_inv_", item2, item);
3252 item2.Destroy();
3253 }
3254 }
3255 }
3256 }
3257 return;
3258 }
3259 foreach (Chara item3 in list)
3260 {
3261 if (!item3.IsPCFactionOrMinion)
3262 {
3263 continue;
3264 }
3265 List<Thing> list3 = item3.things.List((Thing t) => t.id == af.id && t != af && !t.isReplica);
3266 if (list3.Count == 0)
3267 {
3268 continue;
3269 }
3270 foreach (Thing item4 in list3)
3271 {
3272 Msg.Say("destroyed_inv_", item4, item3);
3273 item4.Destroy();
3274 }
3275 }
3276 }
3277
3278 public void PurgeEythArtifact()
3279 {
3280 if (!EClass.pc.IsEyth || !EClass.pc.HasElement(1228))
3281 {
3282 return;
3283 }
3284 List<Chara> list = new List<Chara>();
3285 foreach (FactionBranch child in EClass.pc.faction.GetChildren())
3286 {
3287 foreach (Chara member in child.members)
3288 {
3289 list.Add(member);
3290 }
3291 }
3292 foreach (Chara chara in EClass._map.charas)
3293 {
3294 list.Add(chara);
3295 }
3296 foreach (Chara item in list)
3297 {
3298 if (item.IsPCFactionOrMinion)
3299 {
3300 Thing thing = item.things.Find((Thing t) => t.HasTag(CTAG.godArtifact) && t.c_idDeity == "eyth");
3301 if (thing != null)
3302 {
3304 }
3305 break;
3306 }
3307 }
3308 }
3309
3310 public void RemoveThings()
3311 {
3312 for (int num = things.Count - 1; num >= 0; num--)
3313 {
3314 RemoveThing(things[num]);
3315 }
3316 }
3317
3318 public void RemoveThing(Thing thing)
3319 {
3320 Card rootCard = GetRootCard();
3321 if (rootCard != null && rootCard.isChara && (rootCard.Chara.held == thing || (rootCard.IsPC && thing.things.Find((Thing t) => EClass.pc.held == t) != null)))
3322 {
3323 rootCard.Chara.held = null;
3324 if (rootCard.IsPC)
3325 {
3327 if ((bool)instance && instance.selected != -1 && instance.selectedButton.card != null && instance.selectedButton.card == thing)
3328 {
3329 instance.selectedButton.card = null;
3330 }
3332 ActionMode.AdvOrRegion.updatePlans = true;
3333 LayerInventory.SetDirty(thing);
3334 }
3336 }
3337 dirtyWeight = true;
3338 if (thing.c_equippedSlot != 0 && isChara)
3339 {
3340 Chara.body.Unequip(thing);
3341 }
3342 things.Remove(thing);
3343 things.OnRemove(thing);
3344 if (isSale && things.Count == 0 && IsContainer)
3345 {
3346 isSale = false;
3347 EClass._map.props.sales.Remove(this);
3348 }
3349 if (thing.invY == 1)
3350 {
3351 WidgetCurrentTool.dirty = true;
3352 }
3353 thing.invX = -1;
3354 thing.invY = 0;
3355 if (thing.props != null)
3356 {
3357 thing.props.Remove(thing);
3358 }
3361 {
3362 LayerInventory.SetDirty(thing);
3363 WidgetHotbar.dirtyCurrentItem = true;
3364 thing.parent = null;
3365 if (thing.trait.IsContainer)
3366 {
3367 foreach (LayerInventory item in LayerInventory.listInv.Copy())
3368 {
3369 if (item.invs[0].owner.Container.GetRootCard() != EClass.pc && item.floatInv)
3370 {
3371 EClass.ui.layerFloat.RemoveLayer(item);
3372 }
3373 }
3374 }
3375 }
3376 thing.parent = null;
3377 }
3378
3380 {
3381 if (EClass.player.chara != null)
3382 {
3383 if (!IsPC && GetRootCard() != EClass.pc)
3384 {
3385 return EClass.ui.layers.Count > 0;
3386 }
3387 return true;
3388 }
3389 return false;
3390 }
3391
3392 public virtual bool CanStackTo(Thing to)
3393 {
3394 return false;
3395 }
3396
3397 public bool TryStackTo(Thing to)
3398 {
3399 if (isDestroyed || to.isDestroyed || !CanStackTo(to))
3400 {
3401 return false;
3402 }
3403 to.decay = (to.decay * to.Num + decay * Num) / (to.Num + Num);
3404 to.ModNum(Num);
3405 if (c_isImportant)
3406 {
3407 to.c_isImportant = true;
3408 }
3410 {
3411 to.isNew = true;
3412 }
3413 Destroy();
3414 return true;
3415 }
3416
3418 {
3419 if (parent == null)
3420 {
3421 return this;
3422 }
3423 return parent.GetRoot();
3424 }
3425
3427 {
3428 if (!(parent is Card card))
3429 {
3430 return this;
3431 }
3432 return card.GetRootCard();
3433 }
3434
3435 public bool IsStackable(Thing tg)
3436 {
3437 if (id != tg.id || material != tg.material)
3438 {
3439 return false;
3440 }
3441 return true;
3442 }
3443
3444 public Thing Duplicate(int num)
3445 {
3446 Thing thing = ThingGen.Create(id);
3447 thing.ChangeMaterial(idMaterial, ignoreFixedMaterial: true);
3448 thing._bits1 = _bits1;
3449 thing._bits2 = _bits2;
3450 thing.dir = dir;
3451 thing.refVal = refVal;
3452 thing.altitude = altitude;
3453 thing.idSkin = idSkin;
3454 thing.blessedState = blessedState;
3455 thing.rarityLv = rarityLv;
3456 thing.tier = tier;
3457 thing.LV = LV;
3458 thing.exp = exp;
3459 thing.encLV = encLV;
3460 thing.decay = decay;
3461 thing.mapInt.Clear();
3462 thing.mapStr.Clear();
3463 foreach (KeyValuePair<int, int> item in mapInt)
3464 {
3465 thing.mapInt[item.Key] = item.Value;
3466 }
3467 foreach (KeyValuePair<int, string> item2 in mapStr)
3468 {
3469 thing.mapStr[item2.Key] = item2.Value;
3470 }
3471 elements.CopyTo(thing.elements);
3472 thing.SetNum(num);
3473 if (thing.IsRangedWeapon)
3474 {
3475 thing.sockets = IO.DeepCopy(sockets);
3476 }
3477 if (thing.c_containerSize != 0)
3478 {
3479 thing.things.SetOwner(thing);
3480 }
3481 return thing;
3482 }
3483
3484 public Thing Split(int a)
3485 {
3486 if (a == Num)
3487 {
3488 return Thing;
3489 }
3490 Thing result = Duplicate(a);
3491 ModNum(-a, notify: false);
3492 return result;
3493 }
3494
3495 public Thing SetNum(int a)
3496 {
3497 if (!isThing)
3498 {
3499 return null;
3500 }
3501 if (a == Num)
3502 {
3503 return this as Thing;
3504 }
3505 ModNum(a - Num);
3506 return this as Thing;
3507 }
3508
3510 {
3511 noSell = true;
3512 return this as Thing;
3513 }
3514
3515 public void ModNum(int a, bool notify = true)
3516 {
3517 if (Num + a < 0)
3518 {
3519 a = -Num;
3520 }
3521 Num += a;
3522 if (props != null)
3523 {
3524 props.OnNumChange(this, a);
3525 }
3526 if (parent != null)
3527 {
3529 }
3530 if (a > 0 && EClass.core.IsGameStarted && GetRootCard() == EClass.pc && notify)
3531 {
3533 }
3535 if (Num <= 0)
3536 {
3537 Destroy();
3538 }
3539 }
3540
3541 public void AddSocket()
3542 {
3543 if (sockets == null)
3544 {
3545 sockets = new List<int>();
3546 }
3547 sockets.Add(0);
3548 }
3549
3550 public void ApplySocket(Thing t)
3551 {
3552 if (t.trait is TraitMod traitMod && sockets != null)
3553 {
3554 ApplySocket(traitMod.source.id, traitMod.owner.encLV, traitMod.owner);
3555 }
3556 }
3557
3558 public void ApplySocket(int id, int lv, Card mod = null)
3559 {
3560 for (int i = 0; i < sockets.Count; i++)
3561 {
3562 if (sockets[i] == 0)
3563 {
3564 if (lv >= 1000)
3565 {
3566 lv = 999;
3567 }
3568 sockets[i] = id * 1000 + lv;
3569 elements.ModBase(id, lv);
3570 mod?.Destroy();
3571 break;
3572 }
3573 }
3574 }
3575
3576 public void EjectSockets()
3577 {
3578 for (int i = 0; i < sockets.Count; i++)
3579 {
3580 int num = sockets[i];
3581 if (num != 0)
3582 {
3583 Thing thing = ThingGen.Create(isCopy ? "ash3" : "mod_ranged");
3584 int ele = num / 1000;
3585 int num2 = num % 1000;
3586 elements.ModBase(ele, -num2);
3587 if (!isCopy)
3588 {
3589 thing.refVal = ele;
3590 thing.encLV = num2;
3591 }
3593 sockets[i] = 0;
3594 }
3595 }
3596 }
3597
3599 {
3600 return AddRune(rune.refVal, rune.encLV, rune.trait is TraitRuneFree);
3601 }
3602
3603 public SocketData AddRune(int idEle, int v, bool free)
3604 {
3605 if (socketList == null)
3606 {
3607 socketList = new List<SocketData>();
3608 }
3609 SourceElement.Row row = EClass.sources.elements.map[idEle];
3610 SocketData socketData = new SocketData
3611 {
3612 idEle = idEle,
3613 value = v,
3614 type = SocketData.Type.Rune,
3615 isFree = free
3616 };
3617 socketList.Add(socketData);
3618 if (IsWeapon || !row.IsWeaponEnc)
3619 {
3620 elements.SetTo(idEle, v);
3621 }
3622 return socketData;
3623 }
3624
3625 public SocketData GetRuneEnc(int idEle)
3626 {
3627 if (socketList != null)
3628 {
3629 foreach (SocketData socket in socketList)
3630 {
3631 if (socket.type == SocketData.Type.Rune && socket.idEle == idEle)
3632 {
3633 return socket;
3634 }
3635 }
3636 }
3637 return null;
3638 }
3639
3640 public int CountRune(bool countFree = true)
3641 {
3642 int num = 0;
3643 if (socketList != null)
3644 {
3645 foreach (SocketData socket in socketList)
3646 {
3647 if (socket.type == SocketData.Type.Rune && (countFree || !socket.isFree))
3648 {
3649 num++;
3650 }
3651 }
3652 }
3653 return num;
3654 }
3655
3656 public int MaxRune()
3657 {
3658 return ((!IsUnique && !isReplica) ? 1 : 0) + Evalue(484);
3659 }
3660
3661 public bool CanAddRune(TraitMod mod)
3662 {
3663 SourceElement.Row source = mod.source;
3664 if (category.slot == 0)
3665 {
3666 return false;
3667 }
3668 if (material.HasEnc(source.id))
3669 {
3670 return false;
3671 }
3672 if (!IsWeapon && source.IsWeaponEnc)
3673 {
3674 return false;
3675 }
3676 if (source.category == "resist")
3677 {
3678 foreach (Element item in elements.ListElements())
3679 {
3680 if (item.source.category == "resist" && (item.vBase != 0 || item.vSource != 0))
3681 {
3682 return false;
3683 }
3684 }
3685 }
3686 string encSlot = source.encSlot;
3687 if (encSlot == null || encSlot.Length != 0)
3688 {
3689 switch (encSlot)
3690 {
3691 case "shield":
3692 if (!category.IsChildOf("shield") && !category.IsChildOf("martial"))
3693 {
3694 return false;
3695 }
3696 break;
3697 default:
3698 {
3699 bool flag = false;
3700 string[] array = source.encSlot.Split(',');
3701 foreach (string key in array)
3702 {
3703 if (EClass.sources.elements.alias[key].id == category.slot)
3704 {
3705 flag = true;
3706 }
3707 }
3708 if (!flag)
3709 {
3710 return false;
3711 }
3712 break;
3713 }
3714 case "global":
3715 case "all":
3716 case "weapon":
3717 break;
3718 }
3719 }
3720 if (mod is TraitRuneFree)
3721 {
3722 return true;
3723 }
3724 return CountRune(countFree: false) < MaxRune();
3725 }
3726
3727 public bool HasRune()
3728 {
3729 return CountRune() > 0;
3730 }
3731
3732 public void OnChildNumChange(Card c)
3733 {
3735 {
3738 }
3739 }
3740
3741 public Card Install()
3742 {
3743 SetPlaceState(PlaceState.installed);
3744 return this;
3745 }
3746
3747 public void SetPlaceState(PlaceState newState, bool byPlayer = false)
3748 {
3749 if (this.placeState == newState)
3750 {
3751 return;
3752 }
3753 if (parent != EClass._zone)
3754 {
3755 Debug.Log("tried to change placestate of non-root card:" + this);
3756 return;
3757 }
3759 Area area = pos.area;
3760 if (placeState == PlaceState.installed)
3761 {
3762 area?.OnUninstallCard(this);
3763 if (!isRoofItem)
3764 {
3765 altitude = 0;
3766 freePos = false;
3767 float num2 = (fy = 0f);
3768 fx = num2;
3769 }
3770 trait.Uninstall();
3771 }
3772 if (placeState == PlaceState.installed || newState == PlaceState.installed)
3773 {
3774 ForeachPoint(delegate(Point p, bool main)
3775 {
3776 p.cell.RemoveCard(this);
3777 });
3778 this.placeState = newState;
3779 ForeachPoint(delegate(Point p, bool main)
3780 {
3781 p.cell.AddCard(this);
3782 });
3783 }
3784 else
3785 {
3786 this.placeState = newState;
3787 }
3788 if (trait is TraitFakeBlock)
3789 {
3791 }
3792 if (newState == PlaceState.none)
3793 {
3794 this.placeState = PlaceState.roaming;
3795 if (props != null)
3796 {
3797 props.Remove(this);
3798 }
3799 }
3800 else
3801 {
3803 if (this.placeState == PlaceState.installed)
3804 {
3805 if (isThing)
3806 {
3807 if (trait.InstallBottomPriority != -1)
3808 {
3810 }
3811 else
3812 {
3814 }
3815 }
3816 area?.OnInstallCard(this);
3817 isRoofItem = false;
3818 trait.Install(byPlayer);
3819 }
3820 }
3822 {
3824 }
3825 if (trait.ShouldTryRefreshRoom && (placeState == PlaceState.installed || this.placeState == PlaceState.installed))
3826 {
3828 }
3829 trait.OnChangePlaceState(newState);
3831 {
3833 }
3834 }
3835
3836 public int GetTotalQuality(bool applyBonus = true)
3837 {
3838 int num = 5 + LV + material.quality;
3839 if (applyBonus)
3840 {
3841 num = num * (100 + Quality) / 100;
3842 }
3843 return num;
3844 }
3845
3846 public void ModEncLv(int a)
3847 {
3848 ApplyMaterialElements(remove: true);
3849 encLV += a;
3850 ApplyMaterialElements(remove: false);
3852 {
3853 if (IsWeapon || IsAmmo)
3854 {
3855 elements.ModBase(67, a);
3856 }
3857 else
3858 {
3859 elements.ModBase(65, a * 2);
3860 }
3861 }
3862 }
3863
3864 public void SetEncLv(int a)
3865 {
3866 ModEncLv(a - encLV);
3867 }
3868
3869 public void SetTier(int a, bool setTraits = true)
3870 {
3871 if (a < 0)
3872 {
3873 a = 0;
3874 }
3875 tier = a;
3876 if (setTraits)
3877 {
3878 int num = ((a == 1) ? 180 : ((a == 2) ? 400 : ((a >= 3) ? 600 : 0)));
3879 if (a > 0)
3880 {
3881 foreach (Element value in elements.dict.Values)
3882 {
3883 if (value.IsFoodTrait || value.IsTrait)
3884 {
3885 elements.SetTo(value.id, value.Value * num / 100);
3886 }
3887 }
3888 }
3889 elements.SetBase(2, a * 30);
3890 elements.SetBase(759, (a > 1) ? a : 0);
3891 }
3893 }
3894
3895 public virtual void SetBlessedState(BlessedState s)
3896 {
3897 int num = 0;
3898 if (s == BlessedState.Blessed && blessedState < BlessedState.Blessed)
3899 {
3900 num = 1;
3901 }
3902 if (s < BlessedState.Blessed && blessedState == BlessedState.Blessed)
3903 {
3904 num = -1;
3905 }
3906 if (num != 0 && IsEquipmentOrRangedOrAmmo)
3907 {
3908 if (IsWeapon || IsAmmo)
3909 {
3910 elements.ModBase(67, num);
3911 }
3912 else
3913 {
3914 elements.ModBase(65, num * 2);
3915 }
3916 }
3917 blessedState = s;
3918 }
3919
3920 public virtual void ChangeRarity(Rarity q)
3921 {
3922 rarity = q;
3923 }
3924
3925 public bool TryPay(int a, string id = "money")
3926 {
3927 if (GetCurrency(id) < a)
3928 {
3929 if (IsPC)
3930 {
3931 SE.Beep();
3932 Msg.Say((id == "ration") ? "notEnoughFood" : "notEnoughMoney");
3933 }
3934 return false;
3935 }
3936 if (IsPC && !(id == "ration"))
3937 {
3938 SE.Pay();
3939 }
3940 ModCurrency(-a, id);
3941 return true;
3942 }
3943
3944 public void SetCharge(int a)
3945 {
3946 c_charges = a;
3948 }
3949
3950 public void ModCharge(int a, bool destroy = false)
3951 {
3952 c_charges += a;
3954 if (c_charges <= 0 && destroy)
3955 {
3956 Say("spellbookCrumble", this);
3957 ModNum(-1);
3958 }
3959 }
3960
3961 public void ModCurrency(int a, string id = "money")
3962 {
3963 if (a != 0)
3964 {
3965 if (id == "influence")
3966 {
3968 return;
3969 }
3970 SourceMaterial.Row mat = null;
3971 things.AddCurrency(this, id, a, mat);
3972 }
3973 }
3974
3975 public int GetCurrency(string id = "money")
3976 {
3977 if (id == "influence")
3978 {
3979 return EClass._zone.influence;
3980 }
3981 int sum = 0;
3982 SourceMaterial.Row mat = null;
3983 things.GetCurrency(id, ref sum, mat);
3984 return sum;
3985 }
3986
3987 public virtual void HealHPHost(int a, HealSource origin = HealSource.None)
3988 {
3989 if (isChara)
3990 {
3991 if (Chara.parasite != null)
3992 {
3994 }
3995 if (Chara.ride != null)
3996 {
3997 Chara.ride.HealHP(a);
3998 }
3999 }
4000 HealHP(a, origin);
4001 }
4002
4003 public virtual void HealHP(int a, HealSource origin = HealSource.None)
4004 {
4005 long num = a;
4006 if (origin == HealSource.Magic)
4007 {
4008 num = (long)a * (long)Mathf.Max(100 - Evalue(93), 1) / 100;
4009 }
4010 if (num > 100000000)
4011 {
4012 num = 100000000L;
4013 }
4014 hp += (int)num;
4015 if (hp > MaxHP)
4016 {
4017 hp = MaxHP;
4018 }
4019 switch (origin)
4020 {
4021 case HealSource.Magic:
4022 case HealSource.Item:
4023 PlaySound("heal");
4024 PlayEffect("heal");
4025 break;
4026 case HealSource.HOT:
4027 PlaySound("heal_tick");
4028 PlayEffect("heal_tick");
4029 break;
4030 }
4031 }
4032
4033 public virtual int GetArmorSkill()
4034 {
4035 return 0;
4036 }
4037
4038 public virtual long ApplyProtection(long dmg, int mod = 100)
4039 {
4040 int armorSkill = GetArmorSkill();
4041 Element orCreateElement = elements.GetOrCreateElement(armorSkill);
4042 int num = PV + orCreateElement.Value + DEX / 10;
4043 int num2 = 1;
4044 int sides = 1;
4045 int bonus = 0;
4046 if (num > 0)
4047 {
4048 int num3 = num / 4;
4049 num2 = num3 / 10 + 1;
4050 sides = num3 / num2 + 1;
4051 bonus = 0;
4052 dmg = dmg * 100 / Mathf.Max(100 + num, 1);
4053 }
4054 int num4 = Dice.Roll(num2, sides, bonus, this);
4055 dmg -= num4 * mod / 100;
4056 if (dmg < 0)
4057 {
4058 dmg = 0L;
4059 }
4060 return dmg;
4061 }
4062
4063 public void DamageHP(long dmg, AttackSource attackSource = AttackSource.None, Card origin = null)
4064 {
4065 DamageHP(dmg, 0, 0, attackSource, origin);
4066 }
4067
4068 public void DamageHP(long dmg, int ele, int eleP = 100, AttackSource attackSource = AttackSource.None, Card origin = null, bool showEffect = true, Thing weapon = null, Chara originalTarget = null)
4069 {
4070 if (hp < 0)
4071 {
4072 return;
4073 }
4074 bool flag = originalTarget != null;
4075 Action onEvade = null;
4076 if (isChara && !isRestrained && !flag)
4077 {
4078 if (HasElement(1249))
4079 {
4080 foreach (Chara chara3 in EClass._map.charas)
4081 {
4082 if (chara3 != this && !chara3.IsHostile(Chara) && !chara3.IsDisabled && !chara3.isRestrained && (!IsPCFactionOrMinion || chara3.IsPCFactionOrMinion) && chara3.Dist(this) <= 3)
4083 {
4084 Say("wall_bond", chara3, this);
4085 chara3.DamageHP(dmg, ele, eleP, attackSource, origin, showEffect, weapon, Chara);
4086 return;
4087 }
4088 }
4089 }
4090 if (!HasElement(1241))
4091 {
4092 AttackSource attackSource2 = attackSource;
4093 if ((uint)(attackSource2 - 3) > 2u && (uint)(attackSource2 - 13) > 4u)
4094 {
4095 foreach (Chara chara4 in EClass._map.charas)
4096 {
4097 if (chara4 != this && !chara4.IsHostile(Chara))
4098 {
4099 int num = chara4.Evalue(1241);
4100 int num2 = chara4.Evalue(438);
4101 if ((num != 0 || num2 != 0) && !chara4.IsDisabled && !chara4.isRestrained && (!IsPCFactionOrMinion || chara4.IsPCFactionOrMinion) && chara4.Dist(this) <= Mathf.Max(num, (num2 > 0) ? 1 : 0) && (num != 0 || num2 <= 0 || hp * 100 / MaxHP <= chara4.hp * 100 / chara4.MaxHP))
4102 {
4103 Say((num2 == 0) ? "wall_flesh" : "wall_knightly", chara4, this);
4104 chara4.DamageHP(dmg, ele, eleP, attackSource, origin, showEffect, weapon, Chara);
4105 return;
4106 }
4107 }
4108 }
4109 }
4110 }
4111 }
4112 if (origin != null && origin.HasElement(1208))
4113 {
4114 switch (attackSource)
4115 {
4116 case AttackSource.MagicHand:
4117 dmg = dmg * 130 / 100;
4118 eleP = eleP * 150 / 100;
4119 break;
4120 case AttackSource.MagicSword:
4121 dmg = dmg * 120 / 100;
4122 eleP = eleP * 150 / 100;
4123 break;
4124 }
4125 }
4126 if (origin != null)
4127 {
4128 dmg = dmg * (100 + origin.Evalue(94)) / 100;
4129 }
4130 Element e;
4131 if (ele == 0 || ele == 926)
4132 {
4133 e = Element.Void;
4134 if (origin != null)
4135 {
4136 dmg = dmg * Mathf.Max(100 + origin.Evalue(93) / 2, 10) / 100;
4137 }
4138 }
4139 else
4140 {
4141 e = Element.Create(ele);
4142 if (attackSource != AttackSource.Condition && showEffect)
4143 {
4144 ActEffect.TryDelay(delegate
4145 {
4146 PlayEffect(e.id, useRenderPos: true, 0.25f);
4147 EClass.Sound.Play("atk_" + e.source.alias);
4148 });
4149 }
4150 if (!e.source.aliasRef.IsEmpty() && attackSource != AttackSource.ManaBackfire)
4151 {
4152 int num3 = ((origin != null) ? origin.Evalue(1238) : 0);
4153 if (attackSource == AttackSource.MagicSword)
4154 {
4155 num3 += 2;
4156 if (origin.HasElement(1247))
4157 {
4158 num3++;
4159 }
4160 }
4161 if (attackSource == AttackSource.MagicArrow && origin != null && origin.HasElement(1244))
4162 {
4163 num3++;
4164 }
4165 if (attackSource == AttackSource.MagicHand && origin != null && origin.HasElement(1246))
4166 {
4167 num3++;
4168 }
4169 dmg = Element.GetResistDamage((int)dmg, Evalue(e.source.aliasRef), num3);
4170 dmg = dmg * 100 / (100 + Mathf.Clamp(Evalue(961) * 5, -50, 200));
4171 dmg = dmg * Mathf.Max(100 - Evalue(93), 10) / 100;
4172 }
4173 switch (e.id)
4174 {
4175 case 910:
4176 {
4177 Chara chara2 = Chara;
4178 if (chara2 != null && chara2.isWet)
4179 {
4180 dmg /= 3L;
4181 }
4182 break;
4183 }
4184 case 912:
4185 {
4186 Chara chara = Chara;
4187 if (chara != null && chara.isWet)
4188 {
4189 dmg = dmg * 150 / 100;
4190 }
4191 break;
4192 }
4193 }
4194 }
4195 if (origin != null && origin.isChara && origin.Chara.HasCondition<ConSupress>())
4196 {
4197 dmg = dmg * 2 / 3;
4198 }
4199 if (attackSource != AttackSource.Finish)
4200 {
4201 if (!IsPCFaction && LV > 50)
4202 {
4203 dmg = dmg * (100 - (int)Mathf.Min(80f, Mathf.Sqrt(LV - 50) * 2.5f)) / 100;
4204 }
4205 if (origin != null && origin.HasCondition<ConBerserk>())
4206 {
4207 dmg = dmg * 3 / 2;
4208 }
4210 {
4211 int num4 = ((origin != null) ? origin.LV : EClass._zone.DangerLv);
4212 if (num4 > 50)
4213 {
4214 dmg = dmg * (100 - (int)Mathf.Min(95f, Mathf.Sqrt(num4 - 50))) / 100;
4215 }
4216 }
4217 if (attackSource == AttackSource.Throw || attackSource == AttackSource.Range)
4218 {
4219 dmg = dmg * 100 / (100 + Evalue(435) * 2);
4220 }
4221 dmg = dmg * Mathf.Max(0, 100 - Mathf.Min(Evalue((e == Element.Void || e.id == 926) ? 55 : 56), 100) / ((!flag) ? 1 : 2)) / 100;
4222 if (origin != null && origin.IsPC && EClass.player.codex.Has(id))
4223 {
4224 dmg = dmg * (100 + Mathf.Min(10, EClass.player.codex.GetOrCreate(id).weakspot)) / 100;
4225 }
4226 if (isChara && Chara.body.GetAttackStyle() == AttackStyle.Shield && elements.ValueWithoutLink(123) >= 5 && (e == Element.Void || e.id == 926))
4227 {
4228 dmg = dmg * 90 / 100;
4229 }
4230 if (HasElement(971))
4231 {
4232 dmg = dmg * 100 / Mathf.Clamp(100 + Evalue(971), 25, 1000);
4233 }
4234 if (HasElement(1305))
4235 {
4236 dmg = dmg * 90 / 100;
4237 }
4238 if (EClass.pc.HasElement(1207) && isChara)
4239 {
4240 int num5 = 0;
4241 int num6 = 0;
4242 foreach (Condition condition2 in Chara.conditions)
4243 {
4244 if (condition2.Type == ConditionType.Buff)
4245 {
4246 num5++;
4247 }
4248 else if (condition2.Type == ConditionType.Debuff)
4249 {
4250 num6++;
4251 }
4252 }
4253 if (IsPCParty)
4254 {
4255 dmg = dmg * 100 / Mathf.Min(100 + num5 * 5, 120);
4256 }
4257 else
4258 {
4259 dmg = dmg * Mathf.Min(100 + num6 * 5, 120) / 100;
4260 }
4261 }
4263 {
4264 dmg = dmg * 100 / Mathf.Clamp(105 + EClass.pc.Evalue(135) / 10, 10, 110);
4265 }
4266 if (HasElement(1218) && attackSource != AttackSource.ManaBackfire && (hp > 0 || Evalue(1421) <= 0))
4267 {
4268 dmg = dmg * (1000 - Mathf.Min(Evalue(1218), 1000) / ((!flag) ? 1 : 2)) / 1000;
4269 if (dmg <= 0 && EClass.rnd(4) == 0)
4270 {
4271 dmg++;
4272 }
4273 }
4274 if (dmg >= MaxHP / 10 && Evalue(68) > 0)
4275 {
4276 int num7 = MaxHP / 10;
4277 long num8 = dmg - num7;
4278 num8 = num8 * 100 / (200 + Evalue(68) * 10);
4279 dmg = num7 + num8;
4280 }
4281 }
4282 if (origin != null && origin.IsPC && EClass.pc.Evalue(654) > 0)
4283 {
4284 dmg = 0L;
4285 }
4286 if (dmg < 0)
4287 {
4288 dmg = 0L;
4289 }
4290 if (dmg > 99999999)
4291 {
4292 dmg = 99999999L;
4293 }
4294 float num9 = Mathf.Clamp(dmg * 6 / MaxHP, 0f, 4f) + (float)((dmg > 0) ? 1 : 0);
4295 int num10 = hp;
4296 if (Evalue(1421) > 0)
4297 {
4298 long num11 = 0L;
4299 long num12 = dmg;
4300 if (hp > 0)
4301 {
4302 num12 = dmg - hp;
4303 hp -= (int)dmg;
4304 num11 += dmg;
4305 if (hp < 0 && Chara.mana.value >= 0)
4306 {
4307 num11 += hp;
4308 hp = 0;
4309 }
4310 }
4311 if (hp <= 0)
4312 {
4313 if (Evalue(1421) >= 2)
4314 {
4315 num12 /= 2;
4316 }
4317 dmg = num12;
4318 if (Chara.mana.value > 0)
4319 {
4320 num12 -= Chara.mana.value;
4321 Chara.mana.value -= (int)dmg;
4322 num11 += dmg;
4323 }
4324 if (Chara.mana.value <= 0)
4325 {
4326 hp -= (int)num12;
4327 num11 += num12;
4328 }
4329 }
4330 dmg = num11;
4331 }
4332 else
4333 {
4334 hp -= (int)dmg;
4335 }
4336 if (isSynced && dmg != 0L)
4337 {
4338 float ratio = (float)dmg / (float)MaxHP;
4339 Card c = ((parent is Chara) ? (parent as Chara) : this);
4340 ActEffect.TryDelay(delegate
4341 {
4342 c.PlayEffect("blood").SetParticleColor(EClass.Colors.matColors[material.alias].main).Emit(20 + (int)(30f * ratio));
4344 {
4345 EClass.scene.damageTextRenderer.Add(this, c, (int)dmg, e);
4346 }
4347 });
4348 }
4349 if (EClass.pc.ai is AI_PracticeDummy { IsRunning: not false } aI_PracticeDummy && aI_PracticeDummy.target == this && (origin == null || origin.IsPC))
4350 {
4351 aI_PracticeDummy.hit++;
4352 aI_PracticeDummy.totalDamage += dmg;
4353 }
4354 ZoneInstanceBout zoneInstanceBout = EClass._zone.instance as ZoneInstanceBout;
4355 bool flag2 = false;
4356 if (hp < 0 && Religion.recentWrath == null)
4357 {
4359 {
4360 EvadeDeath(null);
4361 if (Chara.stamina.value > 0 && (EClass.rnd(2) == 0 || !IsPC))
4362 {
4363 Chara.stamina.Mod(-1);
4364 }
4365 }
4366 else if (IsInstalled && pos.HasBlock && trait.IsDoor)
4367 {
4368 EvadeDeath(null);
4369 }
4370 else if (!trait.CanBeDestroyed)
4371 {
4372 EvadeDeath(null);
4373 }
4374 else if (HasEditorTag(EditorTag.Invulnerable) || (HasEditorTag(EditorTag.InvulnerableToMobs) && (origin == null || !origin.IsPCParty)))
4375 {
4376 EvadeDeath(null);
4377 }
4378 else if (isChara)
4379 {
4381 {
4382 EvadeDeath(null);
4383 }
4384 else if (IsPC && EClass.debug.godMode)
4385 {
4386 EvadeDeath(null);
4387 }
4388 else if (Chara.host != null || (weapon != null && weapon.HasElement(485)))
4389 {
4390 EvadeDeath(null);
4391 flag2 = true;
4392 }
4393 else
4394 {
4395 if (origin != null && origin != this && Evalue(436) > 0 && !HasCondition<ConFractured>())
4396 {
4397 int half = (HasElement(1218) ? MaxHP : (MaxHP / 2));
4398 if (num10 > half)
4399 {
4400 EvadeDeath(delegate
4401 {
4402 Say("guts", this);
4403 Chara.AddCondition<ConFractured>((int)Mathf.Max(10f, 30f - Mathf.Sqrt(Evalue(436))));
4404 hp = Mathf.Min(half * (int)Mathf.Sqrt(Evalue(436) * 2) / 100, MaxHP / 3);
4405 });
4406 goto IL_1077;
4407 }
4408 }
4409 if (zoneInstanceBout != null && (bool)LayerDrama.Instance)
4410 {
4411 EvadeDeath(null);
4412 }
4413 else if (LayerDrama.IsActive() && IsPC)
4414 {
4415 EvadeDeath(null);
4416 }
4417 else
4418 {
4419 if (attackSource != AttackSource.Finish && IsPCParty && Chara.host == null)
4420 {
4421 if (EClass.pc.ai is GoalAutoCombat && !EClass.player.invlunerable && (EClass.pc.ai as GoalAutoCombat).listHealthy.Contains(Chara))
4422 {
4423 EClass.core.actionsNextFrame.Add(delegate
4424 {
4425 Msg.Say(IsPC ? "abort_damage" : "abort_damgeAlly");
4426 });
4427 EClass.player.invlunerable = true;
4430 }
4432 {
4433 EvadeDeath(null);
4434 goto IL_1077;
4435 }
4436 }
4437 if (Evalue(1220) > 0 && Chara.stamina.value >= (IsPC ? (Chara.stamina.max / 2) : (Chara.stamina.max / 3 * 2)))
4438 {
4439 EvadeDeath(delegate
4440 {
4441 Say("fate", this);
4442 PlaySound("revive");
4443 PlayEffect("aura_heaven");
4446 });
4447 }
4448 }
4449 }
4450 }
4451 }
4452 goto IL_1077;
4453 IL_1077:
4454 if (trait.CanBeAttacked)
4455 {
4456 renderer.PlayAnime(AnimeID.HitObj);
4457 hp = MaxHP;
4459 {
4460 hp = -1;
4461 }
4462 }
4463 Chara target;
4464 if (hp < 0)
4465 {
4466 if ((attackSource == AttackSource.Melee || attackSource == AttackSource.Range) && origin != null && originalTarget == null && (origin.isSynced || IsPC))
4467 {
4468 string text = "";
4469 if (IsPC && Lang.setting.combatTextStyle == 0)
4470 {
4471 if (e != Element.Void && e != null)
4472 {
4473 text = "dead_" + e.source.alias;
4474 }
4475 if (text == "" || !LangGame.Has(text))
4476 {
4477 text = "dead_attack";
4478 }
4479 EClass.pc.Say(text, this, "");
4480 }
4481 else
4482 {
4483 if (e != Element.Void && e != null)
4484 {
4485 text = "kill_" + e.source.alias;
4486 }
4487 if (text == "" || !LangGame.Has(text))
4488 {
4489 text = "kill_attack";
4490 }
4491 (IsPC ? EClass.pc : origin).Say(text, origin, this);
4492 }
4493 }
4494 if (isChara && Religion.recentWrath == null)
4495 {
4496 if (HasElement(1410) && !Chara.HasCooldown(1410))
4497 {
4498 Chara.AddCooldown(1410);
4499 Say("reboot", this);
4500 PlaySound("reboot");
4501 Chara.Cure(CureType.Boss);
4502 hp = MaxHP / 3;
4504 return;
4505 }
4506 if (HasCondition<ConRebirth>())
4507 {
4508 Say("rebirth", this);
4509 hp = (int)Mathf.Min((long)MaxHP * (long)(int)(5f + Mathf.Sqrt(Chara.GetCondition<ConRebirth>().power)) / 100, MaxHP);
4511 Chara.RemoveCondition<ConRebirth>();
4512 PlayEffect("revive");
4513 PlaySound("revive");
4514 return;
4515 }
4516 foreach (Chara chara5 in EClass._map.charas)
4517 {
4518 if (Chara.IsFriendOrAbove(chara5) && chara5.HasElement(1408) && chara5.faith == EClass.game.religions.Healing && EClass.world.date.GetRawDay() != chara5.GetInt(58) && (!chara5.IsPCFaction || IsPCFaction) && (chara5.memberType != FactionMemberType.Livestock || Chara.memberType == FactionMemberType.Livestock))
4519 {
4520 Msg.alwaysVisible = true;
4521 Msg.Say("layhand", chara5, this);
4522 Msg.Say("pray_heal", this);
4523 hp = MaxHP;
4525 PlayEffect("revive");
4526 PlaySound("revive");
4527 chara5.SetInt(58, EClass.world.date.GetRawDay());
4528 return;
4529 }
4530 }
4531 }
4532 if (zoneInstanceBout != null)
4533 {
4534 target = EClass._map.FindChara(zoneInstanceBout.uidTarget);
4535 if (target != null)
4536 {
4537 EClass.pc.ai.Cancel();
4538 if (IsPC)
4539 {
4540 EClass.pc.hp = 0;
4541 Heal();
4542 EClass.player.ModFame(-10 - (int)((float)EClass.player.fame * 0.05f));
4543 target.ShowDialog("_chara", "bout_lose");
4544 return;
4545 }
4546 if (target == this)
4547 {
4548 hp = 0;
4549 Heal();
4550 target.ModAffinity(EClass.pc, 10);
4551 target.ShowDialog("_chara", "bout_win");
4552 return;
4553 }
4554 }
4555 }
4556 if (!isDestroyed)
4557 {
4558 if (attackSource == AttackSource.MoonSpear && isChara)
4559 {
4561 ActEffect.LoveMiracle(Chara, origin?.Chara, 100, EffectId.MoonSpear);
4562 Rand.SetSeed();
4563 }
4564 Die(e, origin, attackSource, originalTarget);
4566 {
4567 Rand.SetSeed(uid);
4568 if (EClass.rnd(3) == 0 && !isCrafted && !isCopy)
4569 {
4570 string text2 = new int[18]
4571 {
4572 233, 235, 236, 236, 236, 1170, 1143, 1144, 727, 728,
4573 237, 869, 1178, 1179, 1180, 1243, 1244, 1245
4574 }.RandomItem().ToString();
4575 if (EClass.rnd(10) == 0)
4576 {
4577 text2 = "casino_coin";
4578 }
4579 if (EClass.rnd(10) == 0)
4580 {
4581 text2 = "scratchcard";
4582 }
4583 if (EClass.rnd(3) == 0)
4584 {
4585 text2 = "money";
4586 }
4587 if (EClass.rnd(5) == 0)
4588 {
4589 text2 = "plat";
4590 }
4591 if (EClass.rnd(10) == 0)
4592 {
4593 text2 = "money2";
4594 }
4595 if (EClass.rnd(20) == 0 || EClass.debug.enable)
4596 {
4597 text2 = "medal";
4598 }
4599 EClass._zone.AddCard(ThingGen.Create(text2).SetNum((!(text2 == "money")) ? 1 : EClass.rndHalf(100)).SetHidden(hide: false), pos);
4600 }
4601 Rand.SetSeed();
4602 }
4603 ProcAbsorb();
4604 if (EClass.pc.Evalue(1355) > 0 && isChara && (IsPCFactionOrMinion || (origin != null && origin.IsPCParty)))
4605 {
4606 ((EClass.pc.AddCondition<ConStrife>() as ConStrife) ?? EClass.pc.GetCondition<ConStrife>())?.AddKill(Chara);
4607 }
4608 }
4609 if (origin != null && origin.isChara)
4610 {
4611 if (origin.IsPCFactionOrMinion && isChara && !isCopy)
4612 {
4614 EClass.game.quests.list.ForeachReverse(delegate(Quest q)
4615 {
4616 q.OnKillChara(Chara);
4617 });
4620 {
4621 Guild.Fighter.AddContribution(10 + Mathf.Min(LV, 200) / 5);
4622 }
4624 {
4625 int a = EClass.rndHalf(200 + EClass.curve(LV, 20, 15) * 20);
4626 Msg.Say("bounty", Chara, a.ToString() ?? "");
4628 SE.Pay();
4629 }
4630 }
4631 if (origin.GetInt(106) == 0)
4632 {
4633 origin.Chara.TalkTopic("kill");
4634 }
4635 }
4636 Msg.SetColor();
4637 }
4638 else if ((attackSource == AttackSource.Melee || attackSource == AttackSource.Range) && origin != null && originalTarget == null)
4639 {
4640 (IsPC ? EClass.pc : origin).Say("dmgMelee" + num9 + (IsPC ? "pc" : ""), origin, this);
4641 }
4642 else if (isChara)
4643 {
4644 int num13 = ((attackSource != AttackSource.Condition && attackSource != AttackSource.WeaponEnchant) ? 1 : 2);
4645 if (num9 >= (float)num13)
4646 {
4647 if (e != Element.Void)
4648 {
4649 Say("dmg_" + e.source.alias, this);
4650 }
4651 if (e == Element.Void || num9 >= 2f)
4652 {
4653 Say("dmg" + num9, this);
4654 }
4655 }
4656 }
4657 onEvade?.Invoke();
4658 if (isChara)
4659 {
4660 if (flag2)
4661 {
4662 if (!Chara.HasCondition<ConFaint>())
4663 {
4664 Chara.AddCondition<ConFaint>(200, force: true);
4665 }
4666 return;
4667 }
4668 if (origin != null && origin.IsAliveInCurrentZone && origin.isChara)
4669 {
4670 if (e.id == 916)
4671 {
4672 origin.HealHP(Mathf.Clamp(EClass.rnd(dmg * (50 + eleP) / 500 + 5), 1, origin.MaxHP / 5 + EClass.rnd(10)));
4673 }
4674 if (attackSource == AttackSource.Melee || attackSource == AttackSource.Range)
4675 {
4676 int num14 = origin.Dist(this);
4677 if (attackSource == AttackSource.Melee && HasElement(1221) && num14 <= Evalue(1221))
4678 {
4679 int ele2 = ((Chara.MainElement == Element.Void) ? 924 : Chara.MainElement.id);
4680 if (id == "hedgehog_ether")
4681 {
4682 ele2 = 922;
4683 }
4684 Say("reflect_thorne", this, origin);
4685 origin.DamageHP((int)Mathf.Clamp(dmg / 10, 1f, MaxHP / (origin.IsPowerful ? 200 : 20)), ele2, Power, AttackSource.Condition, this);
4686 }
4687 if (HasElement(1223) && num14 <= Evalue(1223))
4688 {
4689 int ele3 = ((Chara.MainElement == Element.Void) ? 923 : Chara.MainElement.id);
4690 Say("reflect_acid", this, origin);
4691 origin.DamageHP((int)Mathf.Clamp(dmg / 10, 1f, MaxHP / (origin.IsPowerful ? 200 : 20)), ele3, Power * 2, AttackSource.Condition, this);
4692 }
4693 }
4694 ProcAbsorb();
4695 }
4696 }
4697 if (hp < 0 || !isChara)
4698 {
4699 return;
4700 }
4701 if (dmg > 0)
4702 {
4703 int a2 = (int)(100 * (dmg * 100 / MaxHP) / 100) + 1;
4704 a2 = Mathf.Min(a2, Chara.isRestrained ? 15 : 200);
4705 if (a2 > 0)
4706 {
4708 if (Chara.body.GetAttackStyle() == AttackStyle.Shield)
4709 {
4710 elements.ModExp(123, a2);
4711 }
4712 }
4713 }
4714 int num15 = ((EClass.rnd(2) == 0) ? 1 : 0);
4715 if (attackSource == AttackSource.Condition)
4716 {
4717 num15 = 1 + EClass.rnd(2);
4718 }
4719 if (num15 > 0)
4720 {
4721 bool flag3 = Chara.HasCondition<ConPoison>() || ((e.id == 915 || e.id == 923) && ResistLv(Evalue(955)) < 4);
4722 AddBlood(num15, flag3 ? 6 : (-1));
4723 }
4724 if (dmg > 0 || (origin != null && origin.HasElement(1345)))
4725 {
4726 ApplyElementEffect(e, eleP, origin);
4727 }
4728 if (origin != null && origin.HasElement(1411) && !Chara.HasCondition<ConGravity>())
4729 {
4730 Condition.ignoreEffect = true;
4732 Condition.ignoreEffect = false;
4733 }
4734 if (IsPC)
4735 {
4736 float num16 = (float)hp / (float)MaxHP;
4737 if (Evalue(1421) > 0)
4738 {
4739 num16 = (float)Chara.mana.value / (float)Chara.mana.max;
4740 }
4741 if (num16 < 0.3f)
4742 {
4743 PlaySound("heartbeat", 1f - num16 * 2f);
4744 }
4745 }
4746 if (!IsPC && hp < MaxHP / 5 && Evalue(423) <= 0 && dmg * 100 / MaxHP + 10 > EClass.rnd(IsPowerful ? 400 : 150) && !HasCondition<ConFear>())
4747 {
4748 Chara.AddCondition<ConFear>(100 + EClass.rnd(100));
4749 }
4750 if (Chara.ai.Current.CancelWhenDamaged && attackSource != AttackSource.Hunger && attackSource != AttackSource.Fatigue && (!EClass.core.config.test.dontCancelIfZeroDamage || dmg != 0L || !IsPC))
4751 {
4752 Chara.ai.Current.TryCancel(origin);
4753 }
4755 {
4756 ConWeapon condition = Chara.GetCondition<ConWeapon>();
4757 if (e.source.aliasRef == condition.sourceElement.aliasRef)
4758 {
4759 condition.Mod(-1);
4760 }
4761 }
4762 if (Chara.HasElement(1222) && (dmg >= MaxHP / 10 || EClass.rnd(20) == 0))
4763 {
4764 ActEffect.Proc(EffectId.Duplicate, this);
4765 }
4766 if (origin != null && !Chara.isRestrained)
4767 {
4769 }
4770 if (hp < MaxHP / 3 && HasElement(1409) && !Chara.HasCooldown(1409))
4771 {
4772 Chara.AddCooldown(1409);
4774 Chara.Cure(CureType.Boss);
4775 Chara.HealHP(MaxHP / 2);
4776 EClass.player.forceTalk = true;
4777 }
4778 if (origin != null && origin.isChara && attackSource != AttackSource.Finish)
4779 {
4781 {
4782 Chara.TrySetEnemy(origin.Chara);
4783 }
4784 if ((weapon == null || !weapon.HasElement(486)) && origin.Evalue(428) > 0 && !IsPCFactionOrMinion && EClass.rnd(dmg) >= EClass.rnd(MaxHP / 10) + MaxHP / 100 + 1)
4785 {
4786 origin.Chara.TryNeckHunt(Chara, origin.Evalue(428) * 20, harvest: true);
4787 }
4788 }
4789 void EvadeDeath(Action action)
4790 {
4791 hp = 0;
4792 if (Evalue(1421) > 0 && isChara && Chara.mana.value < 0)
4793 {
4794 Chara.mana.value = 0;
4795 }
4796 onEvade = action;
4797 }
4798 void Heal()
4799 {
4800 target.Cure(CureType.HealComplete);
4801 foreach (Chara member in EClass.pc.party.members)
4802 {
4803 member.Cure(CureType.HealComplete);
4804 }
4805 }
4806 void ProcAbsorb()
4807 {
4808 if (origin != null && origin.isChara && isChara && (weapon == null || !weapon.HasElement(486)))
4809 {
4810 int valueOrDefault = (origin.Evalue(662) + weapon?.Evalue(662, ignoreGlobalElement: true)).GetValueOrDefault();
4811 int valueOrDefault2 = (origin.Evalue(661) + weapon?.Evalue(661, ignoreGlobalElement: true)).GetValueOrDefault();
4812 if (valueOrDefault > 0 && attackSource == AttackSource.Melee && origin.isChara && !origin.Chara.ignoreSPAbsorb && Chara.IsHostile(origin as Chara))
4813 {
4814 int num17 = EClass.rnd(3 + (int)Mathf.Clamp(dmg / 100, 0f, valueOrDefault / 10));
4815 origin.Chara.stamina.Mod(num17);
4817 {
4818 Chara.stamina.Mod(-num17);
4819 }
4820 }
4821 if (origin.HasElement(1350) && attackSource == AttackSource.Melee)
4822 {
4823 int num18 = EClass.rndHalf(2 + (int)Mathf.Clamp(dmg / 10, 0f, origin.Chara.GetPietyValue() + 10));
4824 origin.Chara.mana.Mod(num18);
4826 {
4827 Chara.mana.Mod(-num18);
4828 }
4829 }
4830 if (valueOrDefault2 > 0 && attackSource == AttackSource.Melee)
4831 {
4832 int num19 = EClass.rnd(2 + (int)Mathf.Clamp(dmg / 10, 0f, valueOrDefault2 + 10));
4833 origin.Chara.mana.Mod(num19);
4835 {
4836 Chara.mana.Mod(-num19);
4837 }
4838 }
4839 }
4840 }
4841 }
4842
4843 public void ApplyElementEffect(Element e, int eleP, Card origin, bool checkHostileAct = false)
4844 {
4845 if (!isChara)
4846 {
4847 return;
4848 }
4849 bool flag = true;
4850 bool hostile = false;
4851 switch (e.id)
4852 {
4853 case 910:
4854 if (Chance(30 + eleP / 5, 100))
4855 {
4856 MarkHostile().AddCondition<ConBurning>(eleP);
4857 }
4858 break;
4859 case 911:
4860 if (Chara.isWet)
4861 {
4862 if (Chance(30 + eleP / 10, 100))
4863 {
4865 }
4866 }
4867 else if (Chance(50 + eleP / 10, 100))
4868 {
4869 Chara.AddCondition<ConWet>(eleP);
4870 }
4871 break;
4872 case 912:
4873 if (Chance(75 + eleP / 20, 100) && EClass.rnd(3) == 0)
4874 {
4875 Chara.AddCondition<ConParalyze>(1, force: true);
4876 }
4877 break;
4878 case 915:
4879 if (Chance(30 + eleP / 5, 100))
4880 {
4881 MarkHostile().AddCondition<ConPoison>(eleP);
4882 }
4883 break;
4884 case 913:
4885 if (Chance(30 + eleP / 5, 100))
4886 {
4888 }
4889 break;
4890 case 918:
4891 flag = false;
4892 if (Chance(30 + eleP / 5, 100))
4893 {
4895 }
4896 break;
4897 case 914:
4898 flag = false;
4899 if (EClass.rnd(3) != 0)
4900 {
4901 if (Chance(30 + eleP / 5, 100))
4902 {
4904 }
4905 }
4906 else if (Chance(30 + eleP / 5, 100))
4907 {
4909 }
4910 break;
4911 case 917:
4912 if (Chance(50 + eleP / 10, 100))
4913 {
4914 Chara.AddCondition<ConDim>(eleP);
4915 }
4916 break;
4917 case 925:
4918 if (EClass.rnd(3) == 0)
4919 {
4920 if (Chance(30 + eleP / 5, 100))
4921 {
4922 Chara.AddCondition<ConDim>(eleP);
4923 }
4924 }
4925 else if (EClass.rnd(2) == 0)
4926 {
4927 if (EClass.rnd(3) == 0)
4928 {
4929 Chara.AddCondition<ConParalyze>(1, force: true);
4930 }
4931 }
4932 else if (EClass.rnd(2) == 0)
4933 {
4934 Chara.AddCondition<ConConfuse>(1 + EClass.rnd(3), force: true);
4935 }
4936 break;
4937 case 920:
4938 flag = false;
4939 if (Chance(5 + eleP / 25, 40))
4940 {
4941 Chara.AddCondition<ConBlind>(eleP / 2);
4942 }
4943 if (Chance(5 + eleP / 25, 40))
4944 {
4945 Chara.AddCondition<ConParalyze>(eleP / 2);
4946 }
4947 if (Chance(5 + eleP / 25, 40))
4948 {
4949 Chara.AddCondition<ConConfuse>(eleP / 2);
4950 }
4951 if (Chance(5 + eleP / 25, 40))
4952 {
4953 MarkHostile().AddCondition<ConPoison>(eleP / 2);
4954 }
4955 if (Chance(5 + eleP / 25, 40))
4956 {
4957 Chara.AddCondition<ConSleep>(eleP / 2);
4958 }
4959 if (Chance(5 + eleP / 25, 40))
4960 {
4961 Chara.AddCondition<ConDim>(eleP / 2);
4962 }
4963 if (Chance(30 + eleP / 10, 100))
4964 {
4965 Chara.SAN.Mod(EClass.rnd(2));
4966 }
4967 break;
4968 case 924:
4969 if (Chance(50 + eleP / 10, 100))
4970 {
4971 MarkHostile().AddCondition<ConBleed>(eleP);
4972 }
4973 break;
4974 case 923:
4975 if (Chance(50 + eleP / 10, 100) && EClass.rnd(4) == 0)
4976 {
4978 }
4979 break;
4980 case 922:
4981 Chara.ModCorruption(EClass.rnd(eleP / 50 + 10));
4982 break;
4983 }
4984 if (Chara.conSleep != null && flag)
4985 {
4987 }
4988 if (checkHostileAct && hostile && origin != null && origin.isChara)
4989 {
4990 origin.Chara.DoHostileAction(this);
4991 }
4992 static bool Chance(int a, int max)
4993 {
4994 return Mathf.Min(a, max) > EClass.rnd(100);
4995 }
4996 Chara MarkHostile()
4997 {
4998 hostile = true;
4999 return Chara;
5000 }
5001 }
5002
5003 public virtual void Die(Element e = null, Card origin = null, AttackSource attackSource = AttackSource.None, Chara originalTarget = null)
5004 {
5005 Card rootCard = GetRootCard();
5006 Point _pos = rootCard?.pos ?? pos;
5007 if (_pos != null && !_pos.IsValid)
5008 {
5009 _pos = null;
5010 }
5011 if (trait.EffectDead == EffectDead.Default && _pos != null)
5012 {
5013 _pos.PlaySound(material.GetSoundDead(sourceCard));
5014 _pos.PlayEffect("mine").SetParticleColor(material.GetColor()).Emit(10 + EClass.rnd(10));
5015 material.AddBlood(_pos, trait.CanBeSmashedToDeath ? (12 + EClass.rnd(8)) : 6);
5016 if (_pos.IsSync)
5017 {
5018 string text = ((rootCard != this) ? "destroyed_inv_" : "destroyed_ground_");
5019 if (e != null && LangGame.Has(text + e.source.alias))
5020 {
5021 text += e.source.alias;
5022 }
5023 if (attackSource != AttackSource.Throw)
5024 {
5025 Msg.Say(text, this, rootCard);
5026 }
5027 }
5028 else if (attackSource != AttackSource.Throw)
5029 {
5030 Msg.Say("destroyed", this);
5031 }
5032 }
5033 if (_pos != null && !EClass._zone.IsUserZone)
5034 {
5035 things.ForeachReverse(delegate(Thing t)
5036 {
5037 if (!(t.trait is TraitChestMerchant))
5038 {
5039 EClass._zone.AddCard(t, _pos);
5040 }
5041 });
5042 }
5043 Destroy();
5044 if (e != null && _pos != null && e.id == 21)
5045 {
5046 EClass._zone.AddCard(ThingGen.Create((EClass.rnd(2) == 0) ? "ash" : "ash2"), _pos);
5047 }
5048 if (trait.ThrowType == ThrowType.Explosive && EClass.rnd((!(trait is TraitAmmoRocket)) ? 1 : 2) == 0)
5049 {
5050 Explode(pos, origin);
5051 }
5052 }
5053
5054 public void Explode(Point p, Card origin)
5055 {
5056 ActEffect.ProcAt(EffectId.Explosive, 100, blessedState, this, null, p, isNeg: true, new ActRef
5057 {
5058 origin = origin?.Chara,
5059 refThing = Thing,
5060 aliasEle = "eleImpact"
5061 });
5062 }
5063
5064 public void Deconstruct()
5065 {
5066 PlaySound(material.GetSoundDead(sourceCard));
5067 Destroy();
5068 }
5069
5070 public void Destroy()
5071 {
5072 if (isDestroyed)
5073 {
5074 Debug.Log(Name + " is already destroyed.");
5075 return;
5076 }
5077 if (isChara)
5078 {
5079 if (IsPCFaction && !Chara.isSummon)
5080 {
5081 Debug.Log(this);
5082 return;
5083 }
5084 Chara.DropHeld();
5085 Chara.isDead = true;
5086 if (IsPCParty)
5087 {
5089 }
5090 if (IsGlobal)
5091 {
5093 }
5094 }
5095 if (renderer.hasActor)
5096 {
5097 renderer.KillActor();
5098 }
5099 if (parent != null)
5100 {
5101 parent.RemoveCard(this);
5102 }
5103 for (int num = things.Count - 1; num >= 0; num--)
5104 {
5105 things[num].Destroy();
5106 }
5107 isDestroyed = true;
5108 }
5109
5110 public void SpawnLoot(Card origin)
5111 {
5112 if (!isChara || IsPCFactionMinion || (isCopy && EClass.rnd(10) != 0))
5113 {
5114 return;
5115 }
5116 bool isUserZone = EClass._zone.IsUserZone;
5117 bool flag = EClass._zone is Zone_Music;
5118 List<Card> list = new List<Card>();
5119 if (!IsPCFaction && !isUserZone && sourceCard.idActor.IsEmpty())
5120 {
5121 int i2 = 500;
5122 if (this.rarity >= Rarity.Legendary)
5123 {
5124 i2 = ((!EClass.player.codex.DroppedCard(id)) ? 1 : 10);
5126 }
5127 if (trait is TraitAdventurerBacker)
5128 {
5129 i2 = 10;
5130 }
5131 if (chance(i2))
5132 {
5133 Thing thing = ThingGen.Create("figure");
5134 thing.MakeFigureFrom(id);
5135 list.Add(thing);
5136 }
5137 if (chance(i2))
5138 {
5139 Thing thing2 = ThingGen.Create("figure3");
5140 thing2.MakeFigureFrom(id);
5141 list.Add(thing2);
5142 }
5143 }
5144 bool flag2 = Chara.race.corpse[1].ToInt() > EClass.rnd(1500) || (Chara.IsPowerful && !IsPCFaction) || EClass.debug.godFood;
5145 int num = 1;
5146 if (!IsMinion && Chara.IsAnimal && EClass.rnd(EClass._zone.IsPCFaction ? 3 : 5) == 0)
5147 {
5148 flag2 = true;
5149 }
5151 {
5152 flag2 = true;
5153 num = EClass.rndHalf(4 + 10 * (50 + Mathf.Max(0, (int)MathF.Sqrt(EClass.pc.Evalue(290) * 10))) / 100);
5154 }
5155 else if (origin != null && origin.HasElement(290) && !IsMinion)
5156 {
5157 if (!flag2 && Chara.race.corpse[1].ToInt() > EClass.rnd(150000 / (100 + (int)Mathf.Sqrt(origin.Evalue(290)) * 5)))
5158 {
5159 flag2 = true;
5160 origin.elements.ModExp(290, 150f);
5161 }
5162 else
5163 {
5164 origin.elements.ModExp(290, 25f);
5165 }
5166 }
5167 if (id == "littleOne" && IsPCFactionOrMinion)
5168 {
5169 flag2 = false;
5170 }
5171 if (flag2 && !isUserZone)
5172 {
5173 string text = Chara.race.corpse[0];
5174 bool num2 = text == "_meat";
5175 int num3 = 10;
5177 {
5178 num3 += (int)Mathf.Min(Mathf.Sqrt(EClass.pc.Evalue(290)), 20f);
5179 }
5180 if (EClass.rnd((Act.CurrentAct is ActMeleeBladeStorm || (origin != null && (origin.HasElement(1556) || origin.HasCondition<ConTransmuteCat>()))) ? 2 : 100) == 0)
5181 {
5182 text = "dattamono";
5183 }
5184 if (num2 && num3 > EClass.rnd(100))
5185 {
5186 text = "meat_marble";
5187 }
5188 Thing thing3 = ThingGen.Create(text).SetNum(num);
5189 if (thing3.source._origin == "meat")
5190 {
5191 thing3.MakeFoodFrom(this);
5192 }
5193 else
5194 {
5196 }
5197 list.Add(thing3);
5198 }
5199 if (!IsPCFaction && (!isUserZone || !EClass.game.principal.disableUsermapBenefit) && chance(200))
5200 {
5201 list.Add(Chara.MakeGene());
5202 }
5203 if (!IsPCFaction && !isUserZone)
5204 {
5205 foreach (string item2 in sourceCard.loot.Concat(Chara.race.loot).ToList())
5206 {
5207 string[] array = item2.Split('/');
5208 int num4 = array[1].ToInt();
5209 if (num4 >= 1000 || num4 > EClass.rnd(1000) || EClass.debug.godMode)
5210 {
5211 CardRow cardRow = EClass.sources.cards.map[array[0]];
5212 if (cardRow != null && cardRow.Category.slot != 0 && cardRow.quality == 0 && EClass.pc.Evalue(1660) * 25 > EClass.rnd(100))
5213 {
5214 CardBlueprint.SetRarity((EClass.rnd(20) == 0) ? Rarity.Mythical : Rarity.Legendary);
5215 }
5216 list.Add(ThingGen.Create(array[0], -1, LV).SetNum((num4 < 1000) ? 1 : (num4 / 1000 + ((EClass.rnd(1000) < num4 % 1000) ? 1 : 0))));
5217 }
5218 }
5219 if (Chara.IsMachine)
5220 {
5221 bool flag3 = Chara.HasElement(1248);
5222 if (chance(200))
5223 {
5224 list.Add(ThingGen.Create("memory_chip"));
5225 }
5226 if (chance(20))
5227 {
5228 list.Add(ThingGen.Create(flag3 ? "scrap" : "microchip"));
5229 }
5230 if (chance(15))
5231 {
5232 list.Add(ThingGen.Create(flag3 ? "bolt" : "battery"));
5233 }
5234 }
5235 else
5236 {
5237 if (Chara.IsAnimal)
5238 {
5239 if (chance(15))
5240 {
5241 list.Add(ThingGen.Create("fang"));
5242 }
5243 if (chance(10))
5244 {
5245 list.Add(ThingGen.Create("skin"));
5246 }
5247 }
5248 if (chance(20))
5249 {
5250 list.Add(ThingGen.Create("offal"));
5251 }
5252 if (chance(20))
5253 {
5254 list.Add(ThingGen.Create("heart"));
5255 }
5256 }
5257 if (!isBackerContent && !flag)
5258 {
5259 switch (id)
5260 {
5261 case "pumpkin":
5262 if (chance(3))
5263 {
5264 list.Add(ThingGen.CreateFromCategory((EClass.rnd(2) == 0) ? "meal_cookie" : "meal_cake", 5 + EClass.rnd(EClass.rnd(50) + 1)));
5265 }
5266 break;
5267 case "isca":
5268 list.Add(ThingGen.Create("blood_angel"));
5269 break;
5270 case "golem_wood":
5271 if (chance(30))
5272 {
5273 list.Add(ThingGen.Create("crystal_earth"));
5274 }
5275 break;
5276 case "golem_fish":
5277 case "golem_stone":
5278 if (chance(30))
5279 {
5280 list.Add(ThingGen.Create("crystal_sun"));
5281 }
5282 break;
5283 case "golem_steel":
5284 if (chance(30))
5285 {
5286 list.Add(ThingGen.Create("crystal_mana"));
5287 }
5288 break;
5289 case "golem_gold":
5290 list.Add(ThingGen.Create("money2"));
5291 break;
5292 }
5293 int num5 = ((EClass._zone.Boss == this) ? 2 : ((this.rarity >= Rarity.Legendary) ? 1 : 0));
5294 if (EClass._zone is Zone_Void)
5295 {
5296 num5++;
5297 }
5298 if (EClass.rnd(5) == 0)
5299 {
5300 num5++;
5301 }
5302 string text2 = id;
5303 if (text2 == "big_daddy" || text2 == "santa")
5304 {
5305 num5 += 2;
5306 }
5307 if (num5 > 0 && EClass.game.principal.dropRate)
5308 {
5309 num5 = Mathf.Max(1, num5 * (50 + EClass.game.principal.dropRateMtp * 50) / 100);
5310 }
5311 List<Thing> list2 = new List<Thing>();
5312 foreach (Thing thing4 in things)
5313 {
5314 if (thing4.HasTag(CTAG.gift) || thing4.trait is TraitChestMerchant)
5315 {
5316 continue;
5317 }
5318 if (thing4.isGifted || thing4.rarity >= Rarity.Artifact || thing4.trait.DropChance > EClass.rndf(1f))
5319 {
5320 list.Add(thing4);
5321 }
5322 else if (thing4.IsEquipmentOrRanged)
5323 {
5324 if (thing4.rarity >= Rarity.Legendary)
5325 {
5326 list2.Add(thing4);
5327 }
5328 else if (EClass.rnd(100) == 0)
5329 {
5330 list.Add(thing4);
5331 }
5332 }
5333 else if (EClass.rnd(5) == 0)
5334 {
5335 list.Add(thing4);
5336 }
5337 }
5338 if (num5 > 0 && list2.Count > 0)
5339 {
5340 list2.Shuffle();
5341 for (int j = 0; j < list2.Count && j < num5; j++)
5342 {
5343 list.Add(list2[j]);
5344 num5--;
5345 }
5346 }
5347 if (this.rarity >= Rarity.Legendary && !IsUnique && c_bossType != BossType.Evolved)
5348 {
5349 int num6 = 0;
5350 foreach (Card item3 in list)
5351 {
5352 if (item3.rarity >= Rarity.Legendary || item3.IsContainer)
5353 {
5354 num6++;
5355 }
5356 }
5357 if (num6 == 0)
5358 {
5359 int num7 = ((!(EClass._zone is Zone_Void)) ? 1 : 2);
5360 if (num5 < num7)
5361 {
5362 num5 = num7;
5363 }
5364 for (int k = 0; k < num5; k++)
5365 {
5366 Rand.SetSeed(uid + k);
5367 if (EClass.rnd((EClass._zone.events.GetEvent<ZoneEventDefenseGame>() != null) ? 3 : 2) == 0)
5368 {
5369 Rarity rarity = ((EClass.rnd(20) == 0) ? Rarity.Mythical : Rarity.Legendary);
5371 {
5372 rarity = rarity
5373 });
5374 Thing item = ThingGen.CreateFromFilter("eq", LV);
5375 list.Add(item);
5376 }
5377 else if (EClass.rnd(3) == 0)
5378 {
5379 list.Add(ThingGen.Create("medal"));
5380 }
5381 Rand.SetSeed();
5382 }
5383 }
5384 }
5385 }
5386 }
5387 foreach (Thing thing5 in things)
5388 {
5389 if (thing5.GetInt(116) != 0)
5390 {
5391 list.Add(thing5);
5392 }
5393 }
5394 Point nearestPoint = GetRootCard().pos;
5395 if (nearestPoint.IsBlocked)
5396 {
5397 nearestPoint = nearestPoint.GetNearestPoint();
5398 }
5399 foreach (Card item4 in list)
5400 {
5401 if (item4.parent == EClass._zone)
5402 {
5403 continue;
5404 }
5405 item4.isHidden = false;
5406 item4.SetInt(116);
5407 EClass._zone.AddCard(item4, nearestPoint);
5408 if (!item4.IsEquipment || item4.rarity < Rarity.Superior || item4.IsCursed)
5409 {
5410 continue;
5411 }
5412 foreach (Chara chara in EClass._map.charas)
5413 {
5414 if (chara.HasElement(1412) && chara.Dist(nearestPoint) < 3)
5415 {
5416 item4.Thing.TryLickEnchant(chara);
5417 break;
5418 }
5419 }
5420 }
5421 bool chance(int i)
5422 {
5423 i = i * 100 / (100 + EClass.player.codex.GetOrCreate(id).BonusDropLv * 10);
5424 if (i < 1)
5425 {
5426 i = 1;
5427 }
5428 if (IsMinion)
5429 {
5430 i *= 5;
5431 }
5432 if (EClass.rnd(i) == 0)
5433 {
5434 return true;
5435 }
5436 return false;
5437 }
5438 }
5439
5440 public Thing TryMakeRandomItem(int lv = -1, TryMakeRandomItemSource itemSource = TryMakeRandomItemSource.Default, Chara crafter = null)
5441 {
5442 if (lv == -1)
5443 {
5444 lv = EClass._zone.DangerLv;
5445 }
5446 switch (id)
5447 {
5448 case "gene":
5450 break;
5451 case "log":
5452 ChangeMaterial(EClass.sources.materials.rows.Where((SourceMaterial.Row m) => m.category == "wood").RandomItem());
5453 break;
5454 case "ore_gem":
5456 break;
5457 case "ore":
5459 break;
5460 case "milk":
5461 case "_egg":
5462 case "egg_fertilized":
5463 case "_meat":
5464 case "meat_marble":
5465 case "dattamono":
5466 {
5467 string text = "c_wilds";
5468 if (id == "_meat" || id == "meat_marble")
5469 {
5470 text = "c_animal";
5471 }
5472 if (itemSource == TryMakeRandomItemSource.Cooking && crafter != null && crafter.HasElement(1205))
5473 {
5474 text = "c_human";
5475 }
5476 for (int i = 0; i < 20; i++)
5477 {
5478 CardRow cardRow = SpawnList.Get(text).Select(lv + i);
5479 if (cardRow.model.Chara.race.corpse[0] != "_meat" && id != "milk" && id != "_egg" && id != "egg_fertilized")
5480 {
5481 continue;
5482 }
5483 if (itemSource == TryMakeRandomItemSource.Cooking)
5484 {
5485 if (cardRow.model.HasElement(701))
5486 {
5487 continue;
5488 }
5489 if (crafter != null && crafter.id == "big_sister")
5490 {
5491 cardRow = crafter.source;
5492 }
5493 }
5494 if (id == "milk")
5495 {
5496 if (c_idRefCard.IsEmpty())
5497 {
5498 MakeRefFrom(cardRow.model);
5499 }
5500 }
5501 else
5502 {
5503 MakeFoodFrom(cardRow.model);
5504 }
5505 return this as Thing;
5506 }
5507 MakeFoodFrom(EClass.sources.charas.map.Values.Where((SourceChara.Row r) => r.chance > 0 && r.quality == 0).RandomItem().model);
5508 break;
5509 }
5510 }
5511 return this as Thing;
5512 }
5513
5514 public Card MakeFoodFrom(string _id)
5515 {
5516 return MakeFoodFrom(EClass.sources.cards.map[_id].model);
5517 }
5518
5520 {
5521 MakeRefFrom(c);
5523 if (!c.isChara)
5524 {
5525 return this;
5526 }
5527 SourceRace.Row race = c.Chara.race;
5528 int num = race.food[0].ToInt();
5529 bool flag = id == "meat_marble";
5530 int num2 = 1;
5531 bool flag2 = category.IsChildOf("meat");
5532 bool flag3 = category.IsChildOf("egg");
5533 if (flag)
5534 {
5535 num += 100;
5536 }
5537 if (flag2)
5538 {
5539 if (c.IsPCFaction && c.IsUnique)
5540 {
5541 num = -100;
5542 }
5543 elements.SetBase(70, race.STR * race.STR / 5 * num / 100 - 10 + num / 10);
5544 if (flag)
5545 {
5546 elements.SetBase(440, race.END * race.END / 5 * num / 100 - 10 + num / 10);
5547 }
5548 elements.SetBase(71, (int)Mathf.Clamp((float)(num / 10) + Mathf.Sqrt(race.height) - 10f, 1f, 60f));
5549 }
5550 else if (flag3)
5551 {
5552 elements.SetBase(444, race.LER * race.LER / 5 * num / 100 - 10 + num / 10);
5553 num2 = 2;
5554 }
5555 else
5556 {
5557 num2 = 3;
5558 }
5559 if (flag2)
5560 {
5561 if (c.Chara.IsHuman)
5562 {
5563 elements.SetBase(708, 1);
5564 }
5565 if (c.Chara.IsUndead)
5566 {
5567 elements.SetBase(709, 1);
5568 }
5569 }
5570 foreach (Element value in c.elements.dict.Values)
5571 {
5572 if ((!flag3 || value.id != 1229) && (value.source.category == "food" || value.source.tag.Contains("foodEnc") || value.IsTrait))
5573 {
5574 elements.SetBase(value.id, value.Value);
5575 }
5576 }
5577 List<Tuple<int, int>> list = new List<Tuple<int, int>>();
5578 foreach (KeyValuePair<int, int> item in race.elementMap)
5579 {
5580 if (EClass.sources.elements.map[item.Key].tag.Contains("primary"))
5581 {
5582 list.Add(new Tuple<int, int>(item.Key, item.Value));
5583 }
5584 }
5585 list.Sort((Tuple<int, int> a, Tuple<int, int> b) => b.Item2 - a.Item2);
5586 for (int i = 0; i < num2 && i < list.Count; i++)
5587 {
5588 Tuple<int, int> tuple = list[i];
5589 elements.SetBase(tuple.Item1, tuple.Item2 * tuple.Item2 / 4);
5590 }
5591 if (c.Chara.IsUndead)
5592 {
5593 elements.ModBase(73, -20);
5594 }
5595 isWeightChanged = true;
5596 c_weight = race.height * 4 + 100;
5597 c_idMainElement = c.c_idMainElement;
5598 SetBlessedState(BlessedState.Normal);
5599 int num3 = c.LV - c.sourceCard.LV;
5600 if (num3 < 0)
5601 {
5602 num3 = 0;
5603 }
5604 num3 = EClass.curve(num3, 10, 10, 80);
5605 if (c.rarity >= Rarity.Legendary || c.IsUnique)
5606 {
5607 num3 += 60;
5608 }
5609 if (flag2 && c.IsPCFaction && c.IsUnique)
5610 {
5611 num3 = 0;
5612 }
5613 if (num3 > 0)
5614 {
5615 elements.ModBase(2, num3);
5616 }
5617 return this;
5618 }
5619
5620 public void MakeFoodRef(Card c1, Card c2 = null)
5621 {
5622 Card card = c1;
5623 Card card2 = c2;
5624 if (IsIgnoreName(card))
5625 {
5626 card = null;
5627 }
5628 if (IsIgnoreName(card2))
5629 {
5630 card2 = null;
5631 }
5632 if (card == null && card2 != null)
5633 {
5634 card = card2;
5635 card2 = null;
5636 }
5637 if (card != null)
5638 {
5639 MakeRefFrom(card, card2);
5640 if (card.c_idRefCard != null)
5641 {
5642 c_idRefCard = card.c_idRefCard;
5643 c_altName = TryGetFoodName(card);
5644 }
5645 if (card2 != null && card2.c_idRefCard != null)
5646 {
5647 c_idRefCard2 = card2.c_idRefCard;
5648 c_altName2 = TryGetFoodName(card2);
5649 }
5650 }
5651 static bool IsIgnoreName(Card c)
5652 {
5653 if (c == null)
5654 {
5655 return true;
5656 }
5657 switch (c.id)
5658 {
5659 case "dough_cake":
5660 case "dough_bread":
5661 case "noodle":
5662 case "flour":
5663 case "rice":
5664 return true;
5665 default:
5666 return false;
5667 }
5668 }
5669 }
5670
5671 public string TryGetFoodName(Card c)
5672 {
5673 if (c.c_idRefCard.IsEmpty())
5674 {
5675 return c.c_altName;
5676 }
5677 if (!(c.refCard is SourceChara.Row { isChara: not false } row))
5678 {
5679 return c.c_altName;
5680 }
5681 if (!row.aka.IsEmpty())
5682 {
5683 if (row.name == "*r" && row.aka == "*r")
5684 {
5685 return "corpseGeneral".lang();
5686 }
5687 if (row.name == "*r")
5688 {
5689 return row.GetText("aka");
5690 }
5691 }
5692 return row.GetName();
5693 }
5694
5695 public string GetFoodName(string s)
5696 {
5697 return s.Replace("_corpseFrom".lang(), "_corpseTo".lang());
5698 }
5699
5700 public void MakeFigureFrom(string id)
5701 {
5702 MakeRefFrom(id);
5703 }
5704
5705 public Card MakeRefFrom(string id)
5706 {
5707 c_idRefCard = id;
5708 return this;
5709 }
5710
5711 public void MakeRefFrom(Card c1, Card c2 = null)
5712 {
5713 c_idRefCard = c1.id;
5714 c_altName = (c1.IsPC ? c1.c_altName : c1.GetName(NameStyle.Ref, (!c1.isChara) ? 1 : 0));
5715 if (c2 != null)
5716 {
5717 c_idRefCard2 = c2.id;
5718 c_altName2 = (c2.IsPC ? c2.c_altName : c2.GetName(NameStyle.Ref, (!c2.isChara) ? 1 : 0));
5719 }
5720 c_extraNameRef = (c1.IsPC ? EClass.pc.c_altName : c1.c_extraNameRef);
5721 }
5722
5723 public Thing MakeEgg(bool effect = true, int num = 1, bool addToZone = true, int fertChance = 20, BlessedState? state = null)
5724 {
5725 Thing thing = ThingGen.Create((EClass.rnd(EClass.debug.enable ? 1 : fertChance) == 0) ? "egg_fertilized" : "_egg").SetNum(num);
5726 if (!EClass.debug.enable && HasElement(1290) && Evalue(418) >= 0)
5727 {
5728 thing.MakeFoodFrom(EClass.sources.charas.map["caladrius"].model);
5729 }
5730 else
5731 {
5732 thing.MakeFoodFrom(this);
5733 }
5734 thing.c_idMainElement = c_idMainElement;
5735 if (state.HasValue)
5736 {
5737 thing.SetBlessedState(state.Value);
5738 }
5739 if (!addToZone)
5740 {
5741 return thing;
5742 }
5743 return GiveBirth(thing, effect);
5744 }
5745
5746 public Thing MakeMilk(bool effect = true, int num = 1, bool addToZone = true, BlessedState? state = null)
5747 {
5748 Thing thing = ThingGen.Create("milk").SetNum(num);
5749 if (!EClass.debug.enable && HasElement(1290) && Evalue(418) >= 0)
5750 {
5751 thing.MakeRefFrom(EClass.sources.charas.map["caladrius"].model);
5752 }
5753 else
5754 {
5755 thing.MakeRefFrom(this);
5756 }
5757 if (state.HasValue)
5758 {
5759 thing.SetBlessedState(state.Value);
5760 }
5761 int num2 = LV - sourceCard.LV;
5762 if (!IsPCFaction && EClass._zone.IsUserZone)
5763 {
5764 num2 = 0;
5765 }
5766 if (num2 >= 10 && !HasElement(1290))
5767 {
5768 thing.SetEncLv(num2 / 10);
5769 }
5770 if (!addToZone)
5771 {
5772 return thing;
5773 }
5774 return GiveBirth(thing, effect);
5775 }
5776
5777 public Thing GiveBirth(Thing t, bool effect)
5778 {
5779 Card card = (ExistsOnMap ? this : (GetRootCard() ?? EClass.pc));
5780 EClass.player.forceTalk = true;
5781 card.Talk("giveBirth");
5782 EClass._zone.TryAddThing(t, card.pos);
5783 if (effect)
5784 {
5785 card.pos.PlayEffect("revive");
5786 card.pos.PlaySound("egg");
5787 PlayAnime(AnimeID.Shiver);
5788 if (isChara)
5789 {
5791 }
5792 }
5793 return t;
5794 }
5795
5796 public Card SetHidden(bool hide = true)
5797 {
5798 isHidden = hide;
5799 pos.cell.Refresh();
5800 return this;
5801 }
5802
5803 public virtual MoveResult _Move(Point p, MoveType type = MoveType.Walk)
5804 {
5805 EClass._map.MoveCard(p, this);
5806 if (isChara)
5807 {
5808 Chara.SyncRide();
5809 }
5810 return MoveResult.Success;
5811 }
5812
5813 public void MoveImmediate(Point p, bool focus = true, bool cancelAI = true)
5814 {
5815 if (p == null)
5816 {
5817 return;
5818 }
5819 EClass._map.MoveCard(p, this);
5820 if (!IsPC || focus)
5821 {
5822 renderer.SetFirst(first: true, p.PositionCenter());
5823 }
5824 if (isChara)
5825 {
5826 if (cancelAI)
5827 {
5828 Chara.ai.Cancel();
5829 }
5830 Chara.SyncRide();
5831 }
5832 if (IsPC && focus)
5833 {
5836 }
5837 }
5838
5839 public void Teleport(Point point, bool silent = false, bool force = false)
5840 {
5841 if (EClass._zone.IsRegion)
5842 {
5843 SayNothingHappans();
5844 return;
5845 }
5846 PlayEffect("teleport");
5847 if (!force && (!trait.CanBeTeleported || elements.Has(400) || (isChara && Chara.HasCondition<ConGravity>())))
5848 {
5849 Say("antiTeleport", this);
5850 PlaySound("gravity");
5851 return;
5852 }
5853 if (!silent)
5854 {
5855 PlaySound("teleport");
5856 Say("teleported", this);
5857 }
5858 _Move(point);
5859 renderer.SetFirst(first: true, pos.PositionCenter());
5860 if (isChara)
5861 {
5862 Chara.ai.Cancel();
5863 foreach (Chara chara in EClass._map.charas)
5864 {
5865 if (chara.enemy == this)
5866 {
5867 chara.SetEnemy();
5868 }
5869 }
5870 Chara.RemoveCondition<ConEntangle>();
5871 }
5872 if (IsPC)
5873 {
5876 EClass.player.haltMove = true;
5877 }
5878 PlayEffect("teleport", useRenderPos: false);
5879 }
5880
5881 public virtual void OnLand()
5882 {
5884 {
5885 PlayEffect("ripple");
5886 PlaySound("Footstep/water");
5887 }
5888 }
5889
5890 public int ResistLvFrom(int ele)
5891 {
5892 return ResistLv(EClass.sources.elements.alias.TryGetValue(EClass.sources.elements.map[ele].aliasRef)?.id ?? 0);
5893 }
5894
5895 public int ResistLv(int res)
5896 {
5897 return Element.GetResistLv(Evalue(res));
5898 }
5899
5900 public bool HasElement(int ele, bool includeNagative = false)
5901 {
5902 if (elements.Value(ele) <= 0)
5903 {
5904 if (includeNagative)
5905 {
5906 return elements.Value(ele) < 0;
5907 }
5908 return false;
5909 }
5910 return true;
5911 }
5912
5913 public bool HasElement(int ele, int req)
5914 {
5915 return elements.Value(ele) >= req;
5916 }
5917
5918 public bool HasElement(string id, int req = 1)
5919 {
5920 return HasElement(EClass.sources.elements.alias[id].id, req);
5921 }
5922
5923 public bool HasGlobalElement(int ele)
5924 {
5925 return elements.GetElement(ele)?.IsGlobalElement ?? false;
5926 }
5927
5928 public bool HasElementNoCopy()
5929 {
5930 if (HasElement(764))
5931 {
5932 return true;
5933 }
5934 if (HasElement(759))
5935 {
5936 return true;
5937 }
5938 if (HasElement(703))
5939 {
5940 return true;
5941 }
5942 if (HasElement(758))
5943 {
5944 return true;
5945 }
5946 if (HasElement(704))
5947 {
5948 return true;
5949 }
5950 return false;
5951 }
5952
5954 {
5955 renderer = new CardRenderer();
5956 renderer.SetOwner(this);
5957 return renderer;
5958 }
5959
5960 public void AddBlood(int a = 1, int id = -1)
5961 {
5962 if (!EClass._zone.IsRegion)
5963 {
5964 for (int i = 0; i < a; i++)
5965 {
5966 EClass._map.AddDecal(pos.x + ((EClass.rnd(2) != 0) ? (EClass.rnd(3) - 1) : 0), pos.z + ((EClass.rnd(2) != 0) ? (EClass.rnd(3) - 1) : 0), (id == -1) ? (isChara ? Chara.race.blood : material.decal) : id);
5967 }
5968 PlaySound("blood");
5969 }
5970 }
5971
5973 {
5975 shared.color = 11010048f;
5976 shared.liquidLv = 0;
5977 shared.cell = null;
5978 SetRenderParam(shared);
5979 return shared;
5980 }
5981
5982 public virtual void SetRenderParam(RenderParam p)
5983 {
5984 }
5985
5986 public void DyeRandom()
5987 {
5988 Dye(EClass.sources.materials.rows.Where((SourceMaterial.Row r) => r.tier <= 4 && (r.matColor.r != r.matColor.g || r.matColor.g != r.matColor.b || r.matColor.b != r.matColor.r)).RandomItem().alias);
5989 }
5990
5991 public void Dye(string idMat)
5992 {
5993 Dye(EClass.sources.materials.alias[idMat]);
5994 }
5995
5996 public void Dye(SourceMaterial.Row mat)
5997 {
5998 isDyed = mat != null;
5999 c_dyeMat = mat?.id ?? 0;
6000 _colorInt = 0;
6001 }
6002
6003 public void RefreshColor()
6004 {
6005 if (isChara)
6006 {
6007 if (isDyed)
6008 {
6009 _colorInt = BaseTileMap.GetColorInt(ref DyeMat.matColor, sourceRenderCard.colorMod);
6010 }
6011 else if (isElemental)
6012 {
6013 _colorInt = BaseTileMap.GetColorInt(ref EClass.setting.elements[Chara.MainElement.source.alias].colorSprite, sourceRenderCard.colorMod);
6014 }
6015 else
6016 {
6017 _colorInt = 104025;
6018 }
6019 }
6020 else if (isDyed)
6021 {
6022 if (sourceRenderCard.useAltColor)
6023 {
6024 _colorInt = BaseTileMap.GetColorInt(ref DyeMat.altColor, sourceRenderCard.colorMod);
6025 }
6026 else
6027 {
6028 _colorInt = BaseTileMap.GetColorInt(ref DyeMat.matColor, sourceRenderCard.colorMod);
6029 }
6030 }
6031 else if (sourceRenderCard.useRandomColor)
6032 {
6033 _colorInt = BaseTileMap.GetColorInt(ref GetRandomColor(), sourceRenderCard.colorMod);
6034 }
6035 else if (sourceRenderCard.useAltColor)
6036 {
6037 _colorInt = BaseTileMap.GetColorInt(ref material.altColor, sourceRenderCard.colorMod);
6038 }
6039 else
6040 {
6041 _colorInt = BaseTileMap.GetColorInt(ref material.matColor, sourceRenderCard.colorMod);
6042 }
6043 }
6044
6046 {
6047 int num = EClass.game.seed + refVal;
6048 num += id[0] % 10000;
6049 if (id.Length > 1)
6050 {
6051 num += id[1] % 1000;
6052 if (id.Length > 2)
6053 {
6054 num += id[2] % 1000;
6055 if (id.Length > 3)
6056 {
6057 num += id[3] % 1000;
6058 if (id.Length > 4)
6059 {
6060 num += id[4] % 1000;
6061 }
6062 }
6063 }
6064 }
6065 Rand.UseSeed(num, delegate
6066 {
6067 _randColor = EClass.sources.materials.rows[EClass.rnd(90)].matColor;
6068 });
6069 return ref _randColor;
6070 }
6071
6072 public virtual Sprite GetSprite(int dir = 0)
6073 {
6074 if (trait is TraitAbility)
6075 {
6076 return (trait as TraitAbility).CreateAct()?.GetSprite() ?? EClass.core.refs.icons.defaultAbility;
6077 }
6078 return sourceCard.GetSprite(dir, trait.IdSkin, (IsInstalled && pos != null && pos.IsValid && pos.cell.IsSnowTile) ? true : false);
6079 }
6080
6081 public virtual Sprite GetImageSprite()
6082 {
6083 return null;
6084 }
6085
6086 public void SetImage(Image image, int dir, int idSkin = 0)
6087 {
6088 sourceRenderCard.SetImage(image, GetSprite(dir), colorInt, setNativeSize: true, dir, idSkin, this);
6089 }
6090
6091 public virtual void SetImage(Image image)
6092 {
6093 if (trait is TraitAbility)
6094 {
6095 (trait as TraitAbility).act.SetImage(image);
6096 return;
6097 }
6098 Sprite sprite = GetSprite();
6099 if (!c_idSpriteReplacer.IsEmpty())
6100 {
6101 SpriteReplacer spriteReplacer = SpriteReplacer.dictSkins.TryGetValue(c_idSpriteReplacer);
6102 if (spriteReplacer != null)
6103 {
6104 RenderData renderData = ResourceCache.Load<RenderData>("Scene/Render/Data/chara_custom_" + ((spriteReplacer.data.GetSprite().texture.height <= 128) ? "128" : "256"));
6105 sprite = spriteReplacer.data.GetSprite();
6106 sourceRenderCard.SetImage(image, sprite, colorInt, setNativeSize: true, 0, 0, renderData, spriteReplacer.data.pref ?? Pref);
6107 return;
6108 }
6109 }
6110 sourceRenderCard.SetImage(image, sprite, colorInt, setNativeSize: true, 0, 0, this);
6111 }
6112
6113 public void ShowEmo(Emo _emo = Emo.none, float duration = 0f, bool skipSame = true)
6114 {
6115 if ((!isChara || Chara.host == null) && !(_emo == lastEmo && skipSame))
6116 {
6117 if (_emo != 0)
6118 {
6119 renderer.ShowEmo(_emo, duration);
6120 }
6121 lastEmo = _emo;
6122 }
6123 }
6124
6125 public void PlaySoundHold(bool spatial = true)
6126 {
6127 PlaySound(material.GetSoundDrop(sourceCard), 1f, spatial);
6128 }
6129
6130 public void PlaySoundDrop(bool spatial = true)
6131 {
6132 PlaySound(material.GetSoundDrop(sourceCard), 1f, spatial);
6133 }
6134
6135 public void PlaySoundImpact(bool spatial = true)
6136 {
6137 PlaySound(material.GetSoundImpact(sourceCard), 1f, spatial);
6138 }
6139
6140 public void PlaySoundDead(bool spatial = true)
6141 {
6142 PlaySound(material.GetSoundDead(sourceCard), 1f, spatial);
6143 }
6144
6145 public SoundSource PlaySound(string id, float v = 1f, bool spatial = true)
6146 {
6147 Card rootCard = GetRootCard();
6148 if (rootCard.IsPC)
6149 {
6150 spatial = false;
6151 }
6152 if (rootCard.Dist(EClass.pc) < EClass.player.lightRadius + 1 || !spatial)
6153 {
6154 return rootCard.pos.PlaySound(id, isSynced || !spatial, v, spatial);
6155 }
6156 return null;
6157 }
6158
6159 public void KillAnime()
6160 {
6161 renderer.KillAnime();
6162 }
6163
6164 public void PlayAnime(AnimeID id, bool force = false)
6165 {
6166 renderer.PlayAnime(id, force);
6167 }
6168
6169 public void PlayAnime(AnimeID id, Point dest, bool force = false)
6170 {
6171 renderer.PlayAnime(id, dest);
6172 }
6173
6174 public void PlayAnimeLoot()
6175 {
6176 renderer.PlayAnime(AnimeID.Loot);
6177 }
6178
6179 public Effect PlayEffect(string id, bool useRenderPos = true, float range = 0f, Vector3 fix = default(Vector3))
6180 {
6181 if (id.IsEmpty())
6182 {
6183 return null;
6184 }
6185 Card rootCard = GetRootCard();
6186 return Effect.Get(id)._Play(rootCard.pos, fix + ((isSynced && useRenderPos) ? rootCard.renderer.position : rootCard.pos.Position()) + new Vector3(Rand.Range(0f - range, range), Rand.Range(0f - range, range), 0f));
6187 }
6188
6189 public void PlayEffect(int ele, bool useRenderPos = true, float range = 0f)
6190 {
6191 Effect effect = Effect.Get("Element/" + EClass.sources.elements.map[ele].alias);
6192 if (effect == null)
6193 {
6194 Debug.Log(ele);
6195 return;
6196 }
6197 Card rootCard = GetRootCard();
6198 effect._Play(rootCard.pos, ((isSynced && useRenderPos) ? rootCard.renderer.position : rootCard.pos.Position()) + new Vector3(Rand.Range(0f - range, range), Rand.Range(0f - range, range), 0f));
6199 }
6200
6201 public virtual void SetDir(int d)
6202 {
6203 dir = d;
6204 renderer.RefreshSprite();
6205 }
6206
6207 public void SetRandomDir()
6208 {
6209 SetDir(EClass.rnd(4));
6210 }
6211
6212 public virtual void LookAt(Card c)
6213 {
6214 }
6215
6216 public virtual void LookAt(Point p)
6217 {
6218 }
6219
6220 public virtual void Rotate(bool reverse = false)
6221 {
6222 int num = 4;
6223 if (sourceCard.tiles.Length > 4)
6224 {
6225 num = sourceCard.tiles.Length;
6226 }
6227 if (TileType == TileType.Door)
6228 {
6229 num = 2;
6230 }
6231 if (reverse)
6232 {
6233 dir--;
6234 }
6235 else
6236 {
6237 dir++;
6238 }
6239 if (dir < 0)
6240 {
6241 dir = num - 1;
6242 }
6243 if (dir == num)
6244 {
6245 dir = 0;
6246 }
6247 SetDir(dir);
6248 renderer.RefreshSprite();
6249 }
6250
6251 public void ChangeAltitude(int a)
6252 {
6253 altitude += a;
6254 if (altitude < 0)
6255 {
6256 altitude = 0;
6257 }
6258 if (altitude > TileType.MaxAltitude)
6259 {
6260 altitude = TileType.MaxAltitude;
6261 }
6262 }
6263
6265 {
6266 return SubPassData.Default;
6267 }
6268
6269 public void SetFreePos(Point point)
6270 {
6271 freePos = EClass.game.config.FreePos && isThing && TileType.FreeStyle && !sourceCard.multisize && !EClass.scene.actionMode.IsRoofEditMode(this);
6272 if (freePos)
6273 {
6274 Vector3 vector = point.Position();
6275 Vector3 thingPosition = EClass.screen.tileMap.GetThingPosition(this, point);
6276 fx = EInput.mposWorld.x + EClass.setting.render.freePosFix.x;
6277 fy = EInput.mposWorld.y + EClass.setting.render.freePosFix.y;
6279 {
6280 fx -= fx % 0.2f;
6281 fy -= fy % 0.1f;
6282 }
6283 fx = fx - vector.x + thingPosition.x;
6284 fy = fy - vector.y + thingPosition.y;
6285 }
6286 else
6287 {
6288 float num2 = (fy = 0f);
6289 fx = num2;
6290 }
6291 }
6292
6293 public void RenderMarker(Point point, bool active, HitResult result, bool main, int dir, bool useCurrentPosition = false)
6294 {
6295 if (dir != -1)
6296 {
6297 this.dir = dir;
6298 }
6299 Vector3 v = point.Position();
6300 bool skipRender = point.cell.skipRender;
6301 if (result != 0 && EClass.screen.guide.isActive && !skipRender)
6302 {
6303 EClass.screen.guide.passGuideBlock.Add(ref v, (point.HasObj || point.HasChara) ? 5 : 0);
6304 }
6305 if (!main)
6306 {
6307 return;
6308 }
6309 RenderParam renderParam = GetRenderParam();
6311 {
6312 renderParam.x = v.x;
6313 renderParam.y = v.y;
6314 renderParam.z = v.z;
6315 EClass.screen.tileMap.SetRoofHeight(renderParam, point.cell, point.x, point.z);
6316 v.x = renderParam.x;
6317 v.y = renderParam.y;
6318 v.z = renderParam.z;
6319 }
6321 {
6322 TileType.GetMountHeight(ref v, point, this.dir, this);
6323 }
6324 v.z += EClass.setting.render.thingZ;
6325 if (!skipRender)
6326 {
6327 Vector3 thingPosition = EClass.screen.tileMap.GetThingPosition(this, point);
6328 if (freePos)
6329 {
6330 v.x += fx;
6331 v.y += fy;
6332 v.z += thingPosition.z;
6333 }
6334 else
6335 {
6336 v += thingPosition;
6337 }
6338 }
6339 if (useCurrentPosition)
6340 {
6341 v = renderer.position;
6342 v.z += -0.01f;
6343 }
6344 if (TileType == TileType.Door)
6345 {
6346 v.z -= 0.5f;
6347 }
6348 renderParam.matColor = (active ? EClass.Colors.blockColors.Active : EClass.Colors.blockColors.Inactive);
6349 point.ApplyAnime(ref v);
6350 if (renderer.hasActor)
6351 {
6352 renderer.actor.RefreshSprite();
6353 }
6354 renderer.Draw(renderParam, ref v, drawShadow: false);
6355 }
6356
6357 public void RecalculateFOV()
6358 {
6359 if (fov != null)
6360 {
6361 ClearFOV();
6362 fov = null;
6363 if (IsPC)
6364 {
6365 EClass.player.lightRadius = 1;
6366 }
6367 }
6368 CalculateFOV();
6369 }
6370
6371 public bool HasLight()
6372 {
6373 return GetLightRadius() > 0;
6374 }
6375
6376 public float GetLightPower()
6377 {
6378 float num = (isChara ? EClass.scene.profile.light.fovCurveChara.Evaluate(EClass.scene.timeRatio) : EClass.scene.profile.global.fovPower);
6379 if (LightData != null)
6380 {
6381 return 0.01f * LightData.color.a * 256f * 1.12f;
6382 }
6383 if (IsPCFaction && !IsPC)
6384 {
6385 num *= 4f;
6386 }
6387 return num;
6388 }
6389
6390 public int GetHearingRadius()
6391 {
6392 return 8;
6393 }
6394
6395 public int GetSightRadius()
6396 {
6397 if (IsPC)
6398 {
6399 return EClass.player.lightRadius;
6400 }
6401 return (EClass._map.IsIndoor ? 4 : 5) + (IsPCFaction ? 1 : 0);
6402 }
6403
6404 public int GetLightRadius()
6405 {
6406 if (isThing)
6407 {
6408 if (!IsInstalled && EClass.pc.held != this)
6409 {
6410 return 0;
6411 }
6412 if (trait is TraitLightSource && Thing.isEquipped)
6413 {
6414 return (trait as TraitLightSource).LightRadius;
6415 }
6416 if (LightData == null || !trait.IsLightOn)
6417 {
6418 return 0;
6419 }
6420 return LightData.radius;
6421 }
6422 int num = ((LightData != null) ? LightData.radius : 0);
6423 int num2 = 0;
6424 if (IsPC)
6425 {
6426 if (Chara.isBlind)
6427 {
6428 return 1;
6429 }
6430 num = ((EClass._map.IsIndoor || EClass.world.date.IsNight) ? 2 : ((EClass.world.date.periodOfDay == PeriodOfDay.Day) ? 6 : 5));
6431 num2 = 2;
6432 }
6433 else
6434 {
6436 {
6437 return 0;
6438 }
6439 if (LightData == null && !EClass._map.IsIndoor && !EClass.world.date.IsNight)
6440 {
6441 return 0;
6442 }
6443 }
6444 if (IsPCFaction)
6445 {
6446 Thing equippedThing = Chara.body.GetEquippedThing(45);
6447 if (equippedThing != null && equippedThing.trait is TraitLightSource traitLightSource)
6448 {
6449 num2 = traitLightSource.LightRadius;
6450 }
6451 if (Chara.held != null && IsPC)
6452 {
6453 int lightRadius = Chara.held.GetLightRadius();
6454 if (lightRadius > 0)
6455 {
6456 if (lightRadius > num2)
6457 {
6458 num2 = Chara.held.GetLightRadius() - 1;
6459 }
6460 if (num2 < 3)
6461 {
6462 num2 = 3;
6463 }
6464 }
6465 }
6466 if (num < num2)
6467 {
6468 num = num2;
6469 }
6470 }
6471 return num;
6472 }
6473
6474 public void CalculateFOV()
6475 {
6476 int radius = GetLightRadius();
6477 if (radius == 0 || !IsAliveInCurrentZone || !EClass._zone.isStarted)
6478 {
6479 return;
6480 }
6481 float power = GetLightPower();
6482 if (IsPC)
6483 {
6484 if (Chara.held != null && Chara.held.GetLightRadius() > 0)
6485 {
6486 power += Chara.held.GetLightPower();
6487 }
6488 if (radius <= 2)
6489 {
6490 power = 0f;
6491 }
6492 foreach (Condition condition in Chara.conditions)
6493 {
6494 condition.OnCalculateFov(fov, ref radius, ref power);
6495 }
6496 if (power > EClass.scene.profile.global.playerLightPowerLimit)
6497 {
6498 power = EClass.scene.profile.global.playerLightPowerLimit;
6499 }
6500 power *= EClass.scene.profile.light.playerLightMod + (float)EClass.player.customLightMod * EClass.scene.profile.light.playerLightCustomMod;
6501 EClass.player.lightRadius = radius;
6502 EClass.player.lightPower = power;
6503 }
6504 if (fov == null)
6505 {
6506 fov = CreateFov();
6507 }
6508 fov.Perform(pos.x, pos.z, radius, power * 2f);
6509 }
6510
6512 {
6513 c_lightColor = (byte)(EClass.rnd(8) + 1) * 1024 + (byte)(EClass.rnd(8) + 1) * 32 + (byte)(EClass.rnd(8) + 1);
6514 }
6515
6517 {
6518 Fov fov = new Fov();
6519 int num = (trait.UseLightColor ? c_lightColor : 0);
6520 if (num != 0)
6521 {
6522 fov.r = (byte)(num / 1024);
6523 fov.g = (byte)(num % 1024 / 32);
6524 fov.b = (byte)(num % 32);
6525 }
6526 else if (LightData != null)
6527 {
6528 fov.r = (byte)(LightData.color.r * 16f);
6529 fov.g = (byte)(LightData.color.g * 16f);
6530 fov.b = (byte)(LightData.color.b * 16f);
6531 }
6532 else if (isChara)
6533 {
6534 fov.r = 0;
6535 fov.g = 0;
6536 fov.b = 0;
6537 }
6538 else
6539 {
6540 fov.r = 3;
6541 fov.g = 2;
6542 fov.b = 1;
6543 }
6544 if (isChara && Chara.held != null && Chara.held.GetLightRadius() > 0)
6545 {
6546 Fov fov2 = Chara.held.CreateFov();
6547 fov.r += fov2.r;
6548 fov.g += fov2.g;
6549 fov.b += fov2.b;
6550 }
6551 if (IsPC)
6552 {
6553 fov.isPC = true;
6554 foreach (Condition condition in Chara.conditions)
6555 {
6556 condition.OnCreateFov(fov);
6557 }
6558 }
6559 fov.limitGradient = IsPCParty && EClass.scene.profile.global.limitGradient;
6560 return fov;
6561 }
6562
6563 public void ClearFOV()
6564 {
6565 if (fov != null && fov.lastPoints.Count != 0)
6566 {
6567 fov.Perform(pos.x, pos.z, 0);
6568 }
6569 }
6570
6571 public virtual void OnSimulateHour(VirtualDate date)
6572 {
6573 trait.OnSimulateHour(date);
6574 if (date.IsRealTime)
6575 {
6576 DecayNatural();
6577 }
6578 }
6579
6580 public void DecayNatural(int hour = 1)
6581 {
6582 if (!isNPCProperty)
6583 {
6584 things.ForeachReverse(delegate(Thing t)
6585 {
6586 t.DecayNatural(hour);
6587 });
6588 if (sourceCard._origin == "dish")
6589 {
6590 CheckJustCooked();
6591 }
6592 if (parent is Card && (parent as Card).trait.CanChildDecay(this))
6593 {
6594 Decay(10 * hour);
6595 }
6596 else if (!isChara && trait.Decay != 0)
6597 {
6598 Decay(trait.Decay * hour);
6599 }
6600 }
6601 }
6602
6603 public void CheckJustCooked()
6604 {
6605 if (HasElement(757) && c_dateCooked <= EClass.world.date.GetRaw() - 120)
6606 {
6607 c_dateCooked = 0;
6608 elements.Remove(757);
6609 }
6610 }
6611
6612 public void Decay(int a = 10)
6613 {
6614 Card card = parent as Card;
6615 int num = 200;
6616 int num2 = MaxDecay / 4 * 3;
6617 if (a > 0)
6618 {
6619 if (card != null)
6620 {
6621 num = card.trait.DecaySpeedChild;
6622 }
6623 num = num * trait.DecaySpeed / 100;
6624 int num3 = Evalue(405);
6625 if (num3 != 0)
6626 {
6627 num = num * (100 - num3 * 2) / 100;
6628 }
6629 if (num < 0)
6630 {
6631 num = 0;
6632 }
6633 }
6634 else
6635 {
6636 num = 100;
6637 }
6638 a = a * num / 100;
6639 if (decay + a > MaxDecay)
6640 {
6641 if (card != null && !card.trait.OnChildDecay(this, !IsDecayed))
6642 {
6643 return;
6644 }
6645 if (!IsDecayed)
6646 {
6647 if (EClass.pc.HasElement(1325) && GetRootCard() is Chara && category.IsChildOf("food"))
6648 {
6649 Thing thing = TraitSeed.MakeRandomSeed(enc: true).SetNum(Mathf.Min(Num, 3));
6650 card.AddCard(thing);
6651 if (!IsParentLocked())
6652 {
6653 GetRootCard().Say("seed_rot", GetRootCard(), this, thing.Name);
6654 }
6655 Destroy();
6656 return;
6657 }
6658 if (parent == EClass._zone)
6659 {
6660 Say("rot", this);
6661 }
6662 else if (GetRootCard() == EClass.pc)
6663 {
6664 if (!IsParentLocked())
6665 {
6666 EClass.pc.Say("rotInv", this, EClass.pc);
6667 }
6669 }
6670 if (IsFood)
6671 {
6672 elements.ModBase(73, -10);
6673 }
6674 }
6675 }
6676 else if (decay < num2 && decay + a >= num2 && GetRootCard() == EClass.pc)
6677 {
6678 if (!IsParentLocked())
6679 {
6680 EClass.pc.Say("rottingInv", this, EClass.pc);
6681 }
6683 }
6684 decay += a;
6685 bool IsParentLocked()
6686 {
6687 if (parent is Thing)
6688 {
6689 return (parent as Thing).c_lockLv > 0;
6690 }
6691 return false;
6692 }
6693 }
6694
6695 public bool HasTalk(string idTopic)
6696 {
6697 return !MOD.listTalk.GetTalk(c_idTalk.IsEmpty(id), idTopic, useDefault: true).IsEmpty();
6698 }
6699
6700 public void Talk(string idTopic, string ref1 = null, string ref2 = null, bool forceSync = false)
6701 {
6702 if (IsPC && !EClass.player.forceTalk && idTopic != "goodBoy" && idTopic != "insane")
6703 {
6704 EClass.player.forceTalk = false;
6705 Msg.SetColor();
6706 return;
6707 }
6708 EClass.player.forceTalk = false;
6709 if (!isSynced && !forceSync)
6710 {
6711 Msg.SetColor();
6712 return;
6713 }
6714 GameLang.refDrama1 = ref1;
6715 GameLang.refDrama2 = ref2;
6716 string text = GetTalkText(idTopic, stripPun: true);
6717 if (HasElement(1232) && idTopic != "baby")
6718 {
6719 BackerContent.GakiConvert(ref text, "babu");
6720 }
6721 else
6722 {
6723 string text2 = id;
6724 if (!(text2 == "adv_gaki"))
6725 {
6726 if (text2 == "corgon")
6727 {
6728 BackerContent.GakiConvert(ref text, "mokyu");
6729 }
6730 }
6731 else
6732 {
6733 BackerContent.GakiConvert(ref text);
6734 }
6735 }
6736 TalkRaw(text, ref1, ref2, forceSync);
6737 }
6738
6739 public void TalkRaw(string text, string ref1 = null, string ref2 = null, bool forceSync = false)
6740 {
6741 if ((!isSynced && !forceSync) || text.IsEmpty())
6742 {
6743 Msg.SetColor();
6744 return;
6745 }
6746 if (ref1 != null)
6747 {
6748 text = text.Replace("#1", ref1);
6749 }
6750 if (ref2 != null)
6751 {
6752 text = text.Replace("#2", ref2);
6753 }
6754 HostRenderer.Say(ApplyNewLine(text));
6755 bool flag = text.StartsWith("*");
6756 Msg.SetColor(text.StartsWith("(") ? Msg.colors.Thinking : (flag ? Msg.colors.Ono : Msg.colors.Talk));
6757 if (!flag)
6758 {
6759 text = text.Bracket();
6760 }
6761 Msg.Say(text.Replace("&", ""));
6762 }
6763
6764 public string ApplyNewLine(string text)
6765 {
6766 if (text.Contains("&"))
6767 {
6768 string text2 = "_comma".lang();
6769 text = text.Replace(text2 + " &", Environment.NewLine ?? "");
6770 text = text.Replace(text2 + "&", Environment.NewLine ?? "");
6771 text = text.Replace("&", Environment.NewLine ?? "");
6772 }
6773 return text;
6774 }
6775
6776 public void SayRaw(string text, string ref1 = null, string ref2 = null)
6777 {
6778 if (isSynced && !text.IsEmpty())
6779 {
6780 if (ref1 != null)
6781 {
6782 text = text.Replace("#1", ref1);
6783 }
6784 if (ref2 != null)
6785 {
6786 text = text.Replace("#2", ref2);
6787 }
6788 HostRenderer.Say(text);
6789 }
6790 }
6791
6792 public void SayNothingHappans()
6793 {
6794 Say("nothingHappens");
6795 }
6796
6797 public void Say(string lang, string ref1 = null, string ref2 = null)
6798 {
6799 if (ShouldShowMsg)
6800 {
6801 Msg.Say(IsPC ? Lang.Game.TryGetId(lang + "_pc", lang) : lang, ref1, ref2);
6802 }
6803 Msg.SetColor();
6804 }
6805
6806 public void Say(string lang, Card c1, Card c2, string ref1 = null, string ref2 = null)
6807 {
6808 if (ShouldShowMsg)
6809 {
6810 Msg.Say(IsPC ? Lang.Game.TryGetId(lang + "_pc", lang) : lang, c1, c2, ref1, ref2);
6811 }
6812 Msg.SetColor();
6813 }
6814
6815 public void Say(string lang, Card c1, string ref1 = null, string ref2 = null)
6816 {
6817 if (ShouldShowMsg)
6818 {
6819 Msg.Say(IsPC ? Lang.Game.TryGetId(lang + "_pc", lang) : lang, c1, ref1, ref2);
6820 }
6821 Msg.SetColor();
6822 }
6823
6824 public string GetTalkText(string idTopic, bool stripPun = false, bool useDefault = true)
6825 {
6826 bool flag = isChara && Chara.IsHumanSpeak;
6827 string text = MOD.listTalk.GetTalk(c_idTalk.IsEmpty(id), idTopic, useDefault, flag);
6828 if (!text.IsEmpty())
6829 {
6830 text = text.Split('|').RandomItem();
6831 if (!flag || (IsDeadOrSleeping && IsAliveInCurrentZone))
6832 {
6833 if (!text.StartsWith("(") && !text.StartsWith("*"))
6834 {
6835 text = "(" + text + ")";
6836 }
6837 text = text.Replace("。)", ")");
6838 }
6839 }
6840 return ApplyTone(text, stripPun);
6841 }
6842
6843 public string ApplyTone(string text, bool stripPun = false)
6844 {
6845 text = GameLang.ConvertDrama(text, Chara);
6846 return ApplyTone(Chara, ref text, c_idTone, bio?.gender ?? 0, stripPun);
6847 }
6848
6849 public static string ApplyTone(Chara c, ref string text, string _tones, int gender, bool stripPun = false)
6850 {
6851 if (text.IsEmpty())
6852 {
6853 return text;
6854 }
6855 string[] array = _tones.IsEmpty("").Split('|');
6856 string key = array[0];
6857 string text2 = "";
6859 if (!Lang.setting.useTone || MOD.tones.list.Count == 0)
6860 {
6861 text2 = text.Replace("{", "").Replace("}", "");
6862 }
6863 else
6864 {
6865 if (array[0].IsEmpty())
6866 {
6867 key = "default";
6868 }
6869 if (MOD.tones.all.ContainsKey(key))
6870 {
6871 StringBuilder stringBuilder = MOD.tones.ApplyTone(key, ref text, gender);
6872 if (Lang.isJP && c != null)
6873 {
6874 if (array.Length >= 2)
6875 {
6876 stringBuilder.Replace("_toneI".lang(), array[1]);
6877 }
6878 if (array.Length >= 3)
6879 {
6880 stringBuilder.Replace("_toneYou".lang(), array[2]);
6881 }
6882 }
6883 text2 = stringBuilder.ToString();
6884 }
6885 else
6886 {
6887 text2 = text.Replace("{", "").Replace("}", "");
6888 }
6889 }
6890 if (c != null)
6891 {
6892 text2 = text2.Replace("#me", c.NameSimple);
6893 }
6894 if (!stripPun || !Lang.setting.stripPuns)
6895 {
6896 return text2;
6897 }
6898 return text2.StripLastPun();
6899 }
6900
6901 public void SetRandomTalk()
6902 {
6904 if (!MOD.listTalk.list[0].ContainsKey(id))
6905 {
6906 c_idTalk = MOD.listTalk.GetRandomID("human");
6907 }
6908 }
6909
6910 public void SetRandomTone()
6911 {
6913 List<Dictionary<string, string>> list = MOD.tones.list;
6914 if (list.Count != 0)
6915 {
6916 int mtp = EClass.core.config.test.extraToneMTP switch
6917 {
6918 4 => 10,
6919 3 => 5,
6920 2 => 2,
6921 1 => 1,
6922 0 => 0,
6923 _ => 0,
6924 };
6925 if (EClass.debug.enable)
6926 {
6927 mtp *= 100;
6928 }
6929 string text = list.RandomItem()["id"];
6930 text = list.RandomItemWeighted((Dictionary<string, string> a) => a["chance"].ToInt() * ((!a["tag"].Contains("meta")) ? 1 : mtp))["id"];
6931 c_idTone = MOD.tones.GetToneID(text, bio?.gender ?? 0);
6932 }
6933 }
6934
6936 {
6937 return ListCraftBonusTraits().Count > 0;
6938 }
6939
6940 public List<Element> ListCraftBonusTraits()
6941 {
6942 List<Element> list = new List<Element>();
6943 string[] tag = sourceCard.tag;
6944 for (int i = 0; i < tag.Length; i++)
6945 {
6946 string[] array = tag[i].Split('/');
6947 if (!(array[0] != "craft_bonus"))
6948 {
6949 Element item = Element.Create(array[1], array[2].ToInt());
6950 list.Add(item);
6951 }
6952 }
6953 return list;
6954 }
6955
6956 public void TryStack(Thing t)
6957 {
6958 if (t == this)
6959 {
6960 return;
6961 }
6962 ThingContainer.DestData dest = things.GetDest(t);
6963 if (dest.stack != null)
6964 {
6965 if (IsPC)
6966 {
6967 Say("stack_thing", t, dest.stack);
6968 }
6969 t.TryStackTo(dest.stack);
6970 }
6971 }
6972
6973 public void ApplyBacker(int bid)
6974 {
6975 ChangeRarity(Rarity.Normal);
6976 SourceBacker.Row row = EClass.sources.backers.map.TryGetValue(bid);
6977 if (row == null)
6978 {
6979 return;
6980 }
6981 c_idBacker = row.id;
6982 if (row.type == 4)
6983 {
6985 Chara chara = Chara;
6986 Hostility hostility2 = (Chara.c_originalHostility = Hostility.Neutral);
6987 chara.hostility = hostility2;
6988 }
6989 if (row.type == 6)
6990 {
6993 Chara.idFaith = row.deity.ToLowerInvariant();
6994 }
6995 if (row.type == 4 || row.type == 5 || row.type == 7)
6996 {
6997 idSkin = ((row.skin == 0) ? EClass.rnd(sourceCard._tiles.Length) : row.skin);
6998 if (id == "putty_snow")
6999 {
7000 idSkin = 0;
7001 }
7002 }
7003 if (bid == 164)
7004 {
7005 Chara.EQ_ID("amulet_moonnight");
7006 }
7007 }
7008
7009 public void RemoveBacker()
7010 {
7011 if (c_idBacker == 164)
7012 {
7013 Chara.things.Find("amulet_moonnight")?.Destroy();
7014 }
7015 c_idBacker = 0;
7016 }
7017
7018 public void SetPaintData()
7019 {
7020 EClass.ui.Hide(0f);
7022 {
7023 ClearPaintSprite();
7024 c_textureData = GetPaintData();
7026 {
7027 EClass.ui.Show(0f);
7028 });
7029 });
7030 }
7031
7032 public byte[] GetPaintData()
7033 {
7034 Sprite sprite = GetSprite();
7035 Texture2D texture2D = ScreenCapture.CaptureScreenshotAsTexture();
7036 int num = sprite.texture.width * 2;
7037 int num2 = sprite.texture.height * 2;
7038 int x = (int)Mathf.Clamp(Input.mousePosition.x - (float)(num / 2), 1f, texture2D.width - num - 1);
7039 int y = (int)Mathf.Clamp(Input.mousePosition.y - (float)(num2 / 2), 1f, texture2D.height - num2 - 1);
7040 Color[] pixels = texture2D.GetPixels(x, y, num, num2);
7041 Texture2D texture2D2 = new Texture2D(num, num2, TextureFormat.ARGB32, mipChain: false);
7042 texture2D2.SetPixels(pixels);
7043 texture2D2.Apply();
7044 byte[] result = texture2D2.EncodeToJPG();
7045 UnityEngine.Object.Destroy(texture2D);
7046 UnityEngine.Object.Destroy(texture2D2);
7047 return result;
7048 }
7049
7050 public void ClearPaintSprite()
7051 {
7052 if ((bool)_paintSprite)
7053 {
7054 UnityEngine.Object.Destroy(_paintSprite.texture);
7055 UnityEngine.Object.Destroy(_paintSprite);
7056 _paintSprite = null;
7057 }
7058 }
7059
7060 public Sprite GetPaintSprite()
7061 {
7062 if (!_paintSprite)
7063 {
7064 byte[] data = c_textureData;
7065 Texture2D texture2D = new Texture2D(1, 1);
7066 texture2D.LoadImage(data);
7067 _paintSprite = Sprite.Create(texture2D, new Rect(0f, 0f, texture2D.width, texture2D.height), new Vector2(0.5f, 0.5f), 200f);
7068 EClass.game.loadedTextures.Add(texture2D);
7069 if (trait is TraitCanvas traitCanvas)
7070 {
7071 texture2D.filterMode = ((!traitCanvas.PointFilter) ? FilterMode.Bilinear : FilterMode.Point);
7072 }
7073 }
7074 return _paintSprite;
7075 }
7076
7077 public void TryUnrestrain(bool force = false, Chara c = null)
7078 {
7079 if (!(GetRestrainer() == null || force))
7080 {
7081 return;
7082 }
7083 isRestrained = false;
7084 Say("unrestrained", this);
7085 if (this != c)
7086 {
7087 Talk("thanks");
7088 }
7089 MoveImmediate(pos.GetNearestPoint());
7090 renderer.SetFirst(first: true);
7091 if (c == null)
7092 {
7093 return;
7094 }
7095 if (c_rescueState == RescueState.WaitingForRescue)
7096 {
7097 c_rescueState = RescueState.Rescued;
7098 if (c.IsPC)
7099 {
7101 }
7102 }
7104 {
7105 return;
7106 }
7107 foreach (Chara item in c.pos.ListCharasInRadius(c, 5, (Chara _c) => _c.id == "fanatic" && _c.faith != Chara.faith))
7108 {
7109 c.DoHostileAction(item, immediate: true);
7110 }
7111 }
7112
7114 {
7115 foreach (Card item in pos.ListCards())
7116 {
7117 if (item.trait is TraitShackle && item.c_uidRefCard == uid)
7118 {
7119 return item.trait as TraitShackle;
7120 }
7121 }
7122 return null;
7123 }
7124
7125 public virtual void Tick()
7126 {
7127 }
7128
7129 public static int GetTilePrice(TileRow row, SourceMaterial.Row mat)
7130 {
7131 int result = 0;
7132 if (row.id == 0)
7133 {
7134 return result;
7135 }
7136 result = row.value * mat.value / 100;
7137 if (result < 0)
7138 {
7139 result = 1;
7140 }
7141 return result;
7142 }
7143
7144 public Thing SetPriceFix(int a)
7145 {
7146 c_priceFix = a;
7147 return Thing;
7148 }
7149
7150 public int GetEquipValue()
7151 {
7152 return GetValue();
7153 }
7154
7155 public void SetSale(bool sale)
7156 {
7157 if (isSale != sale)
7158 {
7159 isSale = sale;
7160 if (isSale)
7161 {
7162 EClass._map.props.sales.Add(this);
7163 }
7164 else
7165 {
7166 EClass._map.props.sales.Remove(this);
7167 }
7168 }
7169 }
7170
7171 public int GetValue(PriceType priceType = PriceType.Default, bool sell = false)
7172 {
7173 int num = ((c_fixedValue == 0) ? trait.GetValue() : c_fixedValue);
7174 if (id == "plat" && !sell)
7175 {
7176 num = 10000;
7177 }
7178 if (num == 0)
7179 {
7180 return 0;
7181 }
7182 float num2 = num;
7183 if (priceType == PriceType.CopyShop)
7184 {
7185 num2 += (float)c_priceCopy * 0.2f;
7186 num2 = num2 * (float)Mathf.Max(150 + rarityLv, 150) / 100f;
7187 }
7188 else
7189 {
7190 num2 = num2 * (float)Mathf.Max(100 + rarityLv + Mathf.Min(QualityLv * 10, 200), 80) / 100f;
7191 }
7192 if (IsFood && !material.tag.Contains("food"))
7193 {
7194 num2 *= 0.5f;
7195 }
7196 float num3;
7197 if (IsEquipmentOrRangedOrAmmo || trait is TraitMod)
7198 {
7199 if (sell)
7200 {
7201 num2 *= 0.3f;
7202 }
7203 num3 = 2f;
7204 }
7205 else
7206 {
7207 num3 = 0.5f;
7208 }
7209 if (isReplica)
7210 {
7211 num2 *= 0.15f;
7212 }
7213 if (!IsUnique)
7214 {
7215 if (IsEquipmentOrRanged && rarity >= Rarity.Legendary)
7216 {
7217 num2 = Mathf.Max(num2, 1800f + num2 / 5f);
7218 }
7219 num2 = num2 * (100f + num3 * (float)(material.value - 100)) / 100f;
7220 if (IsEquipmentOrRanged)
7221 {
7222 int num4 = 0;
7223 foreach (Element value in elements.dict.Values)
7224 {
7225 num4 += value.source.value;
7226 }
7227 num2 = num2 * (float)(100 + (sell ? ((int)MathF.Sqrt(num4) * 10) : num4)) / 100f;
7228 if (rarity >= Rarity.Legendary)
7229 {
7230 num2 = Mathf.Max(num2, 3600f + num2 / 5f);
7231 }
7232 }
7233 }
7234 if (trait is TraitRecipe && sell)
7235 {
7236 num2 *= 0.1f;
7237 }
7238 if (encLV != 0 && !category.tag.Contains("noEnc"))
7239 {
7240 num2 = (category.tag.Contains("enc") ? (num2 * (0.7f + (float)(encLV - 1) * 0.2f)) : ((!IsFood) ? (num2 * (1f + (float)encLV * 0.01f)) : ((!(id == "honey")) ? (num2 * Mathf.Min(1f + 0.1f * (float)encLV, 2f) + (float)(encLV * 100)) : (num2 + (float)(encLV * 10)))));
7241 }
7242 if (tier > 0)
7243 {
7244 num2 *= (float)(tier + 1);
7245 }
7246 return (int)num2;
7247 }
7248
7249 public virtual int GetPrice(CurrencyType currency = CurrencyType.Money, bool sell = false, PriceType priceType = PriceType.Default, Chara c = null)
7250 {
7251 if (priceType == PriceType.CopyShop && sell)
7252 {
7253 return 0;
7254 }
7255 if (!sell)
7256 {
7257 if (id == "littleball")
7258 {
7259 return 0;
7260 }
7261 switch (currency)
7262 {
7263 case CurrencyType.Money:
7264 if (id == "crimale2")
7265 {
7266 return 6480;
7267 }
7268 break;
7269 case CurrencyType.Influence:
7270 switch (id)
7271 {
7272 case "ticket_fortune":
7273 return 5;
7274 case "medal":
7275 return 5;
7276 case "lunch_love":
7277 return 20;
7278 }
7279 break;
7280 case CurrencyType.Ecopo:
7281 switch (id)
7282 {
7283 case "plat":
7284 return 500;
7285 case "rune_free":
7286 return 1000;
7287 case "whip_egg":
7288 return 3000;
7289 case "brush_strip":
7290 return 2500;
7291 case "hammer_strip":
7292 return 5000;
7293 case "helm_chef":
7294 return 25000;
7295 }
7296 break;
7297 case CurrencyType.Plat:
7298 switch (id)
7299 {
7300 case "lucky_coin":
7301 return 100;
7302 case "book_exp":
7303 return 200;
7304 case "book_skill":
7305 return 50;
7306 }
7307 break;
7308 case CurrencyType.Medal:
7309 switch (id)
7310 {
7311 case "1282":
7312 return 5;
7313 case "bill_tax":
7314 return 3;
7315 case "water":
7316 return 3;
7317 case "bill":
7318 return 3;
7319 case "1165":
7320 return 10;
7321 case "diary_sister":
7322 return 12;
7323 case "diary_lady":
7324 return 25;
7325 case "diary_catsister":
7326 return 85;
7327 case "container_magic":
7328 return 20;
7329 case "wrench_tent_elec":
7330 return 3;
7331 case "wrench_tent_soil":
7332 return 3;
7333 case "wrench_tent_seabed":
7334 return 12;
7335 case "wrench_bed":
7336 return 3;
7337 case "wrench_storage":
7338 return 4;
7339 case "wrench_fridge":
7340 return 15;
7341 case "wrench_extend_v":
7342 return 6;
7343 case "wrench_extend_h":
7344 return 6;
7345 case "monsterball":
7346 return LV / 8;
7347 case "372":
7348 return 3;
7349 case "scroll_random":
7350 if (refVal == 8288)
7351 {
7352 return 20;
7353 }
7354 break;
7355 }
7356 break;
7357 }
7358 }
7359 if (sell && noSell)
7360 {
7361 return 0;
7362 }
7363 if (!sell && id == "casino_coin")
7364 {
7365 return 20;
7366 }
7367 int value = GetValue(priceType, sell);
7368 if (value == 0)
7369 {
7370 return 0;
7371 }
7372 if (c == null)
7373 {
7374 c = EClass.pc;
7375 }
7376 double p = value;
7377 Trait trait = this.trait;
7378 if (!(trait is TraitBed))
7379 {
7380 if (trait is TraitContainer traitContainer)
7381 {
7382 p *= 1f + 4f * (float)(things.width - traitContainer.Width) + 4f * (float)(things.height - traitContainer.Height);
7383 }
7384 }
7385 else
7386 {
7387 p *= 1f + 0.5f * (float)c_containerSize;
7388 }
7389 p += c_priceAdd;
7390 if (c_priceFix != 0)
7391 {
7392 p = (int)((float)p * (float)Mathf.Clamp(100 + c_priceFix, 0, 1000000) / 100f);
7393 if (p == 0.0)
7394 {
7395 return 0;
7396 }
7397 }
7398 if (isStolen)
7399 {
7400 if (sell && priceType == PriceType.PlayerShop && EClass.Branch != null && EClass.Branch.policies.IsActive(2824))
7401 {
7402 p = p * 100.0 / (double)Mathf.Max(110f, 170f - Mathf.Sqrt(EClass.Branch.Evalue(2824) * 5));
7403 }
7404 else if (sell && Guild.Thief.IsMember)
7405 {
7406 p = Guild.Thief.SellStolenPrice((int)p);
7407 }
7408 else
7409 {
7410 p *= 0.5;
7411 }
7412 }
7413 if (!sell && category.id == "spellbook")
7414 {
7415 p = Guild.Mage.BuySpellbookPrice((int)p);
7416 }
7417 bool flag = priceType == PriceType.CopyShop;
7418 int num = ((!flag) ? 1 : 5);
7419 float num2 = Mathf.Min(0.01f * (float)Evalue(752), 1f);
7420 float num3 = Mathf.Min(0.01f * (float)Evalue(751), 1f);
7421 float num4 = Mathf.Min(0.02f * (float)Evalue(759), 2f);
7422 if (num3 > 0f)
7423 {
7424 num3 *= (float)num;
7425 }
7426 float num5 = Mathf.Clamp(1f + num2 + num3, 0.5f, 5f) + num4;
7427 p *= num5;
7428 p *= 0.20000000298023224;
7429 if (sell)
7430 {
7431 p *= 0.20000000298023224;
7432 if (isCopy)
7433 {
7434 p *= 0.20000000298023224;
7435 }
7436 if (isReplica)
7437 {
7438 p *= 0.20000000298023224;
7439 }
7440 if (currency == CurrencyType.Money && (category.IsChildOf("meal") || category.IsChildOf("preserved")))
7441 {
7442 p *= 0.5;
7443 }
7444 if ((uint)(priceType - 1) <= 1u)
7445 {
7446 if (category.IsChildOf("fish"))
7447 {
7448 p *= ((EClass.pc.faith == EClass.game.religions.Luck) ? 1.5f : 1f);
7449 }
7450 if (category.IsChildOf("vegi") || category.IsChildOf("fruit"))
7451 {
7452 p *= ((EClass.pc.faith == EClass.game.religions.Harvest) ? 3f : 2f);
7453 }
7454 }
7455 }
7456 if (id == "rod_wish")
7457 {
7458 p *= (sell ? 0.01f : 50f);
7459 }
7460 switch (currency)
7461 {
7462 case CurrencyType.Ecopo:
7463 if (this.trait is TraitSeed)
7464 {
7465 p *= 2.0;
7466 }
7467 else if (this.trait is TraitEcoMark)
7468 {
7469 p *= 1.0;
7470 }
7471 else
7472 {
7473 p *= 0.20000000298023224;
7474 }
7475 break;
7476 case CurrencyType.Casino_coin:
7477 p *= 0.10000000149011612;
7478 break;
7479 case CurrencyType.Influence:
7480 p *= 0.0020000000949949026;
7481 break;
7482 case CurrencyType.Medal:
7483 p *= 0.00019999999494757503;
7484 break;
7485 case CurrencyType.Money2:
7486 p *= 0.004999999888241291;
7487 break;
7488 default:
7489 if (IsIdentified || (this.trait is TraitErohon && !sell) || priceType == PriceType.Tourism)
7490 {
7491 if (blessedState == BlessedState.Blessed)
7492 {
7493 p *= 1.25;
7494 }
7495 else if (blessedState <= BlessedState.Cursed)
7496 {
7497 p *= (flag ? 1.25f : 0.3f);
7498 }
7499 if (this.trait.HasCharges)
7500 {
7501 p = p * 0.05000000074505806 + p * (double)(0.5f + Mathf.Clamp(0.1f * (float)c_charges, 0f, 1.5f));
7502 }
7503 if (IsDecayed)
7504 {
7505 p *= (flag ? 0.9f : 0.5f);
7506 }
7507 }
7508 else
7509 {
7510 Rand.UseSeed(uid, delegate
7511 {
7512 p = (sell ? (1 + EClass.rnd(15)) : (50 + EClass.rnd(500)));
7513 });
7514 }
7515 if (!sell)
7516 {
7517 p *= 1f + 0.2f * (float)c.Evalue(1406);
7518 }
7519 break;
7520 }
7521 float num6 = Math.Clamp(Mathf.Sqrt(c.EvalueMax(291) + ((!sell && EClass._zone.IsPCFaction) ? (EClass.Branch.Evalue(2800) * 2) : 0)), 0f, 25f);
7522 switch (priceType)
7523 {
7524 case PriceType.Tourism:
7525 num6 = 0f;
7526 break;
7527 case PriceType.Shipping:
7528 if (sell)
7529 {
7530 p *= 1.100000023841858;
7531 }
7532 break;
7533 case PriceType.PlayerShop:
7534 {
7535 if (!sell)
7536 {
7537 break;
7538 }
7539 float num7 = 1.25f;
7540 if (EClass.Branch != null)
7541 {
7542 if (EClass.Branch.policies.IsActive(2817))
7543 {
7544 num7 += 0.1f + 0.01f * Mathf.Sqrt(EClass.Branch.Evalue(2817));
7545 }
7546 if (EClass.Branch.policies.IsActive(2816))
7547 {
7548 num7 += 0.2f + 0.02f * Mathf.Sqrt(EClass.Branch.Evalue(2816));
7549 }
7550 if (isChara)
7551 {
7552 if (EClass.Branch.policies.IsActive(2828))
7553 {
7554 num7 += 0.1f + 0.01f * Mathf.Sqrt(EClass.Branch.Evalue(2828));
7555 }
7556 }
7557 else if (category.IsChildOf("food") || category.IsChildOf("drink"))
7558 {
7559 if (EClass.Branch.policies.IsActive(2818))
7560 {
7561 num7 += 0.05f + 0.005f * Mathf.Sqrt(EClass.Branch.Evalue(2818));
7562 }
7563 }
7564 else if (category.IsChildOf("furniture"))
7565 {
7566 if (EClass.Branch.policies.IsActive(2819))
7567 {
7568 num7 += 0.05f + 0.005f * Mathf.Sqrt(EClass.Branch.Evalue(2819));
7569 }
7570 }
7571 else if (EClass.Branch.policies.IsActive(2820))
7572 {
7573 num7 += 0.05f + 0.005f * Mathf.Sqrt(EClass.Branch.Evalue(2820));
7574 }
7575 }
7576 p *= num7;
7577 break;
7578 }
7579 }
7580 if ((uint)currency > 1u)
7581 {
7582 num6 = 0f;
7583 }
7584 p *= (sell ? (1f + num6 * 0.02f) : (1f - num6 * 0.02f));
7585 if (sell)
7586 {
7587 p = EClass.curve((int)p, 10000, 10000, 80);
7588 }
7589 if (p < 1.0)
7590 {
7591 p = ((!sell) ? 1 : 0);
7592 }
7593 if (!sell)
7594 {
7595 if (currency == CurrencyType.Casino_coin)
7596 {
7597 if (p > 100000.0)
7598 {
7599 p = Mathf.CeilToInt((float)p / 100000f) * 100000;
7600 }
7601 else if (p > 10000.0)
7602 {
7603 p = Mathf.CeilToInt((float)p / 10000f) * 10000;
7604 }
7605 else if (p > 1000.0)
7606 {
7607 p = Mathf.CeilToInt((float)p / 1000f) * 1000;
7608 }
7609 else if (p > 100.0)
7610 {
7611 p = Mathf.CeilToInt((float)p / 100f) * 100;
7612 }
7613 else if (p > 10.0)
7614 {
7615 p = Mathf.CeilToInt((float)p / 10f) * 10;
7616 }
7617 }
7618 if (this.trait is TraitDeed)
7619 {
7620 p *= Mathf.Pow(2f, EClass.player.flags.landDeedBought);
7621 }
7622 }
7623 if (p > (double)(sell ? 500000000 : 1000000000))
7624 {
7625 if (!sell)
7626 {
7627 return 1000000000;
7628 }
7629 return 500000000;
7630 }
7631 return (int)p;
7632 }
7633
7634 public virtual string GetHoverText()
7635 {
7636 return Name + GetExtraName();
7637 }
7638
7639 public virtual string GetHoverText2()
7640 {
7641 return "";
7642 }
7643
7644 public int Dist(Card c)
7645 {
7646 if (!IsMultisize && !c.IsMultisize)
7647 {
7648 return pos.Distance(c.pos);
7649 }
7650 if (IsMultisize)
7651 {
7652 int dist = 99;
7653 ForeachPoint(delegate(Point p, bool main)
7654 {
7655 int num2 = DistMulti(p, c);
7656 if (num2 < dist)
7657 {
7658 dist = num2;
7659 }
7660 });
7661 return dist;
7662 }
7663 return DistMulti(pos, c);
7664 static int DistMulti(Point p1, Card c)
7665 {
7666 if (!c.IsMultisize)
7667 {
7668 return p1.Distance(c.pos);
7669 }
7670 int dist2 = 99;
7671 c.ForeachPoint(delegate(Point p, bool main)
7672 {
7673 int num = p1.Distance(p);
7674 if (num < dist2)
7675 {
7676 dist2 = num;
7677 }
7678 });
7679 return dist2;
7680 }
7681 }
7682
7683 public int Dist(Point p)
7684 {
7685 return pos.Distance(p);
7686 }
7687
7688 public bool IsInMutterDistance(int d = 10)
7689 {
7690 return pos.Distance(EClass.pc.pos) < d;
7691 }
7692
7693 public void SetCensored(bool enable)
7694 {
7695 isCensored = enable;
7697 {
7698 isCensored = false;
7699 }
7700 renderer.SetCensored(isCensored);
7701 }
7702
7703 public void SetDeconstruct(bool deconstruct)
7704 {
7705 if (isDeconstructing != deconstruct)
7706 {
7707 if (deconstruct)
7708 {
7709 EClass._map.props.deconstructing.Add(this);
7710 }
7711 else
7712 {
7713 EClass._map.props.deconstructing.Remove(this);
7714 }
7715 isDeconstructing = deconstruct;
7716 }
7717 }
7718
7719 public virtual bool MatchEncSearch(string s)
7720 {
7721 return false;
7722 }
7723
7725 {
7726 switch (m)
7727 {
7728 case UIList.SortMode.ByEquip:
7729 sortVal = ((c_equippedSlot == 0) ? (category.sortVal * 1000) : 0);
7730 break;
7731 case UIList.SortMode.ByValue:
7732 sortVal = -GetPrice(currency) * 1000;
7733 break;
7734 case UIList.SortMode.ByNumber:
7735 sortVal = -Num * 1000;
7736 break;
7737 case UIList.SortMode.ByCategory:
7738 sortVal = category.sortVal * 1000;
7739 break;
7740 case UIList.SortMode.ByWeight:
7741 sortVal = -ChildrenAndSelfWeight * 1000;
7742 break;
7743 case UIList.SortMode.ByWeightSingle:
7744 sortVal = -ChildrenAndSelfWeightSingle * 1000;
7745 break;
7746 case UIList.SortMode.ByPrice:
7747 sortVal = -GetPrice(currency) * 1000;
7748 break;
7749 default:
7750 sortVal = sourceCard._index * 1000;
7751 break;
7752 }
7753 }
7754
7755 public virtual int SecondaryCompare(UIList.SortMode m, Card c)
7756 {
7757 int num = 0;
7758 if (num == 0)
7759 {
7760 num = id.CompareTo(c.id);
7761 }
7762 if (num == 0)
7763 {
7764 num = trait.CompareTo(c);
7765 }
7766 if (num == 0)
7767 {
7768 num = Lang.comparer.Compare(GetName(NameStyle.Full, 1), c.GetName(NameStyle.Full, 1));
7769 }
7770 if (num == 0)
7771 {
7772 num = refVal - c.refVal;
7773 }
7774 if (num == 0)
7775 {
7776 num = c_charges - c.c_charges;
7777 }
7778 if (num == 0)
7779 {
7780 num = encLV - c.encLV;
7781 }
7782 if (num == 0)
7783 {
7784 num = Num - c.Num;
7785 }
7786 if (num == 0)
7787 {
7788 num = uid - c.uid;
7789 }
7790 return num;
7791 }
7792
7793 public void ForeachFOV(Func<Point, bool> func)
7794 {
7795 if (fov == null)
7796 {
7797 return;
7798 }
7799 foreach (KeyValuePair<int, byte> lastPoint in fov.lastPoints)
7800 {
7801 Point arg = new Point().Set(lastPoint.Key);
7802 if (func(arg))
7803 {
7804 break;
7805 }
7806 }
7807 }
7808
7809 public void ForeachPoint(Action<Point, bool> action)
7810 {
7811 if (IsMultisize)
7812 {
7813 pos.ForeachMultiSize(W, H, action);
7814 }
7815 else
7816 {
7817 action(pos, arg2: true);
7818 }
7819 }
7820
7821 public void OnInspect()
7822 {
7823 }
7824
7825 public virtual void WriteNote(UINote n, Action<UINote> onWriteNote = null, IInspect.NoteMode mode = IInspect.NoteMode.Default, Recipe recipe = null)
7826 {
7827 }
7828
7829 public void Inspect()
7830 {
7831 SE.Play("pop_paper");
7832 if (isChara)
7833 {
7834 LayerChara layerChara = EClass.ui.AddLayerDontCloseOthers<LayerChara>();
7835 layerChara.windows[0].SetRect(EClass.core.refs.rects.center);
7836 layerChara.SetChara(Chara);
7837 }
7838 else
7839 {
7840 EClass.ui.AddLayerDontCloseOthers<LayerInfo>().SetThing(Thing);
7841 }
7842 }
7843
7844 public virtual bool HasCondition<T>() where T : Condition
7845 {
7846 return false;
7847 }
7848
7849 public bool HaveFur()
7850 {
7851 if (!isChara)
7852 {
7853 return false;
7854 }
7855 string text = id;
7856 if (text == "putty_snow" || text == "putty_snow_gold")
7857 {
7858 return true;
7859 }
7860 return !Chara.race.fur.IsEmpty();
7861 }
7862
7863 public bool CanBeSheared()
7864 {
7866 {
7867 return false;
7868 }
7869 if (!HaveFur() || c_fur < 0)
7870 {
7871 return false;
7872 }
7873 return true;
7874 }
7875}
AnimeID
Definition: AnimeID.cs:2
AttackSource
Definition: AttackSource.cs:2
AttackStyle
Definition: AttackStyle.cs:2
BedType
Definition: BedType.cs:2
BlessedState
Definition: BlessedState.cs:2
BossType
Definition: BossType.cs:2
CTAG
Definition: CTAG.cs:2
@ currency
ConditionType
Definition: ConditionType.cs:2
CureType
Definition: CureType.cs:2
CurrencyType
Definition: CurrencyType.cs:2
EditorTag
Definition: EditorTag.cs:2
EffectDead
Definition: EffectDead.cs:2
EffectId
Definition: EffectId.cs:2
@ ChangeMaterial
Emo
Definition: Emo.cs:2
@ harvest
FactionMemberType
HealSource
Definition: HealSource.cs:2
HitResult
Definition: HitResult.cs:2
Hostility
Definition: Hostility.cs:2
MinionType
Definition: MinionType.cs:2
NameStyle
Definition: NameStyle.cs:2
PeriodOfDay
Definition: PeriodOfDay.cs:2
PlaceState
Definition: PlaceState.cs:2
PriceType
Definition: PriceType.cs:2
Rarity
Definition: Rarity.cs:2
RescueState
Definition: RescueState.cs:2
SourceValueType
ThrowType
Definition: ThrowType.cs:2
ToggleType
Definition: ToggleType.cs:2
TryMakeRandomItemSource
if(item3.idFile==idFirstFile &&item3.id==idFirstTopic)
Definition: UIBook.cs:627
VisitorState
Definition: VisitorState.cs:2
Definition: AIAct.cs:6
AIAct Current
Definition: AIAct.cs:103
bool TryCancel(Card c)
Definition: AIAct.cs:266
virtual bool IsRunning
Definition: AIAct.cs:31
virtual Status Cancel()
Definition: AIAct.cs:291
virtual bool CancelWhenDamaged
Definition: AIAct.cs:94
static bool ignoreDamage
Definition: AI_PlayMusic.cs:14
static bool slaughtering
Definition: AI_Slaughter.cs:6
static void LoveMiracle(Chara tc, Chara c, int power, EffectId idEffect=EffectId.Love, BlessedState? state=null)
Definition: ActEffect.cs:2657
static void TryDelay(Action a)
Definition: ActEffect.cs:23
static void Proc(EffectId id, Card cc, Card tc=null, int power=100, ActRef actRef=default(ActRef))
Definition: ActEffect.cs:987
static void ProcAt(EffectId id, int power, BlessedState state, Card cc, Card tc, Point tp, bool isNeg, ActRef actRef=default(ActRef))
Definition: ActEffect.cs:485
void Add(Act a, string s="")
Definition: ActPlan.cs:11
Definition: ACT.cs:62
static Act CurrentAct
Definition: ACT.cs:89
virtual bool IsRoofEditMode(Card c=null)
Definition: ActionMode.cs:311
int value
Definition: Affinity.cs:26
Definition: Area.cs:4
virtual void OnInstallCard(Card t)
Definition: Area.cs:59
virtual void OnUninstallCard(Card t)
Definition: Area.cs:63
static void ProcShieldEncs(Chara CC, Card TC, int mtpChance=100)
static void GakiConvert(ref string text, string idLang="zako")
Dictionary< int, int > mapInt
Definition: BaseCard.cs:10
void SetStr(int id, string value=null)
Definition: BaseCard.cs:63
void SetObj(int id, object o)
Definition: BaseCard.cs:91
string GetStr(int id, string defaultStr=null)
Definition: BaseCard.cs:54
int GetInt(int id, int? defaultInt=null)
Definition: BaseCard.cs:25
void SetInt(int id, int value=0)
Definition: BaseCard.cs:39
Dictionary< int, string > mapStr
Definition: BaseCard.cs:13
void Mod(int a, bool force=false)
SourceElement.Row sourceElement
void WaitForEndOfFrame(Action action)
Definition: BaseCore.cs:61
List< Action > actionsNextFrame
Definition: BaseCore.cs:31
Version version
Definition: BaseCore.cs:17
ScreenGuide guide
BaseTileMap tileMap
virtual void RefreshPosition()
virtual ConditionType Type
Definition: BaseStats.cs:19
static int GetColorInt(ref Color matColor, int p)
void SetRoofHeight(MeshPassParam _param, Cell _cell, int _cx, int _cz, int h=0, int altitude=0, int dirWall=-1, bool ignoreAltitudeY=false)
Vector3 GetThingPosition(Card tg, Point p)
void SetGender(int g)
Definition: Biography.cs:473
void SetPortrait(Chara c)
Definition: Biography.cs:482
Card card
Definition: ButtonGrid.cs:24
virtual void RefreshSprite()
Definition: CardActor.cs:224
static void SetRarity(Rarity q=Rarity.Normal)
static CardBlueprint current
static void Set(CardBlueprint _bp=null)
bool tryLevelMatTier
static CardBlueprint _Default
GlobalCharaList globalCharas
Definition: CardManager.cs:46
void AssignUID(Card c)
Definition: CardManager.cs:78
void ShowEmo(Emo emo, float duration=0f)
void PlayAnime(AnimeID id, bool force)
virtual void KillAnime()
override void Draw(RenderParam p)
Definition: CardRenderer.cs:53
Vector3 position
Definition: CardRenderer.cs:21
void RefreshSprite()
virtual void SetOwner(Card c)
Definition: CardRenderer.cs:38
virtual void SetFirst(bool first, Vector3 pos)
CardActor actor
Definition: CardRenderer.cs:11
void KillActor()
void SetCensored(bool enable)
string[] idActor
Definition: CardRow.cs:35
Card model
Definition: CardRow.cs:60
int quality
Definition: CardRow.cs:19
CardRow origin
Definition: CardRow.cs:49
string[] trait
Definition: CardRow.cs:33
string _origin
Definition: CardRow.cs:15
string id
Definition: CardRow.cs:7
string tierGroup
Definition: CardRow.cs:11
string lightData
Definition: CardRow.cs:13
string[] loot
Definition: CardRow.cs:29
Definition: Card.cs:11
float angle
Definition: Card.cs:71
int CountRune(bool countFree=true)
Definition: Card.cs:3640
bool IsNegativeGift
Definition: Card.cs:2396
CharaList c_charaList
Definition: Card.cs:1893
int c_lockedAge
Definition: Card.cs:1353
void SetTier(int a, bool setTraits=true)
Definition: Card.cs:3869
bool isDestroyed
Definition: Card.cs:75
MinionType c_minionType
Definition: Card.cs:988
int FameLv
Definition: Card.cs:2298
int c_priceFix
Definition: Card.cs:1137
void ModExp(int ele, int a)
Definition: Card.cs:2653
Thing TryMakeRandomItem(int lv=-1, TryMakeRandomItemSource itemSource=TryMakeRandomItemSource.Default, Chara crafter=null)
Definition: Card.cs:5440
virtual string AliasMaterialOnCreate
Definition: Card.cs:2053
Props props
Definition: Card.cs:51
virtual string GetName(NameStyle style, int num=-1)
Definition: Card.cs:2615
int DMG
Definition: Card.cs:2331
bool IsPCFactionOrMinion
Definition: Card.cs:2272
int GetBestAttribute()
Definition: Card.cs:2630
bool isCrafted
Definition: Card.cs:794
virtual MoveResult _Move(Point p, MoveType type=MoveType.Walk)
Definition: Card.cs:5803
virtual string GetHoverText()
Definition: Card.cs:7634
void Teleport(Point point, bool silent=false, bool force=false)
Definition: Card.cs:5839
string ReferenceId()
Definition: Card.cs:2737
virtual string GetExtraName()
Definition: Card.cs:2620
ContainerUpgrade c_containerUpgrade
Definition: Card.cs:1869
virtual bool IsMultisize
Definition: Card.cs:2158
void PurgeDuplicateArtifact(Thing af)
Definition: Card.cs:3222
BitArray32 _bits1
Definition: Card.cs:79
int tier
Definition: Card.cs:410
void RemoveEditorTag(EditorTag tag)
Definition: Card.cs:2610
void ApplySocket(int id, int lv, Card mod=null)
Definition: Card.cs:3558
bool IsDecayed
Definition: Card.cs:2287
string c_idPortrait
Definition: Card.cs:1497
virtual bool IsPCC
Definition: Card.cs:2147
virtual int PV
Definition: Card.cs:2327
virtual bool isThing
Definition: Card.cs:2081
bool IsAmmo
Definition: Card.cs:2247
bool IsVariation
Definition: Card.cs:2323
SocketData AddRune(Card rune)
Definition: Card.cs:3598
string c_note
Definition: Card.cs:1761
bool isImported
Definition: Card.cs:614
bool IsImportant
Definition: Card.cs:2105
bool isSummon
Definition: Card.cs:710
bool HasRune()
Definition: Card.cs:3727
bool CanAddRune(TraitMod mod)
Definition: Card.cs:3661
bool isElemental
Definition: Card.cs:722
void Say(string lang, Card c1, Card c2, string ref1=null, string ref2=null)
Definition: Card.cs:6806
int idMaterial
Definition: Card.cs:134
virtual Chara Chara
Definition: Card.cs:2070
int version
Definition: Card.cs:422
virtual void ApplyMaterialElements(bool remove)
Definition: Card.cs:3032
int posInvY
Definition: Card.cs:350
int INT
Definition: Card.cs:2349
Thing Split(int a)
Definition: Card.cs:3484
virtual void OnSimulateHour(VirtualDate date)
Definition: Card.cs:6571
int EvalueMax(int ele, int min=0)
Definition: Card.cs:2585
bool IsAgent
Definition: Card.cs:2249
bool isMasked
Definition: Card.cs:590
void MakeFigureFrom(string id)
Definition: Card.cs:5700
int c_idMainElement
Definition: Card.cs:1413
void SetPlaceState(PlaceState newState, bool byPlayer=false)
Definition: Card.cs:3747
void AddSocket()
Definition: Card.cs:3541
void SetCensored(bool enable)
Definition: Card.cs:7693
ElementContainerCard elements
Definition: Card.cs:41
int END
Definition: Card.cs:2337
CardRow refCard
Definition: Card.cs:1967
const int DamageLimit
Definition: Card.cs:29
void _OnDeserialized(StreamingContext context)
Definition: Card.cs:2691
bool c_wasInPcParty
Definition: Card.cs:1012
int c_ammo
Definition: Card.cs:1461
bool IsFresn
Definition: Card.cs:2291
string id
Definition: Card.cs:35
float GetLightPower()
Definition: Card.cs:6376
int ChildrenWeight
Definition: Card.cs:2013
bool isNPCProperty
Definition: Card.cs:554
virtual void SetSource()
Definition: Card.cs:2855
int GetSightRadius()
Definition: Card.cs:6395
bool IsUnique
Definition: Card.cs:2091
bool IsRestrainedResident
Definition: Card.cs:2258
int c_equippedSlot
Definition: Card.cs:952
SourceBacker.Row sourceBacker
Definition: Card.cs:928
bool TryReserve(AIAct act)
Definition: Card.cs:2501
Hostility c_originalHostility
Definition: Card.cs:976
bool IsExcludeFromCraft(Recipe.Ingredient ing)
Definition: Card.cs:2529
bool isFloating
Definition: Card.cs:650
int _childrenWeight
Definition: Card.cs:87
bool isSubsetCard
Definition: Card.cs:746
Thing AddThing(Thing t, bool tryStack=true, int destInvX=-1, int destInvY=-1)
Definition: Card.cs:3109
void PlaySoundHold(bool spatial=true)
Definition: Card.cs:6125
virtual void Die(Element e=null, Card origin=null, AttackSource attackSource=AttackSource.None, Chara originalTarget=null)
Definition: Card.cs:5003
bool IsInheritFoodTraits
Definition: Card.cs:2178
ICardParent GetRoot()
Definition: Card.cs:3417
void AddBlood(int a=1, int id=-1)
Definition: Card.cs:5960
virtual bool IsMoving
Definition: Card.cs:2113
bool isRoofItem
Definition: Card.cs:578
void SetRandomLightColors()
Definition: Card.cs:6511
bool isRestrained
Definition: Card.cs:566
bool c_lockedHard
Definition: Card.cs:1036
CardRenderer HostRenderer
Definition: Card.cs:2442
virtual bool IsDisabled
Definition: Card.cs:2111
bool IsThrownWeapon
Definition: Card.cs:2245
bool isLostProperty
Definition: Card.cs:806
string TextRarity
Definition: Card.cs:2379
int ExpToNext
Definition: Card.cs:2008
void OnChildNumChange(Card c)
Definition: Card.cs:3732
int Evalue(int ele, bool ignoreGlobalElement)
Definition: Card.cs:2576
bool IsStackable(Thing tg)
Definition: Card.cs:3435
bool HasElement(string id, int req=1)
Definition: Card.cs:5918
float fy
Definition: Card.cs:266
void Explode(Point p, Card origin)
Definition: Card.cs:5054
bool noSell
Definition: Card.cs:830
bool isCensored
Definition: Card.cs:434
bool CanInspect
Definition: Card.cs:2470
CardBlueprint bp
Definition: Card.cs:77
virtual int Power
Definition: Card.cs:2295
int Evalue(string alias)
Definition: Card.cs:2590
SourceMaterial.Row DyeMat
Definition: Card.cs:1940
bool isBroken
Definition: Card.cs:734
int PER
Definition: Card.cs:2339
SourceMaterial.Row material
Definition: Card.cs:2051
bool IsRotting
Definition: Card.cs:2289
int c_summonDuration
Definition: Card.cs:1425
int c_indexContainerIcon
Definition: Card.cs:1401
SoundSource PlaySound(string id, float v=1f, bool spatial=true)
Definition: Card.cs:6145
string c_idDeity
Definition: Card.cs:1581
int c_invest
Definition: Card.cs:1293
Card ChangeMaterial(int idNew, bool ignoreFixedMaterial=false)
Definition: Card.cs:3041
int HIT
Definition: Card.cs:2329
string c_extraNameRef
Definition: Card.cs:1617
bool isCopy
Definition: Card.cs:878
Card MakeRefFrom(string id)
Definition: Card.cs:5705
string c_idTrait
Definition: Card.cs:1725
string c_altName
Definition: Card.cs:1593
string TryGetFoodName(Card c)
Definition: Card.cs:5671
int c_weight
Definition: Card.cs:1377
string ApplyNewLine(string text)
Definition: Card.cs:6764
virtual void LookAt(Point p)
Definition: Card.cs:6216
void ClampInitialSkill()
Definition: Card.cs:2943
Thing Tool
Definition: Card.cs:2410
bool isRestocking
Definition: Card.cs:890
void DamageHP(long dmg, int ele, int eleP=100, AttackSource attackSource=AttackSource.None, Card origin=null, bool showEffect=true, Thing weapon=null, Chara originalTarget=null)
Definition: Card.cs:4068
string NameOne
Definition: Card.cs:2141
string InspectName
Definition: Card.cs:2481
string c_idJob
Definition: Card.cs:1521
virtual SourceMaterial.Row DefaultMaterial
Definition: Card.cs:2421
int c_priceAdd
Definition: Card.cs:1149
virtual int GetPrice(CurrencyType currency=CurrencyType.Money, bool sell=false, PriceType priceType=PriceType.Default, Chara c=null)
Definition: Card.cs:7249
virtual void HealHPHost(int a, HealSource origin=HealSource.None)
Definition: Card.cs:3987
Thing ammoData
Definition: Card.cs:1785
virtual bool IsPCParty
Definition: Card.cs:2149
virtual void SetDir(int d)
Definition: Card.cs:6201
int GetHearingRadius()
Definition: Card.cs:6390
int c_lockLv
Definition: Card.cs:964
bool ignoreAutoPick
Definition: Card.cs:506
int GetEquipValue()
Definition: Card.cs:7150
BitArray32 _bits2
Definition: Card.cs:81
virtual void HealHP(int a, HealSource origin=HealSource.None)
Definition: Card.cs:4003
virtual int SelfWeight
Definition: Card.cs:2045
int c_uidRefCard
Definition: Card.cs:1124
bool IsEquipmentOrRangedOrAmmo
Definition: Card.cs:2230
int DefaultLV
Definition: Card.cs:2010
Fov fov
Definition: Card.cs:57
int GetAffinityExpBonus()
Definition: Card.cs:2983
int c_dyeMat
Definition: Card.cs:1185
void Say(string lang, Card c1, string ref1=null, string ref2=null)
Definition: Card.cs:6815
Card AddCard(Card c)
Definition: Card.cs:3090
int invY
Definition: Card.cs:1955
Point InspectPoint
Definition: Card.cs:2483
static int GetTilePrice(TileRow row, SourceMaterial.Row mat)
Definition: Card.cs:7129
string c_refText
Definition: Card.cs:1629
bool IsMale
Definition: Card.cs:2384
virtual CardRenderer _CreateRenderer()
Definition: Card.cs:5953
bool IsCursed
Definition: Card.cs:2255
int c_dateCooked
Definition: Card.cs:1341
bool isSale
Definition: Card.cs:866
void CalculateFOV()
Definition: Card.cs:6474
int c_uidMaster
Definition: Card.cs:1449
int c_dateDeathLock
Definition: Card.cs:1245
Biography bio
Definition: Card.cs:44
int c_fixedValue
Definition: Card.cs:1173
Thing AddThing(string id, int lv=-1)
Definition: Card.cs:3104
virtual bool MatchEncSearch(string s)
Definition: Card.cs:7719
void SetCharge(int a)
Definition: Card.cs:3944
virtual string GetDetail()
Definition: Card.cs:2625
void Talk(string idTopic, string ref1=null, string ref2=null, bool forceSync=false)
Definition: Card.cs:6700
Card SetLv(int a)
Definition: Card.cs:2905
int hp
Definition: Card.cs:242
Rarity rarity
Definition: Card.cs:314
int c_vomit
Definition: Card.cs:1000
float fx
Definition: Card.cs:254
string Name
Definition: Card.cs:2137
void SetRandomTone()
Definition: Card.cs:6910
void PlaySoundImpact(bool spatial=true)
Definition: Card.cs:6135
int c_seed
Definition: Card.cs:1305
bool IsRangedWeapon
Definition: Card.cs:2243
const int MaxWeight
Definition: Card.cs:25
virtual string actorPrefab
Definition: Card.cs:2129
int CHA
Definition: Card.cs:2347
virtual int DV
Definition: Card.cs:2325
ICardParent parent
Definition: Card.cs:55
bool ExistsOnMap
Definition: Card.cs:2085
bool dirtyWeight
Definition: Card.cs:85
bool hasSpawned
Definition: Card.cs:902
void EjectSockets()
Definition: Card.cs:3576
virtual void OnBeforeCreate()
Definition: Card.cs:2847
bool IsHotItem
Definition: Card.cs:119
void NotifyAddThing(Thing t, int num)
Definition: Card.cs:3100
virtual int WeightLimit
Definition: Card.cs:2047
Sprite GetPaintSprite()
Definition: Card.cs:7060
virtual bool IsMinion
Definition: Card.cs:2151
MixedFoodData c_mixedFoodData
Definition: Card.cs:1905
bool c_isPrayed
Definition: Card.cs:1072
bool c_revealLock
Definition: Card.cs:1048
void AddEditorTag(EditorTag tag)
Definition: Card.cs:2605
string c_idAbility
Definition: Card.cs:1665
virtual string GetHoverText2()
Definition: Card.cs:7639
void ApplySocket(Thing t)
Definition: Card.cs:3550
string c_idTone
Definition: Card.cs:1533
const int SocketDiv
Definition: Card.cs:27
virtual bool IsDeadOrSleeping
Definition: Card.cs:2109
Thing SetNum(int a)
Definition: Card.cs:3495
int c_priceCopy
Definition: Card.cs:1161
int GetCurrency(string id="money")
Definition: Card.cs:3975
void SetReplica(bool on)
Definition: Card.cs:3075
void ForeachPoint(Action< Point, bool > action)
Definition: Card.cs:7809
void Dye(SourceMaterial.Row mat)
Definition: Card.cs:5996
void Deconstruct()
Definition: Card.cs:5064
virtual bool IsPCPartyMinion
Definition: Card.cs:2153
string c_idSpriteReplacer
Definition: Card.cs:1557
SourceMaterial.Row _material
Definition: Card.cs:91
bool HasElement(int ele, int req)
Definition: Card.cs:5913
bool HasLight()
Definition: Card.cs:6371
int decay
Definition: Card.cs:218
Thing GiveBirth(Thing t, bool effect)
Definition: Card.cs:5777
CardRow refCard2
Definition: Card.cs:1988
string c_altName2
Definition: Card.cs:1605
Thing parentThing
Definition: Card.cs:105
virtual Sprite GetImageSprite()
Definition: Card.cs:6081
int LER
Definition: Card.cs:2341
void MakeRefFrom(Card c1, Card c2=null)
Definition: Card.cs:5711
Sprite _paintSprite
Definition: Card.cs:99
bool autoRefuel
Definition: Card.cs:626
Thing c_bloodData
Definition: Card.cs:1917
bool IsFurniture
Definition: Card.cs:2251
virtual void ApplyMaterial(bool remove=false)
Definition: Card.cs:3036
bool IsFood
Definition: Card.cs:2175
Fov CreateFov()
Definition: Card.cs:6516
PlaceState placeState
Definition: Card.cs:83
CharaUpgrade c_upgrades
Definition: Card.cs:1833
void ApplyElementEffect(Element e, int eleP, Card origin, bool checkHostileAct=false)
Definition: Card.cs:4843
void ChangeAltitude(int a)
Definition: Card.cs:6251
List< SocketData > socketList
Definition: Card.cs:1797
int c_IDTState
Definition: Card.cs:1257
bool HasContainerSize
Definition: Card.cs:2407
void PlayAnime(AnimeID id, Point dest, bool force=false)
Definition: Card.cs:6169
int c_daysWithGod
Definition: Card.cs:1473
virtual void SetBlessedState(BlessedState s)
Definition: Card.cs:3895
int WIL
Definition: Card.cs:2343
RenderParam GetRenderParam()
Definition: Card.cs:5972
virtual SourcePref Pref
Definition: Card.cs:2107
bool isAcidproof
Definition: Card.cs:686
void RecalculateFOV()
Definition: Card.cs:6357
bool IsToolbelt
Definition: Card.cs:2169
int MaxRune()
Definition: Card.cs:3656
string c_idEditor
Definition: Card.cs:1689
int STR
Definition: Card.cs:2333
string c_idRace
Definition: Card.cs:1509
bool HasTalk(string idTopic)
Definition: Card.cs:6695
string GetTalkText(string idTopic, bool stripPun=false, bool useDefault=true)
Definition: Card.cs:6824
bool HasTag(CTAG tag)
Definition: Card.cs:2595
Point pos
Definition: Card.cs:59
int DEX
Definition: Card.cs:2335
void DecayNatural(int hour=1)
Definition: Card.cs:6580
bool IsInMutterDistance(int d=10)
Definition: Card.cs:7688
virtual void OnCreate(int genLv)
Definition: Card.cs:2851
void DyeRandom()
Definition: Card.cs:5986
string c_editorTags
Definition: Card.cs:1701
void SetDirtyWeight()
Definition: Card.cs:2554
virtual void LookAt(Card c)
Definition: Card.cs:6212
LightData _LightData
Definition: Card.cs:97
void Decay(int a=10)
Definition: Card.cs:6612
void RenderMarker(Point point, bool active, HitResult result, bool main, int dir, bool useCurrentPosition=false)
Definition: Card.cs:6293
virtual long ApplyProtection(long dmg, int mod=100)
Definition: Card.cs:4038
int sortVal
Definition: Card.cs:101
void MakeFoodRef(Card c1, Card c2=null)
Definition: Card.cs:5620
string c_idRefCard2
Definition: Card.cs:1749
int LUC
Definition: Card.cs:2351
int c_containerSize
Definition: Card.cs:1365
void ClearFOV()
Definition: Card.cs:6563
int c_lightColor
Definition: Card.cs:1096
static Color _randColor
Definition: Card.cs:93
virtual void OnDeserialized()
Definition: Card.cs:2733
void _OnSerializing(StreamingContext context)
Definition: Card.cs:2676
virtual CardRow sourceRenderCard
Definition: Card.cs:2133
int ChildrenAndSelfWeightSingle
Definition: Card.cs:2043
int[] _ints
Definition: Card.cs:32
void SetPaintData()
Definition: Card.cs:7018
int uid
Definition: Card.cs:122
virtual void SetRenderParam(RenderParam p)
Definition: Card.cs:5982
Effect PlayEffect(string id, bool useRenderPos=true, float range=0f, Vector3 fix=default(Vector3))
Definition: Card.cs:6179
bool IsEquipmentOrRanged
Definition: Card.cs:2218
int Quality
Definition: Card.cs:2425
void Dye(string idMat)
Definition: Card.cs:5991
virtual SubPassData GetSubPassData()
Definition: Card.cs:6264
List< int > c_corruptionHistory
Definition: Card.cs:1857
override string ToString()
Definition: Card.cs:2487
void TryStack(Thing t)
Definition: Card.cs:6956
int refVal
Definition: Card.cs:206
void ShowEmo(Emo _emo=Emo.none, float duration=0f, bool skipSame=true)
Definition: Card.cs:6113
void ApplyTrait()
Definition: Card.cs:2884
void OnInspect()
Definition: Card.cs:7821
virtual Sprite GetSprite(int dir=0)
Definition: Card.cs:6072
string c_context
Definition: Card.cs:1677
Trait trait
Definition: Card.cs:53
Window.SaveData GetWindowSaveData()
Definition: Card.cs:2516
virtual int MaxDecay
Definition: Card.cs:2285
void ModCurrency(int a, string id="money")
Definition: Card.cs:3961
bool IsPowerful
Definition: Card.cs:2094
string c_idTalk
Definition: Card.cs:1569
static string ApplyTone(Chara c, ref string text, string _tones, int gender, bool stripPun=false)
Definition: Card.cs:6849
bool ShouldTrySetDirtyInventory()
Definition: Card.cs:3379
void LevelUp()
Definition: Card.cs:2997
string c_idRidePCC
Definition: Card.cs:1653
virtual void ApplyEditorTags(EditorTag tag)
Definition: Card.cs:2859
int encLV
Definition: Card.cs:326
int altitude
Definition: Card.cs:230
int c_diceDim
Definition: Card.cs:1389
bool IsEquipment
Definition: Card.cs:2173
virtual bool IsAliveInCurrentZone
Definition: Card.cs:2127
int c_allowance
Definition: Card.cs:1317
bool isDeconstructing
Definition: Card.cs:446
MoveType
Definition: Card.cs:20
bool disableAutoToggle
Definition: Card.cs:602
virtual int[] Tiles
Definition: Card.cs:2309
Thing MakeMilk(bool effect=true, int num=1, bool addToZone=true, BlessedState? state=null)
Definition: Card.cs:5746
CardRow hat
Definition: Card.cs:63
virtual int SecondaryCompare(UIList.SortMode m, Card c)
Definition: Card.cs:7755
virtual void OnLand()
Definition: Card.cs:5881
void DamageHP(long dmg, AttackSource attackSource=AttackSource.None, Card origin=null)
Definition: Card.cs:4063
int exp
Definition: Card.cs:398
void RemoveBacker()
Definition: Card.cs:7009
CharaGenes c_genes
Definition: Card.cs:1845
virtual int MaxHP
Definition: Card.cs:2293
void ChangeWeight(int a)
Definition: Card.cs:2564
void ModEncLv(int a)
Definition: Card.cs:3846
void RemoveThing(Thing thing)
Definition: Card.cs:3318
void SetEncLv(int a)
Definition: Card.cs:3864
Card MakeFoodFrom(string _id)
Definition: Card.cs:5514
SocketData GetRuneEnc(int idEle)
Definition: Card.cs:3625
int c_dateStockExpire
Definition: Card.cs:1233
void PlaySoundDead(bool spatial=true)
Definition: Card.cs:6140
int c_idBacker
Definition: Card.cs:1437
bool CanBeSheared()
Definition: Card.cs:7863
float roundTimer
Definition: Card.cs:69
bool TryPay(int a, string id="money")
Definition: Card.cs:3925
void SayNothingHappans()
Definition: Card.cs:6792
void ModCharge(int a, bool destroy=false)
Definition: Card.cs:3950
bool isDyed
Definition: Card.cs:458
bool isNew
Definition: Card.cs:482
void PlayAnimeLoot()
Definition: Card.cs:6174
int MAG
Definition: Card.cs:2345
bool isWeightChanged
Definition: Card.cs:662
void Destroy()
Definition: Card.cs:5070
bool HasGlobalElement(int ele)
Definition: Card.cs:5923
int feat
Definition: Card.cs:374
bool c_isImportant
Definition: Card.cs:1024
MoveResult
Definition: Card.cs:13
bool noMove
Definition: Card.cs:770
bool HaveFur()
Definition: Card.cs:7849
bool HasEditorTag(EditorTag tag)
Definition: Card.cs:2600
Card ChangeMaterial(string idNew, bool ignoreFixedMaterial=false)
Definition: Card.cs:3046
ThingContainer things
Definition: Card.cs:38
BossType c_bossType
Definition: Card.cs:1221
void PurgeEythArtifact()
Definition: Card.cs:3278
bool HasCraftBonusTrait()
Definition: Card.cs:6935
bool IsInstalled
Definition: Card.cs:2381
virtual void Rotate(bool reverse=false)
Definition: Card.cs:6220
virtual bool IsPC
Definition: Card.cs:2143
int GetExpMtp()
Definition: Card.cs:2965
int c_daysWithPC
Definition: Card.cs:1485
bool IsMeleeWeapon
Definition: Card.cs:2241
string c_color
Definition: Card.cs:1545
Card SetHidden(bool hide=true)
Definition: Card.cs:5796
string NameSimple
Definition: Card.cs:2139
void SetSale(bool sale)
Definition: Card.cs:7155
bool isFireproof
Definition: Card.cs:674
void SetRandomTalk()
Definition: Card.cs:6901
bool IsChildOf(Card c)
Definition: Card.cs:2661
int rarityLv
Definition: Card.cs:302
void SetFreePos(Point point)
Definition: Card.cs:6269
virtual bool isChara
Definition: Card.cs:2083
int GetDaysTogetherBonus()
Definition: Card.cs:2988
void RefreshColor()
Definition: Card.cs:6003
virtual Thing Thing
Definition: Card.cs:2058
BedType c_bedType
Definition: Card.cs:940
int turn
Definition: Card.cs:65
Card GetRootCard()
Definition: Card.cs:3426
virtual void SetImage(Image image)
Definition: Card.cs:6091
int Evalue(int ele)
Definition: Card.cs:2571
virtual bool CanStackTo(Thing to)
Definition: Card.cs:3392
int Dist(Card c)
Definition: Card.cs:7644
TraitShackle GetRestrainer()
Definition: Card.cs:7113
Thing SetNoSell()
Definition: Card.cs:3509
int c_bill
Definition: Card.cs:1281
void Mod()
Definition: Card.cs:2511
void CheckJustCooked()
Definition: Card.cs:6603
byte[] c_textureData
Definition: Card.cs:1929
virtual void WriteNote(UINote n, Action< UINote > onWriteNote=null, IInspect.NoteMode mode=IInspect.NoteMode.Default, Recipe recipe=null)
Definition: Card.cs:7825
int colorInt
Definition: Card.cs:108
int invX
Definition: Card.cs:1943
bool isHidden
Definition: Card.cs:530
int idSkin
Definition: Card.cs:362
void MoveImmediate(Point p, bool focus=true, bool cancelAI=true)
Definition: Card.cs:5813
bool CanReserve(AIAct act)
Definition: Card.cs:2492
bool isOn
Definition: Card.cs:542
virtual void OnSerializing()
Definition: Card.cs:2686
Thing SetPriceFix(int a)
Definition: Card.cs:7144
virtual bool IsPCFaction
Definition: Card.cs:2269
Window.SaveData c_windowSaveData
Definition: Card.cs:1821
bool isGifted
Definition: Card.cs:782
int ResistLv(int res)
Definition: Card.cs:5895
bool IsLightsource
Definition: Card.cs:2171
bool isPlayerCreation
Definition: Card.cs:494
int _z
Definition: Card.cs:182
virtual bool HasHost
Definition: Card.cs:2423
BlessedState blessedState
Definition: Card.cs:278
int H
Definition: Card.cs:2366
Thing Duplicate(int num)
Definition: Card.cs:3444
int _colorInt
Definition: Card.cs:67
virtual int PrefIndex
Definition: Card.cs:2312
bool isStolen
Definition: Card.cs:854
virtual bool IsGlobal
Definition: Card.cs:2283
void PlaySoundDrop(bool spatial=true)
Definition: Card.cs:6130
PlaceState _placeState
Definition: Card.cs:290
ref Color GetRandomColor()
Definition: Card.cs:6045
int dir
Definition: Card.cs:146
int c_uidZone
Definition: Card.cs:1111
bool isScaled
Definition: Card.cs:914
int W
Definition: Card.cs:2354
bool TryStackTo(Thing to)
Definition: Card.cs:3397
virtual bool IsPCFactionMinion
Definition: Card.cs:2155
bool IsBlessed
Definition: Card.cs:2253
Card Install()
Definition: Card.cs:3741
void ApplyBacker(int bid)
Definition: Card.cs:6973
Thing c_copyContainer
Definition: Card.cs:1809
bool ShouldShowMsg
Definition: Card.cs:2454
void TryUnrestrain(bool force=false, Chara c=null)
Definition: Card.cs:7077
Card parentCard
Definition: Card.cs:103
bool c_isDisableStockUse
Definition: Card.cs:1084
RescueState c_rescueState
Definition: Card.cs:1209
Emo lastEmo
Definition: Card.cs:95
bool noSnow
Definition: Card.cs:758
void SetImage(Image image, int dir, int idSkin=0)
Definition: Card.cs:6086
virtual CardRow sourceCard
Definition: Card.cs:2131
void ModExp(string alias, int a)
Definition: Card.cs:2648
List< Element > ListCraftBonusTraits()
Definition: Card.cs:6940
string c_idRefName
Definition: Card.cs:1641
void SetRandomDir()
Definition: Card.cs:6207
bool noShadow
Definition: Card.cs:818
int GetLightRadius()
Definition: Card.cs:6404
DNA c_DNA
Definition: Card.cs:1881
int ChildrenAndSelfWeight
Definition: Card.cs:2041
int GetTotalQuality(bool applyBonus=true)
Definition: Card.cs:3836
bool isModified
Definition: Card.cs:470
float animeCounter
Definition: Card.cs:73
Thing Add(string id, int num=1, int lv=1)
Definition: Card.cs:3081
int genLv
Definition: Card.cs:194
virtual void Tick()
Definition: Card.cs:7125
int Num
Definition: Card.cs:158
int _x
Definition: Card.cs:170
Color LightColor
Definition: Card.cs:1108
void PlayAnime(AnimeID id, bool force=false)
Definition: Card.cs:6164
SourceCategory.Row category
Definition: Card.cs:2049
void SetDeconstruct(bool deconstruct)
Definition: Card.cs:7703
bool c_isTrained
Definition: Card.cs:1060
int posInvX
Definition: Card.cs:338
void Inspect()
Definition: Card.cs:7829
virtual void SetSortVal(UIList.SortMode m, CurrencyType currency=CurrencyType.Money)
Definition: Card.cs:7724
byte[] GetPaintData()
Definition: Card.cs:7032
UniqueData c_uniqueData
Definition: Card.cs:1773
bool IsWeapon
Definition: Card.cs:2206
Vector3 InspectPosition
Definition: Card.cs:2485
void ModNum(int a, bool notify=true)
Definition: Card.cs:3515
bool isLeashed
Definition: Card.cs:842
T FindTool< T >()
Definition: Card.cs:2666
virtual void ChangeRarity(Rarity q)
Definition: Card.cs:3920
bool IsIdentified
Definition: Card.cs:2377
bool IsContainer
Definition: Card.cs:2089
bool isReplica
Definition: Card.cs:698
bool freePos
Definition: Card.cs:518
int c_charges
Definition: Card.cs:1269
SourceCategory.Row _category
Definition: Card.cs:89
SocketData AddRune(int idEle, int v, bool free)
Definition: Card.cs:3603
void SayRaw(string text, string ref1=null, string ref2=null)
Definition: Card.cs:6776
virtual int GetArmorSkill()
Definition: Card.cs:4033
int GetValue(PriceType priceType=PriceType.Default, bool sell=false)
Definition: Card.cs:7171
void PlayEffect(int ele, bool useRenderPos=true, float range=0f)
Definition: Card.cs:6189
List< int > sockets
Definition: Card.cs:47
bool _IsPC
Definition: Card.cs:2145
void RemoveCard(Card c)
Definition: Card.cs:3095
string c_editorTraitVal
Definition: Card.cs:1713
CardRenderer renderer
Definition: Card.cs:61
int c_fur
Definition: Card.cs:1329
void AddExp(int a, bool applyMod=true)
Definition: Card.cs:2951
void KillAnime()
Definition: Card.cs:6159
virtual bool flipX
Definition: Card.cs:2116
void SpawnLoot(Card origin)
Definition: Card.cs:5110
bool HasElement(int ele, bool includeNagative=false)
Definition: Card.cs:5900
void ClearPaintSprite()
Definition: Card.cs:7050
string GetFoodName(string s)
Definition: Card.cs:5695
VisitorState visitorState
Definition: Card.cs:1197
void TalkRaw(string text, string ref1=null, string ref2=null, bool forceSync=false)
Definition: Card.cs:6739
int LV
Definition: Card.cs:386
bool isBackerContent
Definition: Card.cs:925
Card ChangeMaterial(SourceMaterial.Row row, bool ignoreFixedMaterial=false)
Definition: Card.cs:3051
virtual bool isSynced
Definition: Card.cs:2087
bool ignoreStackHeight
Definition: Card.cs:638
void ForeachFOV(Func< Point, bool > func)
Definition: Card.cs:7793
void Create(string _id, int _idMat=-1, int genLv=-1)
Definition: Card.cs:2742
AIAct reservedAct
Definition: Card.cs:49
int ResistLvFrom(int ele)
Definition: Card.cs:5890
int QualityLv
Definition: Card.cs:2427
void Say(string lang, string ref1=null, string ref2=null)
Definition: Card.cs:6797
string ApplyTone(string text, bool stripPun=false)
Definition: Card.cs:6843
string c_idRefCard
Definition: Card.cs:1737
Card MakeFoodFrom(Card c)
Definition: Card.cs:5519
Thing MakeEgg(bool effect=true, int num=1, bool addToZone=true, int fertChance=20, BlessedState? state=null)
Definition: Card.cs:5723
int Dist(Point p)
Definition: Card.cs:7683
bool ShowFoodEnc
Definition: Card.cs:2190
bool HasElementNoCopy()
Definition: Card.cs:5928
void RemoveThings()
Definition: Card.cs:3310
void MoveThingToBottom(Thing t)
Definition: CellDetail.cs:45
void MoveThingToTop(Thing t)
Definition: CellDetail.cs:58
Definition: Cell.cs:7
void RemoveCard(Card c)
Definition: Cell.cs:1566
bool IsSnowTile
Definition: Cell.cs:782
bool IsTopWaterAndNoSnow
Definition: Cell.cs:712
void Refresh()
Definition: Cell.cs:1152
bool skipRender
Definition: Cell.cs:270
void AddCard(Card c)
Definition: Cell.cs:1550
void Unequip(Thing thing, bool refresh=true)
Definition: CharaBody.cs:49
AttackStyle GetAttackStyle()
Definition: CharaBody.cs:457
Thing GetEquippedThing(int elementId)
Definition: CharaBody.cs:402
Definition: Chara.cs:10
bool IsHumanSpeak
Definition: Chara.cs:1015
Element MainElement
Definition: Chara.cs:717
CharaBody body
Definition: Chara.cs:94
Card held
Definition: Chara.cs:70
bool IsEyth
Definition: Chara.cs:1052
AIAct ai
Definition: Chara.cs:202
bool isWet
Definition: Chara.cs:142
Condition AddCondition(string id, int p=100, bool force=false)
Definition: Chara.cs:9189
Faction faction
Definition: Chara.cs:427
void ModAffinity(Chara c, int a, bool show=true, bool showOnlyEmo=false)
Definition: Chara.cs:7876
Chara host
Definition: Chara.cs:33
SourceJob.Row job
Definition: Chara.cs:466
void SetFeat(int id, int value=1, bool msg=false)
Definition: Chara.cs:9818
void ShowDialog()
Definition: Chara.cs:6978
override string ToString()
Definition: Chara.cs:1172
Party party
Definition: Chara.cs:43
ElementContainer tempElements
Definition: Chara.cs:36
List< Condition > conditions
Definition: Chara.cs:211
bool HasCondition(string alias)
Definition: Chara.cs:9350
override bool IsDisabled
Definition: Chara.cs:585
bool IsHuman
Definition: Chara.cs:879
bool IsAnimal
Definition: Chara.cs:867
override bool IsPCFaction
Definition: Chara.cs:671
void CalculateMaxStamina()
Definition: Chara.cs:1999
ConSleep conSleep
Definition: Chara.cs:102
bool IsFriendOrAbove()
Definition: Chara.cs:6564
override int MaxHP
Definition: Chara.cs:708
Stats SAN
Definition: Chara.cs:1158
SourceChara.Row source
Definition: Chara.cs:158
Stats mana
Definition: Chara.cs:1154
FactionMemberType memberType
Definition: Chara.cs:46
Stats stamina
Definition: Chara.cs:1146
Chara parasite
Definition: Chara.cs:30
Card DropHeld(Point dropPos=null)
Definition: Chara.cs:4574
Chara ride
Definition: Chara.cs:27
bool IsUndead
Definition: Chara.cs:891
void AddCooldown(int idEle, int turns=0)
Definition: Chara.cs:8600
Thing MakeGene(DNA.Type? type=null)
Definition: Chara.cs:8094
Affinity affinity
Definition: Chara.cs:314
void ModCorruption(int a)
Definition: Chara.cs:9760
Religion faith
Definition: Chara.cs:439
Chara enemy
Definition: Chara.cs:86
Chara SetEnemy(Chara c=null)
Definition: Chara.cs:6246
void SyncRide()
Definition: Chara.cs:3901
void DoHostileAction(Card _tg, bool immediate=false)
Definition: Chara.cs:6295
bool isBlind
Definition: Chara.cs:130
Thing EQ_ID(string s, int mat=-1, Rarity r=Rarity.Random)
Definition: Chara.cs:5022
bool IsMachine
Definition: Chara.cs:903
bool IsHostile()
Definition: Chara.cs:6472
bool isDead
Definition: Chara.cs:389
void Cure(CureType type, int p=100, BlessedState state=BlessedState.Normal)
Definition: Chara.cs:9442
void TrySetEnemy(Chara c)
Definition: Chara.cs:6263
bool HasCooldown(int idEle)
Definition: Chara.cs:8651
void CalcBurden()
Definition: Chara.cs:1819
SourceRace.Row race
Definition: Chara.cs:464
bool Has(string id)
Definition: CodexManager.cs:36
bool DroppedCard(string id)
Definition: CodexManager.cs:46
CodexCreature GetOrCreate(string id)
Definition: CodexManager.cs:9
void AddKill(string id)
Definition: CodexManager.cs:55
void MarkCardDrop(string id)
Definition: CodexManager.cs:41
BlockColors blockColors
UD_String_LightData lightColors
UD_String_MatData matColors
Definition: ConDim.cs:2
Definition: ConWet.cs:2
virtual void OnCalculateFov(Fov fov, ref int radius, ref float power)
Definition: Condition.cs:75
void Kill(bool silent=false)
Definition: Condition.cs:91
virtual void OnCreateFov(Fov fov)
Definition: Condition.cs:79
bool dontCancelIfZeroDamage
Definition: CoreConfig.cs:558
new GameConfig game
Definition: CoreConfig.cs:609
GraphicSetting graphic
Definition: CoreConfig.cs:607
OtherSetting other
Definition: CoreConfig.cs:619
bool godMode
Definition: CoreDebug.cs:173
bool godFood
Definition: CoreDebug.cs:183
bool enable
Definition: CoreDebug.cs:286
bool testThingQuality
Definition: CoreDebug.cs:215
Sprite defaultAbility
Definition: CoreRef.cs:118
RectData center
Definition: CoreRef.cs:166
Icons icons
Definition: CoreRef.cs:355
Rects rects
Definition: CoreRef.cs:361
CoreRef refs
Definition: Core.cs:51
bool IsGameStarted
Definition: Core.cs:84
CoreConfig config
Definition: Core.cs:70
Definition: DNA.cs:8
static Thing CopyDNA(Thing from, Thing to)
Definition: DNA.cs:142
static Thing GenerateRandomGene(int lv=-1, int seed=-1)
Definition: DNA.cs:150
void Add(Card target, Card attacker, int dmg, Element e=null)
int GetRaw(int offsetHours=0)
Definition: Date.cs:326
int day
Definition: Date.cs:62
bool IsNight
Definition: Date.cs:112
int GetRawDay()
Definition: Date.cs:331
PeriodOfDay periodOfDay
Definition: Date.cs:128
Definition: Dice.cs:5
static int Roll(int num, int sides, int bonus=0, Card card=null)
Definition: Dice.cs:48
Definition: EClass.cs:6
static Game game
Definition: EClass.cs:9
static Scene scene
Definition: EClass.cs:31
static ColorProfile Colors
Definition: EClass.cs:39
static int curve(int _a, int start, int step, int rate=75)
Definition: EClass.cs:69
static Core core
Definition: EClass.cs:7
static Zone _zone
Definition: EClass.cs:21
static World world
Definition: EClass.cs:41
static Map _map
Definition: EClass.cs:19
static int rnd(long a)
Definition: EClass.cs:59
static SourceManager sources
Definition: EClass.cs:43
static float rndf(float a)
Definition: EClass.cs:102
static FactionBranch Branch
Definition: EClass.cs:23
static BaseGameScreen screen
Definition: EClass.cs:33
static int rndHalf(int a)
Definition: EClass.cs:97
static Player player
Definition: EClass.cs:13
static Chara pc
Definition: EClass.cs:15
static CoreDebug debug
Definition: EClass.cs:49
static SoundManager Sound
Definition: EClass.cs:47
static UI ui
Definition: EClass.cs:17
static GameSetting setting
Definition: EClass.cs:35
Definition: Effect.cs:7
Effect _Play(Point from, Vector3 fromV, float fixY=0f, Point to=null, Sprite sprite=null)
Definition: Effect.cs:115
Effect Emit(int num)
Definition: Effect.cs:279
static Effect Get(Effect original)
Definition: Effect.cs:85
Effect SetParticleColor(Color c)
Definition: Effect.cs:289
void SetOwner(Card c, bool applyFeat)
void ModExp(int ele, float a, bool chain=false)
List< Element > ListElements(Func< Element, bool > shoudList=null, Comparison< Element > comparison=null)
Dictionary< int, Element > dict
bool Has(int ele)
int Value(int ele)
void CopyTo(ElementContainer container)
int ValueWithoutLink(int ele)
Element ModBase(int ele, int v)
void ApplyElementMap(int uid, SourceValueType type, Dictionary< int, int > map, int lv, bool invert=false, bool applyFeat=false)
void SetTo(int id, int v)
Element SetBase(string alias, int v, int potential=0)
void Remove(int id)
Element GetOrCreateElement(Element ele)
Element GetElement(string alias)
int ValueWithoutLink
Definition: ELEMENT.cs:294
static int GetResistDamage(int dmg, int v, int power=0)
Definition: ELEMENT.cs:1136
int id
Definition: ELEMENT.cs:250
SourceElement.Row source
Definition: ELEMENT.cs:273
static int GetResistLv(int v)
Definition: ELEMENT.cs:1122
int Value
Definition: ELEMENT.cs:292
bool IsFoodTrait
Definition: ELEMENT.cs:364
static Element Create(int id, int v=0)
Definition: ELEMENT.cs:1098
static Element Void
Definition: ELEMENT.cs:238
bool IsGlobalElement
Definition: ELEMENT.cs:345
bool IsTrait
Definition: ELEMENT.cs:362
static int[] List_MainAttributesMajor
Definition: ELEMENT.cs:242
Dictionary< string, Dictionary< string, string > > all
Definition: ExcelDataList.cs:8
List< Dictionary< string, string > > list
virtual void Initialize()
int Evalue(int ele)
List< Chara > members
PolicyManager policies
HomeResourceManager resources
List< FactionBranch > GetChildren()
Definition: FACTION.cs:202
void AddContribution(int a)
Definition: FACTION.cs:318
Definition: Fov.cs:6
byte b
Definition: Fov.cs:30
byte g
Definition: Fov.cs:28
Dictionary< int, byte > lastPoints
Definition: Fov.cs:36
void Perform(int _x, int _z, int _range, float power=1f)
Definition: Fov.cs:139
byte r
Definition: Fov.cs:26
static string ConvertDrama(string text, Chara c=null)
Definition: GameLang.cs:14
bool enableDamageReduction
bool disableUsermapBenefit
RenderSetting render
Definition: GameSetting.cs:301
UD_String_ElementRef elements
Definition: GameSetting.cs:315
bool snapFreePos
Definition: Game.cs:33
HashSet< Texture2D > loadedTextures
Definition: Game.cs:257
ReligionManager religions
Definition: Game.cs:158
GamePrincipal principal
Definition: Game.cs:224
CardManager cards
Definition: Game.cs:155
Zone activeZone
Definition: Game.cs:251
Config config
Definition: Game.cs:218
QuestManager quests
Definition: Game.cs:182
bool HasBounty(Chara c)
Definition: GuildFighter.cs:44
bool CanGiveContribution(Chara c)
Definition: GuildFighter.cs:26
int BuySpellbookPrice(int a)
Definition: GuildMage.cs:17
int SellStolenPrice(int a)
Definition: GuildThief.cs:17
Definition: Guild.cs:2
static GuildMage Mage
Definition: Guild.cs:58
static GuildFighter Fighter
Definition: Guild.cs:56
bool IsMember
Definition: Guild.cs:72
static GuildThief Thief
Definition: Guild.cs:60
virtual Thing Thing
Definition: HotItem.cs:38
static bool Has(string id)
Definition: LangGame.cs:46
bool stripPuns
Definition: LangSetting.cs:44
int combatTextStyle
Definition: LangSetting.cs:50
bool useTone
Definition: LangSetting.cs:40
Definition: Lang.cs:6
static LangSetting setting
Definition: Lang.cs:54
static NaturalStringComparer comparer
Definition: Lang.cs:22
static string[] GetList(string id)
Definition: Lang.cs:114
static LangGame Game
Definition: Lang.cs:48
static bool isJP
Definition: Lang.cs:38
LayerChara SetChara(Chara c)
Definition: LayerChara.cs:9
static bool IsActive()
Definition: LayerDrama.cs:34
static LayerDrama Instance
Definition: LayerDrama.cs:20
static void SetDirty(Thing t)
static List< LayerInventory > listInv
List< Window > windows
Definition: Layer.cs:116
int radius
Definition: LightData.cs:10
Color color
Definition: LightData.cs:7
static SourceMaterial.Row GetRandomMaterial(int lv, string group=null, bool tryLevelMatTier=false)
Definition: MATERIAL.cs:56
static SourceMaterial.Row GetRandomMaterialFromCategory(int lv, string cat, SourceMaterial.Row fallback)
Definition: MATERIAL.cs:93
Definition: MOD.cs:7
static TalkDataList listTalk
Definition: MOD.cs:10
static ToneDataList tones
Definition: MOD.cs:12
bool IsIndoor
Definition: Map.cs:131
Chara FindChara(string id)
Definition: Map.cs:2568
void TrySmoothPick(Cell cell, Thing t, Chara c)
Definition: Map.cs:1804
void MoveCard(Point p, Card t)
Definition: Map.cs:841
PropsManager props
Definition: Map.cs:91
void OnSetBlockOrDoor(int x, int z)
Definition: Map.cs:1024
PropsStocked Stocked
Definition: Map.cs:121
List< Chara > charas
Definition: Map.cs:81
void AddDecal(int x, int z, int id, int amount=1, bool refresh=true)
Definition: Map.cs:2029
void Add(Point point, float tile=0f, float color=0f)
Definition: MeshPass.cs:122
Color Thinking
Definition: MsgColors.cs:17
Color Talk
Definition: MsgColors.cs:7
Color Ono
Definition: MsgColors.cs:13
Definition: Msg.cs:5
static MsgColors colors
Definition: Msg.cs:20
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
void RemoveMember(Chara c)
Definition: Party.cs:102
List< Chara > members
Definition: Party.cs:19
int landDeedBought
Definition: Player.cs:659
int kills
Definition: Player.cs:87
Flags flags
Definition: Player.cs:1094
CodexManager codex
Definition: Player.cs:1115
RecipeManager recipes
Definition: Player.cs:1097
void ModFame(int a)
Definition: Player.cs:2094
void ModKarma(int a)
Definition: Player.cs:2516
float lightPower
Definition: Player.cs:1197
Stats stats
Definition: Player.cs:1016
int lightRadius
Definition: Player.cs:1189
bool invlunerable
Definition: Player.cs:1173
int customLightMod
Definition: Player.cs:959
int totalFeat
Definition: Player.cs:905
bool forceTalk
Definition: Player.cs:1151
HotItem currentHotItem
Definition: Player.cs:1100
Chara Agent
Definition: Player.cs:1274
Chara chara
Definition: Player.cs:1203
int fame
Definition: Player.cs:881
bool TryAbortAutoCombat(bool immediate=true)
Definition: Player.cs:2410
void RefreshCurrentHotItem()
Definition: Player.cs:2199
Definition: Point.cs:9
void ForeachMultiSize(int w, int h, Action< Point, bool > action)
Definition: Point.cs:1385
ref Vector3 Position(int height)
Definition: Point.cs:548
List< Card > ListCards(bool includeMasked=false)
Definition: Point.cs:1051
RenderParam ApplyAnime(RenderParam p)
Definition: Point.cs:1325
override string ToString()
Definition: Point.cs:524
Point Set(int _x, int _z)
Definition: Point.cs:503
CellDetail detail
Definition: Point.cs:71
bool IsBlocked
Definition: Point.cs:363
int x
Definition: Point.cs:36
Point GetNearestPoint(bool allowBlock=false, bool allowChara=true, bool allowInstalled=true, bool ignoreCenter=false, int minRadius=0)
Definition: Point.cs:619
int z
Definition: Point.cs:39
bool IsSync
Definition: Point.cs:344
SoundSource PlaySound(string id, bool synced=true, float v=1f, bool spatial=true)
Definition: Point.cs:1253
ref Vector3 PositionCenter()
Definition: Point.cs:587
bool IsValid
Definition: Point.cs:88
Effect PlayEffect(string id)
Definition: Point.cs:1248
bool HasObj
Definition: Point.cs:137
void RefreshNeighborTiles()
Definition: Point.cs:1276
Area area
Definition: Point.cs:73
int Distance(Point p)
Definition: Point.cs:989
bool HasBlock
Definition: Point.cs:141
Cell cell
Definition: Point.cs:51
bool HasChara
Definition: Point.cs:238
bool IsActive(int id, int days=-1)
List< Card > sales
Definition: PropsManager.cs:14
void OnCardAddedToZone(Card c)
Definition: PropsManager.cs:25
List< Card > deconstructing
Definition: PropsManager.cs:12
Definition: Props.cs:7
void Add(Card t)
Definition: Props.cs:63
void OnNumChange(Card c, int a)
Definition: Props.cs:160
void Remove(Card t)
Definition: Props.cs:115
List< Quest > list
Definition: QuestManager.cs:11
Definition: Quest.cs:7
virtual void OnKillChara(Chara c)
Definition: Quest.cs:548
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
HashSet< string > knownIngredients
Definition: Recipe.cs:7
ReligionHarvest Harvest
ReligionLuck Luck
ReligionHealing Healing
static Religion recentWrath
Definition: Religion.cs:22
virtual string id
Definition: Religion.cs:26
static RenderParam shared
Definition: RenderParam.cs:5
bool multisize
Definition: RenderRow.cs:64
string[] tag
Definition: RenderRow.cs:58
SourceCategory.Row Category
Definition: RenderRow.cs:119
SourcePref pref
Definition: RenderRow.cs:68
bool HasTag(CTAG _tag)
Definition: RenderRow.cs:125
bool useAltColor
Definition: RenderRow.cs:80
string category
Definition: RenderRow.cs:46
bool useRandomColor
Definition: RenderRow.cs:83
TileType tileType
Definition: RenderRow.cs:77
int[] _tiles
Definition: RenderRow.cs:12
void SetImage(Image image, Sprite sprite=null, int matCol=0, bool setNativeSize=true, int dir=0, int idSkin=0, Card card=null)
Definition: RenderRow.cs:351
int[] tiles
Definition: RenderRow.cs:10
Sprite GetSprite(int dir=0, int skin=0, bool snow=false)
Definition: RenderRow.cs:261
SourceMaterial.Row DefaultMaterial
Definition: RenderRow.cs:86
int colorMod
Definition: RenderRow.cs:16
int LV
Definition: RenderRow.cs:22
bool fixedMaterial
Definition: RenderRow.cs:66
AnimationCurve fovCurveChara
SceneGlobalProfile global
Definition: SceneProfile.cs:6
SceneLightProfile light
Definition: SceneProfile.cs:10
DamageTextRenderer damageTextRenderer
Definition: Scene.cs:109
float timeRatio
Definition: Scene.cs:130
ActionMode actionMode
Definition: Scene.cs:79
SceneProfile profile
Definition: Scene.cs:75
bool isActive
Definition: ScreenGuide.cs:15
MeshPass passGuideBlock
Definition: ScreenGuide.cs:5
bool isFree
Definition: SocketData.cs:54
Type type
Definition: SocketData.cs:18
Dictionary< string, CardRow > map
Definition: SourceCard.cs:8
bool IsChildOf(string id)
string GetText(string id="name", bool returnNull=false)
Definition: SourceData.cs:553
string TryGetId(string id, string id2)
Definition: SourceLang.cs:34
SourceMaterial materials
SourceCard cards
SourceBacker backers
SourceCategory categories
SourceElement elements
SourceChara charas
bool Float
Definition: SourcePref.cs:316
string[] food
Definition: SourceRace.cs:89
virtual bool IsRegion
Definition: Spatial.cs:515
int influence
Definition: Spatial.cs:214
static SpawnList Get(string id, string parent=null, CardFilter filter=null)
Definition: SpawnList.cs:18
CardRow Select(int lv=-1, int levelRange=-1)
Definition: SpawnList.cs:139
SourcePref pref
Definition: SpriteData.cs:23
Sprite GetSprite(bool snow=false)
Definition: SpriteData.cs:67
SpriteData data
static Dictionary< string, SpriteReplacer > dictSkins
virtual void Mod(int a)
Definition: Stats.cs:135
virtual int value
Definition: Stats.cs:56
virtual int max
Definition: Stats.cs:68
static SubPassData Default
Definition: SubPassData.cs:7
string GetTalk(string id, string idTopic, bool useDefault=false, bool human=true)
Definition: TalkDataList.cs:23
string GetRandomID(string tag)
Definition: TalkDataList.cs:58
List< Thing > List(Func< Thing, bool > func, bool onlyAccessible=false)
void SetOwner(Card owner)
Thing Find(int uid)
void OnAdd(Thing t)
Thing TryStack(Thing target, int destInvX=-1, int destInvY=-1)
void AddCurrency(Card owner, string id, int a, SourceMaterial.Row mat=null)
DestData GetDest(Thing t, bool tryStack=true)
void OnRemove(Thing t)
void Foreach(Action< Thing > action, bool onlyAccessible=true)
int GetCurrency(string id, ref int sum, SourceMaterial.Row mat=null)
static Thing CreateFromFilter(string id, int lv=-1)
Definition: ThingGen.cs:63
static Thing CreateFromCategory(string idCat, int lv=-1)
Definition: ThingGen.cs:75
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
void TryLickEnchant(Chara c, bool msg=true, Chara tg=null, BodySlot slot=null)
Definition: Thing.cs:2002
bool CanSearchContents
Definition: Thing.cs:100
override CardRow sourceCard
Definition: Thing.cs:47
int id
Definition: TileRow.cs:8
virtual void GetMountHeight(ref Vector3 v, Point p, int d, Card target=null)
Definition: TileType.cs:383
virtual int MaxAltitude
Definition: TileType.cs:208
virtual bool UseMountHeight
Definition: TileType.cs:221
static TileTypeDoor Door
Definition: TileType.cs:95
StringBuilder ApplyTone(string id, ref string text, int gender)
Definition: ToneDataList.cs:11
string GetToneID(string id, int gender)
Definition: ToneDataList.cs:58
SourceElement.Row source
Definition: TraitMod.cs:11
static Thing MakeRandomSeed(bool enc=false)
Definition: TraitSeed.cs:192
Definition: Trait.cs:7
virtual bool CanBeAttacked
Definition: Trait.cs:166
virtual bool ShouldRefreshTile
Definition: Trait.cs:76
virtual void OnChangePlaceState(PlaceState state)
Definition: Trait.cs:681
virtual float DropChance
Definition: Trait.cs:360
virtual int GetValue()
Definition: Trait.cs:589
virtual bool CanChildDecay(Card c)
Definition: Trait.cs:1068
virtual bool CanBeDestroyed
Definition: Trait.cs:296
virtual void SetOwner(Card _owner)
Definition: Trait.cs:642
virtual bool HasCharges
Definition: Trait.cs:330
virtual bool IsLightOn
Definition: Trait.cs:415
virtual bool IsDoor
Definition: Trait.cs:57
virtual void Toggle(bool on, bool silent=false)
Definition: Trait.cs:1157
virtual int IdSkin
Definition: Trait.cs:45
virtual void OnSimulateHour(VirtualDate date)
Definition: Trait.cs:693
virtual bool CanBeTeleported
Definition: Trait.cs:168
virtual EffectDead EffectDead
Definition: Trait.cs:252
virtual void OnCreate(int lv)
Definition: Trait.cs:669
virtual ToggleType ToggleType
Definition: Trait.cs:471
virtual bool ShouldTryRefreshRoom
Definition: Trait.cs:87
virtual bool CanBeSmashedToDeath
Definition: Trait.cs:298
virtual bool LevelAsQuality
Definition: Trait.cs:194
virtual int Decay
Definition: Trait.cs:122
void Uninstall()
Definition: Trait.cs:1109
virtual int CompareTo(Card b)
Definition: Trait.cs:721
virtual bool IsContainer
Definition: Trait.cs:214
virtual ThrowType ThrowType
Definition: Trait.cs:250
virtual int InstallBottomPriority
Definition: Trait.cs:89
void Install(bool byPlayer)
Definition: Trait.cs:1089
static void Reserve(string idStep, Action onBeforePlay=null)
Definition: Tutorial.cs:55
Definition: UIList.cs:9
SortMode
Definition: UIList.cs:27
Definition: UINote.cs:6
bool IsRealTime
Definition: VirtualDate.cs:7
static WidgetCurrentTool Instance
static void RefreshCurrentHotItem()
ButtonGrid selectedButton
bool excludeCraft
Definition: Window.cs:379
Definition: Window.cs:13
static Dictionary< string, SaveData > dictData
Definition: Window.cs:594
GameDate date
Definition: World.cs:6
ZoneEventManager events
Definition: Zone.cs:40
bool isStarted
Definition: Zone.cs:70
virtual bool IsUserZone
Definition: Zone.cs:268
bool TryAddThing(Thing target, Point p, bool destroyIfFail=false)
Definition: Zone.cs:2199
void ModInfluence(int a)
Definition: Zone.cs:3578
override int DangerLv
Definition: Zone.cs:107
bool IsPCFaction
Definition: Zone.cs:470
Card AddCard(Card t, Point point)
Definition: Zone.cs:1959
void RemoveCard(Card c)
void OnChildNumChange(Card c)
ICardParent GetRoot()
NoteMode
Definition: IInspect.cs:7
Definition: ActRef.cs:2
void SetInt(int i)
Definition: BitArray32.cs:89
int ToInt()
Definition: BitArray32.cs:84
bool demo
Definition: Version.cs:14