warscript 0.0.1-dev.404878c

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (493) hide show
  1. package/LICENSE +23 -0
  2. package/binaryreader.d.ts +20 -0
  3. package/binaryreader.lua +50 -0
  4. package/binarywriter.d.ts +21 -0
  5. package/binarywriter.lua +90 -0
  6. package/core/dummy.d.ts +22 -0
  7. package/core/dummy.lua +133 -0
  8. package/core/game.d.ts +3 -0
  9. package/core/game.lua +24 -0
  10. package/core/mapbounds.d.ts +8 -0
  11. package/core/mapbounds.lua +12 -0
  12. package/core/thread.d.ts +8 -0
  13. package/core/thread.lua +40 -0
  14. package/core/types/ability.d.ts +4 -0
  15. package/core/types/ability.lua +10 -0
  16. package/core/types/async.d.ts +3 -0
  17. package/core/types/async.lua +2 -0
  18. package/core/types/camera.d.ts +4 -0
  19. package/core/types/camera.lua +21 -0
  20. package/core/types/cameraField.d.ts +15 -0
  21. package/core/types/cameraField.lua +38 -0
  22. package/core/types/color.d.ts +16 -0
  23. package/core/types/color.lua +93 -0
  24. package/core/types/destructable.d.ts +31 -0
  25. package/core/types/destructable.lua +245 -0
  26. package/core/types/effect.d.ts +31 -0
  27. package/core/types/effect.lua +209 -0
  28. package/core/types/frame.d.ts +140 -0
  29. package/core/types/frame.lua +882 -0
  30. package/core/types/game.d.ts +8 -0
  31. package/core/types/game.lua +41 -0
  32. package/core/types/group.d.ts +22 -0
  33. package/core/types/group.lua +94 -0
  34. package/core/types/handle.d.ts +48 -0
  35. package/core/types/handle.lua +169 -0
  36. package/core/types/image.d.ts +30 -0
  37. package/core/types/image.lua +121 -0
  38. package/core/types/internal/ability+cooldownRemaining.d.ts +1 -0
  39. package/core/types/internal/ability+cooldownRemaining.lua +0 -0
  40. package/core/types/item.d.ts +4 -0
  41. package/core/types/item.lua +6 -0
  42. package/core/types/missile.d.ts +22 -0
  43. package/core/types/missile.lua +233 -0
  44. package/core/types/order.d.ts +25 -0
  45. package/core/types/order.lua +55 -0
  46. package/core/types/player.d.ts +71 -0
  47. package/core/types/player.lua +448 -0
  48. package/core/types/playerCamera.d.ts +32 -0
  49. package/core/types/playerCamera.lua +162 -0
  50. package/core/types/playerColor.d.ts +40 -0
  51. package/core/types/playerColor.lua +203 -0
  52. package/core/types/rect.d.ts +39 -0
  53. package/core/types/rect.lua +152 -0
  54. package/core/types/region.d.ts +14 -0
  55. package/core/types/region.lua +84 -0
  56. package/core/types/sound.d.ts +69 -0
  57. package/core/types/sound.lua +247 -0
  58. package/core/types/tileCell.d.ts +13 -0
  59. package/core/types/tileCell.lua +100 -0
  60. package/core/types/timer.d.ts +36 -0
  61. package/core/types/timer.lua +230 -0
  62. package/core/types/timerDialog.d.ts +19 -0
  63. package/core/types/timerDialog.lua +95 -0
  64. package/core/types/unit.d.ts +10 -0
  65. package/core/types/unit.lua +24 -0
  66. package/core/types/widget.d.ts +5 -0
  67. package/core/types/widget.lua +2 -0
  68. package/core/util.d.ts +62 -0
  69. package/core/util.lua +464 -0
  70. package/core/vecmath/common.d.ts +18 -0
  71. package/core/vecmath/common.lua +29 -0
  72. package/core/vecmath/mat2.d.ts +73 -0
  73. package/core/vecmath/mat2.lua +261 -0
  74. package/core/vecmath/vec3.d.ts +47 -0
  75. package/core/vecmath/vec3.lua +350 -0
  76. package/core/vecmath/vec4.d.ts +54 -0
  77. package/core/vecmath/vec4.lua +400 -0
  78. package/crypto/ecc.d.ts +6 -0
  79. package/crypto/ecc.lua +1734 -0
  80. package/decl/index.d.ts +116 -0
  81. package/decl/native.d.ts +8198 -0
  82. package/destroyable.d.ts +20 -0
  83. package/destroyable.lua +31 -0
  84. package/engine/ability.d.ts +5 -0
  85. package/engine/ability.lua +7 -0
  86. package/engine/behavior.d.ts +28 -0
  87. package/engine/behavior.lua +181 -0
  88. package/engine/behaviour/ability/apply-buff.d.ts +38 -0
  89. package/engine/behaviour/ability/apply-buff.lua +126 -0
  90. package/engine/behaviour/ability/apply-unit-behavior.d.ts +12 -0
  91. package/engine/behaviour/ability/apply-unit-behavior.lua +36 -0
  92. package/engine/behaviour/ability/damage.d.ts +25 -0
  93. package/engine/behaviour/ability/damage.lua +75 -0
  94. package/engine/behaviour/ability/heal.d.ts +16 -0
  95. package/engine/behaviour/ability/heal.lua +35 -0
  96. package/engine/behaviour/ability/instant-impact.d.ts +6 -0
  97. package/engine/behaviour/ability/instant-impact.lua +25 -0
  98. package/engine/behaviour/ability.d.ts +40 -0
  99. package/engine/behaviour/ability.lua +175 -0
  100. package/engine/behaviour/unit/stun-immunity.d.ts +19 -0
  101. package/engine/behaviour/unit/stun-immunity.lua +67 -0
  102. package/engine/behaviour/unit.d.ts +20 -0
  103. package/engine/behaviour/unit.lua +75 -0
  104. package/engine/buff.d.ts +221 -0
  105. package/engine/buff.lua +1093 -0
  106. package/engine/constants.d.ts +7 -0
  107. package/engine/constants.lua +8 -0
  108. package/engine/index.d.ts +5 -0
  109. package/engine/index.lua +2 -0
  110. package/engine/internal/ability.d.ts +91 -0
  111. package/engine/internal/ability.lua +531 -0
  112. package/engine/internal/item/ability.d.ts +2 -0
  113. package/engine/internal/item/ability.lua +48 -0
  114. package/engine/internal/item+owner.d.ts +7 -0
  115. package/engine/internal/item+owner.lua +22 -0
  116. package/engine/internal/item.d.ts +86 -0
  117. package/engine/internal/item.lua +580 -0
  118. package/engine/internal/mechanics/ability-duration.d.ts +4 -0
  119. package/engine/internal/mechanics/ability-duration.lua +11 -0
  120. package/engine/internal/mechanics/area-damage.d.ts +2 -0
  121. package/engine/internal/mechanics/area-damage.lua +33 -0
  122. package/engine/internal/misc/dummy-units.d.ts +2 -0
  123. package/engine/internal/misc/dummy-units.lua +14 -0
  124. package/engine/internal/object-data/armor-increase.d.ts +2 -0
  125. package/engine/internal/object-data/armor-increase.lua +19 -0
  126. package/engine/internal/object-data/attribute-bonus.d.ts +2 -0
  127. package/engine/internal/object-data/attribute-bonus.lua +15 -0
  128. package/engine/internal/object-data/auto-attack-damage-increase.d.ts +2 -0
  129. package/engine/internal/object-data/auto-attack-damage-increase.lua +17 -0
  130. package/engine/internal/object-data/auto-attack-speed-increase.d.ts +2 -0
  131. package/engine/internal/object-data/auto-attack-speed-increase.lua +14 -0
  132. package/engine/internal/object-data/dummy-inventory.d.ts +2 -0
  133. package/engine/internal/object-data/dummy-inventory.lua +16 -0
  134. package/engine/internal/object-data/dummy-item.d.ts +2 -0
  135. package/engine/internal/object-data/dummy-item.lua +10 -0
  136. package/engine/internal/object-data/ghost-visible.d.ts +2 -0
  137. package/engine/internal/object-data/ghost-visible.lua +15 -0
  138. package/engine/internal/object-data/invulnerable.d.ts +2 -0
  139. package/engine/internal/object-data/invulnerable.lua +11 -0
  140. package/engine/internal/object-data/movement-speed-increase-factor.d.ts +2 -0
  141. package/engine/internal/object-data/movement-speed-increase-factor.lua +18 -0
  142. package/engine/internal/unit/ability.d.ts +143 -0
  143. package/engine/internal/unit/ability.lua +369 -0
  144. package/engine/internal/unit/allowed-targets.d.ts +17 -0
  145. package/engine/internal/unit/allowed-targets.lua +19 -0
  146. package/engine/internal/unit/band-aids/ancestral-spirit-cannibalize.d.ts +2 -0
  147. package/engine/internal/unit/band-aids/ancestral-spirit-cannibalize.lua +21 -0
  148. package/engine/internal/unit/bonus.d.ts +41 -0
  149. package/engine/internal/unit/bonus.lua +188 -0
  150. package/engine/internal/unit/buff.d.ts +38 -0
  151. package/engine/internal/unit/buff.lua +81 -0
  152. package/engine/internal/unit/expiration-timer.d.ts +22 -0
  153. package/engine/internal/unit/expiration-timer.lua +44 -0
  154. package/engine/internal/unit/ghost-counter.d.ts +12 -0
  155. package/engine/internal/unit/ghost-counter.lua +26 -0
  156. package/engine/internal/unit/invulnerability-counter.d.ts +12 -0
  157. package/engine/internal/unit/invulnerability-counter.lua +26 -0
  158. package/engine/internal/unit/missile.d.ts +42 -0
  159. package/engine/internal/unit/missile.lua +70 -0
  160. package/engine/internal/unit/movement-speed.d.ts +18 -0
  161. package/engine/internal/unit/movement-speed.lua +42 -0
  162. package/engine/internal/unit/summon-event.d.ts +12 -0
  163. package/engine/internal/unit/summon-event.lua +50 -0
  164. package/engine/internal/unit+ability.d.ts +9 -0
  165. package/engine/internal/unit+ability.lua +59 -0
  166. package/engine/internal/unit+bonus.d.ts +8 -0
  167. package/engine/internal/unit+bonus.lua +40 -0
  168. package/engine/internal/unit+damage.d.ts +69 -0
  169. package/engine/internal/unit+damage.lua +123 -0
  170. package/engine/internal/unit+rally.d.ts +10 -0
  171. package/engine/internal/unit+rally.lua +159 -0
  172. package/engine/internal/unit+spellSteal.d.ts +7 -0
  173. package/engine/internal/unit+spellSteal.lua +64 -0
  174. package/engine/internal/unit+transport.d.ts +12 -0
  175. package/engine/internal/unit+transport.lua +102 -0
  176. package/engine/internal/unit-missile-data.d.ts +2 -0
  177. package/engine/internal/unit-missile-data.lua +107 -0
  178. package/engine/internal/unit-missile-launch.d.ts +7 -0
  179. package/engine/internal/unit-missile-launch.lua +32 -0
  180. package/engine/internal/unit.d.ts +312 -0
  181. package/engine/internal/unit.lua +2430 -0
  182. package/engine/internal/utility.d.ts +2 -0
  183. package/engine/internal/utility.lua +13 -0
  184. package/engine/lightning.d.ts +51 -0
  185. package/engine/lightning.lua +303 -0
  186. package/engine/local-client.d.ts +16 -0
  187. package/engine/local-client.lua +86 -0
  188. package/engine/object-data/auxiliary/animation-name.d.ts +14 -0
  189. package/engine/object-data/auxiliary/animation-name.lua +2 -0
  190. package/engine/object-data/auxiliary/animation-qualifier.d.ts +53 -0
  191. package/engine/object-data/auxiliary/animation-qualifier.lua +2 -0
  192. package/engine/object-data/auxiliary/armor-sound-type.d.ts +8 -0
  193. package/engine/object-data/auxiliary/armor-sound-type.lua +2 -0
  194. package/engine/object-data/auxiliary/attachment-preset.d.ts +15 -0
  195. package/engine/object-data/auxiliary/attachment-preset.lua +29 -0
  196. package/engine/object-data/auxiliary/attack-type.d.ts +11 -0
  197. package/engine/object-data/auxiliary/attack-type.lua +2 -0
  198. package/engine/object-data/auxiliary/buff-polarity.d.ts +6 -0
  199. package/engine/object-data/auxiliary/buff-polarity.lua +2 -0
  200. package/engine/object-data/auxiliary/buff-resistance-type.d.ts +6 -0
  201. package/engine/object-data/auxiliary/buff-resistance-type.lua +2 -0
  202. package/engine/object-data/auxiliary/combat-classification.d.ts +46 -0
  203. package/engine/object-data/auxiliary/combat-classification.lua +206 -0
  204. package/engine/object-data/auxiliary/detection-type.d.ts +7 -0
  205. package/engine/object-data/auxiliary/detection-type.lua +2 -0
  206. package/engine/object-data/auxiliary/model-node-name.d.ts +12 -0
  207. package/engine/object-data/auxiliary/model-node-name.lua +2 -0
  208. package/engine/object-data/auxiliary/model-node-qualifier.d.ts +21 -0
  209. package/engine/object-data/auxiliary/model-node-qualifier.lua +2 -0
  210. package/engine/object-data/auxiliary/movement-type.d.ts +10 -0
  211. package/engine/object-data/auxiliary/movement-type.lua +2 -0
  212. package/engine/object-data/auxiliary/race.d.ts +14 -0
  213. package/engine/object-data/auxiliary/race.lua +2 -0
  214. package/engine/object-data/auxiliary/sound-preset-name.d.ts +8 -0
  215. package/engine/object-data/auxiliary/sound-preset-name.lua +2 -0
  216. package/engine/object-data/auxiliary/sound-set-name.d.ts +35 -0
  217. package/engine/object-data/auxiliary/sound-set-name.lua +2 -0
  218. package/engine/object-data/auxiliary/targeting-type.d.ts +8 -0
  219. package/engine/object-data/auxiliary/targeting-type.lua +2 -0
  220. package/engine/object-data/auxiliary/tech-tree-dependency.d.ts +16 -0
  221. package/engine/object-data/auxiliary/tech-tree-dependency.lua +8 -0
  222. package/engine/object-data/auxiliary/unit-classification.d.ts +19 -0
  223. package/engine/object-data/auxiliary/unit-classification.lua +50 -0
  224. package/engine/object-data/auxiliary/weapon-sound-type.d.ts +17 -0
  225. package/engine/object-data/auxiliary/weapon-sound-type.lua +2 -0
  226. package/engine/object-data/entry/ability-type/armor-increase.d.ts +8 -0
  227. package/engine/object-data/entry/ability-type/armor-increase.lua +26 -0
  228. package/engine/object-data/entry/ability-type/attribute-increase.d.ts +12 -0
  229. package/engine/object-data/entry/ability-type/attribute-increase.lua +52 -0
  230. package/engine/object-data/entry/ability-type/auto-attack-damage-increase.d.ts +8 -0
  231. package/engine/object-data/entry/ability-type/auto-attack-damage-increase.lua +26 -0
  232. package/engine/object-data/entry/ability-type/auto-attack-heal-reduction-effect.d.ts +12 -0
  233. package/engine/object-data/entry/ability-type/auto-attack-heal-reduction-effect.lua +52 -0
  234. package/engine/object-data/entry/ability-type/auto-attack-speed-increase.d.ts +8 -0
  235. package/engine/object-data/entry/ability-type/auto-attack-speed-increase.lua +26 -0
  236. package/engine/object-data/entry/ability-type/bash.d.ts +16 -0
  237. package/engine/object-data/entry/ability-type/bash.lua +78 -0
  238. package/engine/object-data/entry/ability-type/berserk.d.ts +10 -0
  239. package/engine/object-data/entry/ability-type/berserk.lua +39 -0
  240. package/engine/object-data/entry/ability-type/blank-configurable.d.ts +21 -0
  241. package/engine/object-data/entry/ability-type/blank-configurable.lua +249 -0
  242. package/engine/object-data/entry/ability-type/blank-passive.d.ts +7 -0
  243. package/engine/object-data/entry/ability-type/blank-passive.lua +28 -0
  244. package/engine/object-data/entry/ability-type/blizzard.d.ts +16 -0
  245. package/engine/object-data/entry/ability-type/blizzard.lua +78 -0
  246. package/engine/object-data/entry/ability-type/blood-lust.d.ts +12 -0
  247. package/engine/object-data/entry/ability-type/blood-lust.lua +52 -0
  248. package/engine/object-data/entry/ability-type/chain-lightning.d.ts +12 -0
  249. package/engine/object-data/entry/ability-type/chain-lightning.lua +52 -0
  250. package/engine/object-data/entry/ability-type/channel.d.ts +48 -0
  251. package/engine/object-data/entry/ability-type/channel.lua +140 -0
  252. package/engine/object-data/entry/ability-type/charge-gold-and-lumber.d.ts +14 -0
  253. package/engine/object-data/entry/ability-type/charge-gold-and-lumber.lua +65 -0
  254. package/engine/object-data/entry/ability-type/cleaving-attack.d.ts +8 -0
  255. package/engine/object-data/entry/ability-type/cleaving-attack.lua +26 -0
  256. package/engine/object-data/entry/ability-type/cluster-rockets.d.ts +18 -0
  257. package/engine/object-data/entry/ability-type/cluster-rockets.lua +91 -0
  258. package/engine/object-data/entry/ability-type/cripple.d.ts +12 -0
  259. package/engine/object-data/entry/ability-type/cripple.lua +52 -0
  260. package/engine/object-data/entry/ability-type/critical-strike.d.ts +18 -0
  261. package/engine/object-data/entry/ability-type/critical-strike.lua +91 -0
  262. package/engine/object-data/entry/ability-type/curse.d.ts +8 -0
  263. package/engine/object-data/entry/ability-type/curse.lua +26 -0
  264. package/engine/object-data/entry/ability-type/dark-summoning.d.ts +10 -0
  265. package/engine/object-data/entry/ability-type/dark-summoning.lua +39 -0
  266. package/engine/object-data/entry/ability-type/death-coil.d.ts +8 -0
  267. package/engine/object-data/entry/ability-type/death-coil.lua +26 -0
  268. package/engine/object-data/entry/ability-type/disease-cloud.d.ts +15 -0
  269. package/engine/object-data/entry/ability-type/disease-cloud.lua +65 -0
  270. package/engine/object-data/entry/ability-type/divine-shield.d.ts +5 -0
  271. package/engine/object-data/entry/ability-type/divine-shield.lua +12 -0
  272. package/engine/object-data/entry/ability-type/endurance-aura.d.ts +10 -0
  273. package/engine/object-data/entry/ability-type/endurance-aura.lua +39 -0
  274. package/engine/object-data/entry/ability-type/engineering-upgrade.d.ts +13 -0
  275. package/engine/object-data/entry/ability-type/engineering-upgrade.lua +88 -0
  276. package/engine/object-data/entry/ability-type/evasion.d.ts +8 -0
  277. package/engine/object-data/entry/ability-type/evasion.lua +26 -0
  278. package/engine/object-data/entry/ability-type/faerie-fire.d.ts +10 -0
  279. package/engine/object-data/entry/ability-type/faerie-fire.lua +39 -0
  280. package/engine/object-data/entry/ability-type/far-sight.d.ts +9 -0
  281. package/engine/object-data/entry/ability-type/far-sight.lua +26 -0
  282. package/engine/object-data/entry/ability-type/feral-spirit.d.ts +11 -0
  283. package/engine/object-data/entry/ability-type/feral-spirit.lua +39 -0
  284. package/engine/object-data/entry/ability-type/frenzy.d.ts +12 -0
  285. package/engine/object-data/entry/ability-type/frenzy.lua +52 -0
  286. package/engine/object-data/entry/ability-type/frost-nova.d.ts +12 -0
  287. package/engine/object-data/entry/ability-type/frost-nova.lua +52 -0
  288. package/engine/object-data/entry/ability-type/ghost-visible.d.ts +10 -0
  289. package/engine/object-data/entry/ability-type/ghost-visible.lua +39 -0
  290. package/engine/object-data/entry/ability-type/gold-mine.d.ts +12 -0
  291. package/engine/object-data/entry/ability-type/gold-mine.lua +52 -0
  292. package/engine/object-data/entry/ability-type/heal.d.ts +8 -0
  293. package/engine/object-data/entry/ability-type/heal.lua +26 -0
  294. package/engine/object-data/entry/ability-type/healing-salve.d.ts +22 -0
  295. package/engine/object-data/entry/ability-type/healing-salve.lua +78 -0
  296. package/engine/object-data/entry/ability-type/healing-spray.d.ts +18 -0
  297. package/engine/object-data/entry/ability-type/healing-spray.lua +91 -0
  298. package/engine/object-data/entry/ability-type/healing-wave.d.ts +12 -0
  299. package/engine/object-data/entry/ability-type/healing-wave.lua +52 -0
  300. package/engine/object-data/entry/ability-type/holy-light.d.ts +8 -0
  301. package/engine/object-data/entry/ability-type/holy-light.lua +26 -0
  302. package/engine/object-data/entry/ability-type/incinerate.d.ts +18 -0
  303. package/engine/object-data/entry/ability-type/incinerate.lua +91 -0
  304. package/engine/object-data/entry/ability-type/inner-fire.d.ts +14 -0
  305. package/engine/object-data/entry/ability-type/inner-fire.lua +65 -0
  306. package/engine/object-data/entry/ability-type/inventory.d.ts +16 -0
  307. package/engine/object-data/entry/ability-type/inventory.lua +78 -0
  308. package/engine/object-data/entry/ability-type/invulnerable.d.ts +5 -0
  309. package/engine/object-data/entry/ability-type/invulnerable.lua +12 -0
  310. package/engine/object-data/entry/ability-type/lightning-shield.d.ts +8 -0
  311. package/engine/object-data/entry/ability-type/lightning-shield.lua +26 -0
  312. package/engine/object-data/entry/ability-type/movement-speed-increase.d.ts +8 -0
  313. package/engine/object-data/entry/ability-type/movement-speed-increase.lua +26 -0
  314. package/engine/object-data/entry/ability-type/permanent-immolation.d.ts +8 -0
  315. package/engine/object-data/entry/ability-type/permanent-immolation.lua +26 -0
  316. package/engine/object-data/entry/ability-type/phoenix-morph.d.ts +25 -0
  317. package/engine/object-data/entry/ability-type/phoenix-morph.lua +130 -0
  318. package/engine/object-data/entry/ability-type/recall.d.ts +10 -0
  319. package/engine/object-data/entry/ability-type/recall.lua +39 -0
  320. package/engine/object-data/entry/ability-type/rejuvenation.d.ts +20 -0
  321. package/engine/object-data/entry/ability-type/rejuvenation.lua +65 -0
  322. package/engine/object-data/entry/ability-type/searing-arrows.d.ts +8 -0
  323. package/engine/object-data/entry/ability-type/searing-arrows.lua +26 -0
  324. package/engine/object-data/entry/ability-type/shock-wave.d.ts +10 -0
  325. package/engine/object-data/entry/ability-type/shock-wave.lua +39 -0
  326. package/engine/object-data/entry/ability-type/slow-poison.d.ts +12 -0
  327. package/engine/object-data/entry/ability-type/slow-poison.lua +52 -0
  328. package/engine/object-data/entry/ability-type/slow.d.ts +12 -0
  329. package/engine/object-data/entry/ability-type/slow.lua +52 -0
  330. package/engine/object-data/entry/ability-type/spell-damage-reduction.d.ts +10 -0
  331. package/engine/object-data/entry/ability-type/spell-damage-reduction.lua +39 -0
  332. package/engine/object-data/entry/ability-type/spiked-carapace.d.ts +12 -0
  333. package/engine/object-data/entry/ability-type/spiked-carapace.lua +52 -0
  334. package/engine/object-data/entry/ability-type/spirit-touch.d.ts +14 -0
  335. package/engine/object-data/entry/ability-type/spirit-touch.lua +65 -0
  336. package/engine/object-data/entry/ability-type/storm-bolt.d.ts +8 -0
  337. package/engine/object-data/entry/ability-type/storm-bolt.lua +26 -0
  338. package/engine/object-data/entry/ability-type/summon-quilbeast.d.ts +11 -0
  339. package/engine/object-data/entry/ability-type/summon-quilbeast.lua +39 -0
  340. package/engine/object-data/entry/ability-type/summon-water-elemental.d.ts +11 -0
  341. package/engine/object-data/entry/ability-type/summon-water-elemental.lua +39 -0
  342. package/engine/object-data/entry/ability-type.d.ts +148 -0
  343. package/engine/object-data/entry/ability-type.lua +1058 -0
  344. package/engine/object-data/entry/buff-type/applicable.d.ts +16 -0
  345. package/engine/object-data/entry/buff-type/applicable.lua +377 -0
  346. package/engine/object-data/entry/buff-type/blank.d.ts +8 -0
  347. package/engine/object-data/entry/buff-type/blank.lua +17 -0
  348. package/engine/object-data/entry/buff-type.d.ts +64 -0
  349. package/engine/object-data/entry/buff-type.lua +316 -0
  350. package/engine/object-data/entry/destructible-type.d.ts +21 -0
  351. package/engine/object-data/entry/destructible-type.lua +83 -0
  352. package/engine/object-data/entry/item-type/blank.d.ts +8 -0
  353. package/engine/object-data/entry/item-type/blank.lua +21 -0
  354. package/engine/object-data/entry/item-type.d.ts +49 -0
  355. package/engine/object-data/entry/item-type.lua +259 -0
  356. package/engine/object-data/entry/lightning-type.d.ts +37 -0
  357. package/engine/object-data/entry/lightning-type.lua +191 -0
  358. package/engine/object-data/entry/unit-type/blank.d.ts +6 -0
  359. package/engine/object-data/entry/unit-type/blank.lua +13 -0
  360. package/engine/object-data/entry/unit-type.d.ts +218 -0
  361. package/engine/object-data/entry/unit-type.lua +1306 -0
  362. package/engine/object-data/entry/upgrade/blank.d.ts +8 -0
  363. package/engine/object-data/entry/upgrade/blank.lua +22 -0
  364. package/engine/object-data/entry/upgrade.d.ts +59 -0
  365. package/engine/object-data/entry/upgrade.lua +238 -0
  366. package/engine/object-data/entry.d.ts +80 -0
  367. package/engine/object-data/entry.lua +634 -0
  368. package/engine/object-data/utility/object-data-entry-id-generator.d.ts +6 -0
  369. package/engine/object-data/utility/object-data-entry-id-generator.lua +63 -0
  370. package/engine/object-data/utility/order-type-string-id-factory.d.ts +9 -0
  371. package/engine/object-data/utility/order-type-string-id-factory.lua +368 -0
  372. package/engine/object-field/ability.d.ts +115 -0
  373. package/engine/object-field/ability.lua +471 -0
  374. package/engine/object-field/unit.d.ts +15 -0
  375. package/engine/object-field/unit.lua +49 -0
  376. package/engine/object-field.d.ts +84 -0
  377. package/engine/object-field.lua +444 -0
  378. package/engine/random.d.ts +10 -0
  379. package/engine/random.lua +9 -0
  380. package/engine/standard/entries/ability-type.d.ts +8 -0
  381. package/engine/standard/entries/ability-type.lua +8 -0
  382. package/engine/standard/entries/lightning-type.d.ts +16 -0
  383. package/engine/standard/entries/lightning-type.lua +16 -0
  384. package/engine/standard/entries/unit-type.d.ts +63 -0
  385. package/engine/standard/entries/unit-type.lua +63 -0
  386. package/engine/standard/entries/upgrade.d.ts +92 -0
  387. package/engine/standard/entries/upgrade.lua +92 -0
  388. package/engine/standard/fields/ability.d.ts +737 -0
  389. package/engine/standard/fields/ability.lua +749 -0
  390. package/engine/standard/pathing-textures.d.ts +6 -0
  391. package/engine/standard/pathing-textures.lua +7 -0
  392. package/engine/text-tag.d.ts +25 -0
  393. package/engine/text-tag.lua +109 -0
  394. package/engine/unit.d.ts +20 -0
  395. package/engine/unit.lua +31 -0
  396. package/event.d.ts +53 -0
  397. package/event.lua +269 -0
  398. package/exception.d.ts +17 -0
  399. package/exception.lua +53 -0
  400. package/file.d.ts +4 -0
  401. package/file.lua +42 -0
  402. package/global/math.d.ts +21 -0
  403. package/global/math.lua +72 -0
  404. package/global/vec2.d.ts +66 -0
  405. package/global/vec2.lua +159 -0
  406. package/index.d.ts +8 -0
  407. package/index.lua +9 -0
  408. package/lualib_bundle.lua +2629 -0
  409. package/math/vec2.d.ts +18 -0
  410. package/math/vec2.lua +42 -0
  411. package/math.d.ts +39 -0
  412. package/math.lua +91 -0
  413. package/net/signal.d.ts +11 -0
  414. package/net/signal.lua +56 -0
  415. package/net/socket.d.ts +9 -0
  416. package/net/socket.lua +26 -0
  417. package/network.d.ts +31 -0
  418. package/network.lua +194 -0
  419. package/objutil/ability.d.ts +710 -0
  420. package/objutil/ability.lua +3781 -0
  421. package/objutil/buff.d.ts +110 -0
  422. package/objutil/buff.lua +769 -0
  423. package/objutil/dummy.d.ts +2 -0
  424. package/objutil/dummy.lua +49 -0
  425. package/objutil/idgen.d.ts +9 -0
  426. package/objutil/idgen.lua +92 -0
  427. package/objutil/item.d.ts +38 -0
  428. package/objutil/item.lua +254 -0
  429. package/objutil/object.d.ts +43 -0
  430. package/objutil/object.lua +213 -0
  431. package/objutil/unit.d.ts +134 -0
  432. package/objutil/unit.lua +913 -0
  433. package/objutil/upgrade.d.ts +22 -0
  434. package/objutil/upgrade.lua +127 -0
  435. package/operation.d.ts +35 -0
  436. package/operation.lua +179 -0
  437. package/package.json +47 -0
  438. package/patch-lualib.d.ts +2 -0
  439. package/patch-lualib.lua +67 -0
  440. package/patch-natives.d.ts +11 -0
  441. package/patch-natives.lua +14 -0
  442. package/string.d.ts +106 -0
  443. package/string.lua +34 -0
  444. package/time/dayOfWeek.d.ts +97 -0
  445. package/time/dayOfWeek.lua +53 -0
  446. package/time/localDate.d.ts +145 -0
  447. package/time/localDate.lua +236 -0
  448. package/time/localDateTime.d.ts +133 -0
  449. package/time/localDateTime.lua +154 -0
  450. package/time/localTime.d.ts +87 -0
  451. package/time/localTime.lua +91 -0
  452. package/time/month.d.ts +146 -0
  453. package/time/month.lua +129 -0
  454. package/time/year.d.ts +117 -0
  455. package/time/year.lua +81 -0
  456. package/types.d.ts +13 -0
  457. package/types.lua +0 -0
  458. package/util/objectPool.d.ts +6 -0
  459. package/util/objectPool.lua +28 -0
  460. package/util/stream.d.ts +29 -0
  461. package/util/stream.lua +453 -0
  462. package/util/stringBuilder.d.ts +8 -0
  463. package/util/stringBuilder.lua +25 -0
  464. package/utility/arrays.d.ts +57 -0
  465. package/utility/arrays.lua +369 -0
  466. package/utility/base64.d.ts +23 -0
  467. package/utility/base64.lua +177 -0
  468. package/utility/bit-set.d.ts +18 -0
  469. package/utility/bit-set.lua +12 -0
  470. package/utility/functions.d.ts +5 -0
  471. package/utility/functions.lua +90 -0
  472. package/utility/json.d.ts +2 -0
  473. package/utility/json.lua +400 -0
  474. package/utility/linked-set.d.ts +49 -0
  475. package/utility/linked-set.lua +181 -0
  476. package/utility/lua-maps.d.ts +6 -0
  477. package/utility/lua-maps.lua +25 -0
  478. package/utility/lua-sets.d.ts +6 -0
  479. package/utility/lua-sets.lua +37 -0
  480. package/utility/lzw.d.ts +2 -0
  481. package/utility/lzw.lua +161 -0
  482. package/utility/observable-array.d.ts +17 -0
  483. package/utility/observable-array.lua +30 -0
  484. package/utility/preconditions.d.ts +23 -0
  485. package/utility/preconditions.lua +58 -0
  486. package/utility/records.d.ts +3 -0
  487. package/utility/records.lua +9 -0
  488. package/utility/reflection.d.ts +4 -0
  489. package/utility/reflection.lua +31 -0
  490. package/utility/strings.d.ts +2 -0
  491. package/utility/strings.lua +44 -0
  492. package/utility/types.d.ts +39 -0
  493. package/utility/types.lua +2 -0
