warscript 0.0.1-dev.9b0216a → 0.0.1-dev.9bcb501

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 (442) hide show
  1. package/attributes.d.ts +6 -0
  2. package/attributes.lua +17 -1
  3. package/config.d.ts +5 -0
  4. package/config.lua +10 -0
  5. package/core/dummy.lua +4 -2
  6. package/core/types/effect.d.ts +12 -4
  7. package/core/types/effect.lua +67 -104
  8. package/core/types/frame.d.ts +16 -2
  9. package/core/types/frame.lua +141 -77
  10. package/core/types/handle.lua +9 -9
  11. package/core/types/item.d.ts +1 -0
  12. package/core/types/item.lua +1 -0
  13. package/core/types/missile.lua +8 -7
  14. package/core/types/player.d.ts +18 -1
  15. package/core/types/player.lua +76 -26
  16. package/core/types/playerCamera.d.ts +2 -0
  17. package/core/types/playerCamera.lua +123 -5
  18. package/core/types/playerColor.lua +4 -3
  19. package/core/types/sound.d.ts +18 -25
  20. package/core/types/sound.lua +113 -33
  21. package/core/types/tileCell.d.ts +18 -3
  22. package/core/types/tileCell.lua +108 -0
  23. package/core/types/timer.d.ts +9 -8
  24. package/core/types/timer.lua +45 -23
  25. package/core/types/unit.d.ts +5 -0
  26. package/core/types/unit.lua +5 -0
  27. package/core/util.d.ts +3 -1
  28. package/core/util.lua +115 -4
  29. package/decl/native.d.ts +1719 -964
  30. package/destroyable.d.ts +1 -0
  31. package/destroyable.lua +9 -0
  32. package/engine/ability-type-extended-tooltip.d.ts +8 -0
  33. package/engine/ability-type-extended-tooltip.lua +44 -0
  34. package/engine/behavior.d.ts +14 -1
  35. package/engine/behavior.lua +230 -70
  36. package/engine/behaviour/ability/apply-buff.d.ts +5 -0
  37. package/engine/behaviour/ability/apply-buff.lua +36 -4
  38. package/engine/behaviour/ability/apply-unit-behavior.lua +6 -0
  39. package/engine/behaviour/ability/damage.d.ts +13 -3
  40. package/engine/behaviour/ability/damage.lua +41 -49
  41. package/engine/behaviour/ability/emulate-impact.d.ts +15 -1
  42. package/engine/behaviour/ability/emulate-impact.lua +92 -4
  43. package/engine/behaviour/ability/instant-impact.d.ts +12 -1
  44. package/engine/behaviour/ability/instant-impact.lua +17 -2
  45. package/engine/behaviour/ability/on-command-impact.d.ts +1 -0
  46. package/engine/behaviour/ability/on-command-impact.lua +1 -0
  47. package/engine/behaviour/ability/remove-buffs.d.ts +9 -0
  48. package/engine/behaviour/ability/remove-buffs.lua +21 -0
  49. package/engine/behaviour/ability/restore-mana.d.ts +1 -1
  50. package/engine/behaviour/ability/restore-mana.lua +6 -6
  51. package/engine/behaviour/ability.d.ts +28 -6
  52. package/engine/behaviour/ability.lua +188 -27
  53. package/engine/behaviour/unit/stun-immunity.d.ts +12 -6
  54. package/engine/behaviour/unit/stun-immunity.lua +57 -31
  55. package/engine/behaviour/unit.d.ts +41 -2
  56. package/engine/behaviour/unit.lua +270 -6
  57. package/engine/buff.d.ts +130 -59
  58. package/engine/buff.lua +638 -307
  59. package/engine/index.d.ts +2 -1
  60. package/engine/internal/ability.d.ts +14 -1
  61. package/engine/internal/ability.lua +112 -42
  62. package/engine/internal/item/ability.lua +92 -15
  63. package/engine/internal/item/fields.d.ts +12 -0
  64. package/engine/internal/item/fields.lua +33 -0
  65. package/engine/internal/item/owner-cache.d.ts +5 -0
  66. package/engine/internal/item/owner-cache.lua +4 -0
  67. package/engine/internal/item+owner.d.ts +2 -0
  68. package/engine/internal/item+owner.lua +37 -8
  69. package/engine/internal/item.d.ts +34 -18
  70. package/engine/internal/item.lua +308 -102
  71. package/engine/internal/mechanics/ability-duration.lua +1 -1
  72. package/engine/internal/mechanics/cast-ability.lua +6 -3
  73. package/engine/internal/misc/damage-metadata-by-target.lua +5 -0
  74. package/engine/internal/misc/frame-coordinates.d.ts +2 -0
  75. package/engine/internal/misc/frame-coordinates.lua +21 -0
  76. package/engine/internal/misc/get-terrain-z.d.ts +2 -0
  77. package/engine/internal/misc/get-terrain-z.lua +11 -0
  78. package/engine/internal/misc/player-local-handle.d.ts +2 -0
  79. package/engine/internal/misc/player-local-handle.lua +5 -0
  80. package/engine/internal/misc/unit-ability-level-natives.d.ts +2 -0
  81. package/engine/internal/misc/unit-ability-level-natives.lua +12 -0
  82. package/engine/internal/object-data/armor-bonus.d.ts +2 -0
  83. package/engine/internal/object-data/attribute-bonus.lua +2 -2
  84. package/engine/internal/object-data/auto-attack-speed-increase.d.ts +1 -1
  85. package/engine/internal/object-data/auto-attack-speed-increase.lua +2 -0
  86. package/engine/internal/object-data/evasion-probability.d.ts +2 -0
  87. package/engine/internal/object-data/evasion-probability.lua +16 -0
  88. package/engine/internal/object-data/health-bonus.d.ts +2 -0
  89. package/engine/internal/object-data/health-bonus.lua +16 -0
  90. package/engine/internal/object-data/health-regeneration-rate-increase.d.ts +2 -0
  91. package/engine/internal/object-data/health-regeneration-rate-increase.lua +48 -0
  92. package/engine/internal/object-data/mana-bonus.d.ts +2 -0
  93. package/engine/internal/object-data/mana-bonus.lua +16 -0
  94. package/engine/internal/object-data/mana-regeneration-rate-increase-factor.d.ts +2 -0
  95. package/engine/internal/object-data/mana-regeneration-rate-increase-factor.lua +16 -0
  96. package/engine/internal/object-data/returned-melee-damage-factor.d.ts +2 -0
  97. package/engine/internal/object-data/returned-melee-damage-factor.lua +21 -0
  98. package/engine/internal/unit/ability.d.ts +35 -0
  99. package/engine/internal/unit/ability.lua +114 -9
  100. package/engine/internal/unit/add-item-to-slot-init.d.ts +2 -0
  101. package/engine/internal/unit/add-item-to-slot-init.lua +12 -0
  102. package/engine/internal/unit/add-item-to-slot.d.ts +2 -0
  103. package/engine/internal/unit/add-item-to-slot.lua +93 -0
  104. package/engine/internal/unit/allowed-targets.d.ts +1 -1
  105. package/engine/internal/unit/allowed-targets.lua +9 -1
  106. package/engine/internal/unit/appearance.d.ts +15 -0
  107. package/engine/internal/unit/appearance.lua +85 -0
  108. package/engine/internal/unit/attributes.d.ts +17 -0
  109. package/engine/internal/unit/attributes.lua +46 -0
  110. package/engine/internal/unit/bonus.d.ts +19 -0
  111. package/engine/internal/unit/bonus.lua +130 -8
  112. package/engine/internal/unit/buff.d.ts +2 -2
  113. package/engine/internal/unit/buff.lua +34 -19
  114. package/engine/internal/unit/equipment-inventory.d.ts +44 -0
  115. package/engine/internal/unit/equipment-inventory.lua +233 -0
  116. package/engine/internal/unit/expiration-timer.lua +1 -1
  117. package/engine/internal/unit/extended-inventory.d.ts +25 -0
  118. package/engine/internal/unit/extended-inventory.lua +99 -0
  119. package/engine/internal/unit/fly-height.d.ts +7 -0
  120. package/engine/internal/unit/fly-height.lua +20 -0
  121. package/engine/internal/unit/ignore-events-items.d.ts +2 -0
  122. package/engine/internal/unit/ignore-events-items.lua +14 -0
  123. package/engine/internal/unit/interrupts.d.ts +12 -0
  124. package/engine/internal/unit/interrupts.lua +28 -0
  125. package/engine/internal/unit/{item.d.ts → inventory.d.ts} +7 -3
  126. package/engine/internal/unit/inventory.lua +87 -0
  127. package/engine/internal/unit/item-container.d.ts +25 -0
  128. package/engine/internal/unit/item-container.lua +11 -0
  129. package/engine/internal/unit/item-order-events.d.ts +17 -0
  130. package/engine/internal/unit/item-order-events.lua +67 -0
  131. package/engine/internal/unit/item-slot.d.ts +27 -0
  132. package/engine/internal/unit/item-slot.lua +92 -0
  133. package/engine/internal/unit/main-selected.lua +12 -27
  134. package/engine/internal/unit/order.d.ts +20 -0
  135. package/engine/internal/unit/order.lua +136 -0
  136. package/engine/internal/unit/range-event.d.ts +12 -0
  137. package/engine/internal/unit/range-event.lua +90 -0
  138. package/engine/internal/unit/scale.d.ts +7 -0
  139. package/engine/internal/unit/scale.lua +20 -0
  140. package/engine/internal/unit+ability.d.ts +2 -1
  141. package/engine/internal/unit+ability.lua +83 -3
  142. package/engine/internal/unit+bonus.lua +3 -3
  143. package/engine/internal/unit+damage.d.ts +11 -11
  144. package/engine/internal/unit+damage.lua +43 -14
  145. package/engine/internal/unit+rally.lua +9 -31
  146. package/engine/internal/unit+spellSteal.lua +1 -2
  147. package/engine/internal/unit-missile-data.lua +96 -68
  148. package/engine/internal/unit-missile-launch.lua +65 -27
  149. package/engine/internal/unit.d.ts +45 -34
  150. package/engine/internal/unit.lua +433 -327
  151. package/engine/lightning.d.ts +12 -5
  152. package/engine/lightning.lua +52 -18
  153. package/engine/local-client.d.ts +28 -0
  154. package/engine/local-client.lua +324 -54
  155. package/engine/object-data/auxiliary/animation-name.d.ts +1 -0
  156. package/engine/object-data/auxiliary/animation-name.lua +16 -0
  157. package/engine/object-data/auxiliary/armor-type.d.ts +11 -0
  158. package/engine/object-data/auxiliary/armor-type.lua +46 -0
  159. package/engine/object-data/auxiliary/attachment-preset.d.ts +14 -2
  160. package/engine/object-data/auxiliary/attachment-preset.lua +11 -3
  161. package/engine/object-data/auxiliary/attack-type.d.ts +7 -8
  162. package/engine/object-data/auxiliary/attack-type.lua +42 -0
  163. package/engine/object-data/auxiliary/equipment-slot.d.ts +12 -0
  164. package/engine/object-data/auxiliary/equipment-slot.lua +2 -0
  165. package/engine/object-data/auxiliary/equipment-type.d.ts +12 -0
  166. package/engine/object-data/auxiliary/equipment-type.lua +26 -0
  167. package/engine/object-data/auxiliary/health-regeneration-type.d.ts +8 -0
  168. package/engine/object-data/auxiliary/health-regeneration-type.lua +2 -0
  169. package/engine/object-data/auxiliary/item-class.d.ts +11 -0
  170. package/engine/object-data/auxiliary/item-class.lua +2 -0
  171. package/engine/object-data/auxiliary/item-tag.d.ts +12 -0
  172. package/engine/object-data/auxiliary/item-tag.lua +2 -0
  173. package/engine/object-data/auxiliary/movement-type.d.ts +7 -7
  174. package/engine/object-data/auxiliary/movement-type.lua +22 -0
  175. package/engine/object-data/auxiliary/order-type.d.ts +939 -0
  176. package/engine/object-data/auxiliary/order-type.lua +2 -0
  177. package/engine/object-data/auxiliary/sound-eax.d.ts +10 -0
  178. package/engine/object-data/auxiliary/sound-eax.lua +2 -0
  179. package/engine/object-data/auxiliary/sound-set-name.d.ts +14 -3
  180. package/engine/object-data/auxiliary/tech-tree-dependency.d.ts +1 -1
  181. package/engine/object-data/auxiliary/unit-attribute.d.ts +6 -0
  182. package/engine/object-data/auxiliary/unit-attribute.lua +9 -0
  183. package/engine/object-data/entry/ability-type/apprehend.d.ts +22 -0
  184. package/engine/object-data/entry/ability-type/apprehend.lua +66 -0
  185. package/engine/object-data/entry/ability-type/armor-bonus.d.ts +8 -0
  186. package/engine/object-data/entry/ability-type/{armor-increase.lua → armor-bonus.lua} +9 -9
  187. package/engine/object-data/entry/ability-type/aura-of-blight.d.ts +13 -0
  188. package/engine/object-data/entry/ability-type/aura-of-blight.lua +39 -0
  189. package/engine/object-data/entry/ability-type/banshee.d.ts +8 -0
  190. package/engine/object-data/entry/ability-type/banshee.lua +13 -0
  191. package/engine/object-data/entry/ability-type/banshees-wail-damage-amp.d.ts +12 -0
  192. package/engine/object-data/entry/ability-type/banshees-wail-damage-amp.lua +27 -0
  193. package/engine/object-data/entry/ability-type/banshees-wail.d.ts +31 -0
  194. package/engine/object-data/entry/ability-type/banshees-wail.lua +117 -0
  195. package/engine/object-data/entry/ability-type/barrage.d.ts +12 -0
  196. package/engine/object-data/entry/ability-type/barrage.lua +52 -0
  197. package/engine/object-data/entry/ability-type/battering-ram.d.ts +33 -0
  198. package/engine/object-data/entry/ability-type/battering-ram.lua +130 -0
  199. package/engine/object-data/entry/ability-type/berserk.d.ts +2 -0
  200. package/engine/object-data/entry/ability-type/berserk.lua +13 -0
  201. package/engine/object-data/entry/ability-type/blank-configurable.lua +14 -3
  202. package/engine/object-data/entry/ability-type/blank-passive-with-cooldown.d.ts +23 -0
  203. package/engine/object-data/entry/ability-type/blank-passive-with-cooldown.lua +112 -0
  204. package/engine/object-data/entry/ability-type/blank-passive.d.ts +4 -0
  205. package/engine/object-data/entry/ability-type/blank-passive.lua +27 -7
  206. package/engine/object-data/entry/ability-type/breath-of-fire.d.ts +11 -0
  207. package/engine/object-data/entry/ability-type/breath-of-fire.lua +27 -0
  208. package/engine/object-data/entry/ability-type/carrion-swarm.d.ts +14 -0
  209. package/engine/object-data/entry/ability-type/carrion-swarm.lua +65 -0
  210. package/engine/object-data/entry/ability-type/channel.d.ts +2 -2
  211. package/engine/object-data/entry/ability-type/channel.lua +3 -3
  212. package/engine/object-data/entry/ability-type/cleansing-fire.d.ts +27 -0
  213. package/engine/object-data/entry/ability-type/cleansing-fire.lua +104 -0
  214. package/engine/object-data/entry/ability-type/consecration.d.ts +15 -0
  215. package/engine/object-data/entry/ability-type/consecration.lua +52 -0
  216. package/engine/object-data/entry/ability-type/cooldown-reduction.d.ts +12 -0
  217. package/engine/object-data/entry/ability-type/cooldown-reduction.lua +39 -0
  218. package/engine/object-data/entry/ability-type/critical-strike-system.d.ts +18 -0
  219. package/engine/object-data/entry/ability-type/critical-strike-system.lua +65 -0
  220. package/engine/object-data/entry/ability-type/deathseeker-arrows.d.ts +21 -0
  221. package/engine/object-data/entry/ability-type/deathseeker-arrows.lua +78 -0
  222. package/engine/object-data/entry/ability-type/disease-cloud.lua +2 -2
  223. package/engine/object-data/entry/ability-type/engineering-upgrade.lua +2 -2
  224. package/engine/object-data/entry/ability-type/ensnare.d.ts +12 -0
  225. package/engine/object-data/entry/ability-type/ensnare.lua +52 -0
  226. package/engine/object-data/entry/ability-type/equipment-inventory-interface.d.ts +8 -0
  227. package/engine/object-data/entry/ability-type/equipment-inventory-interface.lua +13 -0
  228. package/engine/object-data/entry/ability-type/equipment-inventory.d.ts +13 -0
  229. package/engine/object-data/entry/ability-type/equipment-inventory.lua +27 -0
  230. package/engine/object-data/entry/ability-type/equipment.d.ts +13 -0
  231. package/engine/object-data/entry/ability-type/equipment.lua +27 -0
  232. package/engine/object-data/entry/ability-type/exhume-corpses.d.ts +14 -0
  233. package/engine/object-data/entry/ability-type/exhume-corpses.lua +40 -0
  234. package/engine/object-data/entry/ability-type/feral-spirit.lua +2 -2
  235. package/engine/object-data/entry/ability-type/firebolt.d.ts +7 -0
  236. package/engine/object-data/entry/ability-type/firebolt.lua +13 -0
  237. package/engine/object-data/entry/ability-type/flame-strike.d.ts +25 -0
  238. package/engine/object-data/entry/ability-type/flame-strike.lua +92 -0
  239. package/engine/object-data/entry/ability-type/grant-talent-point.d.ts +8 -0
  240. package/engine/object-data/entry/ability-type/grant-talent-point.lua +13 -0
  241. package/engine/object-data/entry/ability-type/grim-conviction.d.ts +36 -0
  242. package/engine/object-data/entry/ability-type/grim-conviction.lua +131 -0
  243. package/engine/object-data/entry/ability-type/grit.d.ts +18 -0
  244. package/engine/object-data/entry/ability-type/grit.lua +65 -0
  245. package/engine/object-data/entry/ability-type/guiding-hand.d.ts +27 -0
  246. package/engine/object-data/entry/ability-type/guiding-hand.lua +104 -0
  247. package/engine/object-data/entry/ability-type/headsplitter.d.ts +27 -0
  248. package/engine/object-data/entry/ability-type/headsplitter.lua +104 -0
  249. package/engine/object-data/entry/ability-type/{armor-increase.d.ts → healing-modifier.d.ts} +4 -3
  250. package/engine/object-data/entry/ability-type/healing-modifier.lua +26 -0
  251. package/engine/object-data/entry/ability-type/healing-ward-aura.d.ts +13 -0
  252. package/engine/object-data/entry/ability-type/healing-ward-aura.lua +39 -0
  253. package/engine/object-data/entry/ability-type/health-bonus.d.ts +8 -0
  254. package/engine/object-data/entry/ability-type/health-bonus.lua +26 -0
  255. package/engine/object-data/entry/ability-type/heroic-slash.d.ts +18 -0
  256. package/engine/object-data/entry/ability-type/heroic-slash.lua +65 -0
  257. package/engine/object-data/entry/ability-type/holy-wrath.d.ts +30 -0
  258. package/engine/object-data/entry/ability-type/holy-wrath.lua +117 -0
  259. package/engine/object-data/entry/ability-type/inspire-courage.d.ts +18 -0
  260. package/engine/object-data/entry/ability-type/inspire-courage.lua +65 -0
  261. package/engine/object-data/entry/ability-type/item-life-regeneration.d.ts +10 -0
  262. package/engine/object-data/entry/ability-type/item-life-regeneration.lua +26 -0
  263. package/engine/object-data/entry/ability-type/life-drain.d.ts +37 -0
  264. package/engine/object-data/entry/ability-type/life-drain.lua +144 -0
  265. package/engine/object-data/entry/ability-type/lights-mercy.d.ts +27 -0
  266. package/engine/object-data/entry/ability-type/lights-mercy.lua +104 -0
  267. package/engine/object-data/entry/ability-type/mana-bonus.d.ts +8 -0
  268. package/engine/object-data/entry/ability-type/mana-bonus.lua +26 -0
  269. package/engine/object-data/entry/ability-type/mana-efficiency.d.ts +12 -0
  270. package/engine/object-data/entry/ability-type/mana-efficiency.lua +39 -0
  271. package/engine/object-data/entry/ability-type/mana-regeneration.d.ts +8 -0
  272. package/engine/object-data/entry/ability-type/mana-regeneration.lua +26 -0
  273. package/engine/object-data/entry/ability-type/mind-control.d.ts +21 -0
  274. package/engine/object-data/entry/ability-type/mind-control.lua +78 -0
  275. package/engine/object-data/entry/ability-type/on-attack-cast-spell.d.ts +21 -0
  276. package/engine/object-data/entry/ability-type/on-attack-cast-spell.lua +52 -0
  277. package/engine/object-data/entry/ability-type/on-basic-attack-cast-spell.d.ts +19 -0
  278. package/engine/object-data/entry/ability-type/on-basic-attack-cast-spell.lua +65 -0
  279. package/engine/object-data/entry/ability-type/on-hit-cast-spell.d.ts +15 -0
  280. package/engine/object-data/entry/ability-type/on-hit-cast-spell.lua +26 -0
  281. package/engine/object-data/entry/ability-type/on-magic-attack-cast-spell.d.ts +6 -0
  282. package/engine/object-data/entry/ability-type/on-magic-attack-cast-spell.lua +12 -0
  283. package/engine/object-data/entry/ability-type/permanent-invisibility.d.ts +8 -0
  284. package/engine/object-data/entry/ability-type/permanent-invisibility.lua +26 -0
  285. package/engine/object-data/entry/ability-type/phase-shift.d.ts +10 -0
  286. package/engine/object-data/entry/ability-type/phase-shift.lua +39 -0
  287. package/engine/object-data/entry/ability-type/phoenix-morph.lua +4 -4
  288. package/engine/object-data/entry/ability-type/provoke.d.ts +21 -0
  289. package/engine/object-data/entry/ability-type/provoke.lua +66 -0
  290. package/engine/object-data/entry/ability-type/rain-of-fire.d.ts +7 -0
  291. package/engine/object-data/entry/ability-type/rain-of-fire.lua +13 -0
  292. package/engine/object-data/entry/ability-type/raise-dead.d.ts +17 -0
  293. package/engine/object-data/entry/ability-type/raise-dead.lua +78 -0
  294. package/engine/object-data/entry/ability-type/raise-the-banner.d.ts +9 -0
  295. package/engine/object-data/entry/ability-type/raise-the-banner.lua +26 -0
  296. package/engine/object-data/entry/ability-type/reincarnation.d.ts +8 -0
  297. package/engine/object-data/entry/ability-type/reincarnation.lua +26 -0
  298. package/engine/object-data/entry/ability-type/resolve.d.ts +12 -0
  299. package/engine/object-data/entry/ability-type/resolve.lua +39 -0
  300. package/engine/object-data/entry/ability-type/righteous-fury.d.ts +33 -0
  301. package/engine/object-data/entry/ability-type/righteous-fury.lua +130 -0
  302. package/engine/object-data/entry/ability-type/sacred-aura.d.ts +27 -0
  303. package/engine/object-data/entry/ability-type/sacred-aura.lua +104 -0
  304. package/engine/object-data/entry/ability-type/shock-wave.d.ts +4 -0
  305. package/engine/object-data/entry/ability-type/shock-wave.lua +26 -0
  306. package/engine/object-data/entry/ability-type/slow-poison.d.ts +10 -0
  307. package/engine/object-data/entry/ability-type/slow-poison.lua +58 -0
  308. package/engine/object-data/entry/ability-type/soul-burn.d.ts +22 -0
  309. package/engine/object-data/entry/ability-type/soul-burn.lua +79 -0
  310. package/engine/object-data/entry/ability-type/soul-lantern.d.ts +30 -0
  311. package/engine/object-data/entry/ability-type/soul-lantern.lua +117 -0
  312. package/engine/object-data/entry/ability-type/spell-amp.d.ts +15 -0
  313. package/engine/object-data/entry/ability-type/spell-amp.lua +52 -0
  314. package/engine/object-data/entry/ability-type/spell-critical-strike.d.ts +12 -0
  315. package/engine/object-data/entry/ability-type/spell-critical-strike.lua +39 -0
  316. package/engine/object-data/entry/ability-type/spell-vamp.d.ts +12 -0
  317. package/engine/object-data/entry/ability-type/spell-vamp.lua +39 -0
  318. package/engine/object-data/entry/ability-type/stackable-evasion.d.ts +9 -0
  319. package/engine/object-data/entry/ability-type/stackable-evasion.lua +13 -0
  320. package/engine/object-data/entry/ability-type/stackable-hardened-skin.d.ts +21 -0
  321. package/engine/object-data/entry/ability-type/stackable-hardened-skin.lua +78 -0
  322. package/engine/object-data/entry/ability-type/stackable-life-steal.d.ts +9 -0
  323. package/engine/object-data/entry/ability-type/stackable-life-steal.lua +26 -0
  324. package/engine/object-data/entry/ability-type/stackable-spell-damage-reduction.d.ts +9 -0
  325. package/engine/object-data/entry/ability-type/stackable-spell-damage-reduction.lua +13 -0
  326. package/engine/object-data/entry/ability-type/stackable-thorn-shield.d.ts +9 -0
  327. package/engine/object-data/entry/ability-type/stackable-thorn-shield.lua +13 -0
  328. package/engine/object-data/entry/ability-type/stat-details.d.ts +12 -0
  329. package/engine/object-data/entry/ability-type/stat-details.lua +27 -0
  330. package/engine/object-data/entry/ability-type/summon-quilbeast.lua +2 -2
  331. package/engine/object-data/entry/ability-type/summon-water-elemental.lua +2 -2
  332. package/engine/object-data/entry/ability-type/surge-of-light.d.ts +33 -0
  333. package/engine/object-data/entry/ability-type/surge-of-light.lua +130 -0
  334. package/engine/object-data/entry/ability-type/sweeping-strike.d.ts +57 -0
  335. package/engine/object-data/entry/ability-type/sweeping-strike.lua +234 -0
  336. package/engine/object-data/entry/ability-type/talents.d.ts +12 -0
  337. package/engine/object-data/entry/ability-type/talents.lua +27 -0
  338. package/engine/object-data/entry/ability-type/unyielding-guard.d.ts +30 -0
  339. package/engine/object-data/entry/ability-type/unyielding-guard.lua +117 -0
  340. package/engine/object-data/entry/ability-type/valiant-charge.d.ts +27 -0
  341. package/engine/object-data/entry/ability-type/valiant-charge.lua +104 -0
  342. package/engine/object-data/entry/ability-type/warcry.d.ts +9 -0
  343. package/engine/object-data/entry/ability-type/warcry.lua +26 -0
  344. package/engine/object-data/entry/ability-type/web.d.ts +12 -0
  345. package/engine/object-data/entry/ability-type/web.lua +52 -0
  346. package/engine/object-data/entry/ability-type/withering-fire.d.ts +21 -0
  347. package/engine/object-data/entry/ability-type/withering-fire.lua +78 -0
  348. package/engine/object-data/entry/ability-type.d.ts +50 -21
  349. package/engine/object-data/entry/ability-type.lua +384 -35
  350. package/engine/object-data/entry/buff-type/applicable.lua +131 -139
  351. package/engine/object-data/entry/buff-type.d.ts +10 -12
  352. package/engine/object-data/entry/buff-type.lua +39 -29
  353. package/engine/object-data/entry/destructible-type.d.ts +32 -2
  354. package/engine/object-data/entry/destructible-type.lua +181 -0
  355. package/engine/object-data/entry/item-type.d.ts +18 -3
  356. package/engine/object-data/entry/item-type.lua +88 -4
  357. package/engine/object-data/entry/lightning-type.d.ts +6 -8
  358. package/engine/object-data/entry/lightning-type.lua +1 -1
  359. package/engine/object-data/entry/sound-preset.d.ts +33 -0
  360. package/engine/object-data/entry/sound-preset.lua +140 -0
  361. package/engine/object-data/entry/unit-type.d.ts +81 -6
  362. package/engine/object-data/entry/unit-type.lua +606 -93
  363. package/engine/object-data/entry/upgrade.d.ts +2 -2
  364. package/engine/object-data/entry/upgrade.lua +4 -4
  365. package/engine/object-data/entry.d.ts +21 -14
  366. package/engine/object-data/entry.lua +68 -32
  367. package/engine/object-field/ability.d.ts +8 -5
  368. package/engine/object-field/ability.lua +10 -6
  369. package/engine/object-field/item.d.ts +22 -0
  370. package/engine/object-field/item.lua +118 -0
  371. package/engine/object-field/unit.d.ts +72 -3
  372. package/engine/object-field/unit.lua +268 -7
  373. package/engine/object-field.d.ts +26 -7
  374. package/engine/object-field.lua +362 -117
  375. package/engine/random.d.ts +10 -0
  376. package/engine/random.lua +21 -0
  377. package/engine/standard/entries/ability-type.d.ts +3102 -7
  378. package/engine/standard/entries/ability-type.lua +0 -6
  379. package/engine/standard/entries/buff-type.d.ts +48 -0
  380. package/engine/standard/entries/buff-type.lua +46 -0
  381. package/engine/standard/entries/item-type.d.ts +1299 -0
  382. package/engine/standard/entries/item-type.lua +2 -0
  383. package/engine/standard/entries/lightning-type.d.ts +42 -15
  384. package/engine/standard/entries/lightning-type.lua +0 -14
  385. package/engine/standard/entries/sound-preset.d.ts +10 -0
  386. package/engine/standard/entries/sound-preset.lua +10 -0
  387. package/engine/standard/entries/unit-type.d.ts +5 -0
  388. package/engine/standard/entries/unit-type.lua +5 -0
  389. package/engine/standard/fields/ability.d.ts +4 -4
  390. package/engine/standard/fields/ability.lua +4 -4
  391. package/engine/standard/fields/item.d.ts +4 -0
  392. package/engine/standard/fields/item.lua +6 -0
  393. package/engine/standard/fields/unit.d.ts +12 -0
  394. package/engine/standard/fields/unit.lua +20 -0
  395. package/engine/synchronization.d.ts +11 -0
  396. package/engine/synchronization.lua +77 -0
  397. package/engine/text-tag.d.ts +36 -2
  398. package/engine/text-tag.lua +250 -10
  399. package/engine/unit.d.ts +12 -1
  400. package/engine/unit.lua +12 -1
  401. package/event.d.ts +1 -1
  402. package/lualib_bundle.lua +1 -1
  403. package/math.d.ts +2 -0
  404. package/math.lua +14 -0
  405. package/net/socket.lua +1 -1
  406. package/network.lua +25 -1
  407. package/objutil/buff.lua +12 -11
  408. package/objutil/object.lua +1 -1
  409. package/objutil/unit.lua +8 -0
  410. package/operation.d.ts +8 -1
  411. package/operation.lua +38 -18
  412. package/package.json +3 -23
  413. package/patch-lua.lua +15 -0
  414. package/patch-lualib.lua +1 -1
  415. package/utility/arrays.d.ts +9 -1
  416. package/utility/arrays.lua +28 -0
  417. package/utility/callback-array.d.ts +17 -0
  418. package/utility/callback-array.lua +61 -0
  419. package/utility/functions.d.ts +8 -0
  420. package/utility/functions.lua +13 -0
  421. package/utility/linked-map.d.ts +35 -0
  422. package/utility/linked-map.lua +107 -0
  423. package/utility/linked-set.d.ts +5 -1
  424. package/utility/linked-set.lua +49 -1
  425. package/utility/lua-maps.d.ts +15 -2
  426. package/utility/lua-maps.lua +53 -2
  427. package/utility/lua-sets.d.ts +2 -0
  428. package/utility/lua-sets.lua +7 -0
  429. package/utility/random.d.ts +102 -0
  430. package/utility/random.lua +273 -0
  431. package/utility/records.lua +20 -1
  432. package/utility/reflection.lua +11 -7
  433. package/utility/types.d.ts +3 -0
  434. package/utility/unordered-map.d.ts +27 -0
  435. package/utility/unordered-map.lua +99 -0
  436. package/core/types/order.d.ts +0 -25
  437. package/core/types/order.lua +0 -55
  438. package/engine/internal/unit/item.lua +0 -79
  439. /package/engine/internal/{object-data/armor-increase.d.ts → misc/damage-metadata-by-target.d.ts} +0 -0
  440. /package/engine/internal/object-data/{armor-increase.lua → armor-bonus.lua} +0 -0
  441. /package/engine/object-data/entry/ability-type/{attribute-increase.d.ts → attribute-bonus.d.ts} +0 -0
  442. /package/engine/object-data/entry/ability-type/{attribute-increase.lua → attribute-bonus.lua} +0 -0
