warscript 0.0.1-dev.9cbb1ff → 0.0.1-dev.9d07b64

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