warscript 0.0.1-dev.2450f74 → 0.0.1-dev.24da7f2

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