package/engine/buff.lua CHANGED
@@ -14,8 +14,10 @@ local Unit = ____unit.Unit
14
14
  local ____applicable = require("engine.object-data.entry.buff-type.applicable")
15
15
  local internalApplyBuff = ____applicable.internalApplyBuff
16
16
  local removeBuff = ____applicable.removeBuff
17
+ local removeBuffApplicator = ____applicable.removeBuffApplicator
17
18
  local ____ability = require("engine.internal.ability")
18
19
  local Ability = ____ability.Ability
20
+ local UnitAbility = ____ability.UnitAbility
19
21
  local ____ability = require("engine.object-field.ability")
20
22
  local AbilityBooleanField = ____ability.AbilityBooleanField
21
23
  local AbilityNumberField = ____ability.AbilityNumberField
@@ -28,13 +30,11 @@ local ____math = require("math")
28
30
  local max = ____math.max
29
31
  local min = ____math.min
30
32
  local ____bonus = require("engine.internal.unit.bonus")
31
- local addOrUpdateOrRemoveUnitBonus = ____bonus.addOrUpdateOrRemoveUnitBonus
32
- local getUnitBonus = ____bonus.getUnitBonus
33
- local removeUnitBonus = ____bonus.removeUnitBonus
34
33
  local UnitBonusType = ____bonus.UnitBonusType
