warscript 0.0.1-dev.c37d12c → 0.0.1-dev.c47d565

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