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