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