35
34
  local ____area_2Ddamage = require("engine.internal.mechanics.area-damage")
36
35
  local damageArea = ____area_2Ddamage.damageArea
37
36
  local ____preconditions = require("utility.preconditions")
37
+ local check = ____preconditions.check
38
38
  local checkNotNull = ____preconditions.checkNotNull
39
39
  local ____effect = require("core.types.effect")
40
40
  local Effect = ____effect.Effect
@@ -43,13 +43,25 @@ local BuffType = ____buff_2Dtype.BuffType
43
43
  local ____unit = require("engine.behaviour.unit")
44
44
  local UnitBehavior = ____unit.UnitBehavior
45
45
  local ____arrays = require("utility.arrays")
46
+ local emptyArray = ____arrays.emptyArray
46
47
  local forEach = ____arrays.forEach
48
+ local ____event = require("event")
49
+ local Event = ____event.Event
47
50
  local ____ability_2Dduration = require("engine.internal.mechanics.ability-duration")
48
51
  local getAbilityDuration = ____ability_2Dduration.getAbilityDuration
49
52
  local ____item = require("engine.internal.item")
50
53
  local Item = ____item.Item
51
54
  local ____destructable = require("core.types.destructable")
52
55
  local Destructable = ____destructable.Destructable
56
+ local ____ability = require("engine.standard.fields.ability")
57
+ local COOLDOWN_ABILITY_FLOAT_LEVEL_FIELD = ____ability.COOLDOWN_ABILITY_FLOAT_LEVEL_FIELD
58
+ local ____ability = require("engine.behaviour.ability")
59
+ local AbilityBehavior = ____ability.AbilityBehavior
60
+ local ____records = require("utility.records")
61
+ local sortedKeysUnnested = ____records.sortedKeysUnnested
62
+ local ____sound = require("core.types.sound")
63
+ local Sound3D = ____sound.Sound3D
64
+ local SoundSettings = ____sound.SoundSettings
53
65
  local getUnitAbility = BlzGetUnitAbility
