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