Commit 425a88e3e7249bd2efb003dc1e95bf29ddcddef3

Authored by DarkGod
1 parent 3918db47

correctly handle "wrong" state parameters to projectors (due to many times using…

… as the dam parameter a self:fooCrit() which returns 2 values)
... ... @@ -20,6 +20,12 @@
20 20 local print = print
21 21 if not config.settings.cheat then print = function() end end
22 22
  23 +function initState(state)
  24 + if state == nil then return {}
  25 + elseif state == true or state == false then return {}
  26 + else return state end
  27 +end
  28 +
23 29 -- Loads the implicit crit if one has not been passed.
24 30 function DamageType.useImplicitCrit(src, state)
25 31 if state.crit_set then return end
... ... @@ -42,7 +48,7 @@ setDefaultProjector(function(src, x, y, type, dam, state)
42 48 if not game.level.map:isBound(x, y) then return 0 end
43 49
44 50 -- Manage crits.
45   - state = state or {}
  51 + state = initState(state)
46 52 useImplicitCrit(src, state)
47 53 local crit_type = state.crit_type
48 54 local crit_power = state.crit_power
... ... @@ -649,7 +655,7 @@ newDamageType{
649 655 newDamageType{
650 656 name = "physical", type = "PHYSICAL",
651 657 projector = function(src, x, y, type, dam, state)
652   - state = state or {}
  658 + state = initState(state)
653 659 useImplicitCrit(src, state)
654 660 local realdam = DamageType.defaultProjector(src, x, y, type, dam, state)
655 661
... ... @@ -674,7 +680,7 @@ newDamageType{
674 680 name = "fire", type = "FIRE", text_color = "#LIGHT_RED#",
675 681 antimagic_resolve = true,
676 682 projector = function(src, x, y, type, dam, state)
677   - state = state or {}
  683 + state = initState(state)
678 684 useImplicitCrit(src, state)
679 685 if src.fire_convert_to then
680 686 if src.fire_convert_to[2] >= 100 then
... ... @@ -702,7 +708,7 @@ newDamageType{
702 708 name = "cold", type = "COLD", text_color = "#1133F3#",
703 709 antimagic_resolve = true,
704 710 projector = function(src, x, y, type, dam, state)
705   - state = state or {}
  711 + state = initState(state)
706 712 useImplicitCrit(src, state)
707 713 local a = game.level.map(x, y, Map.ACTOR)
708 714 local acheive = a and src.player and not a.training_dummy and a ~= src
... ... @@ -721,7 +727,7 @@ newDamageType{
721 727 name = "lightning", type = "LIGHTNING", text_color = "#ROYAL_BLUE#",
722 728 antimagic_resolve = true,
723 729 projector = function(src, x, y, type, dam, state)
724   - state = state or {}
  730 + state = initState(state)
725 731 useImplicitCrit(src, state)
726 732 local realdam = DamageType.defaultProjector(src, x, y, type, dam, state)
727 733 if realdam > 0 and src:attr("lightning_brainlocks") then
... ... @@ -740,7 +746,7 @@ newDamageType{
740 746 name = "acid", type = "ACID", text_color = "#GREEN#",
741 747 antimagic_resolve = true,
742 748 projector = function(src, x, y, type, dam, state)
743   - state = state or {}
  749 + state = initState(state)
744 750 useImplicitCrit(src, state)
745 751 local target = game.level.map(x, y, Map.ACTOR)
746 752 local realdam = DamageType.defaultProjector(src, x, y, type, dam, state)
... ... @@ -758,7 +764,7 @@ newDamageType{
758 764 name = "nature", type = "NATURE", text_color = "#LIGHT_GREEN#",
759 765 antimagic_resolve = true,
760 766 projector = function(src, x, y, type, dam, state)
761   - state = state or {}
  767 + state = initState(state)
762 768 useImplicitCrit(src, state)
763 769 local target = game.level.map(x, y, Map.ACTOR)
764 770 local realdam = DamageType.defaultProjector(src, x, y, type, dam, state)
... ... @@ -775,7 +781,7 @@ newDamageType{
775 781 name = "blight", type = "BLIGHT", text_color = "#DARK_GREEN#",
776 782 antimagic_resolve = true,
777 783 projector = function(src, x, y, type, dam, state)
778   - state = state or {}
  784 + state = initState(state)
779 785 useImplicitCrit(src, state)
780 786 local realdam = DamageType.defaultProjector(src, x, y, type, dam, state)
781 787 local target = game.level.map(x, y, Map.ACTOR)
... ... @@ -801,7 +807,7 @@ newDamageType{
801 807 antimagic_resolve = true,
802 808 death_message = {"shadowed", "darkened", "swallowed by the void"},
803 809 projector = function(src, x, y, type, dam, state)
804   - state = state or {}
  810 + state = initState(state)
805 811 useImplicitCrit(src, state)
806 812 local realdam = DamageType.defaultProjector(src, x, y, type, dam, state)
807 813 local target = game.level.map(x, y, Map.ACTOR)
... ... @@ -819,7 +825,7 @@ newDamageType{
819 825 newDamageType{
820 826 name = "mind", type = "MIND", text_color = "#YELLOW#",
821 827 projector = function(src, x, y, type, dam, state)
822   - state = state or {}
  828 + state = initState(state)
823 829 useImplicitCrit(src, state)
824 830 local target = game.level.map(x, y, Map.ACTOR)
825 831 local thought_form
... ... @@ -848,7 +854,7 @@ newDamageType{
848 854 newDamageType{
849 855 name = "winter", type = "WINTER",
850 856 projector = function(src, x, y, type, dam, state)
851   - state = state or {}
  857 + state = initState(state)
852 858 useImplicitCrit(src, state)
853 859 local srcx, srcy = dam.x, dam.y
854 860 local base = dam
... ... @@ -871,7 +877,7 @@ newDamageType{
871 877 name = "temporal", type = "TEMPORAL", text_color = "#LIGHT_STEEL_BLUE#",
872 878 antimagic_resolve = true,
873 879 projector = function(src, x, y, type, dam, state)
874   - state = state or {}
  880 + state = initState(state)
875 881 useImplicitCrit(src, state)
876 882 local realdam = DamageType.defaultProjector(src, x, y, type, dam, state)
877 883
... ... @@ -889,7 +895,7 @@ newDamageType{
889 895 newDamageType{
890 896 name = "temporal stun", type = "TEMPORALSTUN",
891 897 projector = function(src, x, y, type, dam, state)
892   - state = state or {}
  898 + state = initState(state)
893 899 useImplicitCrit(src, state)
894 900 DamageType:get(DamageType.TEMPORAL).projector(src, x, y, DamageType.TEMPORAL, dam, state)
895 901 local target = game.level.map(x, y, Map.ACTOR)
... ... @@ -907,7 +913,7 @@ newDamageType{
907 913 newDamageType{
908 914 name = "lite", type = "LITE", text_color = "#YELLOW#",
909 915 projector = function(src, x, y, type, dam, state)
910   - state = state or {}
  916 + state = initState(state)
911 917 useImplicitCrit(src, state)
912 918 -- Counter magical unlite level before lighting grids
913 919 local g = game.level.map(x, y, Map.TERRAIN+1)
... ... @@ -923,7 +929,7 @@ newDamageType{
923 929 newDamageType{
924 930 name = "illumination", type = "BREAK_STEALTH",
925 931 projector = function(src, x, y, type, dam, state)
926   - state = state or {}
  932 + state = initState(state)
927 933 useImplicitCrit(src, state)
928 934 -- Dont lit magically unlit grids
929 935 local a = game.level.map(x, y, Map.ACTOR)
... ... @@ -937,7 +943,7 @@ newDamageType{
937 943 newDamageType{
938 944 name = "silence", type = "SILENCE",
939 945 projector = function(src, x, y, type, dam, state)
940   - state = state or {}
  946 + state = initState(state)
941 947 useImplicitCrit(src, state)
942 948 local target = game.level.map(x, y, Map.ACTOR)
943 949 if target then
... ... @@ -954,7 +960,7 @@ newDamageType{
954 960 newDamageType{
955 961 name = "arcane silence", type = "ARCANE_SILENCE", text_color = "#PURPLE#",
956 962 projector = function(src, x, y, type, dam, state)
957   - state = state or {}
  963 + state = initState(state)
958 964 useImplicitCrit(src, state)
959 965 local chance = 100
960 966 if _G.type(dam) == "table" then dam, chance = dam.dam, dam.chance end
... ... @@ -976,7 +982,7 @@ newDamageType{
976 982 newDamageType{
977 983 name = "silence", type = "RANDOM_SILENCE",
978 984 projector = function(src, x, y, type, dam, state)
979   - state = state or {}
  985 + state = initState(state)
980 986 useImplicitCrit(src, state)
981 987 local target = game.level.map(x, y, Map.ACTOR)
982 988 if target and rng.percent(dam) then
... ... @@ -993,7 +999,7 @@ newDamageType{
993 999 newDamageType{
994 1000 name = "blindness", type = "BLIND",
995 1001 projector = function(src, x, y, type, dam, state)
996   - state = state or {}
  1002 + state = initState(state)
997 1003 useImplicitCrit(src, state)
998 1004 local target = game.level.map(x, y, Map.ACTOR)
999 1005 if target then
... ... @@ -1008,7 +1014,7 @@ newDamageType{
1008 1014 newDamageType{
1009 1015 name = "blindness", type = "BLINDPHYSICAL",
1010 1016 projector = function(src, x, y, type, dam, state)
1011   - state = state or {}
  1017 + state = initState(state)
1012 1018 useImplicitCrit(src, state)
1013 1019 local target = game.level.map(x, y, Map.ACTOR)
1014 1020 if target then
... ... @@ -1023,7 +1029,7 @@ newDamageType{
1023 1029 newDamageType{
1024 1030 name = "blinding ink", type = "BLINDING_INK",
1025 1031 projector = function(src, x, y, type, dam, state)
1026   - state = state or {}
  1032 + state = initState(state)
1027 1033 useImplicitCrit(src, state)
1028 1034 local target = game.level.map(x, y, Map.ACTOR)
1029 1035 if target then
... ... @@ -1038,7 +1044,7 @@ newDamageType{
1038 1044 newDamageType{
1039 1045 name = "blindness", type = "BLINDCUSTOMMIND",
1040 1046 projector = function(src, x, y, type, dam, state)
1041   - state = state or {}
  1047 + state = initState(state)
1042 1048 useImplicitCrit(src, state)
1043 1049 local target = game.level.map(x, y, Map.ACTOR)
1044 1050 if target then
... ... @@ -1055,7 +1061,7 @@ newDamageType{
1055 1061 newDamageType{
1056 1062 name = "bright light", type = "LITE_LIGHT",
1057 1063 projector = function(src, x, y, type, dam, state)
1058   - state = state or {}
  1064 + state = initState(state)
1059 1065 useImplicitCrit(src, state)
1060 1066 DamageType:get(DamageType.LITE).projector(src, x, y, DamageType.LITE, 1, state)
1061 1067 return DamageType:get(DamageType.LIGHT).projector(src, x, y, DamageType.LIGHT, dam, state)
... ... @@ -1066,7 +1072,7 @@ newDamageType{
1066 1072 newDamageType{
1067 1073 name = "fire burn", type = "FIREBURN", text_color = "#LIGHT_RED#",
1068 1074 projector = function(src, x, y, type, dam, state)
1069   - state = state or {}
  1075 + state = initState(state)
1070 1076 useImplicitCrit(src, state)
1071 1077 local dur = 3
1072 1078 local perc = 50
... ... @@ -1087,7 +1093,7 @@ newDamageType{
1087 1093 newDamageType{
1088 1094 name = "stunning fire", type = "FIRE_STUN", text_color = "#LIGHT_RED#",
1089 1095 projector = function(src, x, y, type, dam, state)
1090   - state = state or {}
  1096 + state = initState(state)
1091 1097 useImplicitCrit(src, state)
1092 1098 local chance = 25
1093 1099 local dur = 3
... ... @@ -1110,7 +1116,7 @@ newDamageType{
1110 1116 newDamageType{
1111 1117 name = "fire burn", type = "GOLEM_FIREBURN",
1112 1118 projector = function(src, x, y, type, dam, state)
1113   - state = state or {}
  1119 + state = initState(state)
1114 1120 useImplicitCrit(src, state)
1115 1121 local realdam = 0
1116 1122 local target = game.level.map(x, y, Map.ACTOR)
... ... @@ -1125,7 +1131,7 @@ newDamageType{
1125 1131 newDamageType{
1126 1132 name = "devouring flames", type = "FIRE_DRAIN", text_color = "#LIGHT_RED#",
1127 1133 projector = function(src, x, y, type, dam, state)
1128   - state = state or {}
  1134 + state = initState(state)
1129 1135 useImplicitCrit(src, state)
1130 1136 if _G.type(dam) == "number" then dam = {dam=dam, healfactor=0.1} end
1131 1137 local target = game.level.map(x, y, Map.ACTOR) -- Get the target first to make sure we heal even on kill
... ... @@ -1142,7 +1148,7 @@ newDamageType{
1142 1148 newDamageType{
1143 1149 name = "shadowflame", type = "SHADOWFLAME", text_color = "#BF7F73#",
1144 1150 projector = function(src, x, y, type, dam, state)
1145   - state = state or {}
  1151 + state = initState(state)
1146 1152 useImplicitCrit(src, state)
1147 1153 DamageType:get(DamageType.FIRE).projector(src, x, y, DamageType.FIRE, dam / 2, state)
1148 1154 DamageType:get(DamageType.DARKNESS).projector(src, x, y, DamageType.DARKNESS, dam / 2, state)
... ... @@ -1153,7 +1159,7 @@ newDamageType{
1153 1159 newDamageType{
1154 1160 name = "darkness", type = "DARKSTUN",
1155 1161 projector = function(src, x, y, type, dam, state)
1156   - state = state or {}
  1162 + state = initState(state)
1157 1163 useImplicitCrit(src, state)
1158 1164 DamageType:get(DamageType.DARKNESS).projector(src, x, y, DamageType.DARKNESS, dam, state)
1159 1165 local target = game.level.map(x, y, Map.ACTOR)
... ... @@ -1172,7 +1178,7 @@ newDamageType{
1172 1178 newDamageType{
1173 1179 name = "darkness", type = "MINION_DARKNESS",
1174 1180 projector = function(src, x, y, type, dam, state)
1175   - state = state or {}
  1181 + state = initState(state)
1176 1182 useImplicitCrit(src, state)
1177 1183 local target = game.level.map(x, y, Map.ACTOR)
1178 1184 if target and (not target.necrotic_minion or target.summoner ~= src) then
... ... @@ -1185,7 +1191,7 @@ newDamageType{
1185 1191 newDamageType{
1186 1192 name = "fire", type = "FIRE_FRIENDS",
1187 1193 projector = function(src, x, y, type, dam, state)
1188   - state = state or {}
  1194 + state = initState(state)
1189 1195 useImplicitCrit(src, state)
1190 1196 local target = game.level.map(x, y, Map.ACTOR)
1191 1197 if target and target.summoner ~= src then
... ... @@ -1198,7 +1204,7 @@ newDamageType{
1198 1204 newDamageType{
1199 1205 name = "cold", type = "COLDSTUN",
1200 1206 projector = function(src, x, y, type, dam, state)
1201   - state = state or {}
  1207 + state = initState(state)
1202 1208 useImplicitCrit(src, state)
1203 1209 DamageType:get(DamageType.COLD).projector(src, x, y, DamageType.COLD, dam, state)
1204 1210 local target = game.level.map(x, y, Map.ACTOR)
... ... @@ -1216,7 +1222,7 @@ newDamageType{
1216 1222 newDamageType{
1217 1223 name = "flameshock", type = "FLAMESHOCK",
1218 1224 projector = function(src, x, y, type, dam, state)
1219   - state = state or {}
  1225 + state = initState(state)
1220 1226 useImplicitCrit(src, state)
1221 1227 if _G.type(dam) == "number" then dam = {dam=dam, dur=4} end
1222 1228 local target = game.level.map(x, y, Map.ACTOR)
... ... @@ -1235,7 +1241,7 @@ newDamageType{
1235 1241 newDamageType{
1236 1242 name = "ice", type = "ICE", text_color = "#1133F3#",
1237 1243 projector = function(src, x, y, type, dam, state)
1238   - state = state or {}
  1244 + state = initState(state)
1239 1245 useImplicitCrit(src, state)
1240 1246 local chance = 25
1241 1247 if _G.type(dam) == "table" then chance, dam = dam.chance, dam.dam end
... ... @@ -1251,7 +1257,7 @@ newDamageType{
1251 1257 newDamageType{
1252 1258 name = "slowing ice", type = "ICE_SLOW", text_color = "#1133F3#",
1253 1259 projector = function(src, x, y, type, dam, state)
1254   - state = state or {}
  1260 + state = initState(state)
1255 1261 useImplicitCrit(src, state)
1256 1262 local chance = 25
1257 1263 local target = game.level.map(x, y, Map.ACTOR)
... ... @@ -1271,7 +1277,7 @@ newDamageType{
1271 1277 newDamageType{
1272 1278 name = "ice storm", type = "ICE_STORM", text_color = "#1133F3#",
1273 1279 projector = function(src, x, y, type, dam, state)
1274   - state = state or {}
  1280 + state = initState(state)
1275 1281 useImplicitCrit(src, state)
1276 1282 local chance = 25
1277 1283
... ... @@ -1290,7 +1296,7 @@ newDamageType{
1290 1296 newDamageType{
1291 1297 name = "glacial vapour", type = "GLACIAL_VAPOUR", text_color = "#1133F3#",
1292 1298 projector = function(src, x, y, type, dam, state)
1293   - state = state or {}
  1299 + state = initState(state)
1294 1300 useImplicitCrit(src, state)
1295 1301 local chance = 0
1296 1302 local target = game.level.map(x, y, Map.ACTOR)
... ... @@ -1307,7 +1313,7 @@ newDamageType{
1307 1313 newDamageType{
1308 1314 name = "cold ground", type = "COLDNEVERMOVE",
1309 1315 projector = function(src, x, y, type, dam, state)
1310   - state = state or {}
  1316 + state = initState(state)
1311 1317 useImplicitCrit(src, state)
1312 1318 if _G.type(dam) == "number" then dam = {dam=dam, dur=4} end
1313 1319 DamageType:get(DamageType.COLD).projector(src, x, y, DamageType.COLD, dam.dam, state)
... ... @@ -1328,7 +1334,7 @@ newDamageType{
1328 1334 newDamageType{
1329 1335 name = "freeze", type = "FREEZE",
1330 1336 projector = function(src, x, y, type, dam, state)
1331   - state = state or {}
  1337 + state = initState(state)
1332 1338 useImplicitCrit(src, state)
1333 1339 local target = game.level.map(x, y, Map.ACTOR)
1334 1340 if target then
... ... @@ -1349,7 +1355,7 @@ newDamageType{
1349 1355 newDamageType{
1350 1356 name = "sticky smoke", type = "STICKY_SMOKE",
1351 1357 projector = function(src, x, y, type, dam, state)
1352   - state = state or {}
  1358 + state = initState(state)
1353 1359 useImplicitCrit(src, state)
1354 1360 local target = game.level.map(x, y, Map.ACTOR)
1355 1361 if target then
... ... @@ -1366,7 +1372,7 @@ newDamageType{
1366 1372 newDamageType{
1367 1373 name = "acid blind", type = "ACID_BLIND", text_color = "#GREEN#",
1368 1374 projector = function(src, x, y, type, dam, state)
1369   - state = state or {}
  1375 + state = initState(state)
1370 1376 useImplicitCrit(src, state)
1371 1377 local realdam = DamageType:get(DamageType.ACID).projector(src, x, y, DamageType.ACID, dam, state)
1372 1378 local target = game.level.map(x, y, Map.ACTOR)
... ... @@ -1385,7 +1391,7 @@ newDamageType{
1385 1391 newDamageType{
1386 1392 name = "blinding darkness", type = "DARKNESS_BLIND",
1387 1393 projector = function(src, x, y, type, dam, state)
1388   - state = state or {}
  1394 + state = initState(state)
1389 1395 useImplicitCrit(src, state)
1390 1396 local realdam = DamageType:get(DamageType.DARKNESS).projector(src, x, y, DamageType.DARKNESS, dam, state)
1391 1397 local target = game.level.map(x, y, Map.ACTOR)
... ... @@ -1404,7 +1410,7 @@ newDamageType{
1404 1410 newDamageType{
1405 1411 name = "blinding light", type = "LIGHT_BLIND", text_color = "#YELLOW#",
1406 1412 projector = function(src, x, y, type, dam, state)
1407   - state = state or {}
  1413 + state = initState(state)
1408 1414 useImplicitCrit(src, state)
1409 1415 local realdam = DamageType:get(DamageType.LIGHT).projector(src, x, y, DamageType.LIGHT, dam, state)
1410 1416 local target = game.level.map(x, y, Map.ACTOR)
... ... @@ -1423,7 +1429,7 @@ newDamageType{
1423 1429 newDamageType{
1424 1430 name = "dazing lightning", type = "LIGHTNING_DAZE", text_color = "#ROYAL_BLUE#",
1425 1431 projector = function(src, x, y, type, dam, state)
1426   - state = state or {}
  1432 + state = initState(state)
1427 1433 useImplicitCrit(src, state)
1428 1434 if _G.type(dam) == "number" then dam = {dam=dam, daze=25} end
1429 1435 dam.daze = dam.daze or 25
... ... @@ -1451,7 +1457,7 @@ newDamageType{
1451 1457 newDamageType{
1452 1458 name = "cold repulsion", type = "WAVE",
1453 1459 projector = function(src, x, y, type, dam, state)
1454   - state = state or {}
  1460 + state = initState(state)
1455 1461 useImplicitCrit(src, state)
1456 1462 local srcx, srcy = dam.x, dam.y
1457 1463 local base = dam
... ... @@ -1483,7 +1489,7 @@ newDamageType{
1483 1489 newDamageType{
1484 1490 name = "bloodspring", type = "BLOODSPRING",
1485 1491 projector = function(src, x, y, type, dam, state)
1486   - state = state or {}
  1492 + state = initState(state)
1487 1493 useImplicitCrit(src, state)
1488 1494 local srcx, srcy = dam.x, dam.y
1489 1495 local base = dam
... ... @@ -1506,11 +1512,11 @@ newDamageType{
1506 1512 newDamageType{
1507 1513 name = "fire repulsion", type = "FIREKNOCKBACK",
1508 1514 projector = function(src, x, y, type, dam, state)
1509   - state = state or {}
  1515 + state = initState(state)
1510 1516 useImplicitCrit(src, state)
1511 1517 local target = game.level.map(x, y, Map.ACTOR)
1512 1518 if _G.type(dam) ~= "table" then dam = {dam=dam, dist=3} end
1513   - state = state or {}
  1519 + state = initState(state)
1514 1520 if target and not state[target] then
1515 1521 state[target] = true
1516 1522 DamageType:get(DamageType.FIREBURN).projector(src, x, y, DamageType.FIREBURN, dam.dam, state)
... ... @@ -1529,11 +1535,11 @@ newDamageType{
1529 1535 newDamageType{
1530 1536 name = "burning repulsion", type = "FIREKNOCKBACK_MIND",
1531 1537 projector = function(src, x, y, type, dam, state)
1532   - state = state or {}
  1538 + state = initState(state)
1533 1539 useImplicitCrit(src, state)
1534 1540 local target = game.level.map(x, y, Map.ACTOR)
1535 1541 if _G.type(dam) ~= "table" then dam = {dam=dam, dist=3} end
1536   - state = state or {}
  1542 + state = initState(state)
1537 1543 if target and not state[target] then
1538 1544 state[target] = true
1539 1545 DamageType:get(DamageType.FIREBURN).projector(src, x, y, DamageType.FIREBURN, dam.dam, state)
... ... @@ -1552,11 +1558,11 @@ newDamageType{
1552 1558 newDamageType{
1553 1559 name = "darkness repulsion", type = "DARKKNOCKBACK",
1554 1560 projector = function(src, x, y, type, dam, state)
1555   - state = state or {}
  1561 + state = initState(state)
1556 1562 useImplicitCrit(src, state)
1557 1563 local target = game.level.map(x, y, Map.ACTOR)
1558 1564 if _G.type(dam) ~= "table" then dam = {dam=dam, dist=3} end
1559   - state = state or {}
  1565 + state = initState(state)
1560 1566 if target and not state[target] then
1561 1567 state[target] = true
1562 1568 DamageType:get(DamageType.DARKNESS).projector(src, x, y, DamageType.DARKNESS, dam.dam, state)
... ... @@ -1575,12 +1581,12 @@ newDamageType{
1575 1581 newDamageType{
1576 1582 name = "physical repulsion", type = "SPELLKNOCKBACK",
1577 1583 projector = function(src, x, y, type, dam, state)
1578   - state = state or {}
  1584 + state = initState(state)
1579 1585 useImplicitCrit(src, state)
1580 1586 local target = game.level.map(x, y, Map.ACTOR)
1581 1587 local realdam = 0
1582 1588 if _G.type(dam) ~= "table" then dam = {dam=dam, dist=3} end
1583   - state = state or {}
  1589 + state = initState(state)
1584 1590 if target and not state[target] then
1585 1591 state[target] = true
1586 1592 realdam = DamageType:get(DamageType.PHYSICAL).projector(src, x, y, DamageType.PHYSICAL, dam.dam, state)
... ... @@ -1600,10 +1606,10 @@ newDamageType{
1600 1606 newDamageType{
1601 1607 name = "physical repulsion", type = "MINDKNOCKBACK",
1602 1608 projector = function(src, x, y, type, dam, state)
1603   - state = state or {}
  1609 + state = initState(state)
1604 1610 useImplicitCrit(src, state)
1605 1611 local target = game.level.map(x, y, Map.ACTOR)
1606   - state = state or {}
  1612 + state = initState(state)
1607 1613 if target and not state[target] then
1608 1614 state[target] = true
1609 1615 DamageType:get(DamageType.PHYSICAL).projector(src, x, y, DamageType.PHYSICAL, dam, state)
... ... @@ -1622,10 +1628,10 @@ newDamageType{
1622 1628 newDamageType{
1623 1629 name = "physical repulsion", type = "PHYSKNOCKBACK",
1624 1630 projector = function(src, x, y, type, dam, state)
1625   - state = state or {}
  1631 + state = initState(state)
1626 1632 useImplicitCrit(src, state)
1627 1633 local target = game.level.map(x, y, Map.ACTOR)
1628   - state = state or {}
  1634 + state = initState(state)
1629 1635 if _G.type(dam) ~= "table" then dam = {dam=dam, dist=3} end
1630 1636 if target and not state[target] then
1631 1637 state[target] = true
... ... @@ -1645,10 +1651,10 @@ newDamageType{
1645 1651 newDamageType{
1646 1652 name = "fear repulsion", type = "FEARKNOCKBACK",
1647 1653 projector = function(src, x, y, type, dam, state)
1648   - state = state or {}
  1654 + state = initState(state)
1649 1655 useImplicitCrit(src, state)
1650 1656 local target = game.level.map(x, y, Map.ACTOR)
1651   - state = state or {}
  1657 + state = initState(state)
1652 1658 if target and not state[target] then
1653 1659 state[target] = true
1654 1660 if target:checkHit(src:combatMindpower(), target:combatPhysicalResist(), 0, 95, 15) and target:canBe("fear") then
... ... @@ -1666,7 +1672,7 @@ newDamageType{
1666 1672 newDamageType{
1667 1673 name = "poison", type = "POISON", text_color = "#LIGHT_GREEN#",
1668 1674 projector = function(src, x, y, t, dam)
1669   - state = state or {}
  1675 + state = initState(state)
1670 1676 useImplicitCrit(src, state)
1671 1677 local power
1672 1678 if type(dam) == "table" then
... ... @@ -1686,7 +1692,7 @@ newDamageType{
1686 1692 newDamageType{
1687 1693 name = "cleansing fire", type = "INFERNO",
1688 1694 projector = function(src, x, y, type, dam, state)
1689   - state = state or {}
  1695 + state = initState(state)
1690 1696 useImplicitCrit(src, state)
1691 1697 local realdam = DamageType:get(DamageType.FIRE).projector(src, x, y, DamageType.FIRE, dam, state)
1692 1698 local target = game.level.map(x, y, Map.ACTOR)
... ... @@ -1713,7 +1719,7 @@ newDamageType{
1713 1719 newDamageType{
1714 1720 name = "spydric poison", type = "SPYDRIC_POISON",
1715 1721 projector = function(src, x, y, type, dam, state)
1716   - state = state or {}
  1722 + state = initState(state)
1717 1723 useImplicitCrit(src, state)
1718 1724 if _G.type(dam) == "number" then dam = {dam=dam, dur=3} end
1719 1725 DamageType:get(DamageType.NATURE).projector(src, x, y, DamageType.NATURE, dam.dam / dam.dur, state)
... ... @@ -1728,7 +1734,7 @@ newDamageType{
1728 1734 newDamageType{
1729 1735 name = "crippling poison", type = "CRIPPLING_POISON", text_color = "#LIGHT_GREEN#",
1730 1736 projector = function(src, x, y, type, dam, state)
1731   - state = state or {}
  1737 + state = initState(state)
1732 1738 useImplicitCrit(src, state)
1733 1739 if _G.type(dam) == "number" then dam = {dam=dam, dur=3} end
1734 1740 DamageType:get(DamageType.NATURE).projector(src, x, y, DamageType.NATURE, dam.dam / dam.dur, state)
... ... @@ -1743,7 +1749,7 @@ newDamageType{
1743 1749 newDamageType{
1744 1750 name = "insidious poison", type = "INSIDIOUS_POISON", text_color = "#LIGHT_GREEN#",
1745 1751 projector = function(src, x, y, type, dam, state)
1746   - state = state or {}
  1752 + state = initState(state)
1747 1753 useImplicitCrit(src, state)
1748 1754 if _G.type(dam) == "number" then dam = {dam=dam, dur=7, heal_factor=dam} end
1749 1755 DamageType:get(DamageType.NATURE).projector(src, x, y, DamageType.NATURE, dam.dam / dam.dur, state)
... ... @@ -1758,7 +1764,7 @@ newDamageType{
1758 1764 newDamageType{
1759 1765 name = "bleed", type = "BLEED",
1760 1766 projector = function(src, x, y, type, dam, state)
1761   - state = state or {}
  1767 + state = initState(state)
1762 1768 useImplicitCrit(src, state)
1763 1769 DamageType:get(DamageType.PHYSICAL).projector(src, x, y, DamageType.PHYSICAL, dam / 6, state)
1764 1770 dam = dam - dam / 6
... ... @@ -1774,7 +1780,7 @@ newDamageType{
1774 1780 newDamageType{
1775 1781 name = "physical bleed", type = "PHYSICALBLEED",
1776 1782 projector = function(src, x, y, type, dam, state)
1777   - state = state or {}
  1783 + state = initState(state)
1778 1784 useImplicitCrit(src, state)
1779 1785 local realdam = DamageType:get(DamageType.PHYSICAL).projector(src, x, y, DamageType.PHYSICAL, dam, state)
1780 1786 local target = game.level.map(x, y, Map.ACTOR)
... ... @@ -1788,7 +1794,7 @@ newDamageType{
1788 1794 newDamageType{
1789 1795 name = "nature slow", type = "SLIME", text_color = "#LIGHT_GREEN#",
1790 1796 projector = function(src, x, y, type, dam, state)
1791   - state = state or {}
  1797 + state = initState(state)
1792 1798 useImplicitCrit(src, state)
1793 1799 if _G.type(dam) == "number" then dam = {dam=dam, power=0.15} end
1794 1800 DamageType:get(DamageType.NATURE).projector(src, x, y, DamageType.NATURE, dam.dam, state)
... ... @@ -1803,7 +1809,7 @@ newDamageType{
1803 1809 newDamageType{
1804 1810 name = "dig", type = "DIG",
1805 1811 projector = function(src, x, y, typ, dam)
1806   - state = state or {}
  1812 + state = initState(state)
1807 1813 useImplicitCrit(src, state)
1808 1814 local feat = game.level.map(x, y, Map.TERRAIN)
1809 1815 if feat then
... ... @@ -1828,7 +1834,7 @@ newDamageType{
1828 1834 newDamageType{
1829 1835 name = "slow", type = "SLOW",
1830 1836 projector = function(src, x, y, type, dam, state)
1831   - state = state or {}
  1837 + state = initState(state)
1832 1838 useImplicitCrit(src, state)
1833 1839 local target = game.level.map(x, y, Map.ACTOR)
1834 1840 if target then
... ... @@ -1842,7 +1848,7 @@ newDamageType{
1842 1848 newDamageType{
1843 1849 name = "congeal time", type = "CONGEAL_TIME",
1844 1850 projector = function(src, x, y, type, dam, state)
1845   - state = state or {}
  1851 + state = initState(state)
1846 1852 useImplicitCrit(src, state)
1847 1853 local target = game.level.map(x, y, Map.ACTOR)
1848 1854 if target then
... ... @@ -1857,7 +1863,7 @@ newDamageType{
1857 1863 newDamageType{
1858 1864 name = "time prison", type = "TIME_PRISON",
1859 1865 projector = function(src, x, y, type, dam, state)
1860   - state = state or {}
  1866 + state = initState(state)
1861 1867 useImplicitCrit(src, state)
1862 1868 local target = game.level.map(x, y, Map.ACTOR)
1863 1869 if target then
... ... @@ -1880,7 +1886,7 @@ newDamageType{
1880 1886 newDamageType{
1881 1887 name = "confusion", type = "CONFUSION",
1882 1888 projector = function(src, x, y, type, dam, state)
1883   - state = state or {}
  1889 + state = initState(state)
1884 1890 useImplicitCrit(src, state)
1885 1891 local target = game.level.map(x, y, Map.ACTOR)
1886 1892 if target then
... ... @@ -1897,7 +1903,7 @@ newDamageType{
1897 1903 newDamageType{
1898 1904 name = "% chance of confusion", type = "RANDOM_CONFUSION",
1899 1905 projector = function(src, x, y, type, dam, state)
1900   - state = state or {}
  1906 + state = initState(state)
1901 1907 useImplicitCrit(src, state)
1902 1908 if _G.type(dam) == "number" then dam = {dam=dam} end
1903 1909 local target = game.level.map(x, y, Map.ACTOR)
... ... @@ -1915,7 +1921,7 @@ newDamageType{
1915 1921 newDamageType{
1916 1922 name = "% chance of confusion", type = "RANDOM_CONFUSION_PHYS",
1917 1923 projector = function(src, x, y, type, dam, state)
1918   - state = state or {}
  1924 + state = initState(state)
1919 1925 useImplicitCrit(src, state)
1920 1926 if _G.type(dam) == "number" then dam = {dam=dam} end
1921 1927 local target = game.level.map(x, y, Map.ACTOR)
... ... @@ -1932,7 +1938,7 @@ newDamageType{
1932 1938 newDamageType{
1933 1939 name = "% chance of gloom effects", type = "RANDOM_GLOOM",
1934 1940 projector = function(src, x, y, type, dam, state)
1935   - state = state or {}
  1941 + state = initState(state)
1936 1942 useImplicitCrit(src, state)
1937 1943 local target = game.level.map(x, y, Map.ACTOR)
1938 1944 if target and rng.percent(dam) then
... ... @@ -1985,7 +1991,7 @@ newDamageType{
1985 1991 :format(dam, parens)
1986 1992 end,
1987 1993 projector = function(src, x, y, type, dam, state)
1988   - state = state or {}
  1994 + state = initState(state)
1989 1995 useImplicitCrit(src, state)
1990 1996 local target = game.level.map(x, y, Map.ACTOR)
1991 1997 if target then
... ... @@ -2033,7 +2039,7 @@ newDamageType{
2033 2039 :format(dam, parens)
2034 2040 end,
2035 2041 projector = function(src, x, y, type, dam, state)
2036   - state = state or {}
  2042 + state = initState(state)
2037 2043 useImplicitCrit(src, state)
2038 2044 local target = game.level.map(x, y, Map.ACTOR)
2039 2045 if target then
... ... @@ -2065,7 +2071,7 @@ newDamageType{
2065 2071 :format(dam, parens)
2066 2072 end,
2067 2073 projector = function(src, x, y, type, dam, state)
2068   - state = state or {}
  2074 + state = initState(state)
2069 2075 useImplicitCrit(src, state)
2070 2076 local target = game.level.map(x, y, Map.ACTOR)
2071 2077 if target and src and src.name and rng.percent(dam) then
... ... @@ -2100,7 +2106,7 @@ newDamageType{
2100 2106 :format(dam, parens)
2101 2107 end,
2102 2108 projector = function(src, x, y, type, dam, state)
2103   - state = state or {}
  2109 + state = initState(state)
2104 2110 useImplicitCrit(src, state)
2105 2111 local target = game.level.map(x, y, Map.ACTOR)
2106 2112 if target then
... ... @@ -2132,7 +2138,7 @@ newDamageType{
2132 2138 :format(dam, parens)
2133 2139 end,
2134 2140 projector = function(src, x, y, type, dam, state)
2135   - state = state or {}
  2141 + state = initState(state)
2136 2142 useImplicitCrit(src, state)
2137 2143 local target = game.level.map(x, y, Map.ACTOR)
2138 2144 if target then
... ... @@ -2167,7 +2173,7 @@ newDamageType{
2167 2173 :format(dam, parens)
2168 2174 end,
2169 2175 projector = function(src, x, y, type, dam, state)
2170   - state = state or {}
  2176 + state = initState(state)
2171 2177 useImplicitCrit(src, state)
2172 2178 local target = game.level.map(x, y, Map.ACTOR)
2173 2179 if target then
... ... @@ -2199,7 +2205,7 @@ newDamageType{
2199 2205 :format(dam, parens)
2200 2206 end,
2201 2207 projector = function(src, x, y, type, dam, state)
2202   - state = state or {}
  2208 + state = initState(state)
2203 2209 useImplicitCrit(src, state)
2204 2210 local target = game.level.map(x, y, Map.ACTOR)
2205 2211 if target then
... ... @@ -2230,7 +2236,7 @@ newDamageType{
2230 2236 :format(dam or 0, parens)
2231 2237 end,
2232 2238 projector = function(src, x, y, type, dam, state)
2233   - state = state or {}
  2239 + state = initState(state)
2234 2240 useImplicitCrit(src, state)
2235 2241 local target = game.level.map(x, y, Map.ACTOR)
2236 2242 if target then
... ... @@ -2258,7 +2264,7 @@ newDamageType{
2258 2264 :format(dam, parens)
2259 2265 end,
2260 2266 projector = function(src, x, y, type, dam, state)
2261   - state = state or {}
  2267 + state = initState(state)
2262 2268 useImplicitCrit(src, state)
2263 2269 local target = game.level.map(x, y, Map.ACTOR)
2264 2270 if target then
... ... @@ -2287,7 +2293,7 @@ newDamageType{
2287 2293 :format(dam, 20, parens)
2288 2294 end,
2289 2295 projector = function(src, x, y, type, dam, state)
2290   - state = state or {}
  2296 + state = initState(state)
2291 2297 useImplicitCrit(src, state)
2292 2298 local target = game.level.map(x, y, Map.ACTOR)
2293 2299 if target then
... ... @@ -2306,7 +2312,7 @@ newDamageType{
2306 2312 newDamageType{
2307 2313 name = "blinding", type = "RANDOM_BLIND",
2308 2314 projector = function(src, x, y, type, dam, state)
2309   - state = state or {}
  2315 + state = initState(state)
2310 2316 useImplicitCrit(src, state)
2311 2317 if _G.type(dam) == "number" then dam = {dam=dam} end
2312 2318 local target = game.level.map(x, y, Map.ACTOR)
... ... @@ -2324,7 +2330,7 @@ newDamageType{
2324 2330 newDamageType{
2325 2331 name = "blinding physical", type = "SAND",
2326 2332 projector = function(src, x, y, type, dam, state)
2327   - state = state or {}
  2333 + state = initState(state)
2328 2334 useImplicitCrit(src, state)
2329 2335 DamageType:get(DamageType.PHYSICAL).projector(src, x, y, DamageType.PHYSICAL, dam.dam, state)
2330 2336 local target = game.level.map(x, y, Map.ACTOR)
... ... @@ -2342,7 +2348,7 @@ newDamageType{
2342 2348 newDamageType{
2343 2349 name = "physical pinning", type = "PINNING",
2344 2350 projector = function(src, x, y, type, dam, state)
2345   - state = state or {}
  2351 + state = initState(state)
2346 2352 useImplicitCrit(src, state)
2347 2353 DamageType:get(DamageType.PHYSICAL).projector(src, x, y, DamageType.PHYSICAL, dam.dam, state)
2348 2354 local target = game.level.map(x, y, Map.ACTOR)
... ... @@ -2360,7 +2366,7 @@ newDamageType{
2360 2366 newDamageType{
2361 2367 name = "regressive blight", type = "DRAINEXP",
2362 2368 projector = function(src, x, y, type, dam, state)
2363   - state = state or {}
  2369 + state = initState(state)
2364 2370 useImplicitCrit(src, state)
2365 2371 if _G.type(dam) == "number" then dam = {dam=dam} end
2366 2372 local realdam = DamageType:get(DamageType.BLIGHT).projector(src, x, y, DamageType.BLIGHT, dam.dam, state)
... ... @@ -2381,7 +2387,7 @@ newDamageType{
2381 2387 newDamageType{
2382 2388 name = "draining blight", type = "DRAINLIFE", text_color = "#DARK_GREEN#",
2383 2389 projector = function(src, x, y, type, dam, state)
2384   - state = state or {}
  2390 + state = initState(state)
2385 2391 useImplicitCrit(src, state)
2386 2392 if _G.type(dam) == "number" then dam = {dam=dam, healfactor=0.4} end
2387 2393 local target = game.level.map(x, y, Map.ACTOR) -- Get the target first to make sure we heal even on kill
... ... @@ -2398,7 +2404,7 @@ newDamageType{
2398 2404 newDamageType{
2399 2405 name = "vim draining blight", type = "DRAIN_VIM", text_color = "#DARK_GREEN#",
2400 2406 projector = function(src, x, y, type, dam, state)
2401   - state = state or {}
  2407 + state = initState(state)
2402 2408 useImplicitCrit(src, state)
2403 2409 if _G.type(dam) == "number" then dam = {dam=dam, vim=0.2} end
2404 2410 local target = game.level.map(x, y, Map.ACTOR)
... ... @@ -2414,7 +2420,7 @@ newDamageType{
2414 2420 newDamageType{
2415 2421 name = "demonfire", type = "DEMONFIRE",
2416 2422 projector = function(src, x, y, type, dam, state)
2417   - state = state or {}
  2423 + state = initState(state)
2418 2424 useImplicitCrit(src, state)
2419 2425 local target = game.level.map(x, y, Map.ACTOR)
2420 2426 if target and target:attr("demon") then
... ... @@ -2431,7 +2437,7 @@ newDamageType{
2431 2437 newDamageType{
2432 2438 name = "purging blight", type = "RETCH",
2433 2439 projector = function(src, x, y, type, dam, state)
2434   - state = state or {}
  2440 + state = initState(state)
2435 2441 useImplicitCrit(src, state)
2436 2442 local target = game.level.map(x, y, Map.ACTOR)
2437 2443 if target and (target:attr("undead") or target:attr(retch_heal)) then
... ... @@ -2480,7 +2486,7 @@ newDamageType{
2480 2486 newDamageType{
2481 2487 name = "holy light", type = "HOLY_LIGHT",
2482 2488 projector = function(src, x, y, type, dam, state)
2483   - state = state or {}
  2489 + state = initState(state)
2484 2490 useImplicitCrit(src, state)
2485 2491 local target = game.level.map(x, y, Map.ACTOR)
2486 2492 if target and not target:attr("undead") and not target:attr("demon") then
... ... @@ -2495,7 +2501,7 @@ newDamageType{
2495 2501 newDamageType{
2496 2502 name = "healing", type = "HEAL",
2497 2503 projector = function(src, x, y, type, dam, state)
2498   - state = state or {}
  2504 + state = initState(state)
2499 2505 useImplicitCrit(src, state)
2500 2506 local target = game.level.map(x, y, Map.ACTOR)
2501 2507 if target then
... ... @@ -2511,7 +2517,7 @@ newDamageType{
2511 2517 newDamageType{
2512 2518 name = "healing light", type = "HEALING_POWER",
2513 2519 projector = function(src, x, y, type, dam, state)
2514   - state = state or {}
  2520 + state = initState(state)
2515 2521 useImplicitCrit(src, state)
2516 2522 local target = game.level.map(x, y, Map.ACTOR)
2517 2523 if target then
... ... @@ -2549,7 +2555,7 @@ newDamageType{
2549 2555 newDamageType{
2550 2556 name = "judgement", type = "JUDGEMENT",
2551 2557 projector = function(src, x, y, type, dam, state)
2552   - state = state or {}
  2558 + state = initState(state)
2553 2559 useImplicitCrit(src, state)
2554 2560 local target = game.level.map(x, y, Map.ACTOR)
2555 2561 if target and target ~= src then
... ... @@ -2567,7 +2573,7 @@ newDamageType{
2567 2573 newDamageType{
2568 2574 name = "healing nature", type = "HEALING_NATURE",
2569 2575 projector = function(src, x, y, type, dam, state)
2570   - state = state or {}
  2576 + state = initState(state)
2571 2577 useImplicitCrit(src, state)
2572 2578 local target = game.level.map(x, y, Map.ACTOR)
2573 2579 if target and not target:attr("undead") then
... ... @@ -2585,7 +2591,7 @@ newDamageType{
2585 2591 newDamageType{
2586 2592 name = "infective blight", type = "CORRUPTED_BLOOD", text_color = "#DARK_GREEN#",
2587 2593 projector = function(src, x, y, type, dam, state)
2588   - state = state or {}
  2594 + state = initState(state)
2589 2595 useImplicitCrit(src, state)
2590 2596 if _G.type(dam) == "number" then dam = {dam=dam} end
2591 2597 DamageType:get(DamageType.BLIGHT).projector(src, x, y, DamageType.BLIGHT, dam.dam, state)
... ... @@ -2601,7 +2607,7 @@ newDamageType{
2601 2607 newDamageType{
2602 2608 name = "hindering blight", type = "BLOOD_BOIL", text_color = "#DARK_GREEN#",
2603 2609 projector = function(src, x, y, type, dam, state)
2604   - state = state or {}
  2610 + state = initState(state)
2605 2611 useImplicitCrit(src, state)
2606 2612 DamageType:get(DamageType.BLIGHT).projector(src, x, y, DamageType.BLIGHT, dam, state)
2607 2613 local target = game.level.map(x, y, Map.ACTOR)
... ... @@ -2624,7 +2630,7 @@ newDamageType{
2624 2630 newDamageType{
2625 2631 name = "physical stun", type = "PHYSICAL_STUN",
2626 2632 projector = function(src, x, y, type, dam, state)
2627   - state = state or {}
  2633 + state = initState(state)
2628 2634 useImplicitCrit(src, state)
2629 2635 DamageType:get(DamageType.PHYSICAL).projector(src, x, y, DamageType.PHYSICAL, dam, state)
2630 2636 local target = game.level.map(x, y, Map.ACTOR)
... ... @@ -2642,7 +2648,7 @@ newDamageType{
2642 2648 newDamageType{
2643 2649 name = "physical bleed", type = "SPLIT_BLEED",
2644 2650 projector = function(src, x, y, type, dam, state)
2645   - state = state or {}
  2651 + state = initState(state)
2646 2652 useImplicitCrit(src, state)
2647 2653 DamageType:get(DamageType.PHYSICAL).projector(src, x, y, DamageType.PHYSICAL, dam / 2, state)
2648 2654 DamageType:get(DamageType.PHYSICAL).projector(src, x, y, DamageType.PHYSICAL, dam / 12, state)
... ... @@ -2658,7 +2664,7 @@ newDamageType{
2658 2664 newDamageType{
2659 2665 name = "warp", type = "WARP",
2660 2666 projector = function(src, x, y, type, dam, state)
2661   - state = state or {}
  2667 + state = initState(state)
2662 2668 useImplicitCrit(src, state)
2663 2669 DamageType:get(DamageType.TEMPORAL).projector(src, x, y, DamageType.TEMPORAL, dam / 2, state)
2664 2670 DamageType:get(DamageType.PHYSICAL).projector(src, x, y, DamageType.PHYSICAL, dam / 2, state)
... ... @@ -2669,7 +2675,7 @@ newDamageType{
2669 2675 newDamageType{
2670 2676 name = "temporal darkness", type = "VOID", text_color = "#GREY#",
2671 2677 projector = function(src, x, y, type, dam, state)
2672   - state = state or {}
  2678 + state = initState(state)
2673 2679 useImplicitCrit(src, state)
2674 2680 DamageType:get(DamageType.TEMPORAL).projector(src, x, y, DamageType.TEMPORAL, dam / 2, state)
2675 2681 DamageType:get(DamageType.DARKNESS).projector(src, x, y, DamageType.DARKNESS, dam / 2, state)
... ... @@ -2680,7 +2686,7 @@ newDamageType{
2680 2686 newDamageType{
2681 2687 name = "gravity", type = "GRAVITY",
2682 2688 projector = function(src, x, y, type, dam, state)
2683   - state = state or {}
  2689 + state = initState(state)
2684 2690 useImplicitCrit(src, state)
2685 2691 if _G.type(dam) == "number" then dam = {dam=dam} end
2686 2692 local target = game.level.map(x, y, Map.ACTOR)
... ... @@ -2698,7 +2704,7 @@ newDamageType{
2698 2704 newDamageType{
2699 2705 name = "gravity pin", type = "GRAVITYPIN",
2700 2706 projector = function(src, x, y, type, dam, state)
2701   - state = state or {}
  2707 + state = initState(state)
2702 2708 useImplicitCrit(src, state)
2703 2709 local target = game.level.map(x, y, Map.ACTOR)
2704 2710 local reapplied = false
... ... @@ -2723,10 +2729,10 @@ newDamageType{
2723 2729 newDamageType{
2724 2730 name = "physical repulsion", type = "REPULSION",
2725 2731 projector = function(src, x, y, type, dam, state)
2726   - state = state or {}
  2732 + state = initState(state)
2727 2733 useImplicitCrit(src, state)
2728 2734 local target = game.level.map(x, y, Map.ACTOR)
2729   - state = state or {}
  2735 + state = initState(state)
2730 2736 -- extra damage on pinned targets
2731 2737 if target and target:attr("never_move") then
2732 2738 dam = dam * 1.5
... ... @@ -2749,7 +2755,7 @@ newDamageType{
2749 2755 newDamageType{
2750 2756 name = "grow", type = "GROW",
2751 2757 projector = function(src, x, y, typ, dam)
2752   - state = state or {}
  2758 + state = initState(state)
2753 2759 useImplicitCrit(src, state)
2754 2760 local feat = game.level.map(x, y, Map.TERRAIN)
2755 2761 if feat then
... ... @@ -2772,7 +2778,7 @@ newDamageType{
2772 2778 newDamageType{
2773 2779 name = "pinning nature", type = "GRASPING_MOSS",
2774 2780 projector = function(src, x, y, type, dam, state)
2775   - state = state or {}
  2781 + state = initState(state)
2776 2782 useImplicitCrit(src, state)
2777 2783 local target = game.level.map(x, y, Map.ACTOR)
2778 2784 if target and src:reactionToward(target) < 0 then
... ... @@ -2790,7 +2796,7 @@ newDamageType{
2790 2796 newDamageType{
2791 2797 name = "healing nature", type = "NOURISHING_MOSS",
2792 2798 projector = function(src, x, y, type, dam, state)
2793   - state = state or {}
  2799 + state = initState(state)
2794 2800 useImplicitCrit(src, state)
2795 2801 local target = game.level.map(x, y, Map.ACTOR)
2796 2802 if target and src:reactionToward(target) < 0 then
... ... @@ -2803,7 +2809,7 @@ newDamageType{
2803 2809 newDamageType{
2804 2810 name = "impeding nature", type = "SLIPPERY_MOSS",
2805 2811 projector = function(src, x, y, type, dam, state)
2806   - state = state or {}
  2812 + state = initState(state)
2807 2813 useImplicitCrit(src, state)
2808 2814 local target = game.level.map(x, y, Map.ACTOR)
2809 2815 if target and src:reactionToward(target) < 0 then
... ... @@ -2816,7 +2822,7 @@ newDamageType{
2816 2822 newDamageType{
2817 2823 name = "confounding nature", type = "HALLUCINOGENIC_MOSS",
2818 2824 projector = function(src, x, y, type, dam, state)
2819   - state = state or {}
  2825 + state = initState(state)
2820 2826 useImplicitCrit(src, state)
2821 2827 local target = game.level.map(x, y, Map.ACTOR)
2822 2828 if target and src:reactionToward(target) < 0 then
... ... @@ -2834,7 +2840,7 @@ newDamageType{
2834 2840 newDamageType{
2835 2841 name = "sanctity", type = "SANCTITY",
2836 2842 projector = function(src, x, y, type, dam, state)
2837   - state = state or {}
  2843 + state = initState(state)
2838 2844 useImplicitCrit(src, state)
2839 2845 local target = game.level.map(x, y, Map.ACTOR)
2840 2846 if target then
... ... @@ -2852,7 +2858,7 @@ newDamageType{
2852 2858 newDamageType{
2853 2859 name = "defensive darkness", type = "SHIFTINGSHADOWS",
2854 2860 projector = function(src, x, y, type, dam, state)
2855   - state = state or {}
  2861 + state = initState(state)
2856 2862 useImplicitCrit(src, state)
2857 2863 local target = game.level.map(x, y, Map.ACTOR)
2858 2864 if target then
... ... @@ -2868,7 +2874,7 @@ newDamageType{
2868 2874 newDamageType{
2869 2875 name = "blazing light", type = "BLAZINGLIGHT",
2870 2876 projector = function(src, x, y, type, dam, state)
2871   - state = state or {}
  2877 + state = initState(state)
2872 2878 useImplicitCrit(src, state)
2873 2879 local target = game.level.map(x, y, Map.ACTOR)
2874 2880 if target then
... ... @@ -2885,7 +2891,7 @@ newDamageType{
2885 2891 newDamageType{
2886 2892 name = "prismatic repulsion", type = "WARDING",
2887 2893 projector = function(src, x, y, type, dam, state)
2888   - state = state or {}
  2894 + state = initState(state)
2889 2895 useImplicitCrit(src, state)
2890 2896 local target = game.level.map(x, y, Map.ACTOR)
2891 2897 if target then
... ... @@ -2909,7 +2915,7 @@ newDamageType{
2909 2915 newDamageType{
2910 2916 name = "mind slow", type = "MINDSLOW",
2911 2917 projector = function(src, x, y, type, dam, state)
2912   - state = state or {}
  2918 + state = initState(state)
2913 2919 useImplicitCrit(src, state)
2914 2920 local target = game.level.map(x, y, Map.ACTOR)
2915 2921 if target then
... ... @@ -2923,7 +2929,7 @@ newDamageType{
2923 2929 newDamageType{
2924 2930 name = "mind freeze", type = "MINDFREEZE",
2925 2931 projector = function(src, x, y, type, dam, state)
2926   - state = state or {}
  2932 + state = initState(state)
2927 2933 useImplicitCrit(src, state)
2928 2934 local target = game.level.map(x, y, Map.ACTOR)
2929 2935 if target then
... ... @@ -2941,7 +2947,7 @@ newDamageType{
2941 2947 newDamageType{
2942 2948 name = "implosion", type = "IMPLOSION",
2943 2949 projector = function(src, x, y, type, dam, state)
2944   - state = state or {}
  2950 + state = initState(state)
2945 2951 useImplicitCrit(src, state)
2946 2952 local dur = 3
2947 2953 local perc = 50
... ... @@ -2959,7 +2965,7 @@ newDamageType{
2959 2965 newDamageType{
2960 2966 name = "regressive temporal", type = "CLOCK",
2961 2967 projector = function(src, x, y, type, dam, state)
2962   - state = state or {}
  2968 + state = initState(state)
2963 2969 useImplicitCrit(src, state)
2964 2970 if _G.type(dam) == "number" then dam = {dam=dam, stat=2 + math.ceil(dam/15), apply=src:combatSpellpower()} end
2965 2971 local target = game.level.map(x, y, Map.ACTOR)
... ... @@ -2975,7 +2981,7 @@ newDamageType{
2975 2981 newDamageType{
2976 2982 name = "wasting temporal", type = "WASTING", text_color = "#LIGHT_STEEL_BLUE#",
2977 2983 projector = function(src, x, y, type, dam, state)
2978   - state = state or {}
  2984 + state = initState(state)
2979 2985 useImplicitCrit(src, state)
2980 2986 local target = game.level.map(x, y, Map.ACTOR)
2981 2987 local dur = 3
... ... @@ -2995,7 +3001,7 @@ newDamageType{
2995 3001 newDamageType{
2996 3002 name = "stop", type = "STOP",
2997 3003 projector = function(src, x, y, type, dam, state)
2998   - state = state or {}
  3004 + state = initState(state)
2999 3005 useImplicitCrit(src, state)
3000 3006 local target = game.level.map(x, y, Map.ACTOR)
3001 3007 if target then
... ... @@ -3011,7 +3017,7 @@ newDamageType{
3011 3017 newDamageType{
3012 3018 name = "debilitating temporal", type = "RETHREAD",
3013 3019 projector = function(src, x, y, type, dam, state)
3014   - state = state or {}
  3020 + state = initState(state)
3015 3021 useImplicitCrit(src, state)
3016 3022 DamageType:get(DamageType.TEMPORAL).projector(src, x, y, DamageType.TEMPORAL, dam.dam, state)
3017 3023 local target = game.level.map(x, y, Map.ACTOR)
... ... @@ -3050,7 +3056,7 @@ newDamageType{
3050 3056 newDamageType{
3051 3057 name = "draining physical", type = "DEVOUR_LIFE",
3052 3058 projector = function(src, x, y, type, dam, state)
3053   - state = state or {}
  3059 + state = initState(state)
3054 3060 useImplicitCrit(src, state)
3055 3061 if _G.type(dam) == "number" then dam = {dam=dam} end
3056 3062 local target = game.level.map(x, y, Map.ACTOR) -- Get the target first to make sure we heal even on kill
... ... @@ -3072,7 +3078,7 @@ newDamageType{
3072 3078 newDamageType{
3073 3079 name = "temporal slow", type = "CHRONOSLOW",
3074 3080 projector = function(src, x, y, type, dam, state)
3075   - state = state or {}
  3081 + state = initState(state)
3076 3082 useImplicitCrit(src, state)
3077 3083 DamageType:get(DamageType.TEMPORAL).projector(src, x, y, DamageType.TEMPORAL, dam.dam, state)
3078 3084 local target = game.level.map(x, y, Map.ACTOR)
... ... @@ -3093,7 +3099,7 @@ newDamageType{
3093 3099 newDamageType{
3094 3100 name = "molten rock", type = "MOLTENROCK",
3095 3101 projector = function(src, x, y, type, dam, state)
3096   - state = state or {}
  3102 + state = initState(state)
3097 3103 useImplicitCrit(src, state)
3098 3104 return DamageType:get(DamageType.FIRE).projector(src, x, y, DamageType.FIRE, dam / 2, state) +
3099 3105 DamageType:get(DamageType.PHYSICAL).projector(src, x, y, DamageType.PHYSICAL, dam / 2, state)
... ... @@ -3103,7 +3109,7 @@ newDamageType{
3103 3109 newDamageType{
3104 3110 name = "entangle", type = "ENTANGLE",
3105 3111 projector = function(src, x, y, type, dam, state)
3106   - state = state or {}
  3112 + state = initState(state)
3107 3113 useImplicitCrit(src, state)
3108 3114 DamageType:get(DamageType.PHYSICAL).projector(src, x, y, DamageType.PHYSICAL, dam/3, state)
3109 3115 DamageType:get(DamageType.NATURE).projector(src, x, y, DamageType.NATURE, 2*dam/3, state)
... ... @@ -3121,7 +3127,7 @@ newDamageType{
3121 3127 newDamageType{
3122 3128 name = "manaworm arcane", type = "MANAWORM",
3123 3129 projector = function(src, x, y, type, dam, state)
3124   - state = state or {}
  3130 + state = initState(state)
3125 3131 useImplicitCrit(src, state)
3126 3132 local realdam = DamageType:get(DamageType.ARCANE).projector(src, x, y, DamageType.ARCANE, dam, state)
3127 3133 local target = game.level.map(x, y, Map.ACTOR)
... ... @@ -3142,7 +3148,7 @@ newDamageType{
3142 3148 newDamageType{
3143 3149 name = "arcane blast", type = "VOID_BLAST",
3144 3150 projector = function(src, x, y, type, dam, state)
3145   - state = state or {}
  3151 + state = initState(state)
3146 3152 useImplicitCrit(src, state)
3147 3153 local realdam = DamageType:get(DamageType.ARCANE).projector(src, x, y, DamageType.ARCANE, dam, state)
3148 3154 local target = game.level.map(x, y, Map.ACTOR)
... ... @@ -3156,7 +3162,7 @@ newDamageType{
3156 3162 newDamageType{
3157 3163 name = "circle of death", type = "CIRCLE_DEATH",
3158 3164 projector = function(src, x, y, type, dam, state)
3159   - state = state or {}
  3165 + state = initState(state)
3160 3166 useImplicitCrit(src, state)
3161 3167 local target = game.level.map(x, y, Map.ACTOR)
3162 3168 if target and (src:reactionToward(target) < 0 or dam.ff) then
... ... @@ -3179,7 +3185,7 @@ newDamageType{
3179 3185 newDamageType{
3180 3186 name = "decaying darkness", type = "RIGOR_MORTIS",
3181 3187 projector = function(src, x, y, type, dam, state)
3182   - state = state or {}
  3188 + state = initState(state)
3183 3189 useImplicitCrit(src, state)
3184 3190 local target = game.level.map(x, y, Map.ACTOR)
3185 3191 if target then
... ... @@ -3193,7 +3199,7 @@ newDamageType{
3193 3199 newDamageType{
3194 3200 name = "abyssal darkness", type = "ABYSSAL_SHROUD",
3195 3201 projector = function(src, x, y, type, dam, state)
3196   - state = state or {}
  3202