@@ -0,0 +1,1093 @@
1
+ local ____lualib = require("lualib_bundle")
2
+ local __TS__Class = ____lualib.__TS__Class
3
+ local __TS__New = ____lualib.__TS__New
4
+ local __TS__InstanceOf = ____lualib.__TS__InstanceOf
5
+ local __TS__ClassExtends = ____lualib.__TS__ClassExtends
6
+ local __TS__SparseArrayNew = ____lualib.__TS__SparseArrayNew
7
+ local __TS__SparseArrayPush = ____lualib.__TS__SparseArrayPush
8
+ local __TS__SparseArraySpread = ____lualib.__TS__SparseArraySpread
9
+ local __TS__SetDescriptor = ____lualib.__TS__SetDescriptor
10
+ local ____exports = {}
11
+ local buffDamageIntervalTimerCallback, buffHealingIntervalTimerCallback
12
+ local ____unit = require("engine.internal.unit")
13
+ local Unit = ____unit.Unit
14
+ local ____applicable = require("engine.object-data.entry.buff-type.applicable")
15
+ local internalApplyBuff = ____applicable.internalApplyBuff
16
+ local removeBuff = ____applicable.removeBuff
17
+ local ____ability = require("engine.internal.ability")
18
+ local Ability = ____ability.Ability
19
+ local ____ability = require("engine.object-field.ability")
20
+ local AbilityBooleanField = ____ability.AbilityBooleanField
21
+ local AbilityNumberField = ____ability.AbilityNumberField
22
+ local resolveCurrentAbilityDependentValue = ____ability.resolveCurrentAbilityDependentValue
23
+ local ____exception = require("exception")
24
+ local IllegalArgumentException = ____exception.IllegalArgumentException
25
+ local ____timer = require("core.types.timer")
26
+ local Timer = ____timer.Timer
27
+ local ____math = require("math")
28
+ local max = ____math.max
29
+ local min = ____math.min
30
+ local ____bonus = require("engine.internal.unit.bonus")
31
+ local addOrUpdateOrRemoveUnitBonus = ____bonus.addOrUpdateOrRemoveUnitBonus
32
+ local getUnitBonus = ____bonus.getUnitBonus
33
+ local removeUnitBonus = ____bonus.removeUnitBonus
34
+ local UnitBonusType = ____bonus.UnitBonusType
35
+ local ____area_2Ddamage = require("engine.internal.mechanics.area-damage")
36
+ local damageArea = ____area_2Ddamage.damageArea
37
+ local ____preconditions = require("utility.preconditions")
38
+ local checkNotNull = ____preconditions.checkNotNull
39
+ local ____effect = require("core.types.effect")
40
+ local Effect = ____effect.Effect
41
+ local ____buff_2Dtype = require("engine.object-data.entry.buff-type")
42
+ local BuffType = ____buff_2Dtype.BuffType
43
+ local ____unit = require("engine.behaviour.unit")
44
+ local UnitBehavior = ____unit.UnitBehavior
45
+ local ____arrays = require("utility.arrays")
46
+ local forEach = ____arrays.forEach
47
+ local ____ability_2Dduration = require("engine.internal.mechanics.ability-duration")
48
+ local getAbilityDuration = ____ability_2Dduration.getAbilityDuration
49
+ local getUnitAbility = BlzGetUnitAbility
50
+ local stringValueByBuffTypeIdByFieldId = postcompile(function()
51
+ local stringValueByBuffTypeIdByFieldId = {}
52
+ for ____, rawFieldId in ipairs({"feft", "fspt"}) do
53
+ local stringValueByBuffTypeId = {}
54
+ for ____, buffType in ipairs(BuffType:getAll()) do
55
+ local stringValue = buffType.getStringField(buffType, rawFieldId)
56
+ if stringValue ~= "" then
57
+ stringValueByBuffTypeId[buffType.id] = stringValue
58
+ end
59
+ end
60
+ stringValueByBuffTypeIdByFieldId[fourCC(rawFieldId)] = stringValueByBuffTypeId
61
+ end
62
+ return stringValueByBuffTypeIdByFieldId
63
+ end)
64
+ local buffByTypeIdByUnit = setmetatable({}, {__mode = "k"})
65
+ ____exports.BuffUniqueGroup = __TS__Class()
66
+ local BuffUniqueGroup = ____exports.BuffUniqueGroup
67
+ BuffUniqueGroup.name = "BuffUniqueGroup"
68
+ function BuffUniqueGroup.prototype.____constructor(self)
69
+ end
70
+ local buffParametersKeys = {
71
+ spellStealPriority = true,
72
+ level = true,
73
+ duration = true,
74
+ learnLevelMinimum = true,
75
+ source = true,
76
+ behaviorConstructors = true,
77
+ abilityTypeIds = true,
78
+ damageUponDeathAllowedTargetCombatClassifications = true,
79
+ damageUponDeath = true,
80
+ damageUponDeathRange = true,
81
+ mediumDamageUponDeath = true,
82
+ mediumDamageUponDeathRange = true,
83
+ smallDamageUponDeath = true,
84
+ smallDamageUponDeathRange = true,
85
+ damageOverDuration = true,
86
+ damagePerInterval = true,
87
+ damageInterval = true,
88
+ healingOverDuration = true,
89
+ healingPerInterval = true,
90
+ healingInterval = true,
91
+ damageIncrease = true,
92
+ damageIncreaseFactor = true,
93
+ armorIncrease = true,
94
+ armorIncreaseFactor = true,
95
+ attackSpeedIncreaseFactor = true,
96
+ movementSpeedIncreaseFactor = true,
97
+ receivedDamageFactor = true,
98
+ receivedMagicDamageFactor = true,
99
+ durationIncreaseOnAutoAttack = true,
100
+ maximumDuration = true,
101
+ maximumRemainingDuration = true,
102
+ stuns = true,
103
+ ignoresStunImmunity = true,
104
+ providesStunImmunity = true,
105
+ providesSpellImmunity = true,
106
+ providesInvulnerability = true,
107
+ disablesAutoAttack = true,
108
+ destroysOnDamage = true,
109
+ maximumAutoAttackCount = true,
110
+ uniqueGroup = true
111
+ }
112
+ local function resolveNumberValue(ability, level, value)
113
+ if value == nil or type(value) == "number" then
114
+ return value
115
+ end
116
+ if ability == nil then
117
+ error(
118
+ __TS__New(IllegalArgumentException),
119
+ 0
120
+ )
121
+ end
122
+ return __TS__InstanceOf(value, AbilityNumberField) and value:getValue(ability) or value:getValue(ability, level or ability.level)
123
+ end
124
+ local function resolveBooleanValue(ability, level, value)
125
+ if value == nil or type(value) == "boolean" then
126
+ return value
127
+ end
128
+ if ability == nil then
129
+ error(
130
+ __TS__New(IllegalArgumentException),
131
+ 0
132
+ )
133
+ end
134
+ local ____temp_0
135
+ if __TS__InstanceOf(value, AbilityBooleanField) then
136
+ ____temp_0 = value:getValue(ability)
137
+ else
138
+ ____temp_0 = value:getValue(ability, level or ability.level)
139
+ end
140
+ return ____temp_0
141
+ end
142
+ local function resolveAndSetNumberValue(buff, property, ability, level, value, defaultValue)
143
+ local resolvedValue = resolveNumberValue(ability, level, value or defaultValue)
144
+ if resolvedValue ~= nil then
145
+ buff[property] = resolvedValue
146
+ end
147
+ end
148
+ local buffBooleanParameters = {"stuns", "ignoresStunImmunity", "disablesAutoAttack", "providesInvulnerability"}
149
+ local buffNumberParameters = {
150
+ "durationIncreaseOnAutoAttack",
151
+ "attackSpeedIncreaseFactor",
152
+ "movementSpeedIncreaseFactor",
153
+ "armorIncrease",
154
+ "receivedDamageFactor",
155
+ "maximumAutoAttackCount",
156
+ "damageInterval",
157
+ "damagePerInterval",
158
+ "damageOverDuration",
159
+ "healingInterval",
160
+ "healingPerInterval",
161
+ "healingOverDuration"
162
+ }
163
+ local unsuccessfulApplicationMarker = {}
164
+ local function selectBuffTypeIdWithLeastDuration(buffTypeIds, unit)
165
+ local minimumDuration = nil
166
+ local minimumDurationBuffTypeId
167
+ local firstNativeBuffTypeId = nil
168
+ for ____, buffTypeId in ipairs(buffTypeIds) do
169
+ local ____opt_1 = buffByTypeIdByUnit[unit]
170
+ local buff = ____opt_1 and ____opt_1[buffTypeId]
171
+ if buff ~= nil then
172
+ if minimumDuration == nil or buff.remainingDuration < minimumDuration then
173
+ minimumDuration = buff.remainingDuration
174
+ minimumDurationBuffTypeId = buffTypeId
175
+ end
176
+ elseif unit:hasBuff(buffTypeId) then
177
+ firstNativeBuffTypeId = firstNativeBuffTypeId or buffTypeId
178
+ else
179
+ return buffTypeId
180
+ end
181
+ end
182
+ if minimumDurationBuffTypeId ~= nil then
183
+ return minimumDurationBuffTypeId
184
+ end
185
+ return checkNotNull(firstNativeBuffTypeId)
186
+ end
187
+ local function destroyBuffIfItHasSameUniqueGroup(buff, uniqueGroup)
188
+ if buff[103] == uniqueGroup then
189
+ buff:destroy()
190
+ end
191
+ end
192
+ local function destroyBuff(buff)
193
+ buff:destroy()
194
+ end
195
+ local function expireBuff(buff)
196
+ local remainingDamageOverDuration = buff[112] or 0
197
+ local remainingHealingOverDuration = buff[112] or 0
198
+ if remainingDamageOverDuration ~= 0 or remainingHealingOverDuration ~= 0 then
199
+ buff:flashSpecialEffect()
200
+ if remainingDamageOverDuration ~= 0 then
201
+ (buff[101] or buff[100]):damageTarget(buff[100], remainingDamageOverDuration)
202
+ buff[112] = nil
203
+ end
204
+ if remainingHealingOverDuration ~= 0 then
205
+ (buff[101] or buff[100]):healTarget(buff[100], remainingHealingOverDuration)
206
+ buff[117] = nil
207
+ end
208
+ end
209
+ Timer:run(destroyBuff, buff)
210
+ end
211
+ local function buffDamageIntervalInitialTimerCallback(buff)
212
+ buffDamageIntervalTimerCallback(buff)
213
+ local timer = buff[113]
214
+ local damageInterval = buff[111]
215
+ if timer ~= nil and damageInterval ~= nil and damageInterval > 0 then
216
+ timer:start(damageInterval, true, buffDamageIntervalTimerCallback, buff)
217
+ end
218
+ end
219
+ buffDamageIntervalTimerCallback = function(buff)
220
+ buff:flashSpecialEffect()
221
+ local source = buff[101] or buff[100]
222
+ local remainingDamageOverDuration = buff[112] or 0
223
+ if remainingDamageOverDuration ~= 0 then
224
+ local damageInterval = buff[111] or 0
225
+ if damageInterval ~= 0 then
226
+ local damage = remainingDamageOverDuration / (1 + buff.remainingDuration / damageInterval)
227
+ source:damageTarget(buff[100], damage)
228
+ buff[112] = remainingDamageOverDuration - damage
229
+ end
230
+ end
231
+ local damagePerInterval = buff[110] or 0
232
+ if remainingDamageOverDuration == 0 or damagePerInterval ~= 0 then
233
+ source:damageTarget(buff[100], damagePerInterval)
234
+ end
235
+ end
236
+ local function buffHealingIntervalInitialTimerCallback(buff)
237
+ buffHealingIntervalTimerCallback(buff)
238
+ local timer = buff[118]
239
+ local healingInterval = buff[116]
240
+ if timer ~= nil and healingInterval ~= nil and healingInterval > 0 then
241
+ timer:start(healingInterval, true, buffHealingIntervalTimerCallback, buff)
242
+ end
243
+ end
244
+ buffHealingIntervalTimerCallback = function(buff)
245
+ if buff[116] ~= buff[111] then
246
+ buff:flashSpecialEffect()
247
+ end
248
+ local source = buff[101] or buff[100]
249
+ local remainingHealingOverDuration = buff[117] or 0
250
+ if remainingHealingOverDuration ~= 0 then
251
+ local healingInterval = buff[116] or 0
252
+ if healingInterval ~= 0 then
253
+ local healing = remainingHealingOverDuration / (1 + buff.remainingDuration / healingInterval)
254
+ source:healTarget(buff[100], healing)
255
+ buff[117] = remainingHealingOverDuration - healing
256
+ end
257
+ end
258
+ local healingPerInterval = buff[115] or 0
259
+ if remainingHealingOverDuration == 0 or healingPerInterval ~= 0 then
260
+ source:healTarget(buff[100], healingPerInterval)
261
+ end
262
+ end
263
+ ____exports.Buff = __TS__Class()
264
+ local Buff = ____exports.Buff
265
+ Buff.name = "Buff"
266
+ __TS__ClassExtends(Buff, UnitBehavior)
267
+ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOrTypeIdSelectionPolicy, resistanceTypeOrPolarity, abilityOrParametersOrResistanceType, parametersOrAbility, parameters)
268
+ UnitBehavior.prototype.____constructor(self, _unit)
269
+ self._unit = _unit
270
+ self.parameters = nil
271
+ self[100] = _unit
272
+ local typeId
273
+ local polarity
274
+ local resistanceType
275
+ local ability
276
+ if type(typeIdOrTypeIds) ~= "number" then
277
+ typeId = selectBuffTypeIdWithLeastDuration(typeIdOrTypeIds, _unit)
278
+ polarity = resistanceTypeOrPolarity
279
+ resistanceType = abilityOrParametersOrResistanceType
280
+ if __TS__InstanceOf(parametersOrAbility, Ability) then
281
+ ability = parametersOrAbility
282
+ else
283
+ ability = nil
284
+ parameters = parametersOrAbility
285
+ end
286
+ else
287
+ typeId = typeIdOrTypeIds
288
+ polarity = polarityOrTypeIdSelectionPolicy
289
+ resistanceType = resistanceTypeOrPolarity
290
+ if __TS__InstanceOf(abilityOrParametersOrResistanceType, Ability) then
291
+ ability = abilityOrParametersOrResistanceType
292
+ parameters = parametersOrAbility
293
+ else
294
+ ability = nil
295
+ parameters = abilityOrParametersOrResistanceType
296
+ end
297
+ end
298
+ self.typeId = typeId
299
+ self.polarity = polarity
300
+ self.resistanceType = resistanceType
301
+ if not __TS__InstanceOf(ability, Ability) then
302
+ parameters = ability
303
+ ability = nil
304
+ end
305
+ local defaultParameters = self.constructor.defaultParameters
306
+ local level = parameters and parameters.level or defaultParameters.level
307
+ local spellStealPriority = parameters and parameters.spellStealPriority or defaultParameters.spellStealPriority
308
+ local learnLevelMinimum = parameters and parameters.learnLevelMinimum or defaultParameters.learnLevelMinimum
309
+ local duration = parameters and parameters.duration or defaultParameters.duration
310
+ local source = parameters and parameters.source or defaultParameters.source
311
+ if ability ~= nil then
312
+ if level == nil and ability:getField(ABILITY_IF_LEVELS) > 1 then
313
+ level = ability.level
314
+ end
315
+ if source == nil then
316
+ local abilityOwner = ability.owner
317
+ if __TS__InstanceOf(abilityOwner, Unit) then
318
+ source = abilityOwner
319
+ else
320
+ source = abilityOwner.owner
321
+ end
322
+ end
323
+ spellStealPriority = spellStealPriority or ability:getField(ABILITY_IF_PRIORITY)
324
+ learnLevelMinimum = learnLevelMinimum or ability:getField(ABILITY_IF_REQUIRED_LEVEL)
325
+ duration = duration or getAbilityDuration(ability, _unit)
326
+ end
327
+ local buffByTypeId = buffByTypeIdByUnit[_unit]
328
+ if buffByTypeId == nil then
329
+ buffByTypeId = {}
330
+ buffByTypeIdByUnit[_unit] = buffByTypeId
331
+ end
332
+ local ____opt_13 = buffByTypeId[typeId]
333
+ if ____opt_13 ~= nil then
334
+ ____opt_13:destroy()
335
+ end
336
+ local uniqueGroup = parameters and parameters.uniqueGroup or defaultParameters and defaultParameters.uniqueGroup
337
+ if uniqueGroup ~= nil then
338
+ ____exports.Buff:forAll(_unit, destroyBuffIfItHasSameUniqueGroup, uniqueGroup)
339
+ end
340
+ if not internalApplyBuff(
341
+ _unit,
342
+ typeId,
343
+ polarity,
344
+ resistanceType,
345
+ level,
346
+ duration,
347
+ spellStealPriority,
348
+ learnLevelMinimum
349
+ ) then
350
+ UnitBehavior.prototype.destroy(self)
351
+ error(unsuccessfulApplicationMarker, 0)
352
+ end
353
+ local handle = BlzGetUnitAbility(_unit.handle, typeId)
354
+ if handle == nil then
355
+ UnitBehavior.prototype.destroy(self)
356
+ error(unsuccessfulApplicationMarker, 0)
357
+ end
358
+ self.handle = handle
359
+ buffByTypeId[typeId] = self
360
+ self._level = level
361
+ self._spellStealPriority = spellStealPriority
362
+ self._learnLevelMinimum = learnLevelMinimum
363
+ self[101] = source
364
+ self[102] = duration or 0
365
+ self[103] = uniqueGroup
366
+ self[104] = BlzGetAbilityStringLevelField(self.handle, ABILITY_SLF_EFFECT, 0)
367
+ self[105] = BlzGetAbilityStringLevelField(self.handle, ABILITY_SLF_SPECIAL, 0)
368
+ if parameters ~= nil or (next(defaultParameters)) ~= nil then
369
+ for ____, buffBooleanParameter in ipairs(buffBooleanParameters) do
370
+ local ____ability_22 = ability
371
+ local ____level_23 = level
372
+ local ____temp_21 = parameters and parameters[buffBooleanParameter]
373
+ if ____temp_21 == nil then
374
+ ____temp_21 = defaultParameters[buffBooleanParameter]
375
+ end
376
+ if resolveBooleanValue(____ability_22, ____level_23, ____temp_21) then
377
+ self[buffBooleanParameter] = true
378
+ end
379
+ end
380
+ for ____, buffNumberParameter in ipairs(buffNumberParameters) do
381
+ resolveAndSetNumberValue(
382
+ self,
383
+ buffNumberParameter,
384
+ ability,
385
+ level,
386
+ parameters and parameters[buffNumberParameter],
387
+ defaultParameters[buffNumberParameter]
388
+ )
389
+ end
390
+ local maximumDuration = parameters and parameters.maximumDuration or defaultParameters.maximumDuration
391
+ if maximumDuration ~= nil then
392
+ self[107] = resolveNumberValue(ability, level, maximumDuration)
393
+ end
394
+ local maximumRemainingDuration = parameters and parameters.maximumRemainingDuration or defaultParameters.maximumRemainingDuration
395
+ if maximumRemainingDuration ~= nil then
396
+ self[108] = resolveNumberValue(ability, level, maximumRemainingDuration)
397
+ end
398
+ local parametersAbilityTypeIds = parameters and parameters.abilityTypeIds or defaultParameters.abilityTypeIds
399
+ if parametersAbilityTypeIds ~= nil then
400
+ local abilityTypeIds = self._abilityTypeIds
401
+ if abilityTypeIds == nil then
402
+ abilityTypeIds = {}
403
+ self._abilityTypeIds = abilityTypeIds
404
+ end
405
+ for abilityTypeId, abilityParameters in pairs(parametersAbilityTypeIds) do
406
+ local addedAbility = _unit:addAbility(abilityTypeId)
407
+ if addedAbility ~= nil then
408
+ _unit:makeAbilityPermanent(abilityTypeId, true)
409
+ _unit:setAbilityLevel(abilityTypeId, 1 + (abilityParameters.level or ability and ability.level or 0))
410
+ for abilityParameterKey, abilityParameterValue in pairs(abilityParameters) do
411
+ if abilityParameterKey == "isButtonVisible" then
412
+ if not resolveBooleanValue(ability, level, abilityParameterValue) then
413
+ _unit:hideAbility(abilityTypeId, true)
414
+ end
415
+ elseif abilityParameterKey ~= "level" then
416
+ abilityParameterKey:setValue(
417
+ addedAbility,
418
+ resolveNumberValue(ability, level, abilityParameterValue)
419
+ )
420
+ end
421
+ end
422
+ abilityTypeIds[abilityTypeId] = true
423
+ end
424
+ end
425
+ local behaviorConstructors = parameters and parameters.behaviorConstructors or defaultParameters.behaviorConstructors
426
+ if behaviorConstructors ~= nil then
427
+ local behaviors = {}
428
+ for i = 1, #behaviorConstructors do
429
+ behaviors[i] = __TS__New(behaviorConstructors[i], _unit)
430
+ end
431
+ self._behaviors = behaviors
432
+ end
433
+ end
434
+ local additionalParameters = {}
435
+ for key, value in pairs(parameters) do
436
+ if not buffParametersKeys[key] then
437
+ if ability then
438
+ additionalParameters[key] = resolveCurrentAbilityDependentValue(ability, value)
439
+ else
440
+ additionalParameters[key] = value
441
+ end
442
+ end
443
+ end
444
+ if (next(additionalParameters)) ~= nil then
445
+ self.parameters = additionalParameters
446
+ end
447
+ end
448
+ if duration ~= nil and duration > 0 then
449
+ local timer = Timer:create()
450
+ timer:start(duration, false, expireBuff, self)
451
+ self._timer = timer
452
+ end
453
+ end
454
+ function Buff.prototype.getUnitBonus(self, bonusType)
455
+ local ____opt_36 = self._bonusIdByBonusType
456
+ local bonusId = ____opt_36 and ____opt_36[bonusType]
457
+ return bonusId == nil and 0 or getUnitBonus(self._unit, bonusType, bonusId)
458
+ end
459
+ function Buff.prototype.addOrUpdateOrRemoveUnitBonus(self, bonusType, value)
460
+ local bonusIdByBonusType = self._bonusIdByBonusType
461
+ if bonusIdByBonusType == nil then
462
+ bonusIdByBonusType = {}
463
+ self._bonusIdByBonusType = bonusIdByBonusType
464
+ end
465
+ bonusIdByBonusType[bonusType] = addOrUpdateOrRemoveUnitBonus(self._unit, bonusType, bonusIdByBonusType[bonusType], value)
466
+ end
467
+ function Buff.prototype.flashEffect(self, widgetOrDuration, duration)
468
+ local isWidgetProvided = type(widgetOrDuration) == "table"
469
+ local ____Effect_40 = Effect
470
+ local ____Effect_flash_41 = Effect.flash
471
+ local ____array_39 = __TS__SparseArrayNew(
472
+ self[104],
473
+ isWidgetProvided and widgetOrDuration or self._unit,
474
+ stringValueByBuffTypeIdByFieldId[fourCC("feft")][self.typeId] or "origin"
475
+ )
476
+ local ____isWidgetProvided_38
477
+ if isWidgetProvided then
478
+ ____isWidgetProvided_38 = duration
479
+ else
480
+ ____isWidgetProvided_38 = widgetOrDuration
481
+ end
482
+ __TS__SparseArrayPush(____array_39, ____isWidgetProvided_38)
483
+ ____Effect_flash_41(
484
+ ____Effect_40,
485
+ __TS__SparseArraySpread(____array_39)
486
+ )
487
+ end
488
+ function Buff.prototype.flashSpecialEffect(self, widgetOrDuration, duration)
489
+ local isWidgetProvided = type(widgetOrDuration) == "table"
490
+ local ____Effect_44 = Effect
491
+ local ____Effect_flash_45 = Effect.flash
492
+ local ____array_43 = __TS__SparseArrayNew(
493
+ self[105],
494
+ isWidgetProvided and widgetOrDuration or self._unit,
495
+ stringValueByBuffTypeIdByFieldId[fourCC("fspt")][self.typeId] or "origin"
496
+ )
497
+ local ____isWidgetProvided_42
498
+ if isWidgetProvided then
499
+ ____isWidgetProvided_42 = duration
500
+ else
501
+ ____isWidgetProvided_42 = widgetOrDuration
502
+ end
503
+ __TS__SparseArrayPush(____array_43, ____isWidgetProvided_42)
504
+ ____Effect_flash_45(
505
+ ____Effect_44,
506
+ __TS__SparseArraySpread(____array_43)
507
+ )
508
+ end
509
+ function Buff.prototype.onDestroy(self)
510
+ local unit = self._unit
511
+ if getUnitAbility(unit.handle, self.typeId) == self.handle then
512
+ removeBuff(unit.handle, self.typeId)
513
+ end
514
+ buffByTypeIdByUnit[unit][self.typeId] = nil
515
+ local healingIntervalTimer = self[118]
516
+ if healingIntervalTimer ~= nil then
517
+ healingIntervalTimer:destroy()
518
+ self[118] = nil
519
+ end
520
+ local damageIntervalTimer = self[113]
521
+ if damageIntervalTimer ~= nil then
522
+ damageIntervalTimer:destroy()
523
+ self[113] = nil
524
+ end
525
+ if self._timer ~= nil then
526
+ self._timer:destroy()
527
+ end
528
+ if self._behaviors ~= nil then
529
+ for ____, behavior in ipairs(self._behaviors) do
530
+ behavior:destroy()
531
+ end
532
+ end
533
+ if self[130] then
534
+ unit:decrementDisableAutoAttackCounter()
535
+ end
536
+ if self[128] then
537
+ if self[129] then
538
+ unit:decrementStunCounter()
539
+ end
540
+ unit:decrementStunCounter()
541
+ end
542
+ if self._abilityTypeIds ~= nil then
543
+ for abilityTypeId in pairs(self._abilityTypeIds) do
544
+ unit:removeAbility(abilityTypeId)
545
+ end
546
+ end
547
+ if self._bonusIdByBonusType ~= nil then
548
+ for bonusType, bonusId in pairs(self._bonusIdByBonusType) do
549
+ removeUnitBonus(unit, bonusType, bonusId)
550
+ end
551
+ end
552
+ return UnitBehavior.prototype.onDestroy(self)
553
+ end
554
+ function Buff.apply(self, ...)
555
+ local args = {...}
556
+ do
557
+ local function ____catch(exception)
558
+ if exception == unsuccessfulApplicationMarker then
559
+ return true, nil
560
+ else
561
+ error(exception, 0)
562
+ end
563
+ end
564
+ local ____try, ____hasReturned, ____returnValue = pcall(function()
565
+ return true, __TS__New(
566
+ self,
567
+ table.unpack(args)
568
+ )
569
+ end)
570
+ if not ____try then
571
+ ____hasReturned, ____returnValue = ____catch(____hasReturned)
572
+ end
573
+ if ____hasReturned then
574
+ return ____returnValue
575
+ end
576
+ end
577
+ end
578
+ function Buff.getByTypeId(self, unit, typeId)
579
+ local ____opt_46 = buffByTypeIdByUnit[unit]
580
+ local buff = ____opt_46 and ____opt_46[typeId]
581
+ if __TS__InstanceOf(buff, self) then
582
+ return buff
583
+ end
584
+ return nil
585
+ end
586
+ function Buff.prototype.onDeath(self, source)
587
+ local unit = self.unit
588
+ if self[119] ~= nil then
589
+ damageArea(
590
+ self[101] or unit,
591
+ self[119],
592
+ unit.x,
593
+ unit.y,
594
+ self[121] or 0,
595
+ self[120] or 0,
596
+ self[123] or 0,
597
+ self[122] or 0,
598
+ self[125] or 0,
599
+ self[124] or 0
600
+ )
601
+ end
602
+ end
603
+ function Buff.prototype.onDamageDealt(self, target, event)
604
+ if event.isAttack then
605
+ if self[106] ~= nil then
606
+ local durationIncrease = self[106]
607
+ local maximumDuration = self[107] or 0
608
+ if maximumDuration > 0 then
609
+ durationIncrease = min(
610
+ durationIncrease,
611
+ max(0, maximumDuration - self[102])
612
+ )
613
+ end
614
+ local remainingDuration = self.remainingDuration + durationIncrease
615
+ local maximumRemainingDuration = self[108] or 0
616
+ if maximumRemainingDuration > 0 then
617
+ remainingDuration = min(remainingDuration, maximumRemainingDuration)
618
+ end
619
+ self.remainingDuration = remainingDuration
620
+ end
621
+ local autoAttackCount = (self[126] or 0) + 1
622
+ self[126] = autoAttackCount
623
+ if autoAttackCount == self[127] then
624
+ self:destroy()
625
+ end
626
+ end
627
+ end
628
+ Buff.defaultParameters = {}
629
+ __TS__SetDescriptor(
630
+ Buff.prototype,
631
+ "source",
632
+ {get = function(self)
633
+ return self[101] or self._unit
634
+ end},
635
+ true
636
+ )
637
+ __TS__SetDescriptor(
638
+ Buff.prototype,
639
+ "level",
640
+ {get = function(self)
641
+ return self._level or 0
642
+ end},
643
+ true
644
+ )
645
+ __TS__SetDescriptor(
646
+ Buff.prototype,
647
+ "remainingDamageOverDuration",
648
+ {
649
+ get = function(self)
650
+ return self[112] or 0
651
+ end,
652
+ set = function(self, remainingDamageOverDuration)
653
+ local remainingDamageOverDurationDelta = remainingDamageOverDuration - (self[112] or 0)
654
+ self[112] = remainingDamageOverDuration ~= 0 and remainingDamageOverDuration or nil
655
+ local damageOverDuration = (self[109] or 0) + remainingDamageOverDurationDelta
656
+ self[109] = damageOverDuration ~= 0 and damageOverDuration or nil
657
+ end
658
+ },
659
+ true
660
+ )
661
+ __TS__SetDescriptor(
662
+ Buff.prototype,
663
+ "damageOverDuration",
664
+ {
665
+ get = function(self)
666
+ return self[109] or 0
667
+ end,
668
+ set = function(self, damageOverDuration)
669
+ local damageOverDurationDelta = damageOverDuration - (self[109] or 0)
670
+ self[109] = damageOverDuration ~= 0 and damageOverDuration or nil
671
+ local remainingDamageOverDuration = (self[112] or 0) + damageOverDurationDelta
672
+ self[112] = remainingDamageOverDuration ~= 0 and remainingDamageOverDuration or nil
673
+ end
674
+ },
675
+ true
676
+ )
677
+ __TS__SetDescriptor(
678
+ Buff.prototype,
679
+ "damagePerInterval",
680
+ {
681
+ get = function(self)
682
+ return self[110] or 0
683
+ end,
684
+ set = function(self, damagePerInterval)
685
+ self[110] = damagePerInterval ~= 0 and damagePerInterval or nil
686
+ end
687
+ },
688
+ true
689
+ )
690
+ __TS__SetDescriptor(
691
+ Buff.prototype,
692
+ "damageInterval",
693
+ {
694
+ get = function(self)
695
+ return self[111] or 0
696
+ end,
697
+ set = function(self, damageInterval)
698
+ if damageInterval <= 0 then
699
+ self[111] = damageInterval ~= 0 and damageInterval or nil
700
+ local timer = self[113]
701
+ if timer ~= nil then
702
+ timer:destroy()
703
+ self[113] = nil
704
+ end
705
+ return
706
+ end
707
+ self[111] = damageInterval
708
+ local ____opt_48 = self._timer
709
+ local elapsed = ____opt_48 and ____opt_48.elapsed or 0
710
+ local timer = self[113]
711
+ if timer == nil then
712
+ timer = Timer:create()
713
+ self[113] = timer
714
+ end
715
+ local initialDelay = damageInterval - (elapsed >= damageInterval and math.fmod(elapsed, damageInterval) or elapsed)
716
+ if initialDelay == damageInterval then
717
+ timer:start(damageInterval, true, buffDamageIntervalTimerCallback, self)
718
+ else
719
+ timer:start(initialDelay, false, buffDamageIntervalInitialTimerCallback, self)
720
+ end
721
+ end
722
+ },
723
+ true
724
+ )
725
+ __TS__SetDescriptor(
726
+ Buff.prototype,
727
+ "remainingHealingOverDuration",
728
+ {
729
+ get = function(self)
730
+ return self[117] or 0
731
+ end,
732
+ set = function(self, remainingHealingOverDuration)
733
+ local remainingHealingOverDurationDelta = remainingHealingOverDuration - (self[117] or 0)
734
+ self[112] = remainingHealingOverDuration ~= 0 and remainingHealingOverDuration or nil
735
+ local healingOverDuration = (self[114] or 0) + remainingHealingOverDurationDelta
736
+ self[114] = healingOverDuration ~= 0 and healingOverDuration or nil
737
+ end
738
+ },
739
+ true
740
+ )
741
+ __TS__SetDescriptor(
742
+ Buff.prototype,
743
+ "healingOverDuration",
744
+ {
745
+ get = function(self)
746
+ return self[114] or 0
747
+ end,
748
+ set = function(self, healingOverDuration)
749
+ local healingOverDurationDelta = healingOverDuration - (self[114] or 0)
750
+ self[114] = healingOverDuration ~= 0 and healingOverDuration or nil
751
+ local remainingHealingOverDuration = (self[117] or 0) + healingOverDurationDelta
752
+ self[117] = remainingHealingOverDuration ~= 0 and remainingHealingOverDuration or nil
753
+ end
754
+ },
755
+ true
756
+ )
757
+ __TS__SetDescriptor(
758
+ Buff.prototype,
759
+ "healingPerInterval",
760
+ {
761
+ get = function(self)
762
+ return self[115] or 0
763
+ end,
764
+ set = function(self, healingPerInterval)
765
+ self[115] = healingPerInterval ~= 0 and healingPerInterval or nil
766
+ end
767
+ },
768
+ true
769
+ )
770
+ __TS__SetDescriptor(
771
+ Buff.prototype,
772
+ "healingInterval",
773
+ {
774
+ get = function(self)
775
+ return self[116] or 0
776
+ end,
777
+ set = function(self, healingInterval)
778
+ if healingInterval <= 0 then
779
+ self[116] = healingInterval ~= 0 and healingInterval or nil
780
+ local timer = self[118]
781
+ if timer ~= nil then
782
+ timer:destroy()
783
+ self[118] = nil
784
+ end
785
+ return
786
+ end
787
+ self[116] = healingInterval
788
+ local ____opt_50 = self._timer
789
+ local elapsed = ____opt_50 and ____opt_50.elapsed or 0
790
+ local timer = self[118]
791
+ if timer == nil then
792
+ timer = Timer:create()
793
+ self[118] = timer
794
+ end
795
+ local initialDelay = healingInterval - (elapsed >= healingInterval and math.fmod(elapsed, healingInterval) or elapsed)
796
+ if initialDelay == healingInterval then
797
+ timer:start(healingInterval, true, buffHealingIntervalTimerCallback, self)
798
+ else
799
+ timer:start(initialDelay, false, buffHealingIntervalInitialTimerCallback, self)
800
+ end
801
+ end
802
+ },
803
+ true
804
+ )
805
+ __TS__SetDescriptor(
806
+ Buff.prototype,
807
+ "receivedDamageFactor",
808
+ {
809
+ get = function(self)
810
+ return self:getUnitBonus(UnitBonusType.RECEIVED_DAMAGE_FACTOR)
811
+ end,
812
+ set = function(self, receivedDamageFactor)
813
+ self:addOrUpdateOrRemoveUnitBonus(UnitBonusType.RECEIVED_DAMAGE_FACTOR, receivedDamageFactor)
814
+ end
815
+ },
816
+ true
817
+ )
818
+ __TS__SetDescriptor(
819
+ Buff.prototype,
820
+ "armorIncrease",
821
+ {
822
+ get = function(self)
823
+ return self:getUnitBonus(UnitBonusType.ARMOR)
824
+ end,
825
+ set = function(self, armorIncrease)
826
+ self:addOrUpdateOrRemoveUnitBonus(UnitBonusType.ARMOR, armorIncrease)
827
+ end
828
+ },
829
+ true
830
+ )
831
+ __TS__SetDescriptor(
832
+ Buff.prototype,
833
+ "stuns",
834
+ {
835
+ get = function(self)
836
+ local ____self__128_52 = self[128]
837
+ if ____self__128_52 == nil then
838
+ ____self__128_52 = false
839
+ end
840
+ return ____self__128_52
841
+ end,
842
+ set = function(self, stuns)
843
+ if not stuns and self[128] then
844
+ if self[129] then
845
+ self.object:decrementStunCounter()
846
+ end
847
+ self.object:decrementStunCounter()
848
+ self[128] = nil
849
+ elseif stuns and not self[128] then
850
+ if self[129] then
851
+ self.object:incrementStunCounter()
852
+ end
853
+ self.object:incrementStunCounter()
854
+ self[128] = true
855
+ end
856
+ end
857
+ },
858
+ true
859
+ )
860
+ __TS__SetDescriptor(
861
+ Buff.prototype,
862
+ "ignoresStunImmunity",
863
+ {
864
+ get = function(self)
865
+ local ____self__129_53 = self[129]
866
+ if ____self__129_53 == nil then
867
+ ____self__129_53 = false
868
+ end
869
+ return ____self__129_53
870
+ end,
871
+ set = function(self, ignoresStunImmunity)
872
+ if not ignoresStunImmunity and self[129] then
873
+ if self[128] then
874
+ self.object:decrementStunCounter()
875
+ end
876
+ self[129] = nil
877
+ elseif ignoresStunImmunity and not self[129] then
878
+ if self[128] then
879
+ self.object:incrementStunCounter()
880
+ end
881
+ self[129] = true
882
+ end
883
+ end
884
+ },
885
+ true
886
+ )
887
+ __TS__SetDescriptor(
888
+ Buff.prototype,
889
+ "disablesAutoAttack",
890
+ {
891
+ get = function(self)
892
+ local ____self__130_54 = self[130]
893
+ if ____self__130_54 == nil then
894
+ ____self__130_54 = false
895
+ end
896
+ return ____self__130_54
897
+ end,
898
+ set = function(self, disablesAutoAttack)
899
+ if not disablesAutoAttack and self[130] then
900
+ self.object:decrementDisableAutoAttackCounter()
901
+ self[130] = nil
902
+ elseif disablesAutoAttack and not self[130] then
903
+ self.object:incrementDisableAutoAttackCounter()
904
+ self[130] = true
905
+ end
906
+ end
907
+ },
908
+ true
909
+ )
910
+ __TS__SetDescriptor(
911
+ Buff.prototype,
912
+ "providesInvulnerability",
913
+ {
914
+ get = function(self)
915
+ local ____self__131_55 = self[131]
916
+ if ____self__131_55 == nil then
917
+ ____self__131_55 = false
918
+ end
919
+ return ____self__131_55
920
+ end,
921
+ set = function(self, providesInvulnerability)
922
+ if not providesInvulnerability and self[131] then
923
+ self.object:decrementInvulnerabilityCounter()
924
+ self[131] = nil
925
+ elseif providesInvulnerability and not self[131] then
926
+ self.object:incrementInvulnerabilityCounter()
927
+ self[131] = true
928
+ end
929
+ end
930
+ },
931
+ true
932
+ )
933
+ __TS__SetDescriptor(
934
+ Buff.prototype,
935
+ "maximumAutoAttackCount",
936
+ {
937
+ get = function(self)
938
+ return self[127] or 0
939
+ end,
940
+ set = function(self, maximumAutoAttackCount)
941
+ if maximumAutoAttackCount == 0 then
942
+ self[127] = nil
943
+ else
944
+ self[127] = maximumAutoAttackCount
945
+ end
946
+ end
947
+ },
948
+ true
949
+ )
950
+ __TS__SetDescriptor(
951
+ Buff.prototype,
952
+ "durationIncreaseOnAutoAttack",
953
+ {
954
+ get = function(self)
955
+ return self[106] or 0
956
+ end,
957
+ set = function(self, durationIncreaseOnAutoAttack)
958
+ self[106] = durationIncreaseOnAutoAttack
959
+ end
960
+ },
961
+ true
962
+ )
963
+ __TS__SetDescriptor(
964
+ Buff.prototype,
965
+ "attackSpeedIncreaseFactor",
966
+ {
967
+ get = function(self)
968
+ return self:getUnitBonus(UnitBonusType.ATTACK_SPEED_FACTOR)
969
+ end,
970
+ set = function(self, attackSpeedIncreaseFactor)
971
+ self:addOrUpdateOrRemoveUnitBonus(UnitBonusType.ATTACK_SPEED_FACTOR, attackSpeedIncreaseFactor)
972
+ end
973
+ },
974
+ true
975
+ )
976
+ __TS__SetDescriptor(
977
+ Buff.prototype,
978
+ "movementSpeedIncreaseFactor",
979
+ {
980
+ get = function(self)
981
+ return self:getUnitBonus(UnitBonusType.MOVEMENT_SPEED_FACTOR)
982
+ end,
983
+ set = function(self, movementSpeedIncreaseFactor)
984
+ self:addOrUpdateOrRemoveUnitBonus(UnitBonusType.MOVEMENT_SPEED_FACTOR, movementSpeedIncreaseFactor)
985
+ end
986
+ },
987
+ true
988
+ )
989
+ __TS__SetDescriptor(
990
+ Buff.prototype,
991
+ "duration",
992
+ {get = function(self)
993
+ return self[102]
994
+ end},
995
+ true
996
+ )
997
+ __TS__SetDescriptor(
998
+ Buff.prototype,
999
+ "remainingDuration",
1000
+ {
1001
+ get = function(self)
1002
+ local ____opt_56 = self._timer
1003
+ return ____opt_56 and ____opt_56.remaining or 0
1004
+ end,
1005
+ set = function(self, remainingDuration)
1006
+ local ____remainingDuration_60 = remainingDuration
1007
+ local ____opt_58 = self._timer
1008
+ local remainingDurationDelta = ____remainingDuration_60 - (____opt_58 and ____opt_58.remaining or 0)
1009
+ if remainingDurationDelta ~= 0 then
1010
+ self[102] = self[102] + remainingDurationDelta
1011
+ if remainingDuration <= 0 then
1012
+ Timer:run(destroyBuff, self)
1013
+ else
1014
+ if internalApplyBuff(
1015
+ self._unit,
1016
+ self.typeId,
1017
+ self.polarity,
1018
+ self.resistanceType,
1019
+ self._level,
1020
+ remainingDuration,
1021
+ self._spellStealPriority,
1022
+ self._learnLevelMinimum
1023
+ ) then
1024
+ local timer = self._timer
1025
+ if timer == nil then
1026
+ timer = Timer:create()
1027
+ self._timer = timer
1028
+ end
1029
+ timer:start(remainingDuration, false, expireBuff, self)
1030
+ end
1031
+ end
1032
+ end
1033
+ end
1034
+ },
1035
+ true
1036
+ );
1037
+ (function(self)
1038
+ ____exports.checkBuff = function(unit, buffTypeId)
1039
+ local buffByTypeId = buffByTypeIdByUnit[unit]
1040
+ if buffByTypeId ~= nil then
1041
+ local buff = buffByTypeId[buffTypeId]
1042
+ if buff ~= nil and getUnitAbility(unit.handle, buffTypeId) ~= buff.handle then
1043
+ buff:destroy()
1044
+ end
1045
+ end
1046
+ end
1047
+ ____exports.checkBuffs = function(unit)
1048
+ local buffByTypeId = buffByTypeIdByUnit[unit]
1049
+ if buffByTypeId ~= nil then
1050
+ for ____, buff in pairs(buffByTypeId) do
1051
+ if getUnitAbility(unit.handle, buff.typeId) ~= buff.handle then
1052
+ buff:destroy()
1053
+ end
1054
+ end
1055
+ end
1056
+ end
1057
+ Unit.abilityChannelingStartEvent:addListener(
1058
+ 0,
1059
+ function(caster)
1060
+ ____exports.checkBuffs(caster)
1061
+ Timer:run(____exports.checkBuffs, caster)
1062
+ end
1063
+ )
1064
+ Unit.abilityUnitTargetChannelingStartEvent:addListener(
1065
+ 0,
1066
+ function(caster, ability, target)
1067
+ ____exports.checkBuffs(target)
1068
+ Timer:run(____exports.checkBuffs, target)
1069
+ end
1070
+ )
1071
+ Unit.abilityPointTargetChannelingStartEvent:addListener(
1072
+ 0,
1073
+ function(caster, ability, x, y)
1074
+ local units = Unit:getInCollisionRange(
1075
+ x,
1076
+ y,
1077
+ ability:getField(ABILITY_RLF_AREA_OF_EFFECT)
1078
+ )
1079
+ forEach(units, ____exports.checkBuffs)
1080
+ Timer:run(forEach, units, ____exports.checkBuffs)
1081
+ end
1082
+ )
1083
+ Unit.onDamage:addListener(
1084
+ 0,
1085
+ function(source, target)
1086
+ if source ~= nil then
1087
+ ____exports.checkBuffs(source)
1088
+ end
1089
+ ____exports.checkBuffs(target)
1090
+ end
1091
+ )
1092
+ end)(Buff)
1093
+ return ____exports