warscript 0.0.1-dev.8a4aeae → 0.0.1-dev.8bfb72f
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.
- package/attributes.d.ts +0 -1
- package/binaryreader.d.ts +1 -0
- package/binaryreader.lua +3 -0
- package/core/types/effect.d.ts +13 -3
- package/core/types/effect.lua +116 -17
- package/core/types/frame.d.ts +8 -1
- package/core/types/frame.lua +93 -1
- package/core/types/group.d.ts +0 -1
- package/core/types/image.d.ts +0 -1
- package/core/types/missile.d.ts +2 -2
- package/core/types/missile.lua +8 -2
- package/core/types/unit.lua +8 -0
- package/core/util.d.ts +1 -1
- package/core/util.lua +12 -0
- package/decl/index.d.ts +1 -0
- package/engine/ability.d.ts +1 -1
- package/engine/behavior.d.ts +10 -10
- package/engine/behavior.lua +6 -6
- package/engine/behaviour/ability/always-enabled.d.ts +7 -0
- package/engine/behaviour/ability/always-enabled.lua +31 -0
- package/engine/behaviour/ability/apply-buff.d.ts +8 -5
- package/engine/behaviour/ability/apply-buff.lua +32 -0
- package/engine/behaviour/ability/apply-unit-behavior.d.ts +6 -1
- package/engine/behaviour/ability/damage.d.ts +33 -11
- package/engine/behaviour/ability/damage.lua +89 -31
- package/engine/behaviour/ability/emulate-impact.d.ts +6 -0
- package/engine/behaviour/ability/emulate-impact.lua +28 -0
- package/engine/behaviour/ability/heal.d.ts +33 -6
- package/engine/behaviour/ability/heal.lua +89 -10
- package/engine/behaviour/ability/instant-impact.d.ts +2 -2
- package/engine/behaviour/ability/instant-impact.lua +4 -15
- package/engine/behaviour/ability/on-command-impact.d.ts +8 -0
- package/engine/behaviour/ability/on-command-impact.lua +25 -0
- package/engine/behaviour/ability/remove-buffs.d.ts +16 -0
- package/engine/behaviour/ability/remove-buffs.lua +28 -0
- package/engine/behaviour/ability/restore-mana.d.ts +15 -0
- package/engine/behaviour/ability/restore-mana.lua +29 -0
- package/engine/behaviour/ability.d.ts +22 -3
- package/engine/behaviour/ability.lua +134 -13
- package/engine/behaviour/unit/stun-immunity.d.ts +0 -1
- package/engine/behaviour/unit.d.ts +8 -2
- package/engine/behaviour/unit.lua +27 -0
- package/engine/buff.d.ts +73 -21
- package/engine/buff.lua +297 -91
- package/engine/game-map.d.ts +7 -0
- package/engine/game-map.lua +32 -0
- package/engine/internal/ability.d.ts +16 -13
- package/engine/internal/ability.lua +80 -76
- package/engine/internal/item/ability.lua +106 -0
- package/engine/internal/item+owner.lua +2 -2
- package/engine/internal/item.d.ts +2 -2
- package/engine/internal/item.lua +33 -25
- package/engine/internal/misc/ability-disable-counter.d.ts +2 -0
- package/engine/internal/misc/ability-disable-counter.lua +13 -0
- package/engine/internal/object-data/auto-attack-speed-increase.d.ts +1 -1
- package/engine/internal/object-data/auto-attack-speed-increase.lua +2 -0
- package/engine/internal/object-data/evasion-probability.d.ts +2 -0
- package/engine/internal/object-data/evasion-probability.lua +16 -0
- package/engine/internal/unit/ability.d.ts +10 -1
- package/engine/internal/unit/ability.lua +36 -14
- package/engine/internal/unit/add-item-to-slot-init.d.ts +2 -0
- package/engine/internal/unit/add-item-to-slot-init.lua +23 -0
- package/engine/internal/unit/add-item-to-slot.d.ts +2 -0
- package/engine/internal/unit/add-item-to-slot.lua +52 -0
- package/engine/internal/unit/bonus.d.ts +11 -8
- package/engine/internal/unit/bonus.lua +23 -1
- package/engine/internal/unit/ignore-events-items.d.ts +2 -0
- package/engine/internal/unit/ignore-events-items.lua +5 -0
- package/engine/internal/unit/item.d.ts +24 -0
- package/engine/internal/unit/item.lua +78 -0
- package/engine/internal/unit/main-selected.d.ts +13 -0
- package/engine/internal/unit/main-selected.lua +51 -0
- package/engine/internal/unit+ability.lua +2 -2
- package/engine/internal/unit+transport.lua +4 -10
- package/engine/internal/unit-missile-launch.lua +25 -6
- package/engine/internal/unit.d.ts +59 -16
- package/engine/internal/unit.lua +373 -132
- package/engine/internal/utility.lua +12 -0
- package/engine/lightning.d.ts +8 -2
- package/engine/lightning.lua +27 -2
- package/engine/local-client.d.ts +7 -2
- package/engine/local-client.lua +82 -0
- package/engine/object-data/auxiliary/attachment-preset.d.ts +0 -1
- package/engine/object-data/auxiliary/combat-classification.d.ts +0 -2
- package/engine/object-data/auxiliary/sound-preset-name.d.ts +5 -1
- package/engine/object-data/entry/ability-type/blank-configurable.d.ts +0 -1
- package/engine/object-data/entry/ability-type/blank-passive.d.ts +0 -1
- package/engine/object-data/entry/ability-type/channel.d.ts +0 -1
- package/engine/object-data/entry/ability-type/mine.d.ts +10 -0
- package/engine/object-data/entry/ability-type/mine.lua +39 -0
- package/engine/object-data/entry/ability-type/spirit-touch.d.ts +2 -2
- package/engine/object-data/entry/ability-type/spirit-touch.lua +6 -6
- package/engine/object-data/entry/ability-type.d.ts +0 -1
- package/engine/object-data/entry/ability-type.lua +8 -12
- package/engine/object-data/entry/buff-type/applicable.d.ts +0 -1
- package/engine/object-data/entry/buff-type/blank.d.ts +0 -1
- package/engine/object-data/entry/buff-type.d.ts +0 -1
- package/engine/object-data/entry/destructible-type.d.ts +0 -1
- package/engine/object-data/entry/item-type/blank.d.ts +0 -1
- package/engine/object-data/entry/item-type.d.ts +14 -1
- package/engine/object-data/entry/item-type.lua +91 -0
- package/engine/object-data/entry/lightning-type.d.ts +0 -1
- package/engine/object-data/entry/unit-type.d.ts +23 -4
- package/engine/object-data/entry/unit-type.lua +226 -52
- package/engine/object-data/entry/upgrade/blank.d.ts +0 -1
- package/engine/object-data/entry/upgrade.d.ts +0 -1
- package/engine/object-data/entry.d.ts +2 -3
- package/engine/object-data/utility/object-data-entry-id-generator.lua +7 -0
- package/engine/object-field/ability.d.ts +26 -3
- package/engine/object-field/ability.lua +54 -1
- package/engine/object-field.d.ts +2 -3
- package/engine/object-field.lua +4 -0
- package/engine/random.d.ts +1 -0
- package/engine/random.lua +9 -0
- package/engine/standard/entries/unit-type.d.ts +39 -1
- package/engine/standard/entries/unit-type.lua +39 -1
- package/engine/standard/fields/ability.d.ts +3 -1
- package/engine/standard/fields/ability.lua +3 -1
- package/engine/unit.d.ts +3 -0
- package/engine/unit.lua +12 -2
- package/event.d.ts +2 -3
- package/event.lua +9 -5
- package/index.d.ts +1 -0
- package/index.lua +1 -0
- package/lualib_bundle.lua +146 -42
- package/math/vec2.d.ts +2 -9
- package/math.d.ts +0 -2
- package/net/socket.d.ts +7 -1
- package/net/socket.lua +45 -4
- package/network.d.ts +1 -0
- package/network.lua +3 -2
- package/objutil/ability.d.ts +0 -1
- package/objutil/buff.d.ts +0 -1
- package/objutil/buff.lua +1 -1
- package/objutil/object.d.ts +0 -1
- package/objutil/unit.d.ts +0 -1
- package/package.json +13 -14
- package/patch-lua.d.ts +0 -0
- package/patch-lua.lua +10 -0
- package/property.d.ts +55 -0
- package/property.lua +374 -0
- package/string.d.ts +30 -0
- package/string.lua +14 -0
- package/util/stream.d.ts +0 -1
- package/utility/arrays.d.ts +11 -5
- package/utility/arrays.lua +34 -3
- package/utility/bit-set.d.ts +0 -2
- package/utility/lazy.d.ts +2 -0
- package/utility/lazy.lua +14 -0
- package/utility/linked-set.d.ts +11 -3
- package/utility/linked-set.lua +5 -2
- package/utility/lua-maps.d.ts +1 -2
- package/utility/lua-sets.d.ts +1 -2
- package/utility/types.d.ts +1 -0
- package/core/mapbounds.d.ts +0 -8
- package/core/mapbounds.lua +0 -12
package/engine/buff.lua
CHANGED
|
@@ -44,8 +44,14 @@ local ____unit = require("engine.behaviour.unit")
|
|
|
44
44
|
local UnitBehavior = ____unit.UnitBehavior
|
|
45
45
|
local ____arrays = require("utility.arrays")
|
|
46
46
|
local forEach = ____arrays.forEach
|
|
47
|
+
local ____event = require("event")
|
|
48
|
+
local Event = ____event.Event
|
|
47
49
|
local ____ability_2Dduration = require("engine.internal.mechanics.ability-duration")
|
|
48
50
|
local getAbilityDuration = ____ability_2Dduration.getAbilityDuration
|
|
51
|
+
local ____item = require("engine.internal.item")
|
|
52
|
+
local Item = ____item.Item
|
|
53
|
+
local ____destructable = require("core.types.destructable")
|
|
54
|
+
local Destructable = ____destructable.Destructable
|
|
49
55
|
local getUnitAbility = BlzGetUnitAbility
|
|
50
56
|
local stringValueByBuffTypeIdByFieldId = postcompile(function()
|
|
51
57
|
local stringValueByBuffTypeIdByFieldId = {}
|
|
@@ -94,6 +100,8 @@ local buffParametersKeys = {
|
|
|
94
100
|
armorIncreaseFactor = true,
|
|
95
101
|
attackSpeedIncreaseFactor = true,
|
|
96
102
|
movementSpeedIncreaseFactor = true,
|
|
103
|
+
evasionProbability = true,
|
|
104
|
+
damageFactor = true,
|
|
97
105
|
receivedDamageFactor = true,
|
|
98
106
|
receivedMagicDamageFactor = true,
|
|
99
107
|
durationIncreaseOnAutoAttack = true,
|
|
@@ -107,8 +115,26 @@ local buffParametersKeys = {
|
|
|
107
115
|
disablesAutoAttack = true,
|
|
108
116
|
destroysOnDamage = true,
|
|
109
117
|
maximumAutoAttackCount = true,
|
|
110
|
-
|
|
118
|
+
maximumDamageDealtEventCount = true,
|
|
119
|
+
maximumDamageReceivedEventCount = true,
|
|
120
|
+
uniqueGroup = true,
|
|
121
|
+
damageOnExpiration = true,
|
|
122
|
+
healingOnExpiration = true,
|
|
123
|
+
killsOnExpiration = true,
|
|
124
|
+
explodesOnExpiration = true
|
|
111
125
|
}
|
|
126
|
+
local function resolveEnumValue(ability, level, value)
|
|
127
|
+
if value == nil or type(value) == "number" then
|
|
128
|
+
return value
|
|
129
|
+
end
|
|
130
|
+
if ability == nil then
|
|
131
|
+
error(
|
|
132
|
+
__TS__New(IllegalArgumentException),
|
|
133
|
+
0
|
|
134
|
+
)
|
|
135
|
+
end
|
|
136
|
+
return value:getValue(ability, level or ability.level)
|
|
137
|
+
end
|
|
112
138
|
local function resolveNumberValue(ability, level, value)
|
|
113
139
|
if value == nil or type(value) == "number" then
|
|
114
140
|
return value
|
|
@@ -145,20 +171,33 @@ local function resolveAndSetNumberValue(buff, property, ability, level, value, d
|
|
|
145
171
|
buff[property] = resolvedValue
|
|
146
172
|
end
|
|
147
173
|
end
|
|
148
|
-
local buffBooleanParameters = {
|
|
174
|
+
local buffBooleanParameters = {
|
|
175
|
+
"stuns",
|
|
176
|
+
"ignoresStunImmunity",
|
|
177
|
+
"disablesAutoAttack",
|
|
178
|
+
"providesInvulnerability",
|
|
179
|
+
"killsOnExpiration",
|
|
180
|
+
"explodesOnExpiration"
|
|
181
|
+
}
|
|
149
182
|
local buffNumberParameters = {
|
|
150
183
|
"durationIncreaseOnAutoAttack",
|
|
151
184
|
"attackSpeedIncreaseFactor",
|
|
152
185
|
"movementSpeedIncreaseFactor",
|
|
186
|
+
"evasionProbability",
|
|
153
187
|
"armorIncrease",
|
|
188
|
+
"damageFactor",
|
|
154
189
|
"receivedDamageFactor",
|
|
155
190
|
"maximumAutoAttackCount",
|
|
191
|
+
"maximumDamageDealtEventCount",
|
|
192
|
+
"maximumDamageReceivedEventCount",
|
|
156
193
|
"damageInterval",
|
|
157
194
|
"damagePerInterval",
|
|
158
195
|
"damageOverDuration",
|
|
159
196
|
"healingInterval",
|
|
160
197
|
"healingPerInterval",
|
|
161
|
-
"healingOverDuration"
|
|
198
|
+
"healingOverDuration",
|
|
199
|
+
"damageOnExpiration",
|
|
200
|
+
"healingOnExpiration"
|
|
162
201
|
}
|
|
163
202
|
local unsuccessfulApplicationMarker = {}
|
|
164
203
|
local function selectBuffTypeIdWithLeastDuration(buffTypeIds, unit)
|
|
@@ -207,6 +246,7 @@ local function expireBuff(buff)
|
|
|
207
246
|
end
|
|
208
247
|
end
|
|
209
248
|
Timer:run(destroyBuff, buff)
|
|
249
|
+
buff:onExpiration()
|
|
210
250
|
end
|
|
211
251
|
local function buffDamageIntervalInitialTimerCallback(buff)
|
|
212
252
|
buffDamageIntervalTimerCallback(buff)
|
|
@@ -260,6 +300,7 @@ buffHealingIntervalTimerCallback = function(buff)
|
|
|
260
300
|
source:healTarget(buff[100], healingPerInterval)
|
|
261
301
|
end
|
|
262
302
|
end
|
|
303
|
+
local buffDestroyEvent = __TS__New(Event)
|
|
263
304
|
____exports.Buff = __TS__Class()
|
|
264
305
|
local Buff = ____exports.Buff
|
|
265
306
|
Buff.name = "Buff"
|
|
@@ -296,8 +337,6 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
|
|
|
296
337
|
end
|
|
297
338
|
end
|
|
298
339
|
self.typeId = typeId
|
|
299
|
-
self.polarity = polarity
|
|
300
|
-
self.resistanceType = resistanceType
|
|
301
340
|
if not __TS__InstanceOf(ability, Ability) then
|
|
302
341
|
parameters = ability
|
|
303
342
|
ability = nil
|
|
@@ -324,6 +363,8 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
|
|
|
324
363
|
learnLevelMinimum = learnLevelMinimum or ability:getField(ABILITY_IF_REQUIRED_LEVEL)
|
|
325
364
|
duration = duration or getAbilityDuration(ability, _unit)
|
|
326
365
|
end
|
|
366
|
+
self.polarity = resolveEnumValue(ability, level, polarity)
|
|
367
|
+
self.resistanceType = resolveEnumValue(ability, level, resistanceType)
|
|
327
368
|
local buffByTypeId = buffByTypeIdByUnit[_unit]
|
|
328
369
|
if buffByTypeId == nil then
|
|
329
370
|
buffByTypeId = {}
|
|
@@ -340,8 +381,8 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
|
|
|
340
381
|
if not internalApplyBuff(
|
|
341
382
|
_unit,
|
|
342
383
|
typeId,
|
|
343
|
-
polarity,
|
|
344
|
-
resistanceType,
|
|
384
|
+
self.polarity,
|
|
385
|
+
self.resistanceType,
|
|
345
386
|
level,
|
|
346
387
|
duration,
|
|
347
388
|
spellStealPriority,
|
|
@@ -450,6 +491,7 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
|
|
|
450
491
|
timer:start(duration, false, expireBuff, self)
|
|
451
492
|
self._timer = timer
|
|
452
493
|
end
|
|
494
|
+
self:onCreate()
|
|
453
495
|
end
|
|
454
496
|
function Buff.prototype.getUnitBonus(self, bonusType)
|
|
455
497
|
local ____opt_36 = self._bonusIdByBonusType
|
|
@@ -464,26 +506,30 @@ function Buff.prototype.addOrUpdateOrRemoveUnitBonus(self, bonusType, value)
|
|
|
464
506
|
end
|
|
465
507
|
bonusIdByBonusType[bonusType] = addOrUpdateOrRemoveUnitBonus(self._unit, bonusType, bonusIdByBonusType[bonusType], value)
|
|
466
508
|
end
|
|
467
|
-
function Buff.prototype.flashEffect(self,
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
local ____Effect_flash_41 = Effect.flash
|
|
471
|
-
local ____array_39 = __TS__SparseArrayNew(
|
|
472
|
-
self[104],
|
|
473
|
-
isWidgetProvided and widgetOrDuration or self._unit,
|
|
474
|
-
stringValueByBuffTypeIdByFieldId[fourCC("feft")][self.typeId] or "origin"
|
|
475
|
-
)
|
|
476
|
-
local ____isWidgetProvided_38
|
|
477
|
-
if isWidgetProvided then
|
|
478
|
-
____isWidgetProvided_38 = duration
|
|
509
|
+
function Buff.prototype.flashEffect(self, widgetOrXOrParametersOrDuration, yOrParametersOrDuration, parametersOrDuration)
|
|
510
|
+
if type(widgetOrXOrParametersOrDuration) == "number" and type(yOrParametersOrDuration) == "number" then
|
|
511
|
+
Effect:flash(self[104], widgetOrXOrParametersOrDuration, yOrParametersOrDuration, parametersOrDuration)
|
|
479
512
|
else
|
|
480
|
-
|
|
513
|
+
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[104],
|
|
518
|
+
isWidgetProvided and widgetOrXOrParametersOrDuration or self._unit,
|
|
519
|
+
stringValueByBuffTypeIdByFieldId[fourCC("feft")][self.typeId] or "origin"
|
|
520
|
+
)
|
|
521
|
+
local ____isWidgetProvided_38
|
|
522
|
+
if isWidgetProvided then
|
|
523
|
+
____isWidgetProvided_38 = yOrParametersOrDuration
|
|
524
|
+
else
|
|
525
|
+
____isWidgetProvided_38 = widgetOrXOrParametersOrDuration
|
|
526
|
+
end
|
|
527
|
+
__TS__SparseArrayPush(____array_39, ____isWidgetProvided_38)
|
|
528
|
+
____Effect_flash_41(
|
|
529
|
+
____Effect_40,
|
|
530
|
+
__TS__SparseArraySpread(____array_39)
|
|
531
|
+
)
|
|
481
532
|
end
|
|
482
|
-
__TS__SparseArrayPush(____array_39, ____isWidgetProvided_38)
|
|
483
|
-
____Effect_flash_41(
|
|
484
|
-
____Effect_40,
|
|
485
|
-
__TS__SparseArraySpread(____array_39)
|
|
486
|
-
)
|
|
487
533
|
end
|
|
488
534
|
function Buff.prototype.flashSpecialEffect(self, widgetOrDuration, duration)
|
|
489
535
|
local isWidgetProvided = type(widgetOrDuration) == "table"
|
|
@@ -506,6 +552,8 @@ function Buff.prototype.flashSpecialEffect(self, widgetOrDuration, duration)
|
|
|
506
552
|
__TS__SparseArraySpread(____array_43)
|
|
507
553
|
)
|
|
508
554
|
end
|
|
555
|
+
function Buff.prototype.onCreate(self)
|
|
556
|
+
end
|
|
509
557
|
function Buff.prototype.onDestroy(self)
|
|
510
558
|
local unit = self._unit
|
|
511
559
|
if getUnitAbility(unit.handle, self.typeId) == self.handle then
|
|
@@ -530,11 +578,11 @@ function Buff.prototype.onDestroy(self)
|
|
|
530
578
|
behavior:destroy()
|
|
531
579
|
end
|
|
532
580
|
end
|
|
533
|
-
if self[
|
|
581
|
+
if self[136] then
|
|
534
582
|
unit:decrementDisableAutoAttackCounter()
|
|
535
583
|
end
|
|
536
|
-
if self[
|
|
537
|
-
if self[
|
|
584
|
+
if self[134] then
|
|
585
|
+
if self[135] then
|
|
538
586
|
unit:decrementStunCounter()
|
|
539
587
|
end
|
|
540
588
|
unit:decrementStunCounter()
|
|
@@ -549,6 +597,7 @@ function Buff.prototype.onDestroy(self)
|
|
|
549
597
|
removeUnitBonus(unit, bonusType, bonusId)
|
|
550
598
|
end
|
|
551
599
|
end
|
|
600
|
+
Event.invoke(buffDestroyEvent, self)
|
|
552
601
|
return UnitBehavior.prototype.onDestroy(self)
|
|
553
602
|
end
|
|
554
603
|
function Buff.apply(self, ...)
|
|
@@ -583,20 +632,34 @@ function Buff.getByTypeId(self, unit, typeId)
|
|
|
583
632
|
end
|
|
584
633
|
return nil
|
|
585
634
|
end
|
|
586
|
-
function Buff.prototype.
|
|
635
|
+
function Buff.prototype.onExpiration(self)
|
|
587
636
|
local unit = self.unit
|
|
588
637
|
if self[119] ~= nil then
|
|
638
|
+
(self[101] or unit):damageTarget(unit, self[119] or 0)
|
|
639
|
+
end
|
|
640
|
+
if self[120] ~= nil then
|
|
641
|
+
(self[101] or unit):healTarget(unit, self[119] or 0)
|
|
642
|
+
end
|
|
643
|
+
if self[139] then
|
|
644
|
+
unit:explode()
|
|
645
|
+
elseif self[138] then
|
|
646
|
+
unit:kill()
|
|
647
|
+
end
|
|
648
|
+
end
|
|
649
|
+
function Buff.prototype.onDeath(self, source)
|
|
650
|
+
local unit = self.unit
|
|
651
|
+
if self[121] ~= nil then
|
|
589
652
|
damageArea(
|
|
590
653
|
self[101] or unit,
|
|
591
|
-
self[
|
|
654
|
+
self[121],
|
|
592
655
|
unit.x,
|
|
593
656
|
unit.y,
|
|
594
|
-
self[121] or 0,
|
|
595
|
-
self[120] or 0,
|
|
596
657
|
self[123] or 0,
|
|
597
658
|
self[122] or 0,
|
|
598
659
|
self[125] or 0,
|
|
599
|
-
self[124] or 0
|
|
660
|
+
self[124] or 0,
|
|
661
|
+
self[127] or 0,
|
|
662
|
+
self[126] or 0
|
|
600
663
|
)
|
|
601
664
|
end
|
|
602
665
|
end
|
|
@@ -618,9 +681,25 @@ function Buff.prototype.onDamageDealt(self, target, event)
|
|
|
618
681
|
end
|
|
619
682
|
self.remainingDuration = remainingDuration
|
|
620
683
|
end
|
|
621
|
-
local autoAttackCount = (self[
|
|
622
|
-
self[
|
|
623
|
-
if autoAttackCount == self[
|
|
684
|
+
local autoAttackCount = (self[128] or 0) + 1
|
|
685
|
+
self[128] = autoAttackCount
|
|
686
|
+
if autoAttackCount == self[129] then
|
|
687
|
+
self:destroy()
|
|
688
|
+
end
|
|
689
|
+
end
|
|
690
|
+
if event.originalAmount ~= 0 then
|
|
691
|
+
local damageDealtEventCount = (self[130] or 0) + 1
|
|
692
|
+
self[130] = damageDealtEventCount
|
|
693
|
+
if damageDealtEventCount == self[131] then
|
|
694
|
+
self:destroy()
|
|
695
|
+
end
|
|
696
|
+
end
|
|
697
|
+
end
|
|
698
|
+
function Buff.prototype.onDamageReceived(self, source, event)
|
|
699
|
+
if event.originalAmount ~= 0 then
|
|
700
|
+
local damageReceivedEventCount = (self[132] or 0) + 1
|
|
701
|
+
self[132] = damageReceivedEventCount
|
|
702
|
+
if damageReceivedEventCount == self[133] then
|
|
624
703
|
self:destroy()
|
|
625
704
|
end
|
|
626
705
|
end
|
|
@@ -802,6 +881,45 @@ __TS__SetDescriptor(
|
|
|
802
881
|
},
|
|
803
882
|
true
|
|
804
883
|
)
|
|
884
|
+
__TS__SetDescriptor(
|
|
885
|
+
Buff.prototype,
|
|
886
|
+
"damageOnExpiration",
|
|
887
|
+
{
|
|
888
|
+
get = function(self)
|
|
889
|
+
return self[119] or 0
|
|
890
|
+
end,
|
|
891
|
+
set = function(self, damageOnExpiration)
|
|
892
|
+
self[119] = damageOnExpiration ~= 0 and damageOnExpiration or nil
|
|
893
|
+
end
|
|
894
|
+
},
|
|
895
|
+
true
|
|
896
|
+
)
|
|
897
|
+
__TS__SetDescriptor(
|
|
898
|
+
Buff.prototype,
|
|
899
|
+
"healingOnExpiration",
|
|
900
|
+
{
|
|
901
|
+
get = function(self)
|
|
902
|
+
return self[120] or 0
|
|
903
|
+
end,
|
|
904
|
+
set = function(self, healingOnExpiration)
|
|
905
|
+
self[120] = healingOnExpiration ~= 0 and healingOnExpiration or nil
|
|
906
|
+
end
|
|
907
|
+
},
|
|
908
|
+
true
|
|
909
|
+
)
|
|
910
|
+
__TS__SetDescriptor(
|
|
911
|
+
Buff.prototype,
|
|
912
|
+
"damageFactor",
|
|
913
|
+
{
|
|
914
|
+
get = function(self)
|
|
915
|
+
return self:getUnitBonus(UnitBonusType.DAMAGE_FACTOR)
|
|
916
|
+
end,
|
|
917
|
+
set = function(self, damageFactor)
|
|
918
|
+
self:addOrUpdateOrRemoveUnitBonus(UnitBonusType.DAMAGE_FACTOR, damageFactor)
|
|
919
|
+
end
|
|
920
|
+
},
|
|
921
|
+
true
|
|
922
|
+
)
|
|
805
923
|
__TS__SetDescriptor(
|
|
806
924
|
Buff.prototype,
|
|
807
925
|
"receivedDamageFactor",
|
|
@@ -833,25 +951,25 @@ __TS__SetDescriptor(
|
|
|
833
951
|
"stuns",
|
|
834
952
|
{
|
|
835
953
|
get = function(self)
|
|
836
|
-
local
|
|
837
|
-
if
|
|
838
|
-
|
|
954
|
+
local ____self__134_52 = self[134]
|
|
955
|
+
if ____self__134_52 == nil then
|
|
956
|
+
____self__134_52 = false
|
|
839
957
|
end
|
|
840
|
-
return
|
|
958
|
+
return ____self__134_52
|
|
841
959
|
end,
|
|
842
960
|
set = function(self, stuns)
|
|
843
|
-
if not stuns and self[
|
|
844
|
-
if self[
|
|
961
|
+
if not stuns and self[134] then
|
|
962
|
+
if self[135] then
|
|
845
963
|
self.object:decrementStunCounter()
|
|
846
964
|
end
|
|
847
965
|
self.object:decrementStunCounter()
|
|
848
|
-
self[
|
|
849
|
-
elseif stuns and not self[
|
|
850
|
-
if self[
|
|
966
|
+
self[134] = nil
|
|
967
|
+
elseif stuns and not self[134] then
|
|
968
|
+
if self[135] then
|
|
851
969
|
self.object:incrementStunCounter()
|
|
852
970
|
end
|
|
853
971
|
self.object:incrementStunCounter()
|
|
854
|
-
self[
|
|
972
|
+
self[134] = true
|
|
855
973
|
end
|
|
856
974
|
end
|
|
857
975
|
},
|
|
@@ -862,23 +980,23 @@ __TS__SetDescriptor(
|
|
|
862
980
|
"ignoresStunImmunity",
|
|
863
981
|
{
|
|
864
982
|
get = function(self)
|
|
865
|
-
local
|
|
866
|
-
if
|
|
867
|
-
|
|
983
|
+
local ____self__135_53 = self[135]
|
|
984
|
+
if ____self__135_53 == nil then
|
|
985
|
+
____self__135_53 = false
|
|
868
986
|
end
|
|
869
|
-
return
|
|
987
|
+
return ____self__135_53
|
|
870
988
|
end,
|
|
871
989
|
set = function(self, ignoresStunImmunity)
|
|
872
|
-
if not ignoresStunImmunity and self[
|
|
873
|
-
if self[
|
|
990
|
+
if not ignoresStunImmunity and self[135] then
|
|
991
|
+
if self[134] then
|
|
874
992
|
self.object:decrementStunCounter()
|
|
875
993
|
end
|
|
876
|
-
self[
|
|
877
|
-
elseif ignoresStunImmunity and not self[
|
|
878
|
-
if self[
|
|
994
|
+
self[135] = nil
|
|
995
|
+
elseif ignoresStunImmunity and not self[135] then
|
|
996
|
+
if self[134] then
|
|
879
997
|
self.object:incrementStunCounter()
|
|
880
998
|
end
|
|
881
|
-
self[
|
|
999
|
+
self[135] = true
|
|
882
1000
|
end
|
|
883
1001
|
end
|
|
884
1002
|
},
|
|
@@ -889,19 +1007,19 @@ __TS__SetDescriptor(
|
|
|
889
1007
|
"disablesAutoAttack",
|
|
890
1008
|
{
|
|
891
1009
|
get = function(self)
|
|
892
|
-
local
|
|
893
|
-
if
|
|
894
|
-
|
|
1010
|
+
local ____self__136_54 = self[136]
|
|
1011
|
+
if ____self__136_54 == nil then
|
|
1012
|
+
____self__136_54 = false
|
|
895
1013
|
end
|
|
896
|
-
return
|
|
1014
|
+
return ____self__136_54
|
|
897
1015
|
end,
|
|
898
1016
|
set = function(self, disablesAutoAttack)
|
|
899
|
-
if not disablesAutoAttack and self[
|
|
1017
|
+
if not disablesAutoAttack and self[136] then
|
|
900
1018
|
self.object:decrementDisableAutoAttackCounter()
|
|
901
|
-
self[
|
|
902
|
-
elseif disablesAutoAttack and not self[
|
|
1019
|
+
self[136] = nil
|
|
1020
|
+
elseif disablesAutoAttack and not self[136] then
|
|
903
1021
|
self.object:incrementDisableAutoAttackCounter()
|
|
904
|
-
self[
|
|
1022
|
+
self[136] = true
|
|
905
1023
|
end
|
|
906
1024
|
end
|
|
907
1025
|
},
|
|
@@ -912,19 +1030,95 @@ __TS__SetDescriptor(
|
|
|
912
1030
|
"providesInvulnerability",
|
|
913
1031
|
{
|
|
914
1032
|
get = function(self)
|
|
915
|
-
local
|
|
916
|
-
if
|
|
917
|
-
|
|
1033
|
+
local ____self__137_55 = self[137]
|
|
1034
|
+
if ____self__137_55 == nil then
|
|
1035
|
+
____self__137_55 = false
|
|
918
1036
|
end
|
|
919
|
-
return
|
|
1037
|
+
return ____self__137_55
|
|
920
1038
|
end,
|
|
921
1039
|
set = function(self, providesInvulnerability)
|
|
922
|
-
if not providesInvulnerability and self[
|
|
1040
|
+
if not providesInvulnerability and self[137] then
|
|
923
1041
|
self.object:decrementInvulnerabilityCounter()
|
|
924
|
-
self[
|
|
925
|
-
elseif providesInvulnerability and not self[
|
|
1042
|
+
self[137] = nil
|
|
1043
|
+
elseif providesInvulnerability and not self[137] then
|
|
926
1044
|
self.object:incrementInvulnerabilityCounter()
|
|
927
|
-
self[
|
|
1045
|
+
self[137] = true
|
|
1046
|
+
end
|
|
1047
|
+
end
|
|
1048
|
+
},
|
|
1049
|
+
true
|
|
1050
|
+
)
|
|
1051
|
+
__TS__SetDescriptor(
|
|
1052
|
+
Buff.prototype,
|
|
1053
|
+
"killsOnExpiration",
|
|
1054
|
+
{
|
|
1055
|
+
get = function(self)
|
|
1056
|
+
local ____self__138_56 = self[138]
|
|
1057
|
+
if ____self__138_56 == nil then
|
|
1058
|
+
____self__138_56 = false
|
|
1059
|
+
end
|
|
1060
|
+
return ____self__138_56
|
|
1061
|
+
end,
|
|
1062
|
+
set = function(self, killsOnExpiration)
|
|
1063
|
+
if not killsOnExpiration and self[138] then
|
|
1064
|
+
self[138] = nil
|
|
1065
|
+
elseif killsOnExpiration and not self[138] then
|
|
1066
|
+
self[138] = true
|
|
1067
|
+
end
|
|
1068
|
+
end
|
|
1069
|
+
},
|
|
1070
|
+
true
|
|
1071
|
+
)
|
|
1072
|
+
__TS__SetDescriptor(
|
|
1073
|
+
Buff.prototype,
|
|
1074
|
+
"explodesOnExpiration",
|
|
1075
|
+
{
|
|
1076
|
+
get = function(self)
|
|
1077
|
+
local ____self__139_57 = self[139]
|
|
1078
|
+
if ____self__139_57 == nil then
|
|
1079
|
+
____self__139_57 = false
|
|
1080
|
+
end
|
|
1081
|
+
return ____self__139_57
|
|
1082
|
+
end,
|
|
1083
|
+
set = function(self, killsOnExpiration)
|
|
1084
|
+
if not killsOnExpiration and self[139] then
|
|
1085
|
+
self[139] = nil
|
|
1086
|
+
elseif killsOnExpiration and not self[139] then
|
|
1087
|
+
self[139] = true
|
|
1088
|
+
end
|
|
1089
|
+
end
|
|
1090
|
+
},
|
|
1091
|
+
true
|
|
1092
|
+
)
|
|
1093
|
+
__TS__SetDescriptor(
|
|
1094
|
+
Buff.prototype,
|
|
1095
|
+
"maximumDamageDealtEventCount",
|
|
1096
|
+
{
|
|
1097
|
+
get = function(self)
|
|
1098
|
+
return self[131] or 0
|
|
1099
|
+
end,
|
|
1100
|
+
set = function(self, maximumDamageDealtEventCount)
|
|
1101
|
+
if maximumDamageDealtEventCount == 0 then
|
|
1102
|
+
self[131] = nil
|
|
1103
|
+
else
|
|
1104
|
+
self[131] = maximumDamageDealtEventCount
|
|
1105
|
+
end
|
|
1106
|
+
end
|
|
1107
|
+
},
|
|
1108
|
+
true
|
|
1109
|
+
)
|
|
1110
|
+
__TS__SetDescriptor(
|
|
1111
|
+
Buff.prototype,
|
|
1112
|
+
"maximumDamageReceivedEventCount",
|
|
1113
|
+
{
|
|
1114
|
+
get = function(self)
|
|
1115
|
+
return self[133] or 0
|
|
1116
|
+
end,
|
|
1117
|
+
set = function(self, maximumDamageReceivedEventCount)
|
|
1118
|
+
if maximumDamageReceivedEventCount == 0 then
|
|
1119
|
+
self[133] = nil
|
|
1120
|
+
else
|
|
1121
|
+
self[133] = maximumDamageReceivedEventCount
|
|
928
1122
|
end
|
|
929
1123
|
end
|
|
930
1124
|
},
|
|
@@ -935,13 +1129,13 @@ __TS__SetDescriptor(
|
|
|
935
1129
|
"maximumAutoAttackCount",
|
|
936
1130
|
{
|
|
937
1131
|
get = function(self)
|
|
938
|
-
return self[
|
|
1132
|
+
return self[129] or 0
|
|
939
1133
|
end,
|
|
940
1134
|
set = function(self, maximumAutoAttackCount)
|
|
941
1135
|
if maximumAutoAttackCount == 0 then
|
|
942
|
-
self[
|
|
1136
|
+
self[129] = nil
|
|
943
1137
|
else
|
|
944
|
-
self[
|
|
1138
|
+
self[129] = maximumAutoAttackCount
|
|
945
1139
|
end
|
|
946
1140
|
end
|
|
947
1141
|
},
|
|
@@ -986,6 +1180,19 @@ __TS__SetDescriptor(
|
|
|
986
1180
|
},
|
|
987
1181
|
true
|
|
988
1182
|
)
|
|
1183
|
+
__TS__SetDescriptor(
|
|
1184
|
+
Buff.prototype,
|
|
1185
|
+
"evasionProbability",
|
|
1186
|
+
{
|
|
1187
|
+
get = function(self)
|
|
1188
|
+
return self:getUnitBonus(UnitBonusType.EVASION_PROBABILITY)
|
|
1189
|
+
end,
|
|
1190
|
+
set = function(self, evasionProbability)
|
|
1191
|
+
self:addOrUpdateOrRemoveUnitBonus(UnitBonusType.EVASION_PROBABILITY, evasionProbability)
|
|
1192
|
+
end
|
|
1193
|
+
},
|
|
1194
|
+
true
|
|
1195
|
+
)
|
|
989
1196
|
__TS__SetDescriptor(
|
|
990
1197
|
Buff.prototype,
|
|
991
1198
|
"duration",
|
|
@@ -999,13 +1206,13 @@ __TS__SetDescriptor(
|
|
|
999
1206
|
"remainingDuration",
|
|
1000
1207
|
{
|
|
1001
1208
|
get = function(self)
|
|
1002
|
-
local
|
|
1003
|
-
return
|
|
1209
|
+
local ____opt_58 = self._timer
|
|
1210
|
+
return ____opt_58 and ____opt_58.remaining or 0
|
|
1004
1211
|
end,
|
|
1005
1212
|
set = function(self, remainingDuration)
|
|
1006
|
-
local
|
|
1007
|
-
local
|
|
1008
|
-
local remainingDurationDelta =
|
|
1213
|
+
local ____remainingDuration_62 = remainingDuration
|
|
1214
|
+
local ____opt_60 = self._timer
|
|
1215
|
+
local remainingDurationDelta = ____remainingDuration_62 - (____opt_60 and ____opt_60.remaining or 0)
|
|
1009
1216
|
if remainingDurationDelta ~= 0 then
|
|
1010
1217
|
self[102] = self[102] + remainingDurationDelta
|
|
1011
1218
|
if remainingDuration <= 0 then
|
|
@@ -1033,26 +1240,25 @@ __TS__SetDescriptor(
|
|
|
1033
1240
|
end
|
|
1034
1241
|
},
|
|
1035
1242
|
true
|
|
1036
|
-
)
|
|
1243
|
+
)
|
|
1244
|
+
Buff.destroyEvent = buffDestroyEvent;
|
|
1037
1245
|
(function(self)
|
|
1246
|
+
local function destroyBuffIfNeeded(buff)
|
|
1247
|
+
if getUnitAbility(buff[100].handle, buff.typeId) ~= buff.handle then
|
|
1248
|
+
buff:destroy()
|
|
1249
|
+
end
|
|
1250
|
+
end
|
|
1038
1251
|
____exports.checkBuff = function(unit, buffTypeId)
|
|
1039
1252
|
local buffByTypeId = buffByTypeIdByUnit[unit]
|
|
1040
1253
|
if buffByTypeId ~= nil then
|
|
1041
1254
|
local buff = buffByTypeId[buffTypeId]
|
|
1042
|
-
if buff ~= nil
|
|
1043
|
-
buff
|
|
1255
|
+
if buff ~= nil then
|
|
1256
|
+
destroyBuffIfNeeded(buff)
|
|
1044
1257
|
end
|
|
1045
1258
|
end
|
|
1046
1259
|
end
|
|
1047
1260
|
____exports.checkBuffs = function(unit)
|
|
1048
|
-
|
|
1049
|
-
if buffByTypeId ~= nil then
|
|
1050
|
-
for ____, buff in pairs(buffByTypeId) do
|
|
1051
|
-
if getUnitAbility(unit.handle, buff.typeId) ~= buff.handle then
|
|
1052
|
-
buff:destroy()
|
|
1053
|
-
end
|
|
1054
|
-
end
|
|
1055
|
-
end
|
|
1261
|
+
____exports.Buff:forAll(unit, destroyBuffIfNeeded)
|
|
1056
1262
|
end
|
|
1057
1263
|
Unit.abilityChannelingStartEvent:addListener(
|
|
1058
1264
|
0,
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
local ____lualib = require("lualib_bundle")
|
|
2
|
+
local __TS__Class = ____lualib.__TS__Class
|
|
3
|
+
local __TS__ObjectDefineProperty = ____lualib.__TS__ObjectDefineProperty
|
|
4
|
+
local ____exports = {}
|
|
5
|
+
local ____rect = require("core.types.rect")
|
|
6
|
+
local Rect = ____rect.Rect
|
|
7
|
+
local ____region = require("core.types.region")
|
|
8
|
+
local Region = ____region.Region
|
|
9
|
+
____exports.GameMap = __TS__Class()
|
|
10
|
+
local GameMap = ____exports.GameMap
|
|
11
|
+
GameMap.name = "GameMap"
|
|
12
|
+
function GameMap.prototype.____constructor(self)
|
|
13
|
+
end
|
|
14
|
+
__TS__ObjectDefineProperty(
|
|
15
|
+
GameMap,
|
|
16
|
+
"worldBoundsRect",
|
|
17
|
+
{get = function(self)
|
|
18
|
+
local rect = Rect:of(GetWorldBounds())
|
|
19
|
+
rawset(self, "worldBoundsRect", rect)
|
|
20
|
+
return rect
|
|
21
|
+
end}
|
|
22
|
+
)
|
|
23
|
+
__TS__ObjectDefineProperty(
|
|
24
|
+
GameMap,
|
|
25
|
+
"worldBoundsRegion",
|
|
26
|
+
{get = function(self)
|
|
27
|
+
local region = Region:create(self.worldBoundsRect)
|
|
28
|
+
rawset(self, "worldBoundsRegion", region)
|
|
29
|
+
return region
|
|
30
|
+
end}
|
|
31
|
+
)
|
|
32
|
+
return ____exports
|