54
66
  local stringValueByBuffTypeIdByFieldId = postcompile(function()
55
67
  local stringValueByBuffTypeIdByFieldId = {}
@@ -95,15 +107,21 @@ local buffParametersKeys = {
95
107
  damageIncrease = true,
96
108
  damageIncreaseFactor = true,
97
109
  armorIncrease = true,
98
- armorIncreaseFactor = true,
110
+ maxHealthIncrease = true,
111
+ maxManaIncrease = true,
99
112
  attackSpeedIncreaseFactor = true,
100
113
  movementSpeedIncreaseFactor = true,
114
+ manaRegenerationRateIncreaseFactor = true,
115
+ evasionProbability = true,
116
+ missProbability = true,
101
117
  damageFactor = true,
102
118
  receivedDamageFactor = true,
119
+ returnedMeleeDamageFactor = true,
103
120
  receivedMagicDamageFactor = true,
104
121
  durationIncreaseOnAutoAttack = true,
105
122
  maximumDuration = true,
106
123
  maximumRemainingDuration = true,
124
+ turnsIntoGhost = true,
107
125
  stuns = true,
108
126
  ignoresStunImmunity = true,
109
127
  providesStunImmunity = true,
@@ -114,11 +132,16 @@ local buffParametersKeys = {
114
132
  maximumAutoAttackCount = true,
115
133
  maximumDamageDealtEventCount = true,
116
134
  maximumDamageReceivedEventCount = true,
135
+ absorbedDamageFactor = true,
136
+ maximumDamageAbsorbed = true,
137
+ destroysOnMaximumDamageAbsorbed = true,
117
138
  uniqueGroup = true,
139
+ destructionSoundPresetId = true,
118
140
  damageOnExpiration = true,
119
141
  healingOnExpiration = true,
120
142
  killsOnExpiration = true,
121
- explodesOnExpiration = true
143
+ explodesOnExpiration = true,
144
+ abilityCooldownFactor = true
122
145
  }
123
146
  local function resolveEnumValue(ability, level, value)
124
147
  if value == nil or type(value) == "number" then
@@ -169,6 +192,8 @@ local function resolveAndSetNumberValue(buff, property, ability, level, value, d
169
192
  end
170
193
  end
171
194
  local buffBooleanParameters = {
195
+ "destroysOnMaximumDamageAbsorbed",
196
+ "turnsIntoGhost",
172
197
  "stuns",
173
198
  "ignoresStunImmunity",
174
199
  "disablesAutoAttack",
@@ -180,9 +205,14 @@ local buffNumberParameters = {
180
205
  "durationIncreaseOnAutoAttack",
181
206
  "attackSpeedIncreaseFactor",
182
207
  "movementSpeedIncreaseFactor",
208
+ "manaRegenerationRateIncreaseFactor",
209
+ "evasionProbability",
183
210
  "armorIncrease",
211
+ "maxHealthIncrease",
212
+ "maxManaIncrease",
184
213
  "damageFactor",
185
214
  "receivedDamageFactor",
215
+ "returnedMeleeDamageFactor",
186
216
  "maximumAutoAttackCount",
187
217
  "maximumDamageDealtEventCount",
188
218
  "maximumDamageReceivedEventCount",
@@ -193,7 +223,10 @@ local buffNumberParameters = {
193
223
  "healingPerInterval",
194
224
  "healingOverDuration",
195
225
  "damageOnExpiration",
196
- "healingOnExpiration"
226
+ "healingOnExpiration",
227
+ "absorbedDamageFactor",
228
+ "maximumDamageAbsorbed",
229
+ "abilityCooldownFactor"
197
230
  }
198
231
  local unsuccessfulApplicationMarker = {}
199
232
  local function selectBuffTypeIdWithLeastDuration(buffTypeIds, unit)
@@ -220,7 +253,7 @@ local function selectBuffTypeIdWithLeastDuration(buffTypeIds, unit)
220
253
  return checkNotNull(firstNativeBuffTypeId)
221
254
  end
222
255
  local function destroyBuffIfItHasSameUniqueGroup(buff, uniqueGroup)
223
- if buff[103] == uniqueGroup then
256
+ if buff[104] == uniqueGroup then
224
257
  buff:destroy()
225
258
  end
226
259
  end
@@ -228,17 +261,21 @@ local function destroyBuff(buff)
228
261
  buff:destroy()
229
262
  end
230
263
  local function expireBuff(buff)
231
- local remainingDamageOverDuration = buff[112] or 0
232
- local remainingHealingOverDuration = buff[112] or 0
264
+ if buff.isDestroyed or buff[100] ~= 1 then
265
+ return
266
+ end
267
+ buff[100] = 2
268
+ local remainingDamageOverDuration = buff[114] or 0
269
+ local remainingHealingOverDuration = buff[114] or 0
233
270
  if remainingDamageOverDuration ~= 0 or remainingHealingOverDuration ~= 0 then
234
271
  buff:flashSpecialEffect()
235
272
  if remainingDamageOverDuration ~= 0 then
236
- (buff[101] or buff[100]):damageTarget(buff[100], remainingDamageOverDuration)
237
- buff[112] = nil
273
+ (buff[102] or buff[101]):damageTarget(buff[101], remainingDamageOverDuration)
274
+ buff[114] = nil
238
275
  end
239
276
  if remainingHealingOverDuration ~= 0 then
240
- (buff[101] or buff[100]):healTarget(buff[100], remainingHealingOverDuration)
241
- buff[117] = nil
277
+ (buff[102] or buff[101]):healTarget(buff[101], remainingHealingOverDuration)
278
+ buff[119] = nil
242
279
  end
243
280
  end
244
281
  Timer:run(destroyBuff, buff)
@@ -246,56 +283,58 @@ local function expireBuff(buff)
246
283
  end
247
284
  local function buffDamageIntervalInitialTimerCallback(buff)
248
285
  buffDamageIntervalTimerCallback(buff)
249
- local timer = buff[113]
250
- local damageInterval = buff[111]
286
+ local timer = buff[115]
287
+ local damageInterval = buff[113]
251
288
  if timer ~= nil and damageInterval ~= nil and damageInterval > 0 then
252
289
  timer:start(damageInterval, true, buffDamageIntervalTimerCallback, buff)
253
290
  end
254
291
  end
255
292
  buffDamageIntervalTimerCallback = function(buff)
256
293
  buff:flashSpecialEffect()
257
- local source = buff[101] or buff[100]
258
- local remainingDamageOverDuration = buff[112] or 0
294
+ local source = buff[102] or buff[101]
295
+ local remainingDamageOverDuration = buff[114] or 0
259
296
  if remainingDamageOverDuration ~= 0 then
260
- local damageInterval = buff[111] or 0
297
+ local damageInterval = buff[113] or 0
261
298
  if damageInterval ~= 0 then
262
299
  local damage = remainingDamageOverDuration / (1 + buff.remainingDuration / damageInterval)
263
- source:damageTarget(buff[100], damage)
264
- buff[112] = remainingDamageOverDuration - damage
300
+ source:damageTarget(buff[101], damage)
301
+ buff[114] = remainingDamageOverDuration - damage
265
302
  end
266
303
  end
267
- local damagePerInterval = buff[110] or 0
304
+ local damagePerInterval = buff[112] or 0
268
305
  if remainingDamageOverDuration == 0 or damagePerInterval ~= 0 then
269
- source:damageTarget(buff[100], damagePerInterval)
306
+ source:damageTarget(buff[101], damagePerInterval)
270
307
  end
271
308
  end
272
309
  local function buffHealingIntervalInitialTimerCallback(buff)
273
310
  buffHealingIntervalTimerCallback(buff)
274
- local timer = buff[118]
275
- local healingInterval = buff[116]
311
+ local timer = buff[120]
312
+ local healingInterval = buff[118]
276
313
  if timer ~= nil and healingInterval ~= nil and healingInterval > 0 then
277
314
  timer:start(healingInterval, true, buffHealingIntervalTimerCallback, buff)
278
315
  end
279
316
  end
280
317
  buffHealingIntervalTimerCallback = function(buff)
281
- if buff[116] ~= buff[111] then
318
+ if buff[118] ~= buff[113] then
282
319
  buff:flashSpecialEffect()
283
320
  end
284
- local source = buff[101] or buff[100]
285
- local remainingHealingOverDuration = buff[117] or 0
321
+ local source = buff[102] or buff[101]
322
+ local remainingHealingOverDuration = buff[119] or 0
286
323
  if remainingHealingOverDuration ~= 0 then
287
- local healingInterval = buff[116] or 0
324
+ local healingInterval = buff[118] or 0
288
325
  if healingInterval ~= 0 then
289
326
  local healing = remainingHealingOverDuration / (1 + buff.remainingDuration / healingInterval)
290
- source:healTarget(buff[100], healing)
291
- buff[117] = remainingHealingOverDuration - healing
327
+ source:healTarget(buff[101], healing)
328
+ buff[119] = remainingHealingOverDuration - healing
292
329
  end
293
330
  end
294
- local healingPerInterval = buff[115] or 0
331
+ local healingPerInterval = buff[117] or 0
295
332
  if remainingHealingOverDuration == 0 or healingPerInterval ~= 0 then
296
- source:healTarget(buff[100], healingPerInterval)
333
+ source:healTarget(buff[101], healingPerInterval)
297
334
  end
298
335
  end
336
+ local buffCreatedEvent = __TS__New(Event)
337
+ local buffBeingDestroyedEvent = __TS__New(Event)
299
338
  ____exports.Buff = __TS__Class()
300
339
  local Buff = ____exports.Buff
301
340
  Buff.name = "Buff"
@@ -304,38 +343,44 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
304
343
  UnitBehavior.prototype.____constructor(self, _unit)
305
344
  self._unit = _unit
306
345
  self.parameters = nil
307
- self[100] = _unit
346
+ self[100] = 0
347
+ self[101] = _unit
308
348
  local typeId
309
349
  local polarity
310
350
  local resistanceType
311
351
  local ability
352
+ local abilityBehavior
312
353
  if type(typeIdOrTypeIds) ~= "number" then
313
354
  typeId = selectBuffTypeIdWithLeastDuration(typeIdOrTypeIds, _unit)
314
355
  polarity = resistanceTypeOrPolarity
315
356
  resistanceType = abilityOrParametersOrResistanceType
316
- if __TS__InstanceOf(parametersOrAbility, Ability) then
357
+ if __TS__InstanceOf(parametersOrAbility, AbilityBehavior) then
358
+ abilityBehavior = parametersOrAbility
359
+ ability = abilityBehavior.ability
360
+ elseif __TS__InstanceOf(parametersOrAbility, Ability) then
317
361
  ability = parametersOrAbility
318
- else
319
- ability = nil
362
+ elseif parametersOrAbility ~= nil then
320
363
  parameters = parametersOrAbility
321
364
  end
322
365
  else
323
366
  typeId = typeIdOrTypeIds
324
367
  polarity = polarityOrTypeIdSelectionPolicy
325
368
  resistanceType = resistanceTypeOrPolarity
326
- if __TS__InstanceOf(abilityOrParametersOrResistanceType, Ability) then
369
+ if __TS__InstanceOf(abilityOrParametersOrResistanceType, AbilityBehavior) then
370
+ abilityBehavior = abilityOrParametersOrResistanceType
371
+ ability = abilityBehavior.ability
372
+ parameters = parametersOrAbility
373
+ elseif __TS__InstanceOf(abilityOrParametersOrResistanceType, Ability) then
327
374
  ability = abilityOrParametersOrResistanceType
328
375
  parameters = parametersOrAbility
329
- else
330
- ability = nil
376
+ elseif abilityOrParametersOrResistanceType ~= nil then
331
377
  parameters = abilityOrParametersOrResistanceType
378
+ else
379
+ parameters = parametersOrAbility
332
380
  end
333
381
  end
382
+ self.sourceAbilityBehavior = abilityBehavior
334
383
  self.typeId = typeId
335
- if not __TS__InstanceOf(ability, Ability) then
336
- parameters = ability
337
- ability = nil
338
- end
339
384
  local defaultParameters = self.constructor.defaultParameters
340
385
  local level = parameters and parameters.level or defaultParameters.level
341
386
  local spellStealPriority = parameters and parameters.spellStealPriority or defaultParameters.spellStealPriority
@@ -360,14 +405,20 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
360
405
  end
361
406
  self.polarity = resolveEnumValue(ability, level, polarity)
362
407
  self.resistanceType = resolveEnumValue(ability, level, resistanceType)
408
+ local missProbability = parameters and parameters.missProbability or defaultParameters.missProbability
409
+ if missProbability ~= nil then
410
+ missProbability = resolveNumberValue(ability, level, missProbability)
411
+ self[147] = missProbability
412
+ end
363
413
  local buffByTypeId = buffByTypeIdByUnit[_unit]
364
414
  if buffByTypeId == nil then
365
415
  buffByTypeId = {}
366
416
  buffByTypeIdByUnit[_unit] = buffByTypeId
367
417
  end
368
- local ____opt_13 = buffByTypeId[typeId]
369
- if ____opt_13 ~= nil then
370
- ____opt_13:destroy()
418
+ self.previousBuff = buffByTypeId[typeId]
419
+ local ____opt_15 = self.previousBuff
420
+ if ____opt_15 ~= nil then
421
+ ____opt_15:destroy()
371
422
  end
372
423
  local uniqueGroup = parameters and parameters.uniqueGroup or defaultParameters and defaultParameters.uniqueGroup
373
424
  if uniqueGroup ~= nil then
@@ -381,13 +432,16 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
381
432
  level,
382
433
  duration,
383
434
  spellStealPriority,
384
- learnLevelMinimum
435
+ learnLevelMinimum,
436
+ missProbability
385
437
  ) then
438
+ self[100] = 1
386
439
  UnitBehavior.prototype.destroy(self)
387
440
  error(unsuccessfulApplicationMarker, 0)
388
441
  end
389
442
  local handle = BlzGetUnitAbility(_unit.handle, typeId)
390
443
  if handle == nil then
444
+ self[100] = 1
391
445
  UnitBehavior.prototype.destroy(self)
392
446
  error(unsuccessfulApplicationMarker, 0)
393
447
  end
@@ -396,20 +450,21 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
396
450
  self._level = level
397
451
  self._spellStealPriority = spellStealPriority
398
452
  self._learnLevelMinimum = learnLevelMinimum
399
- self[101] = source
400
- self[102] = duration or 0
401
- self[103] = uniqueGroup
402
- self[104] = BlzGetAbilityStringLevelField(self.handle, ABILITY_SLF_EFFECT, 0)
403
- self[105] = BlzGetAbilityStringLevelField(self.handle, ABILITY_SLF_SPECIAL, 0)
453
+ self[102] = source
454
+ self[103] = duration or 0
455
+ self[104] = uniqueGroup
456
+ self[105] = parameters and parameters.destructionSoundPresetId or defaultParameters and defaultParameters.destructionSoundPresetId
457
+ self[106] = BlzGetAbilityStringLevelField(self.handle, ABILITY_SLF_EFFECT, 0)
458
+ self[107] = BlzGetAbilityStringLevelField(self.handle, ABILITY_SLF_SPECIAL, 0)
404
459
  if parameters ~= nil or (next(defaultParameters)) ~= nil then
405
460
  for ____, buffBooleanParameter in ipairs(buffBooleanParameters) do
406
- local ____ability_22 = ability
407
- local ____level_23 = level
408
- local ____temp_21 = parameters and parameters[buffBooleanParameter]
409
- if ____temp_21 == nil then
410
- ____temp_21 = defaultParameters[buffBooleanParameter]
461
+ local ____ability_28 = ability
462
+ local ____level_29 = level
463
+ local ____temp_27 = parameters and parameters[buffBooleanParameter]
464
+ if ____temp_27 == nil then
465
+ ____temp_27 = defaultParameters[buffBooleanParameter]
411
466
  end
412
- if resolveBooleanValue(____ability_22, ____level_23, ____temp_21) then
467
+ if resolveBooleanValue(____ability_28, ____level_29, ____temp_27) then
413
468
  self[buffBooleanParameter] = true
414
469
  end
415
470
  end
@@ -425,11 +480,11 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
425
480
  end
426
481
  local maximumDuration = parameters and parameters.maximumDuration or defaultParameters.maximumDuration
427
482
  if maximumDuration ~= nil then
428
- self[107] = resolveNumberValue(ability, level, maximumDuration)
483
+ self[109] = resolveNumberValue(ability, level, maximumDuration)
429
484
  end
430
485
  local maximumRemainingDuration = parameters and parameters.maximumRemainingDuration or defaultParameters.maximumRemainingDuration
431
486
  if maximumRemainingDuration ~= nil then
432
- self[108] = resolveNumberValue(ability, level, maximumRemainingDuration)
487
+ self[110] = resolveNumberValue(ability, level, maximumRemainingDuration)
433
488
  end
434
489
  local parametersAbilityTypeIds = parameters and parameters.abilityTypeIds or defaultParameters.abilityTypeIds
435
490
  if parametersAbilityTypeIds ~= nil then
@@ -438,24 +493,22 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
438
493
  abilityTypeIds = {}
439
494
  self._abilityTypeIds = abilityTypeIds
440
495
  end
441
- for abilityTypeId, abilityParameters in pairs(parametersAbilityTypeIds) do
496
+ for ____, abilityTypeId in ipairs(sortedKeysUnnested(parametersAbilityTypeIds)) do
497
+ local abilityParameters = checkNotNull(parametersAbilityTypeIds[abilityTypeId])
442
498
  local addedAbility = _unit:addAbility(abilityTypeId)
443
499
  if addedAbility ~= nil then
444
500
  _unit:makeAbilityPermanent(abilityTypeId, true)
445
501
  _unit:setAbilityLevel(abilityTypeId, 1 + (abilityParameters.level or ability and ability.level or 0))
446
- for abilityParameterKey, abilityParameterValue in pairs(abilityParameters) do
447
- if abilityParameterKey == "isButtonVisible" then
448
- if not resolveBooleanValue(ability, level, abilityParameterValue) then
449
- _unit:hideAbility(abilityTypeId, true)
450
- end
451
- elseif abilityParameterKey ~= "level" then
452
- abilityParameterKey:setValue(
453
- addedAbility,
454
- resolveNumberValue(ability, level, abilityParameterValue)
455
- )
456
- end
502
+ if abilityParameters.isButtonVisible == false then
503
+ _unit:hideAbility(abilityTypeId, true)
457
504
  end
458
- abilityTypeIds[abilityTypeId] = true
505
+ for ____, field in ipairs(abilityParameters.fields or emptyArray()) do
506
+ field[1]:setValue(
507
+ addedAbility,
508
+ resolveNumberValue(ability, level, field[2])
509
+ )
510
+ end
511
+ abilityTypeIds[#abilityTypeIds + 1] = abilityTypeId
459
512
  end
460
513
  end
461
514
  local behaviorConstructors = parameters and parameters.behaviorConstructors or defaultParameters.behaviorConstructors
@@ -467,18 +520,20 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
467
520
  self._behaviors = behaviors
468
521
  end
469
522
  end
470
- local additionalParameters = {}
471
- for key, value in pairs(parameters) do
472
- if not buffParametersKeys[key] then
473
- if ability then
474
- additionalParameters[key] = resolveCurrentAbilityDependentValue(ability, value)
475
- else
476
- additionalParameters[key] = value
523
+ if parameters ~= nil then
524
+ local additionalParameters = {}
525
+ for ____, key in ipairs(sortedKeysUnnested(parameters)) do
526
+ if not buffParametersKeys[key] then
527
+ if ability then
528
+ additionalParameters[key] = resolveCurrentAbilityDependentValue(ability, parameters[key])
529
+ else
530
+ additionalParameters[key] = parameters[key]
531
+ end
477
532
  end
478
533
  end
479
- end
480
- if (next(additionalParameters)) ~= nil then
481
- self.parameters = additionalParameters
534
+ if (next(additionalParameters)) ~= nil then
535
+ self.parameters = additionalParameters
536
+ end
482
537
  end
483
538
  end
484
539
  if duration ~= nil and duration > 0 then
@@ -487,83 +542,106 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
487
542
  self._timer = timer
488
543
  end
489
544
  self:onCreate()
545
+ self[100] = 1
546
+ Event.invoke(buffCreatedEvent, self)
490
547
  end
491
- function Buff.prototype.getUnitBonus(self, bonusType)
492
- local ____opt_36 = self._bonusIdByBonusType
493
- local bonusId = ____opt_36 and ____opt_36[bonusType]
494
- return bonusId == nil and 0 or getUnitBonus(self._unit, bonusType, bonusId)
548
+ function Buff.prototype.onAbilityGained(self, ability)
549
+ if __TS__InstanceOf(ability, UnitAbility) then
550
+ local abilityCooldownModifier = self[149]
551
+ if abilityCooldownModifier then
552
+ COOLDOWN_ABILITY_FLOAT_LEVEL_FIELD:applyModifier(ability, abilityCooldownModifier)
553
+ end
554
+ end
495
555
  end
496
- function Buff.prototype.addOrUpdateOrRemoveUnitBonus(self, bonusType, value)
497
- local bonusIdByBonusType = self._bonusIdByBonusType
498
- if bonusIdByBonusType == nil then
499
- bonusIdByBonusType = {}
500
- self._bonusIdByBonusType = bonusIdByBonusType
556
+ function Buff.prototype.onAbilityLost(self, ability)
557
+ if __TS__InstanceOf(ability, UnitAbility) then
558
+ local abilityCooldownModifier = self[149]
559
+ if abilityCooldownModifier then
560
+ COOLDOWN_ABILITY_FLOAT_LEVEL_FIELD:removeModifier(ability, abilityCooldownModifier)
561
+ end
501
562
  end
502
- bonusIdByBonusType[bonusType] = addOrUpdateOrRemoveUnitBonus(self._unit, bonusType, bonusIdByBonusType[bonusType], value)
503
563
  end
504
564
  function Buff.prototype.flashEffect(self, widgetOrXOrParametersOrDuration, yOrParametersOrDuration, parametersOrDuration)
565
+ self:flash(
566
+ self[106],
567
+ stringValueByBuffTypeIdByFieldId[fourCC("feft")][self.typeId] or "origin",
568
+ widgetOrXOrParametersOrDuration,
569
+ yOrParametersOrDuration,
570
+ parametersOrDuration
571
+ )
572
+ end
573
+ function Buff.prototype.flashSpecialEffect(self, widgetOrXOrParametersOrDuration, yOrParametersOrDuration, parametersOrDuration)
574
+ self:flash(
575
+ self[107],
576
+ stringValueByBuffTypeIdByFieldId[fourCC("fspt")][self.typeId] or "origin",
577
+ widgetOrXOrParametersOrDuration,
578
+ yOrParametersOrDuration,
579
+ parametersOrDuration
580
+ )
581
+ end
582
+ function Buff.prototype.flash(self, modelPath, attachmentPoint, widgetOrXOrParametersOrDuration, yOrParametersOrDuration, parametersOrDuration)
505
583
  if type(widgetOrXOrParametersOrDuration) == "number" and type(yOrParametersOrDuration) == "number" then
506
- Effect:flash(self[104], widgetOrXOrParametersOrDuration, yOrParametersOrDuration, parametersOrDuration)
584
+ Effect:flash(modelPath, widgetOrXOrParametersOrDuration, yOrParametersOrDuration, parametersOrDuration)
507
585
  else
508
586
  local isWidgetProvided = __TS__InstanceOf(widgetOrXOrParametersOrDuration, Unit) or __TS__InstanceOf(widgetOrXOrParametersOrDuration, Item) or __TS__InstanceOf(widgetOrXOrParametersOrDuration, Destructable)
509
- local ____Effect_40 = Effect
510
- local ____Effect_flash_41 = Effect.flash
511
- local ____array_39 = __TS__SparseArrayNew(
512
- self[104],
513
- isWidgetProvided and widgetOrXOrParametersOrDuration or self._unit,
514
- stringValueByBuffTypeIdByFieldId[fourCC("feft")][self.typeId] or "origin"
515
- )
516
- local ____isWidgetProvided_38
587
+ local ____Effect_44 = Effect
588
+ local ____Effect_flash_45 = Effect.flash
589
+ local ____array_43 = __TS__SparseArrayNew(modelPath, isWidgetProvided and widgetOrXOrParametersOrDuration or self._unit, attachmentPoint)
590
+ local ____isWidgetProvided_42
517
591
  if isWidgetProvided then
518
- ____isWidgetProvided_38 = yOrParametersOrDuration
592
+ ____isWidgetProvided_42 = yOrParametersOrDuration
519
593
  else
520
- ____isWidgetProvided_38 = widgetOrXOrParametersOrDuration
594
+ ____isWidgetProvided_42 = widgetOrXOrParametersOrDuration
521
595
  end
522
- __TS__SparseArrayPush(____array_39, ____isWidgetProvided_38)
523
- ____Effect_flash_41(
524
- ____Effect_40,
525
- __TS__SparseArraySpread(____array_39)
596
+ __TS__SparseArrayPush(____array_43, ____isWidgetProvided_42)
597
+ ____Effect_flash_45(
598
+ ____Effect_44,
599
+ __TS__SparseArraySpread(____array_43)
526
600
  )
527
601
  end
528
602
  end
529
- function Buff.prototype.flashSpecialEffect(self, widgetOrDuration, duration)
530
- local isWidgetProvided = type(widgetOrDuration) == "table"
531
- local ____Effect_44 = Effect
532
- local ____Effect_flash_45 = Effect.flash
533
- local ____array_43 = __TS__SparseArrayNew(
534
- self[105],
535
- isWidgetProvided and widgetOrDuration or self._unit,
536
- stringValueByBuffTypeIdByFieldId[fourCC("fspt")][self.typeId] or "origin"
537
- )
538
- local ____isWidgetProvided_42
539
- if isWidgetProvided then
540
- ____isWidgetProvided_42 = duration
541
- else
542
- ____isWidgetProvided_42 = widgetOrDuration
603
+ function Buff.prototype.expire(self)
604
+ expireBuff(self)
605
+ end
606
+ function Buff.prototype.dispel(self, source)
607
+ if self.isDestroyed or self[100] ~= 1 then
608
+ return
609
+ end
610
+ self[100] = 2
611
+ do
612
+ pcall(function()
613
+ self:onDispel(source)
614
+ end)
615
+ do
616
+ self:destroy()
617
+ end
543
618
  end
544
- __TS__SparseArrayPush(____array_43, ____isWidgetProvided_42)
545
- ____Effect_flash_45(
546
- ____Effect_44,
547
- __TS__SparseArraySpread(____array_43)
548
- )
549
619
  end
550
620
  function Buff.prototype.onCreate(self)
551
621
  end
552
622
  function Buff.prototype.onDestroy(self)
623
+ check(self[100] ~= 0, "Cannot destroy a buff that has not finished creating yet.")
624
+ self[100] = 2
553
625
  local unit = self._unit
626
+ local destructionSoundPresetId = self[105]
627
+ if destructionSoundPresetId ~= nil then
628
+ Sound3D:playFromLabel(destructionSoundPresetId, SoundSettings.Ability, unit)
629
+ end
554
630
  if getUnitAbility(unit.handle, self.typeId) == self.handle then
555
631
  removeBuff(unit.handle, self.typeId)
632
+ else
633
+ removeBuffApplicator(unit.handle, self.typeId)
556
634
  end
557
635
  buffByTypeIdByUnit[unit][self.typeId] = nil
558
- local healingIntervalTimer = self[118]
636
+ local healingIntervalTimer = self[120]
559
637
  if healingIntervalTimer ~= nil then
560
638
  healingIntervalTimer:destroy()
561
- self[118] = nil
639
+ self[120] = nil
562
640
  end
563
- local damageIntervalTimer = self[113]
641
+ local damageIntervalTimer = self[115]
564
642
  if damageIntervalTimer ~= nil then
565
643
  damageIntervalTimer:destroy()
566
- self[113] = nil
644
+ self[115] = nil
567
645
  end
568
646
  if self._timer ~= nil then
569
647
  self._timer:destroy()
@@ -573,25 +651,34 @@ function Buff.prototype.onDestroy(self)
573
651
  behavior:destroy()
574
652
  end
575
653
  end
576
- if self[136] then
654
+ local previousAbilityCooldownModifier = self[149]
655
+ if previousAbilityCooldownModifier then
656
+ for ____, ability in ipairs(self._unit.abilities) do
657
+ COOLDOWN_ABILITY_FLOAT_LEVEL_FIELD:removeModifier(ability, previousAbilityCooldownModifier)
658
+ end
659
+ end
660
+ if self[144] then
661
+ unit:decrementInvulnerabilityCounter()
662
+ end
663
+ if self[143] then
577
664
  unit:decrementDisableAutoAttackCounter()
578
665
  end
579
- if self[134] then
580
- if self[135] then
581
- unit:decrementStunCounter()
666
+ if self[141] then
667
+ if self[142] then
668
+ unit:decrementForceStunCounter()
582
669
  end
583
670
  unit:decrementStunCounter()
584
671
  end
672
+ if self[140] then
673
+ unit:decrementGhostCounter()
674
+ end
585
675
  if self._abilityTypeIds ~= nil then
586
- for abilityTypeId in pairs(self._abilityTypeIds) do
676
+ for ____, abilityTypeId in ipairs(self._abilityTypeIds) do
587
677
  unit:removeAbility(abilityTypeId)
588
678
  end
589
679
  end
590
- if self._bonusIdByBonusType ~= nil then
591
- for bonusType, bonusId in pairs(self._bonusIdByBonusType) do
592
- removeUnitBonus(unit, bonusType, bonusId)
593
- end
594
- end
680
+ Event.invoke(buffBeingDestroyedEvent, self)
681
+ self[100] = 3
595
682
  return UnitBehavior.prototype.onDestroy(self)
596
683
  end
597
684
  function Buff.apply(self, ...)
@@ -626,74 +713,88 @@ function Buff.getByTypeId(self, unit, typeId)
626
713
  end
627
714
  return nil
628
715
  end
716
+ function Buff.prototype.onDispel(self, source)
717
+ end
629
718
  function Buff.prototype.onExpiration(self)
630
719
  local unit = self.unit
631
- if self[119] ~= nil then
632
- (self[101] or unit):damageTarget(unit, self[119] or 0)
720
+ if self[121] ~= nil then
721
+ (self[102] or unit):damageTarget(unit, self[121] or 0)
633
722
  end
634
- if self[120] ~= nil then
635
- (self[101] or unit):healTarget(unit, self[119] or 0)
723
+ if self[122] ~= nil then
724
+ (self[102] or unit):healTarget(unit, self[121] or 0)
636
725
  end
637
- if self[139] then
726
+ if self[146] then
638
727
  unit:explode()
639
- elseif self[138] then
728
+ elseif self[145] then
640
729
  unit:kill()
641
730
  end
642
731
  end
643
732
  function Buff.prototype.onDeath(self, source)
644
733
  local unit = self.unit
645
- if self[121] ~= nil then
734
+ if self[123] ~= nil then
646
735
  damageArea(
647
- self[101] or unit,
648
- self[121],
736
+ self[102] or unit,
737
+ self[123],
649
738
  unit.x,
650
739
  unit.y,
651
- self[123] or 0,
652
- self[122] or 0,
653
740
  self[125] or 0,
654
741
  self[124] or 0,
655
742
  self[127] or 0,
656
- self[126] or 0
743
+ self[126] or 0,
744
+ self[129] or 0,
745
+ self[128] or 0
657
746
  )
658
747
  end
659
748
  end
660
749
  function Buff.prototype.onDamageDealt(self, target, event)
661
750
  if event.isAttack then
662
- if self[106] ~= nil then
663
- local durationIncrease = self[106]
664
- local maximumDuration = self[107] or 0
751
+ if self[108] ~= nil then
752
+ local durationIncrease = self[108]
753
+ local maximumDuration = self[109] or 0
665
754
  if maximumDuration > 0 then
666
755
  durationIncrease = min(
667
756
  durationIncrease,
668
- max(0, maximumDuration - self[102])
757
+ max(0, maximumDuration - self[103])
669
758
  )
670
759
  end
671
760
  local remainingDuration = self.remainingDuration + durationIncrease
672
- local maximumRemainingDuration = self[108] or 0
761
+ local maximumRemainingDuration = self[110] or 0
673
762
  if maximumRemainingDuration > 0 then
674
763
  remainingDuration = min(remainingDuration, maximumRemainingDuration)
675
764
  end
676
765
  self.remainingDuration = remainingDuration
677
766
  end
678
- local autoAttackCount = (self[128] or 0) + 1
679
- self[128] = autoAttackCount
680
- if autoAttackCount == self[129] then
767
+ local autoAttackCount = (self[130] or 0) + 1
768
+ self[130] = autoAttackCount
769
+ if autoAttackCount == self[131] then
681
770
  self:destroy()
682
771
  end
683
772
  end
684
773
  if event.originalAmount ~= 0 then
685
- local damageDealtEventCount = (self[130] or 0) + 1
686
- self[130] = damageDealtEventCount
687
- if damageDealtEventCount == self[131] then
774
+ local damageDealtEventCount = (self[132] or 0) + 1
775
+ self[132] = damageDealtEventCount
776
+ if damageDealtEventCount == self[133] then
688
777
  self:destroy()
689
778
  end
690
779
  end
691
780
  end
692
781
  function Buff.prototype.onDamageReceived(self, source, event)
693
782
  if event.originalAmount ~= 0 then
694
- local damageReceivedEventCount = (self[132] or 0) + 1
695
- self[132] = damageReceivedEventCount
696
- if damageReceivedEventCount == self[133] then
783
+ local absorbedDamage = min(event.amount * (self[136] or 1), (self[137] or 0) - (self[138] or 0))
784
+ if absorbedDamage > 0 then
785
+ event.amount = event.amount - absorbedDamage
786
+ self[138] = (self[138] or 0) + absorbedDamage
787
+ local ____self__139_48 = self[139]
788
+ if ____self__139_48 == nil then
789
+ ____self__139_48 = true
790
+ end
791
+ if ____self__139_48 and self[138] >= (self[137] or 0) then
792
+ self:destroy()
793
+ end
794
+ end
795
+ local damageReceivedEventCount = (self[134] or 0) + 1
796
+ self[134] = damageReceivedEventCount
797
+ if damageReceivedEventCount == self[135] then
697
798
  self:destroy()
698
799
  end
699
800
  end
@@ -703,7 +804,7 @@ __TS__SetDescriptor(
703
804
  Buff.prototype,
704
805
  "source",
705
806
  {get = function(self)
706
- return self[101] or self._unit
807
+ return self[102] or self._unit
707
808
  end},
708
809
  true
709
810
  )
@@ -720,13 +821,13 @@ __TS__SetDescriptor(
720
821
  "remainingDamageOverDuration",
721
822
  {
722
823
  get = function(self)
723
- return self[112] or 0
824
+ return self[114] or 0
724
825
  end,
725
826
  set = function(self, remainingDamageOverDuration)
726
- local remainingDamageOverDurationDelta = remainingDamageOverDuration - (self[112] or 0)
727
- self[112] = remainingDamageOverDuration ~= 0 and remainingDamageOverDuration or nil
728
- local damageOverDuration = (self[109] or 0) + remainingDamageOverDurationDelta
729
- self[109] = damageOverDuration ~= 0 and damageOverDuration or nil
827
+ local remainingDamageOverDurationDelta = remainingDamageOverDuration - (self[114] or 0)
828
+ self[114] = remainingDamageOverDuration ~= 0 and remainingDamageOverDuration or nil
829
+ local damageOverDuration = (self[111] or 0) + remainingDamageOverDurationDelta
830
+ self[111] = damageOverDuration ~= 0 and damageOverDuration or nil
730
831
  end
731
832
  },
732
833
  true
@@ -736,13 +837,13 @@ __TS__SetDescriptor(
736
837
  "damageOverDuration",
737
838
  {
738
839
  get = function(self)
739
- return self[109] or 0
840
+ return self[111] or 0
740
841
  end,
741
842
  set = function(self, damageOverDuration)
742
- local damageOverDurationDelta = damageOverDuration - (self[109] or 0)
743
- self[109] = damageOverDuration ~= 0 and damageOverDuration or nil
744
- local remainingDamageOverDuration = (self[112] or 0) + damageOverDurationDelta
745
- self[112] = remainingDamageOverDuration ~= 0 and remainingDamageOverDuration or nil
843
+ local damageOverDurationDelta = damageOverDuration - (self[111] or 0)
844
+ self[111] = damageOverDuration ~= 0 and damageOverDuration or nil
845
+ local remainingDamageOverDuration = (self[114] or 0) + damageOverDurationDelta
846
+ self[114] = remainingDamageOverDuration ~= 0 and remainingDamageOverDuration or nil
746
847
  end
747
848
  },
748
849
  true
@@ -752,10 +853,10 @@ __TS__SetDescriptor(
752
853
  "damagePerInterval",
753
854
  {
754
855
  get = function(self)
755
- return self[110] or 0
856
+ return self[112] or 0
756
857
  end,
757
858
  set = function(self, damagePerInterval)
758
- self[110] = damagePerInterval ~= 0 and damagePerInterval or nil
859
+ self[112] = damagePerInterval ~= 0 and damagePerInterval or nil
759
860
  end
760
861
  },
761
862
  true
@@ -765,25 +866,25 @@ __TS__SetDescriptor(
765
866
  "damageInterval",
766
867
  {
767
868
  get = function(self)
768
- return self[111] or 0
869
+ return self[113] or 0
769
870
  end,
770
871
  set = function(self, damageInterval)
771
872
  if damageInterval <= 0 then
772
- self[111] = damageInterval ~= 0 and damageInterval or nil
773
- local timer = self[113]
873
+ self[113] = damageInterval ~= 0 and damageInterval or nil
874
+ local timer = self[115]
774
875
  if timer ~= nil then
775
876
  timer:destroy()
776
- self[113] = nil
877
+ self[115] = nil
777
878
  end
778
879
  return
779
880
  end
780
- self[111] = damageInterval
781
- local ____opt_48 = self._timer
782
- local elapsed = ____opt_48 and ____opt_48.elapsed or 0
783
- local timer = self[113]
881
+ self[113] = damageInterval
882
+ local ____opt_49 = self._timer
883
+ local elapsed = ____opt_49 and ____opt_49.elapsed or 0
884
+ local timer = self[115]
784
885
  if timer == nil then
785
886
  timer = Timer:create()
786
- self[113] = timer
887
+ self[115] = timer
787
888
  end
788
889
  local initialDelay = damageInterval - (elapsed >= damageInterval and math.fmod(elapsed, damageInterval) or elapsed)
789
890
  if initialDelay == damageInterval then
@@ -800,13 +901,13 @@ __TS__SetDescriptor(
800
901
  "remainingHealingOverDuration",
801
902
  {
802
903
  get = function(self)
803
- return self[117] or 0
904
+ return self[119] or 0
804
905
  end,
805
906
  set = function(self, remainingHealingOverDuration)
806
- local remainingHealingOverDurationDelta = remainingHealingOverDuration - (self[117] or 0)
807
- self[112] = remainingHealingOverDuration ~= 0 and remainingHealingOverDuration or nil
808
- local healingOverDuration = (self[114] or 0) + remainingHealingOverDurationDelta
809
- self[114] = healingOverDuration ~= 0 and healingOverDuration or nil
907
+ local remainingHealingOverDurationDelta = remainingHealingOverDuration - (self[119] or 0)
908
+ self[114] = remainingHealingOverDuration ~= 0 and remainingHealingOverDuration or nil
909
+ local healingOverDuration = (self[116] or 0) + remainingHealingOverDurationDelta
910
+ self[116] = healingOverDuration ~= 0 and healingOverDuration or nil
810
911
  end
811
912
  },
812
913
  true
@@ -816,13 +917,13 @@ __TS__SetDescriptor(
816
917
  "healingOverDuration",
817
918
  {
818
919
  get = function(self)
819
- return self[114] or 0
920
+ return self[116] or 0
820
921
  end,
821
922
  set = function(self, healingOverDuration)
822
- local healingOverDurationDelta = healingOverDuration - (self[114] or 0)
823
- self[114] = healingOverDuration ~= 0 and healingOverDuration or nil
824
- local remainingHealingOverDuration = (self[117] or 0) + healingOverDurationDelta
825
- self[117] = remainingHealingOverDuration ~= 0 and remainingHealingOverDuration or nil
923
+ local healingOverDurationDelta = healingOverDuration - (self[116] or 0)
924
+ self[116] = healingOverDuration ~= 0 and healingOverDuration or nil
925
+ local remainingHealingOverDuration = (self[119] or 0) + healingOverDurationDelta
926
+ self[119] = remainingHealingOverDuration ~= 0 and remainingHealingOverDuration or nil
826
927
  end
827
928
  },
828
929
  true
@@ -832,10 +933,10 @@ __TS__SetDescriptor(
832
933
  "healingPerInterval",
833
934
  {
834
935
  get = function(self)
835
- return self[115] or 0
936
+ return self[117] or 0
836
937
  end,
837
938
  set = function(self, healingPerInterval)
838
- self[115] = healingPerInterval ~= 0 and healingPerInterval or nil
939
+ self[117] = healingPerInterval ~= 0 and healingPerInterval or nil
839
940
  end
840
941
  },
841
942
  true
@@ -845,25 +946,25 @@ __TS__SetDescriptor(
845
946
  "healingInterval",
846
947
  {
847
948
  get = function(self)
848
- return self[116] or 0
949
+ return self[118] or 0
849
950
  end,
850
951
  set = function(self, healingInterval)
851
952
  if healingInterval <= 0 then
852
- self[116] = healingInterval ~= 0 and healingInterval or nil
853
- local timer = self[118]
953
+ self[118] = healingInterval ~= 0 and healingInterval or nil
954
+ local timer = self[120]
854
955
  if timer ~= nil then
855
956
  timer:destroy()
856
- self[118] = nil
957
+ self[120] = nil
857
958
  end
858
959
  return
859
960
  end
860
- self[116] = healingInterval
861
- local ____opt_50 = self._timer
862
- local elapsed = ____opt_50 and ____opt_50.elapsed or 0
863
- local timer = self[118]
961
+ self[118] = healingInterval
962
+ local ____opt_51 = self._timer
963
+ local elapsed = ____opt_51 and ____opt_51.elapsed or 0
964
+ local timer = self[120]
864
965
  if timer == nil then
865
966
  timer = Timer:create()
866
- self[118] = timer
967
+ self[120] = timer
867
968
  end
868
969
  local initialDelay = healingInterval - (elapsed >= healingInterval and math.fmod(elapsed, healingInterval) or elapsed)
869
970
  if initialDelay == healingInterval then
@@ -880,10 +981,10 @@ __TS__SetDescriptor(
880
981
  "damageOnExpiration",
881
982
  {
882
983
  get = function(self)
883
- return self[119] or 0
984
+ return self[121] or 0
884
985
  end,
885
986
  set = function(self, damageOnExpiration)
886
- self[119] = damageOnExpiration ~= 0 and damageOnExpiration or nil
987
+ self[121] = damageOnExpiration ~= 0 and damageOnExpiration or nil
887
988
  end
888
989
  },
889
990
  true
@@ -893,10 +994,10 @@ __TS__SetDescriptor(
893
994
  "healingOnExpiration",
894
995
  {
895
996
  get = function(self)
896
- return self[120] or 0
997
+ return self[122] or 0
897
998
  end,
898
999
  set = function(self, healingOnExpiration)
899
- self[120] = healingOnExpiration ~= 0 and healingOnExpiration or nil
1000
+ self[122] = healingOnExpiration ~= 0 and healingOnExpiration or nil
900
1001
  end
901
1002
  },
902
1003
  true
@@ -927,6 +1028,19 @@ __TS__SetDescriptor(
927
1028
  },
928
1029
  true
929
1030
  )
1031
+ __TS__SetDescriptor(
1032
+ Buff.prototype,
1033
+ "returnedMeleeDamageFactor",
1034
+ {
1035
+ get = function(self)
1036
+ return self:getUnitBonus(UnitBonusType.RETURNED_MELEE_DAMAGE_FACTOR)
1037
+ end,
1038
+ set = function(self, returnedMeleeDamageFactor)
1039
+ self:addOrUpdateOrRemoveUnitBonus(UnitBonusType.RETURNED_MELEE_DAMAGE_FACTOR, returnedMeleeDamageFactor)
1040
+ end
1041
+ },
1042
+ true
1043
+ )
930
1044
  __TS__SetDescriptor(
931
1045
  Buff.prototype,
932
1046
  "armorIncrease",
@@ -940,30 +1054,79 @@ __TS__SetDescriptor(
940
1054
  },
941
1055
  true
942
1056
  )
1057
+ __TS__SetDescriptor(
1058
+ Buff.prototype,
1059
+ "maxHealthIncrease",
1060
+ {
1061
+ get = function(self)
1062
+ return self:getUnitBonus(UnitBonusType.HEALTH)
1063
+ end,
1064
+ set = function(self, maxHealthIncrease)
1065
+ self:addOrUpdateOrRemoveUnitBonus(UnitBonusType.HEALTH, maxHealthIncrease)
1066
+ end
1067
+ },
1068
+ true
1069
+ )
1070
+ __TS__SetDescriptor(
1071
+ Buff.prototype,
1072
+ "maxManaIncrease",
1073
+ {
1074
+ get = function(self)
1075
+ return self:getUnitBonus(UnitBonusType.MANA)
1076
+ end,
1077
+ set = function(self, maxManaIncrease)
1078
+ self:addOrUpdateOrRemoveUnitBonus(UnitBonusType.MANA, maxManaIncrease)
1079
+ end
1080
+ },
1081
+ true
1082
+ )
1083
+ __TS__SetDescriptor(
1084
+ Buff.prototype,
1085
+ "turnsIntoGhost",
1086
+ {
1087
+ get = function(self)
1088
+ local ____self__140_53 = self[140]
1089
+ if ____self__140_53 == nil then
1090
+ ____self__140_53 = false
1091
+ end
1092
+ return ____self__140_53
1093
+ end,
1094
+ set = function(self, turnsIntoGhost)
1095
+ if not turnsIntoGhost and self[140] then
1096
+ self.object:decrementGhostCounter()
1097
+ self[140] = nil
1098
+ elseif turnsIntoGhost and not self[140] then
1099
+ self.object:incrementGhostCounter()
1100
+ self[140] = true
1101
+ end
1102
+ end
1103
+ },
1104
+ true
1105
+ )
943
1106
  __TS__SetDescriptor(
944
1107
  Buff.prototype,
945
1108
  "stuns",
946
1109
  {
947
1110
  get = function(self)
948
- local ____self__134_52 = self[134]
949
- if ____self__134_52 == nil then
950
- ____self__134_52 = false
1111
+ local ____self__141_54 = self[141]
1112
+ if ____self__141_54 == nil then
1113
+ ____self__141_54 = false
951
1114
  end
952
- return ____self__134_52
1115
+ return ____self__141_54
953
1116
  end,
954
1117
  set = function(self, stuns)
955
- if not stuns and self[134] then
956
- if self[135] then
957
- self.object:decrementStunCounter()
1118
+ if not stuns and self[141] then
1119
+ if self[142] then
1120
+ self.object:decrementForceStunCounter()
958
1121
  end
959
1122
  self.object:decrementStunCounter()
960
- self[134] = nil
961
- elseif stuns and not self[134] then
962
- if self[135] then
963
- self.object:incrementStunCounter()
1123
+ self[141] = nil
1124
+ elseif stuns and not self[141] then
1125
+ if self[142] then
1126
+ self.object:incrementForceStunCounter()
964
1127
  end
965
1128
  self.object:incrementStunCounter()
966
- self[134] = true
1129
+ self[141] = true
967
1130
  end
968
1131
  end
969
1132
  },
@@ -974,23 +1137,23 @@ __TS__SetDescriptor(
974
1137
  "ignoresStunImmunity",
975
1138
  {
976
1139
  get = function(self)
977
- local ____self__135_53 = self[135]
978
- if ____self__135_53 == nil then
979
- ____self__135_53 = false
1140
+ local ____self__142_55 = self[142]
1141
+ if ____self__142_55 == nil then
1142
+ ____self__142_55 = false
980
1143
  end
981
- return ____self__135_53
1144
+ return ____self__142_55
982
1145
  end,
983
1146
  set = function(self, ignoresStunImmunity)
984
- if not ignoresStunImmunity and self[135] then
985
- if self[134] then
986
- self.object:decrementStunCounter()
1147
+ if not ignoresStunImmunity and self[142] then
1148
+ if self[141] then
1149
+ self.object:decrementForceStunCounter()
987
1150
  end
988
- self[135] = nil
989
- elseif ignoresStunImmunity and not self[135] then
990
- if self[134] then
991
- self.object:incrementStunCounter()
1151
+ self[142] = nil
1152
+ elseif ignoresStunImmunity and not self[142] then
1153
+ if self[141] then
1154
+ self.object:incrementForceStunCounter()
992
1155
  end
993
- self[135] = true
1156
+ self[142] = true
994
1157
  end
995
1158
  end
996
1159
  },
@@ -1001,19 +1164,19 @@ __TS__SetDescriptor(
1001
1164
  "disablesAutoAttack",
1002
1165
  {
1003
1166
  get = function(self)
1004
- local ____self__136_54 = self[136]
1005
- if ____self__136_54 == nil then
1006
- ____self__136_54 = false
1167
+ local ____self__143_56 = self[143]
1168
+ if ____self__143_56 == nil then
1169
+ ____self__143_56 = false
1007
1170
  end
1008
- return ____self__136_54
1171
+ return ____self__143_56
1009
1172
  end,
1010
1173
  set = function(self, disablesAutoAttack)
1011
- if not disablesAutoAttack and self[136] then
1174
+ if not disablesAutoAttack and self[143] then
1012
1175
  self.object:decrementDisableAutoAttackCounter()
1013
- self[136] = nil
1014
- elseif disablesAutoAttack and not self[136] then
1176
+ self[143] = nil
1177
+ elseif disablesAutoAttack and not self[143] then
1015
1178
  self.object:incrementDisableAutoAttackCounter()
1016
- self[136] = true
1179
+ self[143] = true
1017
1180
  end
1018
1181
  end
1019
1182
  },
@@ -1024,19 +1187,19 @@ __TS__SetDescriptor(
1024
1187
  "providesInvulnerability",
1025
1188
  {
1026
1189
  get = function(self)
1027
- local ____self__137_55 = self[137]
1028
- if ____self__137_55 == nil then
1029
- ____self__137_55 = false
1190
+ local ____self__144_57 = self[144]
1191
+ if ____self__144_57 == nil then
1192
+ ____self__144_57 = false
1030
1193
  end
1031
- return ____self__137_55
1194
+ return ____self__144_57
1032
1195
  end,
1033
1196
  set = function(self, providesInvulnerability)
1034
- if not providesInvulnerability and self[137] then
1197
+ if not providesInvulnerability and self[144] then
1035
1198
  self.object:decrementInvulnerabilityCounter()
1036
- self[137] = nil
1037
- elseif providesInvulnerability and not self[137] then
1199
+ self[144] = nil
1200
+ elseif providesInvulnerability and not self[144] then
1038
1201
  self.object:incrementInvulnerabilityCounter()
1039
- self[137] = true
1202
+ self[144] = true
1040
1203
  end
1041
1204
  end
1042
1205
  },
@@ -1047,17 +1210,17 @@ __TS__SetDescriptor(
1047
1210
  "killsOnExpiration",
1048
1211
  {
1049
1212
  get = function(self)
1050
- local ____self__138_56 = self[138]
1051
- if ____self__138_56 == nil then
1052
- ____self__138_56 = false
1213
+ local ____self__145_58 = self[145]
1214
+ if ____self__145_58 == nil then
1215
+ ____self__145_58 = false
1053
1216
  end
1054
- return ____self__138_56
1217
+ return ____self__145_58
1055
1218
  end,
1056
1219
  set = function(self, killsOnExpiration)
1057
- if not killsOnExpiration and self[138] then
1058
- self[138] = nil
1059
- elseif killsOnExpiration and not self[138] then
1060
- self[138] = true
1220
+ if not killsOnExpiration and self[145] then
1221
+ self[145] = nil
1222
+ elseif killsOnExpiration and not self[145] then
1223
+ self[145] = true
1061
1224
  end
1062
1225
  end
1063
1226
  },
@@ -1068,17 +1231,17 @@ __TS__SetDescriptor(
1068
1231
  "explodesOnExpiration",
1069
1232
  {
1070
1233
  get = function(self)
1071
- local ____self__139_57 = self[139]
1072
- if ____self__139_57 == nil then
1073
- ____self__139_57 = false
1234
+ local ____self__146_59 = self[146]
1235
+ if ____self__146_59 == nil then
1236
+ ____self__146_59 = false
1074
1237
  end
1075
- return ____self__139_57
1238
+ return ____self__146_59
1076
1239
  end,
1077
1240
  set = function(self, killsOnExpiration)
1078
- if not killsOnExpiration and self[139] then
1079
- self[139] = nil
1080
- elseif killsOnExpiration and not self[139] then
1081
- self[139] = true
1241
+ if not killsOnExpiration and self[146] then
1242
+ self[146] = nil
1243
+ elseif killsOnExpiration and not self[146] then
1244
+ self[146] = true
1082
1245
  end
1083
1246
  end
1084
1247
  },
@@ -1089,13 +1252,13 @@ __TS__SetDescriptor(
1089
1252
  "maximumDamageDealtEventCount",
1090
1253
  {
1091
1254
  get = function(self)
1092
- return self[131] or 0
1255
+ return self[133] or 0
1093
1256
  end,
1094
1257
  set = function(self, maximumDamageDealtEventCount)
1095
1258
  if maximumDamageDealtEventCount == 0 then
1096
- self[131] = nil
1259
+ self[133] = nil
1097
1260
  else
1098
- self[131] = maximumDamageDealtEventCount
1261
+ self[133] = maximumDamageDealtEventCount
1099
1262
  end
1100
1263
  end
1101
1264
  },
@@ -1106,13 +1269,13 @@ __TS__SetDescriptor(
1106
1269
  "maximumDamageReceivedEventCount",
1107
1270
  {
1108
1271
  get = function(self)
1109
- return self[133] or 0
1272
+ return self[135] or 0
1110
1273
  end,
1111
1274
  set = function(self, maximumDamageReceivedEventCount)
1112
1275
  if maximumDamageReceivedEventCount == 0 then
1113
- self[133] = nil
1276
+ self[135] = nil
1114
1277
  else
1115
- self[133] = maximumDamageReceivedEventCount
1278
+ self[135] = maximumDamageReceivedEventCount
1116
1279
  end
1117
1280
  end
1118
1281
  },
@@ -1123,13 +1286,13 @@ __TS__SetDescriptor(
1123
1286
  "maximumAutoAttackCount",
1124
1287
  {
1125
1288
  get = function(self)
1126
- return self[129] or 0
1289
+ return self[131] or 0
1127
1290
  end,
1128
1291
  set = function(self, maximumAutoAttackCount)
1129
1292
  if maximumAutoAttackCount == 0 then
1130
- self[129] = nil
1293
+ self[131] = nil
1131
1294
  else
1132
- self[129] = maximumAutoAttackCount
1295
+ self[131] = maximumAutoAttackCount
1133
1296
  end
1134
1297
  end
1135
1298
  },
@@ -1140,10 +1303,10 @@ __TS__SetDescriptor(
1140
1303
  "durationIncreaseOnAutoAttack",
1141
1304
  {
1142
1305
  get = function(self)
1143
- return self[106] or 0
1306
+ return self[108] or 0
1144
1307
  end,
1145
1308
  set = function(self, durationIncreaseOnAutoAttack)
1146
- self[106] = durationIncreaseOnAutoAttack
1309
+ self[108] = durationIncreaseOnAutoAttack
1147
1310
  end
1148
1311
  },
1149
1312
  true
@@ -1174,12 +1337,52 @@ __TS__SetDescriptor(
1174
1337
  },
1175
1338
  true
1176
1339
  )
1340
+ __TS__SetDescriptor(
1341
+ Buff.prototype,
1342
+ "evasionProbability",
1343
+ {
1344
+ get = function(self)
1345
+ return self:getUnitBonus(UnitBonusType.EVASION_PROBABILITY)
1346
+ end,
1347
+ set = function(self, evasionProbability)
1348
+ self:addOrUpdateOrRemoveUnitBonus(UnitBonusType.EVASION_PROBABILITY, evasionProbability)
1349
+ end
1350
+ },
1351
+ true
1352
+ )
1353
+ __TS__SetDescriptor(
1354
+ Buff.prototype,
1355
+ "manaRegenerationRateIncreaseFactor",
1356
+ {
1357
+ get = function(self)
1358
+ return self:getUnitBonus(UnitBonusType.MANA_REGENERATION_RATE_FACTOR)
1359
+ end,
1360
+ set = function(self, manaRegenerationRateIncreaseFactor)
1361
+ self:addOrUpdateOrRemoveUnitBonus(UnitBonusType.MANA_REGENERATION_RATE_FACTOR, manaRegenerationRateIncreaseFactor)
1362
+ end
1363
+ },
1364
+ true
1365
+ )
1177
1366
  __TS__SetDescriptor(
1178
1367
  Buff.prototype,
1179
1368
  "duration",
1180
- {get = function(self)
1181
- return self[102]
1182
- end},
1369
+ {
1370
+ get = function(self)
1371
+ return self[103]
1372
+ end,
1373
+ set = function(self, duration)
1374
+ if duration <= 0 then
1375
+ local timer = self._timer
1376
+ if timer ~= nil then
1377
+ timer:destroy()
1378
+ self._timer = nil
1379
+ end
1380
+ self[103] = 0
1381
+ else
1382
+ self.remainingDuration = self.remainingDuration + (duration - self[103])
1383
+ end
1384
+ end
1385
+ },
1183
1386
  true
1184
1387
  )
1185
1388
  __TS__SetDescriptor(
@@ -1187,15 +1390,15 @@ __TS__SetDescriptor(
1187
1390
  "remainingDuration",
1188
1391
  {
1189
1392
  get = function(self)
1190
- local ____opt_58 = self._timer
1191
- return ____opt_58 and ____opt_58.remaining or 0
1393
+ local ____opt_60 = self._timer
1394
+ return ____opt_60 and ____opt_60.remaining or 0
1192
1395
  end,
1193
1396
  set = function(self, remainingDuration)
1194
- local ____remainingDuration_62 = remainingDuration
1195
- local ____opt_60 = self._timer
1196
- local remainingDurationDelta = ____remainingDuration_62 - (____opt_60 and ____opt_60.remaining or 0)
1397
+ local ____remainingDuration_64 = remainingDuration
1398
+ local ____opt_62 = self._timer
1399
+ local remainingDurationDelta = ____remainingDuration_64 - (____opt_62 and ____opt_62.remaining or 0)
1197
1400
  if remainingDurationDelta ~= 0 then
1198
- self[102] = self[102] + remainingDurationDelta
1401
+ self[103] = self[103] + remainingDurationDelta
1199
1402
  if remainingDuration <= 0 then
1200
1403
  Timer:run(destroyBuff, self)
1201
1404
  else
@@ -1207,7 +1410,8 @@ __TS__SetDescriptor(
1207
1410
  self._level,
1208
1411
  remainingDuration,
1209
1412
  self._spellStealPriority,
1210
- self._learnLevelMinimum
1413
+ self._learnLevelMinimum,
1414
+ self[147]
1211
1415
  ) then
1212
1416
  local timer = self._timer
1213
1417
  if timer == nil then
@@ -1221,37 +1425,135 @@ __TS__SetDescriptor(
1221
1425
  end
1222
1426
  },
1223
1427
  true
1224
- );
1428
+ )
1429
+ __TS__SetDescriptor(
1430
+ Buff.prototype,
1431
+ "absorbedDamageFactor",
1432
+ {
1433
+ get = function(self)
1434
+ return self[136] or 1
1435
+ end,
1436
+ set = function(self, absorbedDamageFactor)
1437
+ if absorbedDamageFactor == 1 then
1438
+ self[136] = nil
1439
+ else
1440
+ self[136] = absorbedDamageFactor
1441
+ end
1442
+ end
1443
+ },
1444
+ true
1445
+ )
1446
+ __TS__SetDescriptor(
1447
+ Buff.prototype,
1448
+ "maximumDamageAbsorbed",
1449
+ {
1450
+ get = function(self)
1451
+ return self[137] or 0
1452
+ end,
1453
+ set = function(self, maximumDamageAbsorbed)
1454
+ if maximumDamageAbsorbed == 0 then
1455
+ self[137] = nil
1456
+ else
1457
+ self[137] = maximumDamageAbsorbed
1458
+ end
1459
+ end
1460
+ },
1461
+ true
1462
+ )
1463
+ __TS__SetDescriptor(
1464
+ Buff.prototype,
1465
+ "damageAbsorbed",
1466
+ {get = function(self)
1467
+ return self[138] or 0
1468
+ end},
1469
+ true
1470
+ )
1471
+ __TS__SetDescriptor(
1472
+ Buff.prototype,
1473
+ "destroysOnMaximumDamageAbsorbed",
1474
+ {
1475
+ get = function(self)
1476
+ local ____self__139_65 = self[139]
1477
+ if ____self__139_65 == nil then
1478
+ ____self__139_65 = true
1479
+ end
1480
+ return ____self__139_65
1481
+ end,
1482
+ set = function(self, destroysOnMaximumDamageAbsorbed)
1483
+ local ____destroysOnMaximumDamageAbsorbed_66
1484
+ if destroysOnMaximumDamageAbsorbed then
1485
+ ____destroysOnMaximumDamageAbsorbed_66 = nil
1486
+ else
1487
+ ____destroysOnMaximumDamageAbsorbed_66 = false
1488
+ end
1489
+ self[139] = ____destroysOnMaximumDamageAbsorbed_66
1490
+ end
1491
+ },
1492
+ true
1493
+ )
1494
+ __TS__SetDescriptor(
1495
+ Buff.prototype,
1496
+ "abilityCooldownFactor",
1497
+ {
1498
+ get = function(self)
1499
+ return self[148] or 1
1500
+ end,
1501
+ set = function(self, abilityCooldownFactor)
1502
+ local previousAbilityCooldownModifier = self[149]
1503
+ if previousAbilityCooldownModifier then
1504
+ for ____, ability in ipairs(self._unit.abilities) do
1505
+ COOLDOWN_ABILITY_FLOAT_LEVEL_FIELD:removeModifier(ability, previousAbilityCooldownModifier)
1506
+ end
1507
+ end
1508
+ local function modifier(ability, level, cooldown)
1509
+ return cooldown * abilityCooldownFactor
1510
+ end
1511
+ for ____, ability in ipairs(self._unit.abilities) do
1512
+ COOLDOWN_ABILITY_FLOAT_LEVEL_FIELD:applyModifier(ability, modifier)
1513
+ end
1514
+ self[149] = modifier
1515
+ self[148] = abilityCooldownFactor
1516
+ end
1517
+ },
1518
+ true
1519
+ )
1520
+ Buff.createdEvent = buffCreatedEvent
1521
+ Buff.beingDestroyedEvent = buffBeingDestroyedEvent;
1225
1522
  (function(self)
1226
- local function destroyBuffIfNeeded(buff)
1227
- if getUnitAbility(buff[100].handle, buff.typeId) ~= buff.handle then
1228
- buff:destroy()
1523
+ local function destroyBuffIfNeeded(buff, isDispel, source)
1524
+ local currentHandle = getUnitAbility(buff[101].handle, buff.typeId)
1525
+ if currentHandle ~= buff.handle and buff[100] == 1 then
1526
+ if isDispel and currentHandle == nil and buff.unit.isAlive and buff.resistanceType == 1 and (buff._timer == nil or buff.remainingDuration > 0) then
1527
+ buff:dispel(source)
1528
+ else
1529
+ buff:destroy()
1530
+ end
1229
1531
  end
1230
1532
  end
1231
- ____exports.checkBuff = function(unit, buffTypeId)
1533
+ ____exports.checkBuff = function(unit, buffTypeId, isDispel, source)
1232
1534
  local buffByTypeId = buffByTypeIdByUnit[unit]
1233
1535
  if buffByTypeId ~= nil then
1234
1536
  local buff = buffByTypeId[buffTypeId]
1235
1537
  if buff ~= nil then
1236
- destroyBuffIfNeeded(buff)
1538
+ destroyBuffIfNeeded(buff, isDispel, source)
1237
1539
  end
1238
1540
  end
1239
1541
  end
1240
- ____exports.checkBuffs = function(unit)
1241
- ____exports.Buff:forAll(unit, destroyBuffIfNeeded)
1542
+ ____exports.checkBuffs = function(unit, isDispel, source)
1543
+ ____exports.Buff:forAll(unit, destroyBuffIfNeeded, isDispel, source)
1242
1544
  end
1243
1545
  Unit.abilityChannelingStartEvent:addListener(
1244
1546
  0,
1245
1547
  function(caster)
1246
- ____exports.checkBuffs(caster)
1247
- Timer:run(____exports.checkBuffs, caster)
1548
+ ____exports.checkBuffs(caster, true, caster)
1549
+ Timer:run(____exports.checkBuffs, caster, true, caster)
1248
1550
  end
1249
1551
  )
1250
1552
  Unit.abilityUnitTargetChannelingStartEvent:addListener(
1251
1553
  0,
1252
1554
  function(caster, ability, target)
1253
- ____exports.checkBuffs(target)
1254
- Timer:run(____exports.checkBuffs, target)
1555
+ ____exports.checkBuffs(target, true, caster)
1556
+ Timer:run(____exports.checkBuffs, target, true, caster)
1255
1557
  end
1256
1558
  )
1257
1559
  Unit.abilityPointTargetChannelingStartEvent:addListener(
@@ -1262,18 +1564,47 @@ __TS__SetDescriptor(
1262
1564
  y,
1263
1565
  ability:getField(ABILITY_RLF_AREA_OF_EFFECT)
1264
1566
  )
1265
- forEach(units, ____exports.checkBuffs)
1266
- Timer:run(forEach, units, ____exports.checkBuffs)
1567
+ forEach(units, ____exports.checkBuffs, true, caster)
1568
+ Timer:run(
1569
+ forEach,
1570
+ units,
1571
+ ____exports.checkBuffs,
1572
+ true,
1573
+ caster
1574
+ )
1575
+ end
1576
+ )
1577
+ Unit.abilityNoTargetChannelingStartEvent:addListener(
1578
+ 0,
1579
+ function(caster, ability)
1580
+ local radius = ability:getField(ABILITY_RLF_AREA_OF_EFFECT)
1581
+ if radius > 0 then
1582
+ local units = Unit:getInCollisionRange(caster.x, caster.y, radius)
1583
+ forEach(units, ____exports.checkBuffs, true, caster)
1584
+ Timer:run(
1585
+ forEach,
1586
+ units,
1587
+ ____exports.checkBuffs,
1588
+ true,
1589
+ caster
1590
+ )
1591
+ end
1267
1592
  end
1268
1593
  )
1269
1594
  Unit.onDamage:addListener(
1270
1595
  0,
1271
1596
  function(source, target)
1272
1597
  if source ~= nil then
1273
- ____exports.checkBuffs(source)
1598
+ Timer:run(____exports.checkBuffs, source, false)
1274
1599
  end
1275
- ____exports.checkBuffs(target)
1600
+ Timer:run(____exports.checkBuffs, target, false)
1276
1601
  end
1277
1602
  )
1603
+ buffCreatedEvent:addListener(function(buff)
1604
+ UnitBehavior:forAll(buff.unit, "onBuffGained", buff)
1605
+ end)
1606
+ buffBeingDestroyedEvent:addListener(function(buff)
1607
+ UnitBehavior:forAll(buff.unit, "onBuffLost", buff)
1608
+ end)
1278
1609
  end)(Buff)
1279
1610
  return ____exports