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