warscript 0.0.1-dev.05b0efd → 0.0.1-dev.2af030d
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 +13 -0
- package/attributes.lua +16 -0
- package/core/types/handle.d.ts +2 -1
- package/core/types/handle.lua +5 -0
- package/engine/behaviour/ability/apply-unit-behavior.d.ts +1 -2
- package/engine/internal/mechanics/ability-duration.d.ts +1 -3
- package/engine/internal/mechanics/ability-duration.lua +2 -0
- package/engine/internal/mechanics/cast-ability.d.ts +2 -0
- package/engine/internal/mechanics/cast-ability.lua +86 -0
- package/engine/internal/unit/detach-missiles.d.ts +7 -0
- package/engine/internal/unit/detach-missiles.lua +30 -0
- package/engine/internal/unit-missile-launch.lua +1 -1
- package/engine/internal/unit.d.ts +35 -8
- package/engine/internal/unit.lua +212 -63
- package/engine/object-data/entry/buff-type/applicable.lua +27 -71
- package/engine/object-data/entry/unit-type.d.ts +42 -1
- package/engine/object-data/entry/unit-type.lua +378 -50
- package/engine/standard/entries/unit-type.d.ts +24 -1
- package/engine/standard/entries/unit-type.lua +24 -1
- package/engine/unit.d.ts +1 -0
- package/engine/unit.lua +1 -0
- package/global/vec2.lua +1 -0
- package/package.json +3 -4
- package/string.d.ts +14 -0
- package/string.lua +9 -0
- package/utility/types.d.ts +2 -2
package/engine/internal/unit.lua
CHANGED
|
@@ -5,9 +5,9 @@ local __TS__ArrayMap = ____lualib.__TS__ArrayMap
|
|
|
5
5
|
local __TS__New = ____lualib.__TS__New
|
|
6
6
|
local __TS__Class = ____lualib.__TS__Class
|
|
7
7
|
local __TS__ClassExtends = ____lualib.__TS__ClassExtends
|
|
8
|
+
local __TS__SetDescriptor = ____lualib.__TS__SetDescriptor
|
|
8
9
|
local __TS__ArraySetLength = ____lualib.__TS__ArraySetLength
|
|
9
10
|
local __TS__InstanceOf = ____lualib.__TS__InstanceOf
|
|
10
|
-
local __TS__SetDescriptor = ____lualib.__TS__SetDescriptor
|
|
11
11
|
local __TS__ObjectDefineProperty = ____lualib.__TS__ObjectDefineProperty
|
|
12
12
|
local Set = ____lualib.Set
|
|
13
13
|
local __TS__Spread = ____lualib.__TS__Spread
|
|
@@ -92,6 +92,10 @@ local isUnitInRangeXY = IsUnitInRangeXY
|
|
|
92
92
|
local isUnitInRange = IsUnitInRange
|
|
93
93
|
local setResourceAmount = SetResourceAmount
|
|
94
94
|
local getResourceAmount = GetResourceAmount
|
|
95
|
+
local getUnitWeaponRealField = BlzGetUnitWeaponRealField
|
|
96
|
+
local setUnitWeaponRealField = BlzSetUnitWeaponRealField
|
|
97
|
+
local getUnitWeaponStringField = BlzGetUnitWeaponStringField
|
|
98
|
+
local setUnitWeaponStringField = BlzSetUnitWeaponStringField
|
|
95
99
|
local getUnitAbilityLevel = GetUnitAbilityLevel
|
|
96
100
|
local unitDisableAbility = BlzUnitDisableAbility
|
|
97
101
|
local unitInterruptAttack = BlzUnitInterruptAttack
|
|
@@ -387,51 +391,158 @@ local getters = {
|
|
|
387
391
|
return BlzGetUnitArmor(unit)
|
|
388
392
|
end
|
|
389
393
|
}
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
394
|
+
____exports.UnitWeapon = __TS__Class()
|
|
395
|
+
local UnitWeapon = ____exports.UnitWeapon
|
|
396
|
+
UnitWeapon.name = "UnitWeapon"
|
|
397
|
+
function UnitWeapon.prototype.____constructor(self, unit, index)
|
|
398
|
+
self.unit = unit
|
|
399
|
+
self.index = index
|
|
400
|
+
end
|
|
401
|
+
__TS__SetDescriptor(
|
|
402
|
+
UnitWeapon.prototype,
|
|
403
|
+
"cooldown",
|
|
404
|
+
{
|
|
405
|
+
get = function(self)
|
|
406
|
+
return getUnitWeaponRealField(self.unit.handle, UNIT_WEAPON_RF_ATTACK_BASE_COOLDOWN, self.index)
|
|
407
|
+
end,
|
|
408
|
+
set = function(self, cooldown)
|
|
409
|
+
setUnitWeaponRealField(self.unit.handle, UNIT_WEAPON_RF_ATTACK_BASE_COOLDOWN, self.index, cooldown)
|
|
410
|
+
end
|
|
411
|
+
},
|
|
412
|
+
true
|
|
413
|
+
)
|
|
414
|
+
__TS__SetDescriptor(
|
|
415
|
+
UnitWeapon.prototype,
|
|
416
|
+
"damage",
|
|
417
|
+
{
|
|
418
|
+
get = function(self)
|
|
419
|
+
local minimumDamage = self.damageBase + self.damageDiceCount
|
|
420
|
+
local maximumDamage = self.damageBase + self.damageDiceCount * self.damageDiceSideCount
|
|
421
|
+
return {minimumDamage, maximumDamage}
|
|
422
|
+
end,
|
|
423
|
+
set = function(self, ____bindingPattern0)
|
|
424
|
+
local maximumDamage
|
|
425
|
+
local minimumDamage
|
|
426
|
+
minimumDamage = ____bindingPattern0[1]
|
|
427
|
+
maximumDamage = ____bindingPattern0[2]
|
|
428
|
+
self.damageBase = minimumDamage - 1
|
|
429
|
+
self.damageDiceCount = 1
|
|
430
|
+
self.damageDiceSideCount = maximumDamage - minimumDamage + 1
|
|
431
|
+
end
|
|
432
|
+
},
|
|
433
|
+
true
|
|
434
|
+
)
|
|
435
|
+
__TS__SetDescriptor(
|
|
436
|
+
UnitWeapon.prototype,
|
|
437
|
+
"damageBase",
|
|
438
|
+
{
|
|
439
|
+
get = function(self)
|
|
440
|
+
return BlzGetUnitBaseDamage(self.unit.handle, self.index)
|
|
441
|
+
end,
|
|
442
|
+
set = function(self, damageBase)
|
|
443
|
+
BlzSetUnitBaseDamage(self.unit.handle, self.index, damageBase)
|
|
444
|
+
end
|
|
445
|
+
},
|
|
446
|
+
true
|
|
447
|
+
)
|
|
448
|
+
__TS__SetDescriptor(
|
|
449
|
+
UnitWeapon.prototype,
|
|
450
|
+
"damageDiceCount",
|
|
451
|
+
{
|
|
452
|
+
get = function(self)
|
|
453
|
+
return BlzGetUnitDiceNumber(self.unit.handle, self.index)
|
|
454
|
+
end,
|
|
455
|
+
set = function(self, damageDiceCount)
|
|
456
|
+
BlzSetUnitDiceNumber(self.unit.handle, self.index, damageDiceCount)
|
|
457
|
+
end
|
|
458
|
+
},
|
|
459
|
+
true
|
|
460
|
+
)
|
|
461
|
+
__TS__SetDescriptor(
|
|
462
|
+
UnitWeapon.prototype,
|
|
463
|
+
"damageDiceSideCount",
|
|
464
|
+
{
|
|
465
|
+
get = function(self)
|
|
466
|
+
return BlzGetUnitDiceSides(self.unit.handle, self.index)
|
|
467
|
+
end,
|
|
468
|
+
set = function(self, damageDiceSideCount)
|
|
469
|
+
BlzSetUnitDiceSides(self.unit.handle, self.index, damageDiceSideCount)
|
|
470
|
+
end
|
|
471
|
+
},
|
|
472
|
+
true
|
|
473
|
+
)
|
|
474
|
+
__TS__SetDescriptor(
|
|
475
|
+
UnitWeapon.prototype,
|
|
476
|
+
"range",
|
|
477
|
+
{
|
|
478
|
+
get = function(self)
|
|
479
|
+
return getUnitWeaponRealField(self.unit.handle, UNIT_WEAPON_RF_ATTACK_RANGE, self.index)
|
|
480
|
+
end,
|
|
481
|
+
set = function(self, range)
|
|
482
|
+
local handle = self.unit.handle
|
|
483
|
+
local index = self.index
|
|
484
|
+
setUnitWeaponRealField(
|
|
485
|
+
handle,
|
|
486
|
+
UNIT_WEAPON_RF_ATTACK_RANGE,
|
|
487
|
+
index + 1,
|
|
488
|
+
getUnitWeaponRealField(handle, UNIT_WEAPON_RF_ATTACK_RANGE, index + 1) + (range - getUnitWeaponRealField(handle, UNIT_WEAPON_RF_ATTACK_RANGE, index))
|
|
489
|
+
)
|
|
490
|
+
end
|
|
491
|
+
},
|
|
492
|
+
true
|
|
493
|
+
)
|
|
494
|
+
__TS__SetDescriptor(
|
|
495
|
+
UnitWeapon.prototype,
|
|
496
|
+
"impactDelay",
|
|
497
|
+
{
|
|
498
|
+
get = function(self)
|
|
499
|
+
return getUnitWeaponRealField(self.unit.handle, UNIT_WEAPON_RF_ATTACK_DAMAGE_POINT, self.index)
|
|
500
|
+
end,
|
|
501
|
+
set = function(self, impactDelay)
|
|
502
|
+
setUnitWeaponRealField(self.unit.handle, UNIT_WEAPON_RF_ATTACK_DAMAGE_POINT, self.index, impactDelay)
|
|
503
|
+
end
|
|
504
|
+
},
|
|
505
|
+
true
|
|
506
|
+
)
|
|
507
|
+
__TS__SetDescriptor(
|
|
508
|
+
UnitWeapon.prototype,
|
|
509
|
+
"missileArc",
|
|
510
|
+
{
|
|
511
|
+
get = function(self)
|
|
512
|
+
return getUnitWeaponRealField(self.unit.handle, UNIT_WEAPON_RF_ATTACK_PROJECTILE_ARC, self.index)
|
|
513
|
+
end,
|
|
514
|
+
set = function(self, missileArc)
|
|
515
|
+
setUnitWeaponRealField(self.unit.handle, UNIT_WEAPON_RF_ATTACK_PROJECTILE_ARC, self.index, missileArc)
|
|
516
|
+
end
|
|
517
|
+
},
|
|
518
|
+
true
|
|
519
|
+
)
|
|
520
|
+
__TS__SetDescriptor(
|
|
521
|
+
UnitWeapon.prototype,
|
|
522
|
+
"missileModelPath",
|
|
523
|
+
{
|
|
524
|
+
get = function(self)
|
|
525
|
+
return getUnitWeaponStringField(self.unit.handle, UNIT_WEAPON_SF_ATTACK_PROJECTILE_ART, self.index)
|
|
526
|
+
end,
|
|
527
|
+
set = function(self, missileModelPath)
|
|
528
|
+
setUnitWeaponStringField(self.unit.handle, UNIT_WEAPON_SF_ATTACK_PROJECTILE_ART, self.index, missileModelPath)
|
|
529
|
+
end
|
|
530
|
+
},
|
|
531
|
+
true
|
|
532
|
+
)
|
|
533
|
+
__TS__SetDescriptor(
|
|
534
|
+
UnitWeapon.prototype,
|
|
535
|
+
"missileSpeed",
|
|
536
|
+
{
|
|
537
|
+
get = function(self)
|
|
538
|
+
return getUnitWeaponRealField(self.unit.handle, UNIT_WEAPON_RF_ATTACK_PROJECTILE_SPEED, self.index)
|
|
539
|
+
end,
|
|
540
|
+
set = function(self, missileSpeed)
|
|
541
|
+
setUnitWeaponRealField(self.unit.handle, UNIT_WEAPON_RF_ATTACK_PROJECTILE_SPEED, self.index, missileSpeed)
|
|
542
|
+
end
|
|
543
|
+
},
|
|
544
|
+
true
|
|
545
|
+
)
|
|
435
546
|
local unitInventorySize = UnitInventorySize
|
|
436
547
|
local unitItemInSlot = UnitItemInSlot
|
|
437
548
|
local getItemAbility = BlzGetItemAbility
|
|
@@ -442,8 +553,6 @@ local getAbilityName = GetAbilityName
|
|
|
442
553
|
local unitAddAbility = UnitAddAbility
|
|
443
554
|
local getUnitGoldCost = GetUnitGoldCost
|
|
444
555
|
local getUnitLumberCost = GetUnitWoodCost
|
|
445
|
-
local unitMakeAbilityPermanent = UnitMakeAbilityPermanent
|
|
446
|
-
local unitAddItem = UnitAddItem
|
|
447
556
|
local unitRemoveAbility = UnitRemoveAbility
|
|
448
557
|
local function retrieveAbility(unit, ability, abilityId)
|
|
449
558
|
if ability == nil then
|
|
@@ -520,6 +629,23 @@ for ____, player in ipairs(Player.all) do
|
|
|
520
629
|
ShowUnit(dummy, false)
|
|
521
630
|
dummies[player] = dummy
|
|
522
631
|
end
|
|
632
|
+
local function delayHealthChecksCallback(unit)
|
|
633
|
+
local counter = (unit[102] or 0) - 1
|
|
634
|
+
if counter ~= 0 then
|
|
635
|
+
unit[102] = counter
|
|
636
|
+
return
|
|
637
|
+
end
|
|
638
|
+
unit[102] = nil
|
|
639
|
+
local healthBonus = unit[103]
|
|
640
|
+
if healthBonus ~= nil then
|
|
641
|
+
unit[103] = nil
|
|
642
|
+
local handle = unit.handle
|
|
643
|
+
BlzSetUnitMaxHP(
|
|
644
|
+
handle,
|
|
645
|
+
BlzGetUnitMaxHP(handle) - healthBonus
|
|
646
|
+
)
|
|
647
|
+
end
|
|
648
|
+
end
|
|
523
649
|
____exports.Unit = __TS__Class()
|
|
524
650
|
local Unit = ____exports.Unit
|
|
525
651
|
Unit.name = "Unit"
|
|
@@ -674,6 +800,10 @@ end
|
|
|
674
800
|
function Unit.prototype.queueAnimation(self, animation)
|
|
675
801
|
queueUnitAnimation(self.handle, animation)
|
|
676
802
|
end
|
|
803
|
+
function Unit.prototype.delayHealthChecks(self)
|
|
804
|
+
self[102] = (self[102] or 0) + 1
|
|
805
|
+
Timer:run(delayHealthChecksCallback, self)
|
|
806
|
+
end
|
|
677
807
|
function Unit.prototype.setPosition(self, x, y)
|
|
678
808
|
setUnitPosition(self.handle, x, y)
|
|
679
809
|
end
|
|
@@ -1071,12 +1201,27 @@ __TS__SetDescriptor(
|
|
|
1071
1201
|
Unit.prototype,
|
|
1072
1202
|
"weapons",
|
|
1073
1203
|
{get = function(self)
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1204
|
+
return {self.firstWeapon, self.secondWeapon}
|
|
1205
|
+
end},
|
|
1206
|
+
true
|
|
1207
|
+
)
|
|
1208
|
+
__TS__SetDescriptor(
|
|
1209
|
+
Unit.prototype,
|
|
1210
|
+
"firstWeapon",
|
|
1211
|
+
{get = function(self)
|
|
1212
|
+
local weapon = __TS__New(____exports.UnitWeapon, self, 0)
|
|
1213
|
+
rawset(self, "firstWeapon", weapon)
|
|
1214
|
+
return weapon
|
|
1215
|
+
end},
|
|
1216
|
+
true
|
|
1217
|
+
)
|
|
1218
|
+
__TS__SetDescriptor(
|
|
1219
|
+
Unit.prototype,
|
|
1220
|
+
"secondWeapon",
|
|
1221
|
+
{get = function(self)
|
|
1222
|
+
local weapon = __TS__New(____exports.UnitWeapon, self, 1)
|
|
1223
|
+
rawset(self, "secondWeapon", weapon)
|
|
1224
|
+
return weapon
|
|
1080
1225
|
end},
|
|
1081
1226
|
true
|
|
1082
1227
|
)
|
|
@@ -1233,7 +1378,7 @@ __TS__SetDescriptor(
|
|
|
1233
1378
|
"isTeamGlowVisible",
|
|
1234
1379
|
{
|
|
1235
1380
|
get = function(self)
|
|
1236
|
-
return not self[
|
|
1381
|
+
return not self[105]
|
|
1237
1382
|
end,
|
|
1238
1383
|
set = function(self, isTeamGlowVisible)
|
|
1239
1384
|
showUnitTeamGlow(self.handle, isTeamGlowVisible)
|
|
@@ -1243,7 +1388,7 @@ __TS__SetDescriptor(
|
|
|
1243
1388
|
else
|
|
1244
1389
|
____temp_2 = nil
|
|
1245
1390
|
end
|
|
1246
|
-
self[
|
|
1391
|
+
self[105] = ____temp_2
|
|
1247
1392
|
end
|
|
1248
1393
|
},
|
|
1249
1394
|
true
|
|
@@ -1253,7 +1398,7 @@ __TS__SetDescriptor(
|
|
|
1253
1398
|
"color",
|
|
1254
1399
|
{set = function(self, color)
|
|
1255
1400
|
setUnitColor(self.handle, color.handle)
|
|
1256
|
-
if self[
|
|
1401
|
+
if self[105] then
|
|
1257
1402
|
showUnitTeamGlow(self.handle, false)
|
|
1258
1403
|
end
|
|
1259
1404
|
end},
|
|
@@ -1277,10 +1422,14 @@ __TS__SetDescriptor(
|
|
|
1277
1422
|
"maxHealth",
|
|
1278
1423
|
{
|
|
1279
1424
|
get = function(self)
|
|
1280
|
-
return BlzGetUnitMaxHP(self.handle) - (self[
|
|
1425
|
+
return BlzGetUnitMaxHP(self.handle) - (self[103] or 0) - (self[104] or 0)
|
|
1281
1426
|
end,
|
|
1282
1427
|
set = function(self, maxHealth)
|
|
1283
|
-
|
|
1428
|
+
if maxHealth < 1 and self[102] ~= nil then
|
|
1429
|
+
self[103] = (self[103] or 0) + (1 - maxHealth)
|
|
1430
|
+
maxHealth = 1
|
|
1431
|
+
end
|
|
1432
|
+
BlzSetUnitMaxHP(self.handle, maxHealth + (self[104] or 0))
|
|
1284
1433
|
end
|
|
1285
1434
|
},
|
|
1286
1435
|
true
|
|
@@ -1322,10 +1471,10 @@ __TS__SetDescriptor(
|
|
|
1322
1471
|
"health",
|
|
1323
1472
|
{
|
|
1324
1473
|
get = function(self)
|
|
1325
|
-
return GetWidgetLife(self.handle) - (self[
|
|
1474
|
+
return GetWidgetLife(self.handle) - (self[104] or 0)
|
|
1326
1475
|
end,
|
|
1327
1476
|
set = function(self, health)
|
|
1328
|
-
SetWidgetLife(self.handle, health + (self[
|
|
1477
|
+
SetWidgetLife(self.handle, health + (self[104] or 0))
|
|
1329
1478
|
end
|
|
1330
1479
|
},
|
|
1331
1480
|
true
|
|
@@ -2308,7 +2457,7 @@ Unit.onDamage = __TS__New(
|
|
|
2308
2457
|
invoke(event, source, target, evData)
|
|
2309
2458
|
if evData[0] ~= nil and target.health - evData.amount < 0.405 then
|
|
2310
2459
|
local bonusHealth = math.ceil(evData.amount)
|
|
2311
|
-
target[
|
|
2460
|
+
target[104] = (target[104] or 0) + bonusHealth
|
|
2312
2461
|
BlzSetUnitMaxHP(
|
|
2313
2462
|
target.handle,
|
|
2314
2463
|
BlzGetUnitMaxHP(target.handle) + bonusHealth
|
|
@@ -2322,7 +2471,7 @@ Unit.onDamage = __TS__New(
|
|
|
2322
2471
|
evData[0],
|
|
2323
2472
|
table.unpack(evData, 1 + 1, 1 + (evData[1] or 0))
|
|
2324
2473
|
)
|
|
2325
|
-
target[
|
|
2474
|
+
target[104] = (target[104] or 0) - bonusHealth
|
|
2326
2475
|
SetWidgetLife(
|
|
2327
2476
|
target.handle,
|
|
2328
2477
|
GetWidgetLife(target.handle) - bonusHealth
|
|
@@ -7,6 +7,7 @@ local __TS__SparseArrayNew = ____lualib.__TS__SparseArrayNew
|
|
|
7
7
|
local __TS__SparseArrayPush = ____lualib.__TS__SparseArrayPush
|
|
8
8
|
local __TS__SparseArraySpread = ____lualib.__TS__SparseArraySpread
|
|
9
9
|
local ____exports = {}
|
|
10
|
+
local preparePhysicalPositiveApplicatorAbility
|
|
10
11
|
local ____ability_2Dtype = require("engine.object-data.entry.ability-type")
|
|
11
12
|
local AbilityType = ____ability_2Dtype.AbilityType
|
|
12
13
|
local ____cripple = require("engine.object-data.entry.ability-type.cripple")
|
|
@@ -34,20 +35,14 @@ local ____blood_2Dlust = require("engine.object-data.entry.ability-type.blood-lu
|
|
|
34
35
|
local BloodLustAbilityType = ____blood_2Dlust.BloodLustAbilityType
|
|
35
36
|
local ____berserk = require("engine.object-data.entry.ability-type.berserk")
|
|
36
37
|
local BerserkAbilityType = ____berserk.BerserkAbilityType
|
|
37
|
-
local ____dummy_2Ditem = require("engine.internal.object-data.dummy-item")
|
|
38
|
-
local DUMMY_ITEM_ID = ____dummy_2Ditem.DUMMY_ITEM_ID
|
|
39
|
-
local ____dummy_2Dinventory = require("engine.internal.object-data.dummy-inventory")
|
|
40
|
-
local INVENTORY_ABILITY_TYPE_ID = ____dummy_2Dinventory.INVENTORY_ABILITY_TYPE_ID
|
|
41
38
|
local ____blank = require("engine.object-data.entry.upgrade.blank")
|
|
42
39
|
local BlankUpgrade = ____blank.BlankUpgrade
|
|
43
|
-
local ____dummy_2Dunits = require("engine.internal.misc.dummy-units")
|
|
44
|
-
local INVENTORY_DUMMY_NATIVE_UNIT = ____dummy_2Dunits.INVENTORY_DUMMY_NATIVE_UNIT
|
|
45
|
-
local ____preconditions = require("utility.preconditions")
|
|
46
|
-
local checkNotNull = ____preconditions.checkNotNull
|
|
47
40
|
local ____unit_2Dtype = require("engine.object-data.entry.unit-type")
|
|
48
41
|
local UnitType = ____unit_2Dtype.UnitType
|
|
49
42
|
local ____permanent_2Dimmolation = require("engine.object-data.entry.ability-type.permanent-immolation")
|
|
50
43
|
local PermanentImmolationAbilityType = ____permanent_2Dimmolation.PermanentImmolationAbilityType
|
|
44
|
+
local ____cast_2Dability = require("engine.internal.mechanics.cast-ability")
|
|
45
|
+
local castAbility = ____cast_2Dability.castAbility
|
|
51
46
|
local createItem = CreateItem
|
|
52
47
|
local getAbilityId = BlzGetAbilityId
|
|
53
48
|
local getItemAbility = BlzGetItemAbility
|
|
@@ -260,75 +255,25 @@ ____exports.internalApplyBuff = function(unit, applicableBuffTypeId, polarity, r
|
|
|
260
255
|
return unitAddAbility(unit.handle, applicatorAbilityTypeId)
|
|
261
256
|
end
|
|
262
257
|
if applicatorType == 852100 then
|
|
263
|
-
local
|
|
264
|
-
|
|
265
|
-
local nativeItem = createItem(DUMMY_ITEM_ID, 0, 0)
|
|
266
|
-
unitAddItem(INVENTORY_DUMMY_NATIVE_UNIT, nativeItem)
|
|
267
|
-
itemAddAbility(nativeItem, applicatorAbilityTypeId)
|
|
268
|
-
local applicatorAbility = checkNotNull(getItemAbility(nativeItem, applicatorAbilityTypeId))
|
|
269
|
-
if level == nil then
|
|
270
|
-
level = 0
|
|
271
|
-
setAbilityIntegerField(applicatorAbility, ABILITY_IF_LEVELS, 1)
|
|
272
|
-
end
|
|
273
|
-
setAbilityRealLevelField(applicatorAbility, ABILITY_RLF_DURATION_NORMAL, level, duration or 0)
|
|
274
|
-
setAbilityRealLevelField(applicatorAbility, ABILITY_RLF_DURATION_HERO, level, duration or 0)
|
|
275
|
-
if movementSpeedIncreaseFactor ~= nil then
|
|
276
|
-
setAbilityRealLevelField(applicatorAbility, ABILITY_RLF_MOVEMENT_SPEED_INCREASE_BSK1, level, movementSpeedIncreaseFactor)
|
|
277
|
-
end
|
|
278
|
-
setItemBooleanField(nativeItem, ITEM_BF_ACTIVELY_USED, true)
|
|
279
|
-
setItemBooleanField(nativeItem, ITEM_BF_USE_AUTOMATICALLY_WHEN_ACQUIRED, true)
|
|
280
|
-
if level > 0 then
|
|
258
|
+
local nativePlayer = unit.owner.handle
|
|
259
|
+
if level ~= nil and level > 0 then
|
|
281
260
|
local upgradeId = applicatorUpgradeIdByApplicatorAbilityTypeId[applicatorAbilityTypeId]
|
|
282
261
|
if upgradeId ~= nil then
|
|
283
|
-
setPlayerTechResearched(
|
|
284
|
-
getOwningPlayer(nativeUnit),
|
|
285
|
-
upgradeId,
|
|
286
|
-
level
|
|
287
|
-
)
|
|
288
|
-
end
|
|
289
|
-
end
|
|
290
|
-
if not unitAddItem(nativeUnit, nativeItem) then
|
|
291
|
-
local latestInventoryAbilityTypeId = 0
|
|
292
|
-
local nativeItemBySlot = {}
|
|
293
|
-
local inventorySize = unitInventorySize(nativeUnit)
|
|
294
|
-
if inventorySize ~= 0 then
|
|
295
|
-
for slot = 0, inventorySize - 1 do
|
|
296
|
-
nativeItemBySlot[slot] = UnitRemoveItemFromSlot(nativeUnit, slot)
|
|
297
|
-
end
|
|
298
|
-
local unitNativeAbility = getUnitAbilityByIndex(nativeUnit, 0)
|
|
299
|
-
local i = 1
|
|
300
|
-
while unitNativeAbility ~= nil do
|
|
301
|
-
local abilityTypeId = getAbilityId(unitNativeAbility)
|
|
302
|
-
if INVENTORY_ABILITY_TYPE_IDS[abilityTypeId] ~= nil then
|
|
303
|
-
latestInventoryAbilityTypeId = abilityTypeId
|
|
304
|
-
end
|
|
305
|
-
unitNativeAbility = getUnitAbilityByIndex(nativeUnit, i)
|
|
306
|
-
i = i + 1
|
|
307
|
-
end
|
|
308
|
-
unitRemoveAbility(nativeUnit, latestInventoryAbilityTypeId)
|
|
262
|
+
setPlayerTechResearched(nativePlayer, upgradeId, level)
|
|
309
263
|
end
|
|
310
|
-
unitAddAbility(nativeUnit, INVENTORY_ABILITY_TYPE_ID)
|
|
311
|
-
success = unitAddItem(nativeUnit, nativeItem)
|
|
312
|
-
unitRemoveAbility(nativeUnit, INVENTORY_ABILITY_TYPE_ID)
|
|
313
|
-
if latestInventoryAbilityTypeId ~= 0 then
|
|
314
|
-
unitAddAbility(nativeUnit, latestInventoryAbilityTypeId)
|
|
315
|
-
for slot, nativeItem in pairs(nativeItemBySlot) do
|
|
316
|
-
unitAddItem(nativeUnit, nativeItem)
|
|
317
|
-
unitDropItemSlot(nativeUnit, nativeItem, slot)
|
|
318
|
-
end
|
|
319
|
-
end
|
|
320
|
-
else
|
|
321
|
-
success = true
|
|
322
264
|
end
|
|
323
|
-
|
|
324
|
-
|
|
265
|
+
local success = castAbility(
|
|
266
|
+
unit.handle,
|
|
267
|
+
applicatorAbilityTypeId,
|
|
268
|
+
preparePhysicalPositiveApplicatorAbility,
|
|
269
|
+
level,
|
|
270
|
+
duration or 0,
|
|
271
|
+
movementSpeedIncreaseFactor
|
|
272
|
+
)
|
|
273
|
+
if level ~= nil and level > 0 then
|
|
325
274
|
local upgradeId = applicatorUpgradeIdByApplicatorAbilityTypeId[applicatorAbilityTypeId]
|
|
326
275
|
if upgradeId ~= nil then
|
|
327
|
-
setPlayerTechResearched(
|
|
328
|
-
getOwningPlayer(nativeUnit),
|
|
329
|
-
upgradeId,
|
|
330
|
-
0
|
|
331
|
-
)
|
|
276
|
+
setPlayerTechResearched(nativePlayer, upgradeId, 0)
|
|
332
277
|
end
|
|
333
278
|
end
|
|
334
279
|
return success
|
|
@@ -364,6 +309,17 @@ ____exports.internalApplyBuff = function(unit, applicableBuffTypeId, polarity, r
|
|
|
364
309
|
end
|
|
365
310
|
return success
|
|
366
311
|
end
|
|
312
|
+
preparePhysicalPositiveApplicatorAbility = function(ability, level, duration, movementSpeedIncreaseFactor)
|
|
313
|
+
if level == nil then
|
|
314
|
+
setAbilityIntegerField(ability, ABILITY_IF_LEVELS, 1)
|
|
315
|
+
level = 1
|
|
316
|
+
end
|
|
317
|
+
setAbilityRealLevelField(ability, ABILITY_RLF_DURATION_NORMAL, level, duration)
|
|
318
|
+
setAbilityRealLevelField(ability, ABILITY_RLF_DURATION_HERO, level, duration)
|
|
319
|
+
if movementSpeedIncreaseFactor ~= nil then
|
|
320
|
+
setAbilityRealLevelField(ability, ABILITY_RLF_MOVEMENT_SPEED_INCREASE_BSK1, level, movementSpeedIncreaseFactor)
|
|
321
|
+
end
|
|
322
|
+
end
|
|
367
323
|
---
|
|
368
324
|
-- @internal For use by internal systems only.
|
|
369
325
|
____exports.removeBuff = function(unit, applicableBuffTypeId)
|
|
@@ -13,6 +13,7 @@ import { ObjectDataEntryIdGenerator } from "../utility/object-data-entry-id-gene
|
|
|
13
13
|
import type { AbilityTypeId } from "./ability-type";
|
|
14
14
|
import type { UpgradeId } from "./upgrade";
|
|
15
15
|
import { AnimationQualifier } from "../auxiliary/animation-qualifier";
|
|
16
|
+
import { AttackType } from "../auxiliary/attack-type";
|
|
16
17
|
export type UnitTypeId = ObjectDataEntryId & {
|
|
17
18
|
readonly __unitTypeId: unique symbol;
|
|
18
19
|
};
|
|
@@ -23,12 +24,26 @@ export declare class UnitTypeWeapon {
|
|
|
23
24
|
private readonly unitType;
|
|
24
25
|
private readonly index;
|
|
25
26
|
private constructor();
|
|
27
|
+
get attackType(): AttackType;
|
|
28
|
+
set attackType(attackType: AttackType);
|
|
26
29
|
get backSwingDuration(): number;
|
|
27
30
|
set backSwingDuration(backSwingDuration: number);
|
|
31
|
+
get cooldown(): number;
|
|
32
|
+
set cooldown(cooldown: number);
|
|
33
|
+
get damage(): [minimumDamage: number, maximumDamage: number];
|
|
34
|
+
set damage([minimumDamage, maximumDamage]: [number, number]);
|
|
35
|
+
get damageBase(): number;
|
|
36
|
+
set damageBase(damageBase: number);
|
|
37
|
+
get damageDiceCount(): number;
|
|
38
|
+
set damageDiceCount(damageDiceNumber: number);
|
|
39
|
+
get damageDiceSideCount(): number;
|
|
40
|
+
set damageDiceSideCount(damageDiceSideCount: number);
|
|
28
41
|
get impactDelay(): number;
|
|
29
42
|
set impactDelay(impactDelay: number);
|
|
30
43
|
get missileModelPath(): string;
|
|
31
44
|
set missileModelPath(missileModelPath: string);
|
|
45
|
+
get range(): number;
|
|
46
|
+
set range(range: number);
|
|
32
47
|
get soundType(): WeaponSoundType;
|
|
33
48
|
set soundType(soundType: WeaponSoundType);
|
|
34
49
|
get soundTypeSD(): WeaponSoundType;
|
|
@@ -117,6 +132,12 @@ export declare abstract class UnitType<Id extends UnitTypeId = UnitTypeId> exten
|
|
|
117
132
|
set modelPathSD(modelPathSD: string);
|
|
118
133
|
get modelPathHD(): string;
|
|
119
134
|
set modelPathHD(modelPathHD: string);
|
|
135
|
+
get runSpeed(): number;
|
|
136
|
+
set runSpeed(runSpeed: number);
|
|
137
|
+
get runSpeedSD(): number;
|
|
138
|
+
set runSpeedSD(runSpeedSD: number);
|
|
139
|
+
get runSpeedHD(): number;
|
|
140
|
+
set runSpeedHD(runSpeedHD: number);
|
|
120
141
|
get selectionCircleScale(): number;
|
|
121
142
|
set selectionCircleScale(selectionCircleScale: number);
|
|
122
143
|
get selectionCircleScaleSD(): number;
|
|
@@ -149,6 +170,12 @@ export declare abstract class UnitType<Id extends UnitTypeId = UnitTypeId> exten
|
|
|
149
170
|
set shadowImageXOffset(shadowImageXOffset: number);
|
|
150
171
|
get shadowImageYOffset(): number;
|
|
151
172
|
set shadowImageYOffset(shadowImageYOffset: number);
|
|
173
|
+
get walkSpeed(): number;
|
|
174
|
+
set walkSpeed(walkSpeed: number);
|
|
175
|
+
get walkSpeedSD(): number;
|
|
176
|
+
set walkSpeedSD(walkSpeedSD: number);
|
|
177
|
+
get walkSpeedHD(): number;
|
|
178
|
+
set walkSpeedHD(walkSpeedHD: number);
|
|
152
179
|
get armorSoundType(): ArmorSoundType;
|
|
153
180
|
set armorSoundType(armorSoundType: ArmorSoundType);
|
|
154
181
|
get armorSoundTypeSD(): ArmorSoundType;
|
|
@@ -159,9 +186,9 @@ export declare abstract class UnitType<Id extends UnitTypeId = UnitTypeId> exten
|
|
|
159
186
|
set combatClassifications(combatClassifications: CombatClassifications);
|
|
160
187
|
get unitClassifications(): UnitClassifications;
|
|
161
188
|
set unitClassifications(unitClassifications: UnitClassifications);
|
|
189
|
+
get weapons(): TupleOf<UnitTypeWeapon, 2>;
|
|
162
190
|
get firstWeapon(): UnitTypeWeapon;
|
|
163
191
|
get secondWeapon(): UnitTypeWeapon;
|
|
164
|
-
get weapons(): TupleOf<UnitTypeWeapon, 2>;
|
|
165
192
|
get flyHeight(): number;
|
|
166
193
|
set flyHeight(flyHeight: number);
|
|
167
194
|
get flyHeightMinimum(): number;
|
|
@@ -190,6 +217,16 @@ export declare abstract class UnitType<Id extends UnitTypeId = UnitTypeId> exten
|
|
|
190
217
|
set formationRank(formationRank: number);
|
|
191
218
|
get goldCost(): number;
|
|
192
219
|
set goldCost(goldCost: number);
|
|
220
|
+
get healthRegenerationRate(): number;
|
|
221
|
+
set healthRegenerationRate(healthRegenerationRate: number);
|
|
222
|
+
get manaRegenerationRate(): number;
|
|
223
|
+
set manaRegenerationRate(manaRegenerationRate: number);
|
|
224
|
+
get maximumHealth(): number;
|
|
225
|
+
set maximumHealth(maximumHealth: number);
|
|
226
|
+
get maximumMana(): number;
|
|
227
|
+
set maximumMana(maximumMana: number);
|
|
228
|
+
get initialMana(): number;
|
|
229
|
+
set initialMana(initialMana: number);
|
|
193
230
|
get isStructure(): boolean;
|
|
194
231
|
set isStructure(isStructure: boolean);
|
|
195
232
|
get race(): Race;
|
|
@@ -215,4 +252,8 @@ export declare abstract class HeroUnitType<Id extends HeroUnitTypeId = HeroUnitT
|
|
|
215
252
|
protected static generateId(): number;
|
|
216
253
|
get heroAbilityTypeIds(): AbilityTypeId[];
|
|
217
254
|
set heroAbilityTypeIds(heroAbilityTypeIds: AbilityTypeId[]);
|
|
255
|
+
get properNames(): string[];
|
|
256
|
+
set properNames(properNames: string | string[]);
|
|
257
|
+
get properNameCount(): number;
|
|
258
|
+
set properNameCount(properNameCount: number);
|
|
218
259
|
}
|