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