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