warscript 0.0.1-dev.8a4aeae → 0.0.1-dev.9d56c5c
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/engine/behaviour/ability/instant-impact.lua +4 -0
- package/engine/internal/unit-missile-launch.lua +1 -1
- package/engine/internal/unit.d.ts +36 -8
- package/engine/internal/unit.lua +215 -63
- 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/unit-type.d.ts +23 -3
- package/engine/object-data/entry/unit-type.lua +226 -52
- package/engine/standard/entries/unit-type.d.ts +21 -1
- package/engine/standard/entries/unit-type.lua +21 -1
- package/package.json +3 -4
- package/string.d.ts +14 -0
- package/string.lua +9 -0
|
@@ -12,8 +12,12 @@ local InstantImpactAbilityBehavior = ____exports.InstantImpactAbilityBehavior
|
|
|
12
12
|
InstantImpactAbilityBehavior.name = "InstantImpactAbilityBehavior"
|
|
13
13
|
__TS__ClassExtends(InstantImpactAbilityBehavior, AbilityBehavior)
|
|
14
14
|
function InstantImpactAbilityBehavior.prototype.onCastingStart(self, caster)
|
|
15
|
+
local abilityTypeId = self.ability.typeId
|
|
15
16
|
local manaCost = self:resolveCurrentAbilityDependentValue(MANA_COST_ABILITY_INTEGER_LEVEL_FIELD)
|
|
16
17
|
local cooldown = self:resolveCurrentAbilityDependentValue(COOLDOWN_ABILITY_FLOAT_LEVEL_FIELD)
|
|
18
|
+
if caster:getAbilityRemainingCooldown(abilityTypeId) ~= 0 or caster.mana < manaCost then
|
|
19
|
+
return
|
|
20
|
+
end
|
|
17
21
|
caster.mana = caster.mana - manaCost
|
|
18
22
|
if cooldown == 0 then
|
|
19
23
|
caster:interruptCast(self.ability.typeId)
|
|
@@ -25,7 +25,7 @@ local function timerCallback(source, target)
|
|
|
25
25
|
Event.invoke(autoAttackFinishEvent, source, target)
|
|
26
26
|
end
|
|
27
27
|
Unit.autoAttackStartEvent:addListener(function(source, target)
|
|
28
|
-
local attackPoint = source.weapons[1].
|
|
28
|
+
local attackPoint = source.weapons[1].impactDelay
|
|
29
29
|
local timer = Timer:simple(attackPoint, timerCallback, source, target)
|
|
30
30
|
eventTimerByUnit[source] = timer
|
|
31
31
|
end)
|
|
@@ -68,23 +68,44 @@ declare const modifiers: {
|
|
|
68
68
|
speed: (unit: junit, value: number) => void;
|
|
69
69
|
armor: (unit: junit, value: number) => void;
|
|
70
70
|
};
|
|
71
|
-
|
|
71
|
+
export declare class UnitWeapon {
|
|
72
|
+
readonly unit: Unit;
|
|
72
73
|
readonly index: 0 | 1;
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
74
|
+
constructor(unit: Unit, index: 0 | 1);
|
|
75
|
+
get cooldown(): number;
|
|
76
|
+
set cooldown(cooldown: number);
|
|
77
|
+
get damage(): [minimumDamage: number, maximumDamage: number];
|
|
78
|
+
set damage([minimumDamage, maximumDamage]: [number, number]);
|
|
79
|
+
get damageBase(): number;
|
|
80
|
+
set damageBase(damageBase: number);
|
|
81
|
+
get damageDiceCount(): number;
|
|
82
|
+
set damageDiceCount(damageDiceCount: number);
|
|
83
|
+
get damageDiceSideCount(): number;
|
|
84
|
+
set damageDiceSideCount(damageDiceSideCount: number);
|
|
85
|
+
get range(): number;
|
|
86
|
+
set range(range: number);
|
|
87
|
+
get impactDelay(): number;
|
|
88
|
+
set impactDelay(impactDelay: number);
|
|
89
|
+
get missileArc(): number;
|
|
90
|
+
set missileArc(missileArc: number);
|
|
91
|
+
get missileModelPath(): string;
|
|
92
|
+
set missileModelPath(missileModelPath: string);
|
|
93
|
+
get missileSpeed(): number;
|
|
94
|
+
set missileSpeed(missileSpeed: number);
|
|
78
95
|
}
|
|
79
96
|
declare const enum UnitPropertyKey {
|
|
80
97
|
IS_PAUSED = 100,
|
|
81
98
|
STUN_COUNTER = 101,
|
|
82
|
-
|
|
83
|
-
|
|
99
|
+
DELAY_HEALTH_CHECKS_COUNTER = 102,
|
|
100
|
+
DELAY_HEALTH_CHECKS_HEALTH_BONUS = 103,
|
|
101
|
+
PREVENT_DEATH_HEALTH_BONUS = 104,
|
|
102
|
+
IS_TEAM_GLOW_HIDDEN = 105
|
|
84
103
|
}
|
|
85
104
|
export declare class Unit extends Handle<junit> {
|
|
86
105
|
private [UnitPropertyKey.IS_PAUSED]?;
|
|
87
106
|
private [UnitPropertyKey.STUN_COUNTER]?;
|
|
107
|
+
private [UnitPropertyKey.DELAY_HEALTH_CHECKS_COUNTER]?;
|
|
108
|
+
private [UnitPropertyKey.DELAY_HEALTH_CHECKS_HEALTH_BONUS]?;
|
|
88
109
|
private [UnitPropertyKey.PREVENT_DEATH_HEALTH_BONUS]?;
|
|
89
110
|
private [UnitPropertyKey.IS_TEAM_GLOW_HIDDEN]?;
|
|
90
111
|
private _owner?;
|
|
@@ -123,6 +144,8 @@ export declare class Unit extends Handle<junit> {
|
|
|
123
144
|
playAnimation(animation: number): void;
|
|
124
145
|
queueAnimation(animation: string): void;
|
|
125
146
|
get weapons(): [UnitWeapon, UnitWeapon];
|
|
147
|
+
get firstWeapon(): UnitWeapon;
|
|
148
|
+
get secondWeapon(): UnitWeapon;
|
|
126
149
|
get level(): number;
|
|
127
150
|
set level(v: number);
|
|
128
151
|
get xp(): number;
|
|
@@ -148,6 +171,10 @@ export declare class Unit extends Handle<junit> {
|
|
|
148
171
|
set color(color: PlayerColor);
|
|
149
172
|
get acquisitionRange(): number;
|
|
150
173
|
set acquisitionRange(v: number);
|
|
174
|
+
/**
|
|
175
|
+
* Keeps this unit alive even if its health becomes negative until the current game thread yields.
|
|
176
|
+
*/
|
|
177
|
+
delayHealthChecks(): void;
|
|
151
178
|
get maxHealth(): number;
|
|
152
179
|
set maxHealth(maxHealth: number);
|
|
153
180
|
get healthRegenerationRate(): number;
|
|
@@ -222,6 +249,7 @@ export declare class Unit extends Handle<junit> {
|
|
|
222
249
|
getAbilityById(abilityId: number): UnitAbility | undefined;
|
|
223
250
|
removeAbility(abilityId: number): boolean;
|
|
224
251
|
hideAbility(abilityId: number, flag: boolean): void;
|
|
252
|
+
getAbilityRemainingCooldown(abilityId: number): number;
|
|
225
253
|
startAbilityCooldown(abilityId: number, cooldown: number): void;
|
|
226
254
|
endAbilityCooldown(abilityId: number): void;
|
|
227
255
|
interruptAttack(): void;
|
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
|
|
@@ -784,6 +914,9 @@ end
|
|
|
784
914
|
function Unit.prototype.hideAbility(self, abilityId, flag)
|
|
785
915
|
BlzUnitHideAbility(self.handle, abilityId, flag)
|
|
786
916
|
end
|
|
917
|
+
function Unit.prototype.getAbilityRemainingCooldown(self, abilityId)
|
|
918
|
+
return BlzGetUnitAbilityCooldownRemaining(self.handle, abilityId)
|
|
919
|
+
end
|
|
787
920
|
function Unit.prototype.startAbilityCooldown(self, abilityId, cooldown)
|
|
788
921
|
BlzStartUnitAbilityCooldown(self.handle, abilityId, cooldown)
|
|
789
922
|
end
|
|
@@ -1071,12 +1204,27 @@ __TS__SetDescriptor(
|
|
|
1071
1204
|
Unit.prototype,
|
|
1072
1205
|
"weapons",
|
|
1073
1206
|
{get = function(self)
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1207
|
+
return {self.firstWeapon, self.secondWeapon}
|
|
1208
|
+
end},
|
|
1209
|
+
true
|
|
1210
|
+
)
|
|
1211
|
+
__TS__SetDescriptor(
|
|
1212
|
+
Unit.prototype,
|
|
1213
|
+
"firstWeapon",
|
|
1214
|
+
{get = function(self)
|
|
1215
|
+
local weapon = __TS__New(____exports.UnitWeapon, self, 0)
|
|
1216
|
+
rawset(self, "firstWeapon", weapon)
|
|
1217
|
+
return weapon
|
|
1218
|
+
end},
|
|
1219
|
+
true
|
|
1220
|
+
)
|
|
1221
|
+
__TS__SetDescriptor(
|
|
1222
|
+
Unit.prototype,
|
|
1223
|
+
"secondWeapon",
|
|
1224
|
+
{get = function(self)
|
|
1225
|
+
local weapon = __TS__New(____exports.UnitWeapon, self, 1)
|
|
1226
|
+
rawset(self, "secondWeapon", weapon)
|
|
1227
|
+
return weapon
|
|
1080
1228
|
end},
|
|
1081
1229
|
true
|
|
1082
1230
|
)
|
|
@@ -1233,7 +1381,7 @@ __TS__SetDescriptor(
|
|
|
1233
1381
|
"isTeamGlowVisible",
|
|
1234
1382
|
{
|
|
1235
1383
|
get = function(self)
|
|
1236
|
-
return not self[
|
|
1384
|
+
return not self[105]
|
|
1237
1385
|
end,
|
|
1238
1386
|
set = function(self, isTeamGlowVisible)
|
|
1239
1387
|
showUnitTeamGlow(self.handle, isTeamGlowVisible)
|
|
@@ -1243,7 +1391,7 @@ __TS__SetDescriptor(
|
|
|
1243
1391
|
else
|
|
1244
1392
|
____temp_2 = nil
|
|
1245
1393
|
end
|
|
1246
|
-
self[
|
|
1394
|
+
self[105] = ____temp_2
|
|
1247
1395
|
end
|
|
1248
1396
|
},
|
|
1249
1397
|
true
|
|
@@ -1253,7 +1401,7 @@ __TS__SetDescriptor(
|
|
|
1253
1401
|
"color",
|
|
1254
1402
|
{set = function(self, color)
|
|
1255
1403
|
setUnitColor(self.handle, color.handle)
|
|
1256
|
-
if self[
|
|
1404
|
+
if self[105] then
|
|
1257
1405
|
showUnitTeamGlow(self.handle, false)
|
|
1258
1406
|
end
|
|
1259
1407
|
end},
|
|
@@ -1277,10 +1425,14 @@ __TS__SetDescriptor(
|
|
|
1277
1425
|
"maxHealth",
|
|
1278
1426
|
{
|
|
1279
1427
|
get = function(self)
|
|
1280
|
-
return BlzGetUnitMaxHP(self.handle) - (self[
|
|
1428
|
+
return BlzGetUnitMaxHP(self.handle) - (self[103] or 0) - (self[104] or 0)
|
|
1281
1429
|
end,
|
|
1282
1430
|
set = function(self, maxHealth)
|
|
1283
|
-
|
|
1431
|
+
if maxHealth < 1 and self[102] ~= nil then
|
|
1432
|
+
self[103] = (self[103] or 0) + (1 - maxHealth)
|
|
1433
|
+
maxHealth = 1
|
|
1434
|
+
end
|
|
1435
|
+
BlzSetUnitMaxHP(self.handle, maxHealth + (self[104] or 0))
|
|
1284
1436
|
end
|
|
1285
1437
|
},
|
|
1286
1438
|
true
|
|
@@ -1322,10 +1474,10 @@ __TS__SetDescriptor(
|
|
|
1322
1474
|
"health",
|
|
1323
1475
|
{
|
|
1324
1476
|
get = function(self)
|
|
1325
|
-
return GetWidgetLife(self.handle) - (self[
|
|
1477
|
+
return GetWidgetLife(self.handle) - (self[104] or 0)
|
|
1326
1478
|
end,
|
|
1327
1479
|
set = function(self, health)
|
|
1328
|
-
SetWidgetLife(self.handle, health + (self[
|
|
1480
|
+
SetWidgetLife(self.handle, health + (self[104] or 0))
|
|
1329
1481
|
end
|
|
1330
1482
|
},
|
|
1331
1483
|
true
|
|
@@ -2308,7 +2460,7 @@ Unit.onDamage = __TS__New(
|
|
|
2308
2460
|
invoke(event, source, target, evData)
|
|
2309
2461
|
if evData[0] ~= nil and target.health - evData.amount < 0.405 then
|
|
2310
2462
|
local bonusHealth = math.ceil(evData.amount)
|
|
2311
|
-
target[
|
|
2463
|
+
target[104] = (target[104] or 0) + bonusHealth
|
|
2312
2464
|
BlzSetUnitMaxHP(
|
|
2313
2465
|
target.handle,
|
|
2314
2466
|
BlzGetUnitMaxHP(target.handle) + bonusHealth
|
|
@@ -2322,7 +2474,7 @@ Unit.onDamage = __TS__New(
|
|
|
2322
2474
|
evData[0],
|
|
2323
2475
|
table.unpack(evData, 1 + 1, 1 + (evData[1] or 0))
|
|
2324
2476
|
)
|
|
2325
|
-
target[
|
|
2477
|
+
target[104] = (target[104] or 0) - bonusHealth
|
|
2326
2478
|
SetWidgetLife(
|
|
2327
2479
|
target.handle,
|
|
2328
2480
|
GetWidgetLife(target.handle) - bonusHealth
|
|
@@ -7,8 +7,8 @@ export declare class SpiritTouchAbilityType extends AbilityType {
|
|
|
7
7
|
set manaGain(manaGain: ObjectDataEntryLevelFieldValueSupplier<number>);
|
|
8
8
|
get manaRequirement(): number[];
|
|
9
9
|
set manaRequirement(manaRequirement: ObjectDataEntryLevelFieldValueSupplier<number>);
|
|
10
|
-
get maximumTargetCount(): number[];
|
|
11
|
-
set maximumTargetCount(maximumTargetCount: ObjectDataEntryLevelFieldValueSupplier<number>);
|
|
12
10
|
get maximumManaCostFactor(): number[];
|
|
13
11
|
set maximumManaCostFactor(maximumManaCostFactor: ObjectDataEntryLevelFieldValueSupplier<number>);
|
|
12
|
+
get maximumTargetCount(): number[];
|
|
13
|
+
set maximumTargetCount(maximumTargetCount: ObjectDataEntryLevelFieldValueSupplier<number>);
|
|
14
14
|
}
|
|
@@ -38,26 +38,26 @@ __TS__SetDescriptor(
|
|
|
38
38
|
)
|
|
39
39
|
__TS__SetDescriptor(
|
|
40
40
|
SpiritTouchAbilityType.prototype,
|
|
41
|
-
"
|
|
41
|
+
"maximumManaCostFactor",
|
|
42
42
|
{
|
|
43
43
|
get = function(self)
|
|
44
44
|
return self:getNumberLevelField("Rpb5")
|
|
45
45
|
end,
|
|
46
|
-
set = function(self,
|
|
47
|
-
self:setNumberLevelField("Rpb5",
|
|
46
|
+
set = function(self, maximumManaCostFactor)
|
|
47
|
+
self:setNumberLevelField("Rpb5", maximumManaCostFactor)
|
|
48
48
|
end
|
|
49
49
|
},
|
|
50
50
|
true
|
|
51
51
|
)
|
|
52
52
|
__TS__SetDescriptor(
|
|
53
53
|
SpiritTouchAbilityType.prototype,
|
|
54
|
-
"
|
|
54
|
+
"maximumTargetCount",
|
|
55
55
|
{
|
|
56
56
|
get = function(self)
|
|
57
57
|
return self:getNumberLevelField("Rpb6")
|
|
58
58
|
end,
|
|
59
|
-
set = function(self,
|
|
60
|
-
self:setNumberLevelField("Rpb6",
|
|
59
|
+
set = function(self, maximumTargetCount)
|
|
60
|
+
self:setNumberLevelField("Rpb6", maximumTargetCount)
|
|
61
61
|
end
|
|
62
62
|
},
|
|
63
63
|
true
|
|
@@ -28,6 +28,16 @@ export declare class UnitTypeWeapon {
|
|
|
28
28
|
set attackType(attackType: AttackType);
|
|
29
29
|
get backSwingDuration(): number;
|
|
30
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);
|
|
31
41
|
get impactDelay(): number;
|
|
32
42
|
set impactDelay(impactDelay: number);
|
|
33
43
|
get missileModelPath(): string;
|
|
@@ -176,9 +186,9 @@ export declare abstract class UnitType<Id extends UnitTypeId = UnitTypeId> exten
|
|
|
176
186
|
set combatClassifications(combatClassifications: CombatClassifications);
|
|
177
187
|
get unitClassifications(): UnitClassifications;
|
|
178
188
|
set unitClassifications(unitClassifications: UnitClassifications);
|
|
189
|
+
get weapons(): TupleOf<UnitTypeWeapon, 2>;
|
|
179
190
|
get firstWeapon(): UnitTypeWeapon;
|
|
180
191
|
get secondWeapon(): UnitTypeWeapon;
|
|
181
|
-
get weapons(): TupleOf<UnitTypeWeapon, 2>;
|
|
182
192
|
get flyHeight(): number;
|
|
183
193
|
set flyHeight(flyHeight: number);
|
|
184
194
|
get flyHeightMinimum(): number;
|
|
@@ -207,6 +217,16 @@ export declare abstract class UnitType<Id extends UnitTypeId = UnitTypeId> exten
|
|
|
207
217
|
set formationRank(formationRank: number);
|
|
208
218
|
get goldCost(): number;
|
|
209
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);
|
|
210
230
|
get isStructure(): boolean;
|
|
211
231
|
set isStructure(isStructure: boolean);
|
|
212
232
|
get race(): Race;
|
|
@@ -234,6 +254,6 @@ export declare abstract class HeroUnitType<Id extends HeroUnitTypeId = HeroUnitT
|
|
|
234
254
|
set heroAbilityTypeIds(heroAbilityTypeIds: AbilityTypeId[]);
|
|
235
255
|
get properNames(): string[];
|
|
236
256
|
set properNames(properNames: string | string[]);
|
|
237
|
-
get
|
|
238
|
-
set
|
|
257
|
+
get properNameCount(): number;
|
|
258
|
+
set properNameCount(properNameCount: number);
|
|
239
259
|
}
|
|
@@ -73,21 +73,21 @@ __TS__SetDescriptor(
|
|
|
73
73
|
)
|
|
74
74
|
__TS__SetDescriptor(
|
|
75
75
|
UnitTypeWeapon.prototype,
|
|
76
|
-
"
|
|
76
|
+
"cooldown",
|
|
77
77
|
{
|
|
78
78
|
get = function(self)
|
|
79
79
|
local ____self_4 = self.unitType
|
|
80
80
|
return ____self_4.getNumberField(
|
|
81
81
|
____self_4,
|
|
82
|
-
"
|
|
82
|
+
("ua" .. tostring(self.index)) .. "c"
|
|
83
83
|
)
|
|
84
84
|
end,
|
|
85
|
-
set = function(self,
|
|
85
|
+
set = function(self, cooldown)
|
|
86
86
|
local ____self_5 = self.unitType
|
|
87
87
|
____self_5.setNumberField(
|
|
88
88
|
____self_5,
|
|
89
|
-
"
|
|
90
|
-
|
|
89
|
+
("ua" .. tostring(self.index)) .. "c",
|
|
90
|
+
cooldown
|
|
91
91
|
)
|
|
92
92
|
end
|
|
93
93
|
},
|
|
@@ -95,21 +95,42 @@ __TS__SetDescriptor(
|
|
|
95
95
|
)
|
|
96
96
|
__TS__SetDescriptor(
|
|
97
97
|
UnitTypeWeapon.prototype,
|
|
98
|
-
"
|
|
98
|
+
"damage",
|
|
99
|
+
{
|
|
100
|
+
get = function(self)
|
|
101
|
+
local minimumDamage = self.damageBase + self.damageDiceCount
|
|
102
|
+
local maximumDamage = self.damageBase + self.damageDiceCount * self.damageDiceSideCount
|
|
103
|
+
return {minimumDamage, maximumDamage}
|
|
104
|
+
end,
|
|
105
|
+
set = function(self, ____bindingPattern0)
|
|
106
|
+
local maximumDamage
|
|
107
|
+
local minimumDamage
|
|
108
|
+
minimumDamage = ____bindingPattern0[1]
|
|
109
|
+
maximumDamage = ____bindingPattern0[2]
|
|
110
|
+
self.damageBase = minimumDamage - 1
|
|
111
|
+
self.damageDiceCount = 1
|
|
112
|
+
self.damageDiceSideCount = maximumDamage - minimumDamage + 1
|
|
113
|
+
end
|
|
114
|
+
},
|
|
115
|
+
true
|
|
116
|
+
)
|
|
117
|
+
__TS__SetDescriptor(
|
|
118
|
+
UnitTypeWeapon.prototype,
|
|
119
|
+
"damageBase",
|
|
99
120
|
{
|
|
100
121
|
get = function(self)
|
|
101
122
|
local ____self_6 = self.unitType
|
|
102
|
-
return ____self_6.
|
|
123
|
+
return ____self_6.getNumberField(
|
|
103
124
|
____self_6,
|
|
104
|
-
("ua" .. tostring(self.index)) .. "
|
|
125
|
+
("ua" .. tostring(self.index)) .. "b"
|
|
105
126
|
)
|
|
106
127
|
end,
|
|
107
|
-
set = function(self,
|
|
128
|
+
set = function(self, damageBase)
|
|
108
129
|
local ____self_7 = self.unitType
|
|
109
|
-
____self_7.
|
|
130
|
+
____self_7.setNumberField(
|
|
110
131
|
____self_7,
|
|
111
|
-
("ua" .. tostring(self.index)) .. "
|
|
112
|
-
|
|
132
|
+
("ua" .. tostring(self.index)) .. "b",
|
|
133
|
+
damageBase
|
|
113
134
|
)
|
|
114
135
|
end
|
|
115
136
|
},
|
|
@@ -117,19 +138,107 @@ __TS__SetDescriptor(
|
|
|
117
138
|
)
|
|
118
139
|
__TS__SetDescriptor(
|
|
119
140
|
UnitTypeWeapon.prototype,
|
|
120
|
-
"
|
|
141
|
+
"damageDiceCount",
|
|
121
142
|
{
|
|
122
143
|
get = function(self)
|
|
123
144
|
local ____self_8 = self.unitType
|
|
124
145
|
return ____self_8.getNumberField(
|
|
125
146
|
____self_8,
|
|
126
|
-
("ua" .. tostring(self.index)) .. "
|
|
147
|
+
("ua" .. tostring(self.index)) .. "d"
|
|
127
148
|
)
|
|
128
149
|
end,
|
|
129
|
-
set = function(self,
|
|
150
|
+
set = function(self, damageDiceNumber)
|
|
130
151
|
local ____self_9 = self.unitType
|
|
131
152
|
____self_9.setNumberField(
|
|
132
153
|
____self_9,
|
|
154
|
+
("ua" .. tostring(self.index)) .. "d",
|
|
155
|
+
damageDiceNumber
|
|
156
|
+
)
|
|
157
|
+
end
|
|
158
|
+
},
|
|
159
|
+
true
|
|
160
|
+
)
|
|
161
|
+
__TS__SetDescriptor(
|
|
162
|
+
UnitTypeWeapon.prototype,
|
|
163
|
+
"damageDiceSideCount",
|
|
164
|
+
{
|
|
165
|
+
get = function(self)
|
|
166
|
+
local ____self_10 = self.unitType
|
|
167
|
+
return ____self_10.getNumberField(
|
|
168
|
+
____self_10,
|
|
169
|
+
("ua" .. tostring(self.index)) .. "s"
|
|
170
|
+
)
|
|
171
|
+
end,
|
|
172
|
+
set = function(self, damageDiceSideCount)
|
|
173
|
+
local ____self_11 = self.unitType
|
|
174
|
+
____self_11.setNumberField(
|
|
175
|
+
____self_11,
|
|
176
|
+
("ua" .. tostring(self.index)) .. "s",
|
|
177
|
+
damageDiceSideCount
|
|
178
|
+
)
|
|
179
|
+
end
|
|
180
|
+
},
|
|
181
|
+
true
|
|
182
|
+
)
|
|
183
|
+
__TS__SetDescriptor(
|
|
184
|
+
UnitTypeWeapon.prototype,
|
|
185
|
+
"impactDelay",
|
|
186
|
+
{
|
|
187
|
+
get = function(self)
|
|
188
|
+
local ____self_12 = self.unitType
|
|
189
|
+
return ____self_12.getNumberField(
|
|
190
|
+
____self_12,
|
|
191
|
+
"udp" .. tostring(self.index)
|
|
192
|
+
)
|
|
193
|
+
end,
|
|
194
|
+
set = function(self, impactDelay)
|
|
195
|
+
local ____self_13 = self.unitType
|
|
196
|
+
____self_13.setNumberField(
|
|
197
|
+
____self_13,
|
|
198
|
+
"udp" .. tostring(self.index),
|
|
199
|
+
impactDelay
|
|
200
|
+
)
|
|
201
|
+
end
|
|
202
|
+
},
|
|
203
|
+
true
|
|
204
|
+
)
|
|
205
|
+
__TS__SetDescriptor(
|
|
206
|
+
UnitTypeWeapon.prototype,
|
|
207
|
+
"missileModelPath",
|
|
208
|
+
{
|
|
209
|
+
get = function(self)
|
|
210
|
+
local ____self_14 = self.unitType
|
|
211
|
+
return ____self_14.getStringField(
|
|
212
|
+
____self_14,
|
|
213
|
+
("ua" .. tostring(self.index)) .. "m"
|
|
214
|
+
)
|
|
215
|
+
end,
|
|
216
|
+
set = function(self, missileModelPath)
|
|
217
|
+
local ____self_15 = self.unitType
|
|
218
|
+
____self_15.setStringField(
|
|
219
|
+
____self_15,
|
|
220
|
+
("ua" .. tostring(self.index)) .. "m",
|
|
221
|
+
missileModelPath
|
|
222
|
+
)
|
|
223
|
+
end
|
|
224
|
+
},
|
|
225
|
+
true
|
|
226
|
+
)
|
|
227
|
+
__TS__SetDescriptor(
|
|
228
|
+
UnitTypeWeapon.prototype,
|
|
229
|
+
"range",
|
|
230
|
+
{
|
|
231
|
+
get = function(self)
|
|
232
|
+
local ____self_16 = self.unitType
|
|
233
|
+
return ____self_16.getNumberField(
|
|
234
|
+
____self_16,
|
|
235
|
+
("ua" .. tostring(self.index)) .. "r"
|
|
236
|
+
)
|
|
237
|
+
end,
|
|
238
|
+
set = function(self, range)
|
|
239
|
+
local ____self_17 = self.unitType
|
|
240
|
+
____self_17.setNumberField(
|
|
241
|
+
____self_17,
|
|
133
242
|
("ua" .. tostring(self.index)) .. "r",
|
|
134
243
|
range
|
|
135
244
|
)
|
|
@@ -142,16 +251,16 @@ __TS__SetDescriptor(
|
|
|
142
251
|
"soundType",
|
|
143
252
|
{
|
|
144
253
|
get = function(self)
|
|
145
|
-
local
|
|
146
|
-
return
|
|
147
|
-
|
|
254
|
+
local ____self_18 = self.unitType
|
|
255
|
+
return ____self_18.getStringField(
|
|
256
|
+
____self_18,
|
|
148
257
|
"ucs" .. tostring(self.index)
|
|
149
258
|
)
|
|
150
259
|
end,
|
|
151
260
|
set = function(self, soundType)
|
|
152
|
-
local
|
|
153
|
-
|
|
154
|
-
|
|
261
|
+
local ____self_19 = self.unitType
|
|
262
|
+
____self_19.setStringField(
|
|
263
|
+
____self_19,
|
|
155
264
|
"ucs" .. tostring(self.index),
|
|
156
265
|
soundType
|
|
157
266
|
)
|
|
@@ -164,16 +273,16 @@ __TS__SetDescriptor(
|
|
|
164
273
|
"soundTypeSD",
|
|
165
274
|
{
|
|
166
275
|
get = function(self)
|
|
167
|
-
local
|
|
168
|
-
return
|
|
169
|
-
|
|
276
|
+
local ____self_20 = self.unitType
|
|
277
|
+
return ____self_20.getStringField(
|
|
278
|
+
____self_20,
|
|
170
279
|
("ucs" .. tostring(self.index)) .. ":sd"
|
|
171
280
|
)
|
|
172
281
|
end,
|
|
173
282
|
set = function(self, soundTypeSD)
|
|
174
|
-
local
|
|
175
|
-
|
|
176
|
-
|
|
283
|
+
local ____self_21 = self.unitType
|
|
284
|
+
____self_21.setStringField(
|
|
285
|
+
____self_21,
|
|
177
286
|
("ucs" .. tostring(self.index)) .. ":sd",
|
|
178
287
|
soundTypeSD
|
|
179
288
|
)
|
|
@@ -186,16 +295,16 @@ __TS__SetDescriptor(
|
|
|
186
295
|
"soundTypeHD",
|
|
187
296
|
{
|
|
188
297
|
get = function(self)
|
|
189
|
-
local
|
|
190
|
-
return
|
|
191
|
-
|
|
298
|
+
local ____self_22 = self.unitType
|
|
299
|
+
return ____self_22.getStringField(
|
|
300
|
+
____self_22,
|
|
192
301
|
("ucs" .. tostring(self.index)) .. ":hd"
|
|
193
302
|
)
|
|
194
303
|
end,
|
|
195
304
|
set = function(self, soundTypeHD)
|
|
196
|
-
local
|
|
197
|
-
|
|
198
|
-
|
|
305
|
+
local ____self_23 = self.unitType
|
|
306
|
+
____self_23.setStringField(
|
|
307
|
+
____self_23,
|
|
199
308
|
("ucs" .. tostring(self.index)) .. ":hd",
|
|
200
309
|
soundTypeHD
|
|
201
310
|
)
|
|
@@ -1087,25 +1196,25 @@ __TS__SetDescriptor(
|
|
|
1087
1196
|
)
|
|
1088
1197
|
__TS__SetDescriptor(
|
|
1089
1198
|
UnitType.prototype,
|
|
1090
|
-
"
|
|
1199
|
+
"weapons",
|
|
1091
1200
|
{get = function(self)
|
|
1092
|
-
return self
|
|
1201
|
+
return getOrCreateUnitTypeWeapons(self)
|
|
1093
1202
|
end},
|
|
1094
1203
|
true
|
|
1095
1204
|
)
|
|
1096
1205
|
__TS__SetDescriptor(
|
|
1097
1206
|
UnitType.prototype,
|
|
1098
|
-
"
|
|
1207
|
+
"firstWeapon",
|
|
1099
1208
|
{get = function(self)
|
|
1100
|
-
return self.weapons[
|
|
1209
|
+
return self.weapons[1]
|
|
1101
1210
|
end},
|
|
1102
1211
|
true
|
|
1103
1212
|
)
|
|
1104
1213
|
__TS__SetDescriptor(
|
|
1105
1214
|
UnitType.prototype,
|
|
1106
|
-
"
|
|
1215
|
+
"secondWeapon",
|
|
1107
1216
|
{get = function(self)
|
|
1108
|
-
return
|
|
1217
|
+
return self.weapons[2]
|
|
1109
1218
|
end},
|
|
1110
1219
|
true
|
|
1111
1220
|
)
|
|
@@ -1291,6 +1400,71 @@ __TS__SetDescriptor(
|
|
|
1291
1400
|
},
|
|
1292
1401
|
true
|
|
1293
1402
|
)
|
|
1403
|
+
__TS__SetDescriptor(
|
|
1404
|
+
UnitType.prototype,
|
|
1405
|
+
"healthRegenerationRate",
|
|
1406
|
+
{
|
|
1407
|
+
get = function(self)
|
|
1408
|
+
return self:getNumberField("uhpr")
|
|
1409
|
+
end,
|
|
1410
|
+
set = function(self, healthRegenerationRate)
|
|
1411
|
+
self:setNumberField("uhpr", healthRegenerationRate)
|
|
1412
|
+
end
|
|
1413
|
+
},
|
|
1414
|
+
true
|
|
1415
|
+
)
|
|
1416
|
+
__TS__SetDescriptor(
|
|
1417
|
+
UnitType.prototype,
|
|
1418
|
+
"manaRegenerationRate",
|
|
1419
|
+
{
|
|
1420
|
+
get = function(self)
|
|
1421
|
+
return self:getNumberField("umpr")
|
|
1422
|
+
end,
|
|
1423
|
+
set = function(self, manaRegenerationRate)
|
|
1424
|
+
self:setNumberField("umpr", manaRegenerationRate)
|
|
1425
|
+
end
|
|
1426
|
+
},
|
|
1427
|
+
true
|
|
1428
|
+
)
|
|
1429
|
+
__TS__SetDescriptor(
|
|
1430
|
+
UnitType.prototype,
|
|
1431
|
+
"maximumHealth",
|
|
1432
|
+
{
|
|
1433
|
+
get = function(self)
|
|
1434
|
+
return self:getNumberField("uhpm")
|
|
1435
|
+
end,
|
|
1436
|
+
set = function(self, maximumHealth)
|
|
1437
|
+
self:setNumberField("uhpm", maximumHealth)
|
|
1438
|
+
end
|
|
1439
|
+
},
|
|
1440
|
+
true
|
|
1441
|
+
)
|
|
1442
|
+
__TS__SetDescriptor(
|
|
1443
|
+
UnitType.prototype,
|
|
1444
|
+
"maximumMana",
|
|
1445
|
+
{
|
|
1446
|
+
get = function(self)
|
|
1447
|
+
return self:getNumberField("umpm")
|
|
1448
|
+
end,
|
|
1449
|
+
set = function(self, maximumMana)
|
|
1450
|
+
self:setNumberField("umpm", maximumMana)
|
|
1451
|
+
end
|
|
1452
|
+
},
|
|
1453
|
+
true
|
|
1454
|
+
)
|
|
1455
|
+
__TS__SetDescriptor(
|
|
1456
|
+
UnitType.prototype,
|
|
1457
|
+
"initialMana",
|
|
1458
|
+
{
|
|
1459
|
+
get = function(self)
|
|
1460
|
+
return self:getNumberField("umpi")
|
|
1461
|
+
end,
|
|
1462
|
+
set = function(self, initialMana)
|
|
1463
|
+
self:setNumberField("umpi", initialMana)
|
|
1464
|
+
end
|
|
1465
|
+
},
|
|
1466
|
+
true
|
|
1467
|
+
)
|
|
1294
1468
|
__TS__SetDescriptor(
|
|
1295
1469
|
UnitType.prototype,
|
|
1296
1470
|
"isStructure",
|
|
@@ -1385,11 +1559,11 @@ __TS__SetDescriptor(
|
|
|
1385
1559
|
implementReadonlyNumberIndexSupplier(
|
|
1386
1560
|
____exports.UnitType,
|
|
1387
1561
|
function(id)
|
|
1388
|
-
local
|
|
1389
|
-
|
|
1390
|
-
__TS__ClassExtends(
|
|
1391
|
-
|
|
1392
|
-
return
|
|
1562
|
+
local ____class_24 = __TS__Class()
|
|
1563
|
+
____class_24.name = ____class_24.name
|
|
1564
|
+
__TS__ClassExtends(____class_24, ____exports.UnitType)
|
|
1565
|
+
____class_24.BASE_ID = id
|
|
1566
|
+
return ____class_24
|
|
1393
1567
|
end
|
|
1394
1568
|
)
|
|
1395
1569
|
____exports.HeroUnitType = __TS__Class()
|
|
@@ -1436,13 +1610,13 @@ __TS__SetDescriptor(
|
|
|
1436
1610
|
)
|
|
1437
1611
|
__TS__SetDescriptor(
|
|
1438
1612
|
HeroUnitType.prototype,
|
|
1439
|
-
"
|
|
1613
|
+
"properNameCount",
|
|
1440
1614
|
{
|
|
1441
1615
|
get = function(self)
|
|
1442
1616
|
return self:getNumberField("upru")
|
|
1443
1617
|
end,
|
|
1444
|
-
set = function(self,
|
|
1445
|
-
self:setNumberField("upru",
|
|
1618
|
+
set = function(self, properNameCount)
|
|
1619
|
+
self:setNumberField("upru", properNameCount)
|
|
1446
1620
|
end
|
|
1447
1621
|
},
|
|
1448
1622
|
true
|
|
@@ -1450,11 +1624,11 @@ __TS__SetDescriptor(
|
|
|
1450
1624
|
implementReadonlyNumberIndexSupplier(
|
|
1451
1625
|
____exports.HeroUnitType,
|
|
1452
1626
|
function(id)
|
|
1453
|
-
local
|
|
1454
|
-
|
|
1455
|
-
__TS__ClassExtends(
|
|
1456
|
-
|
|
1457
|
-
return
|
|
1627
|
+
local ____class_25 = __TS__Class()
|
|
1628
|
+
____class_25.name = ____class_25.name
|
|
1629
|
+
__TS__ClassExtends(____class_25, ____exports.HeroUnitType)
|
|
1630
|
+
____class_25.BASE_ID = id
|
|
1631
|
+
return ____class_25
|
|
1458
1632
|
end
|
|
1459
1633
|
)
|
|
1460
1634
|
return ____exports
|
|
@@ -9,11 +9,31 @@ export declare const RIFLEMAN_UNIT_TYPE_ID: StandardUnitTypeId;
|
|
|
9
9
|
export declare const SIEGE_ENGINE_UNIT_TYPE_ID: StandardUnitTypeId;
|
|
10
10
|
export declare const SORCERESS_UNIT_TYPE_ID: StandardUnitTypeId;
|
|
11
11
|
export declare const SPELLBREAKER_UNIT_TYPE_ID: StandardUnitTypeId;
|
|
12
|
-
export declare const PALADIN_HERO_UNIT_TYPE_ID: StandardHeroUnitTypeId;
|
|
13
12
|
export declare const ARCHMAGE_HERO_UNIT_TYPE_ID: StandardHeroUnitTypeId;
|
|
13
|
+
export declare const BLOOD_MAGE_HERO_UNIT_TYPE_ID: StandardHeroUnitTypeId;
|
|
14
|
+
export declare const MOUNTAIN_KING_HERO_UNIT_TYPE_ID: StandardHeroUnitTypeId;
|
|
15
|
+
export declare const PALADIN_HERO_UNIT_TYPE_ID: StandardHeroUnitTypeId;
|
|
14
16
|
export declare const CAPTAIN_UNIT_TYPE_ID: StandardUnitTypeId;
|
|
17
|
+
export declare const ADMIRAL_PROUDMOORE_HERO_UNIT_TYPE_ID: StandardHeroUnitTypeId;
|
|
18
|
+
export declare const ANASTERIAN_SUNSTRIDER_HERO_UNIT_TYPE_ID: StandardHeroUnitTypeId;
|
|
19
|
+
export declare const ANTONIDAS_HERO_UNIT_TYPE_ID: StandardHeroUnitTypeId;
|
|
20
|
+
export declare const ANTONIDAS_GHOST_HERO_UNIT_TYPE_ID: StandardHeroUnitTypeId;
|
|
15
21
|
export declare const ARTHAS_HERO_UNIT_TYPE_ID: StandardHeroUnitTypeId;
|
|
16
22
|
export declare const ARTHAS_WITH_FROSTMOURNE_HERO_UNIT_TYPE_ID: StandardHeroUnitTypeId;
|
|
23
|
+
export declare const DAGREN_THE_ORCSLAYER_HERO_UNIT_TYPE_ID: StandardHeroUnitTypeId;
|
|
24
|
+
export declare const HALAHK_THE_LIFEBRINGER_HERO_UNIT_TYPE_ID: StandardHeroUnitTypeId;
|
|
25
|
+
export declare const JAINA_HERO_UNIT_TYPE_ID: StandardHeroUnitTypeId;
|
|
26
|
+
export declare const JENNALLA_DEEMSPRING_HERO_UNIT_TYPE_ID: StandardHeroUnitTypeId;
|
|
27
|
+
export declare const KAEL_HERO_UNIT_TYPE_ID: StandardHeroUnitTypeId;
|
|
28
|
+
export declare const KELEN_THE_SEEKER_HERO_UNIT_TYPE_ID: StandardHeroUnitTypeId;
|
|
29
|
+
export declare const LORD_GARITHOS_HERO_UNIT_TYPE_ID: StandardHeroUnitTypeId;
|
|
30
|
+
export declare const LORD_NICHOLAS_BUZAN_HERO_UNIT_TYPE_ID: StandardHeroUnitTypeId;
|
|
31
|
+
export declare const MAGROTH_THE_DEFENDER_HERO_UNIT_TYPE_ID: StandardHeroUnitTypeId;
|
|
32
|
+
export declare const MURADIN_BRONZEBEARD_HERO_UNIT_TYPE_ID: StandardHeroUnitTypeId;
|
|
33
|
+
export declare const SIR_GREGORY_EDMUNSON_HERO_UNIT_TYPE_ID: StandardHeroUnitTypeId;
|
|
34
|
+
export declare const SYLVANAS_WINDRUNNER_HERO_UNIT_TYPE_ID: StandardHeroUnitTypeId;
|
|
35
|
+
export declare const THALORIEN_DAWNSEEKER_HERO_UNIT_TYPE_ID: StandardHeroUnitTypeId;
|
|
36
|
+
export declare const UTHER_HERO_UNIT_TYPE_ID: StandardHeroUnitTypeId;
|
|
17
37
|
export declare const BATRIDER_UNIT_TYPE_ID: StandardUnitTypeId;
|
|
18
38
|
export declare const DEMOLISHER_UNIT_TYPE_ID: StandardUnitTypeId;
|
|
19
39
|
export declare const GRUNT_UNIT_TYPE_ID: StandardUnitTypeId;
|
|
@@ -8,11 +8,31 @@ ____exports.RIFLEMAN_UNIT_TYPE_ID = fourCC("hrif")
|
|
|
8
8
|
____exports.SIEGE_ENGINE_UNIT_TYPE_ID = fourCC("hmtt")
|
|
9
9
|
____exports.SORCERESS_UNIT_TYPE_ID = fourCC("hsor")
|
|
10
10
|
____exports.SPELLBREAKER_UNIT_TYPE_ID = fourCC("hspt")
|
|
11
|
-
____exports.PALADIN_HERO_UNIT_TYPE_ID = fourCC("Hpal")
|
|
12
11
|
____exports.ARCHMAGE_HERO_UNIT_TYPE_ID = fourCC("Hamg")
|
|
12
|
+
____exports.BLOOD_MAGE_HERO_UNIT_TYPE_ID = fourCC("Hblm")
|
|
13
|
+
____exports.MOUNTAIN_KING_HERO_UNIT_TYPE_ID = fourCC("Hmkg")
|
|
14
|
+
____exports.PALADIN_HERO_UNIT_TYPE_ID = fourCC("Hpal")
|
|
13
15
|
____exports.CAPTAIN_UNIT_TYPE_ID = fourCC("hcth")
|
|
16
|
+
____exports.ADMIRAL_PROUDMOORE_HERO_UNIT_TYPE_ID = fourCC("Hapm")
|
|
17
|
+
____exports.ANASTERIAN_SUNSTRIDER_HERO_UNIT_TYPE_ID = fourCC("Hssa")
|
|
18
|
+
____exports.ANTONIDAS_HERO_UNIT_TYPE_ID = fourCC("Hant")
|
|
19
|
+
____exports.ANTONIDAS_GHOST_HERO_UNIT_TYPE_ID = fourCC("Hgam")
|
|
14
20
|
____exports.ARTHAS_HERO_UNIT_TYPE_ID = fourCC("Hart")
|
|
15
21
|
____exports.ARTHAS_WITH_FROSTMOURNE_HERO_UNIT_TYPE_ID = fourCC("Harf")
|
|
22
|
+
____exports.DAGREN_THE_ORCSLAYER_HERO_UNIT_TYPE_ID = fourCC("Hdgo")
|
|
23
|
+
____exports.HALAHK_THE_LIFEBRINGER_HERO_UNIT_TYPE_ID = fourCC("Hhkl")
|
|
24
|
+
____exports.JAINA_HERO_UNIT_TYPE_ID = fourCC("Hjai")
|
|
25
|
+
____exports.JENNALLA_DEEMSPRING_HERO_UNIT_TYPE_ID = fourCC("Hjnd")
|
|
26
|
+
____exports.KAEL_HERO_UNIT_TYPE_ID = fourCC("Hkal")
|
|
27
|
+
____exports.KELEN_THE_SEEKER_HERO_UNIT_TYPE_ID = fourCC("Haah")
|
|
28
|
+
____exports.LORD_GARITHOS_HERO_UNIT_TYPE_ID = fourCC("Hlgr")
|
|
29
|
+
____exports.LORD_NICHOLAS_BUZAN_HERO_UNIT_TYPE_ID = fourCC("Hpb1")
|
|
30
|
+
____exports.MAGROTH_THE_DEFENDER_HERO_UNIT_TYPE_ID = fourCC("Hmgd")
|
|
31
|
+
____exports.MURADIN_BRONZEBEARD_HERO_UNIT_TYPE_ID = fourCC("Hmbr")
|
|
32
|
+
____exports.SIR_GREGORY_EDMUNSON_HERO_UNIT_TYPE_ID = fourCC("Hpb2")
|
|
33
|
+
____exports.SYLVANAS_WINDRUNNER_HERO_UNIT_TYPE_ID = fourCC("Hvwd")
|
|
34
|
+
____exports.THALORIEN_DAWNSEEKER_HERO_UNIT_TYPE_ID = fourCC("Hddt")
|
|
35
|
+
____exports.UTHER_HERO_UNIT_TYPE_ID = fourCC("Huth")
|
|
16
36
|
____exports.BATRIDER_UNIT_TYPE_ID = fourCC("otbr")
|
|
17
37
|
____exports.DEMOLISHER_UNIT_TYPE_ID = fourCC("ocat")
|
|
18
38
|
____exports.GRUNT_UNIT_TYPE_ID = fourCC("ogru")
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package",
|
|
3
3
|
"name": "warscript",
|
|
4
|
-
"version": "0.0.1-dev.
|
|
4
|
+
"version": "0.0.1-dev.9d56c5c",
|
|
5
5
|
"description": "A typescript library for Warcraft III using Warpack.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"warcraft",
|
|
@@ -22,10 +22,9 @@
|
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
24
|
"@warscript/language-extensions": "^0.0.1",
|
|
25
|
-
"@warscript/tstl-plugin": "^0.0.
|
|
26
|
-
"typescript-to-lua": "^1.24.1",
|
|
25
|
+
"@warscript/tstl-plugin": "^0.0.3",
|
|
27
26
|
"lua-types": "^2.13.1",
|
|
28
|
-
"warpack": "0.0.1-dev.
|
|
27
|
+
"warpack": "0.0.1-dev.ec41c86"
|
|
29
28
|
},
|
|
30
29
|
"devDependencies": {
|
|
31
30
|
"@typescript-eslint/eslint-plugin": "^5.59.11",
|
package/string.d.ts
CHANGED
|
@@ -103,4 +103,18 @@ declare global {
|
|
|
103
103
|
function isNotBlank(string: string): boolean;
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
|
+
declare global {
|
|
107
|
+
namespace string {
|
|
108
|
+
/**
|
|
109
|
+
* Returns the number of characters matching the given predicate.
|
|
110
|
+
*/
|
|
111
|
+
function count(string: string, predicate: (char: string) => boolean): number;
|
|
112
|
+
}
|
|
113
|
+
interface String {
|
|
114
|
+
/**
|
|
115
|
+
* Returns the number of characters matching the given predicate.
|
|
116
|
+
*/
|
|
117
|
+
count(predicate: (char: string) => boolean): number;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
106
120
|
export {};
|
package/string.lua
CHANGED
|
@@ -31,4 +31,13 @@ end
|
|
|
31
31
|
_G.string.isNotBlank = function(____string)
|
|
32
32
|
return (match(____string, "^%s*$")) == nil
|
|
33
33
|
end
|
|
34
|
+
_G.string.count = function(____string, predicate)
|
|
35
|
+
local result = 0
|
|
36
|
+
for i = 1, #____string do
|
|
37
|
+
if predicate(sub(____string, i, i)) then
|
|
38
|
+
result = result + 1
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
return result
|
|
42
|
+
end
|
|
34
43
|
return ____exports
|