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