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