warscript 0.0.1-dev.5dbd5af → 0.0.1-dev.5fb7641
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 +5 -0
- package/attributes.lua +8 -1
- package/core/types/order.d.ts +1 -0
- package/core/types/order.lua +11 -1
- package/engine/behaviour/ability/damage.d.ts +4 -2
- package/engine/behaviour/ability/damage.lua +24 -36
- package/engine/behaviour/ability/emulate-impact.lua +9 -2
- package/engine/behaviour/ability.lua +1 -1
- package/engine/behaviour/unit.d.ts +15 -0
- package/engine/behaviour/unit.lua +114 -4
- package/engine/internal/ability.d.ts +4 -0
- package/engine/internal/ability.lua +17 -0
- package/engine/internal/item/ability.lua +12 -10
- package/engine/internal/item.d.ts +3 -1
- package/engine/internal/item.lua +75 -3
- package/engine/internal/misc/damage-metadata-by-target.d.ts +2 -0
- package/engine/internal/misc/damage-metadata-by-target.lua +5 -0
- package/engine/internal/unit/ability.d.ts +5 -0
- package/engine/internal/unit/ability.lua +14 -0
- package/engine/internal/unit/allowed-targets.d.ts +1 -1
- package/engine/internal/unit/allowed-targets.lua +9 -1
- package/engine/internal/unit+damage.d.ts +1 -1
- package/engine/internal/unit+damage.lua +6 -1
- package/engine/internal/unit-missile-launch.lua +1 -1
- package/engine/internal/unit.d.ts +12 -2
- package/engine/internal/unit.lua +123 -33
- package/engine/object-data/entry/ability-type/permanent-invisibility.d.ts +8 -0
- package/engine/object-data/entry/ability-type/permanent-invisibility.lua +26 -0
- package/engine/object-field.d.ts +6 -3
- package/engine/object-field.lua +85 -73
- package/engine/text-tag.d.ts +12 -1
- package/engine/text-tag.lua +44 -10
- package/package.json +1 -1
- package/utility/arrays.d.ts +1 -0
- package/utility/arrays.lua +3 -0
- package/utility/functions.d.ts +1 -0
- package/utility/functions.lua +1 -0
- package/utility/lua-maps.d.ts +1 -0
- package/utility/lua-maps.lua +4 -0
package/engine/internal/unit.lua
CHANGED
|
@@ -56,13 +56,14 @@ local ignoreEventsItems = ____ignore_2Devents_2Ditems.ignoreEventsItems
|
|
|
56
56
|
local ____attack_2Dtype = require("engine.object-data.auxiliary.attack-type")
|
|
57
57
|
local attackTypeToNative = ____attack_2Dtype.attackTypeToNative
|
|
58
58
|
local nativeToAttackType = ____attack_2Dtype.nativeToAttackType
|
|
59
|
+
local ____damage_2Dmetadata_2Dby_2Dtarget = require("engine.internal.misc.damage-metadata-by-target")
|
|
60
|
+
local damageMetadataByTarget = ____damage_2Dmetadata_2Dby_2Dtarget.damageMetadataByTarget
|
|
61
|
+
local ____attributes = require("attributes")
|
|
62
|
+
local isAttribute = ____attributes.isAttribute
|
|
59
63
|
local match = string.match
|
|
60
64
|
local ____tostring = _G.tostring
|
|
61
65
|
local setUnitAnimation = SetUnitAnimation
|
|
62
|
-
local setUnitAnimationWithRarity = SetUnitAnimationWithRarity
|
|
63
66
|
local setUnitAnimationByIndex = SetUnitAnimationByIndex
|
|
64
|
-
local resetUnitAnimation = ResetUnitAnimation
|
|
65
|
-
local queueUnitAnimation = QueueUnitAnimation
|
|
66
67
|
local getUnitIntegerField = BlzGetUnitIntegerField
|
|
67
68
|
local getUnitRealField = BlzGetUnitRealField
|
|
68
69
|
local getHeroStr = GetHeroStr
|
|
@@ -84,7 +85,6 @@ local getHandleId = GetHandleId
|
|
|
84
85
|
local getUnitCurrentOrder = GetUnitCurrentOrder
|
|
85
86
|
local createUnit = CreateUnit
|
|
86
87
|
local killUnit = KillUnit
|
|
87
|
-
local setUnitExploded = SetUnitExploded
|
|
88
88
|
local removeUnit = RemoveUnit
|
|
89
89
|
local getUnitTypeId = GetUnitTypeId
|
|
90
90
|
local isHeroUnitId = IsHeroUnitId
|
|
@@ -100,8 +100,6 @@ local getSpellTargetItem = GetSpellTargetItem
|
|
|
100
100
|
local getSpellTargetDestructable = GetSpellTargetDestructable
|
|
101
101
|
local isUnitInRangeXY = IsUnitInRangeXY
|
|
102
102
|
local isUnitInRange = IsUnitInRange
|
|
103
|
-
local setResourceAmount = SetResourceAmount
|
|
104
|
-
local getResourceAmount = GetResourceAmount
|
|
105
103
|
local getUnitWeaponRealField = BlzGetUnitWeaponRealField
|
|
106
104
|
local setUnitWeaponRealField = BlzSetUnitWeaponRealField
|
|
107
105
|
local getUnitWeaponStringField = BlzGetUnitWeaponStringField
|
|
@@ -132,8 +130,6 @@ local isUnitType = IsUnitType
|
|
|
132
130
|
local isUnitAlly = IsUnitAlly
|
|
133
131
|
local isUnitEnemy = IsUnitEnemy
|
|
134
132
|
local getOwningPlayer = GetOwningPlayer
|
|
135
|
-
local setUnitColor = SetUnitColor
|
|
136
|
-
local showUnitTeamGlow = BlzShowUnitTeamGlow
|
|
137
133
|
____exports.UnitClassification = {}
|
|
138
134
|
local UnitClassification = ____exports.UnitClassification
|
|
139
135
|
do
|
|
@@ -143,6 +139,7 @@ do
|
|
|
143
139
|
UnitClassification.GROUND = UNIT_TYPE_GROUND
|
|
144
140
|
UnitClassification.SUMMONED = UNIT_TYPE_SUMMONED
|
|
145
141
|
UnitClassification.MECHANICAL = UNIT_TYPE_MECHANICAL
|
|
142
|
+
UnitClassification.WORKER = UNIT_TYPE_PEON
|
|
146
143
|
UnitClassification.ANCIENT = UNIT_TYPE_ANCIENT
|
|
147
144
|
UnitClassification.SUICIDAL = UNIT_TYPE_SAPPER
|
|
148
145
|
UnitClassification.TAUREN = UNIT_TYPE_TAUREN
|
|
@@ -350,6 +347,9 @@ local function dispatchAbility(event)
|
|
|
350
347
|
}
|
|
351
348
|
)
|
|
352
349
|
end
|
|
350
|
+
local function damagingEventPreventRetaliation(self)
|
|
351
|
+
self[0] = true
|
|
352
|
+
end
|
|
353
353
|
local function damageEventPreventDeath(self, callback, ...)
|
|
354
354
|
if self[0] ~= nil then
|
|
355
355
|
return
|
|
@@ -446,6 +446,19 @@ __TS__SetDescriptor(
|
|
|
446
446
|
},
|
|
447
447
|
true
|
|
448
448
|
)
|
|
449
|
+
__TS__SetDescriptor(
|
|
450
|
+
UnitWeapon.prototype,
|
|
451
|
+
"allowedTargetCombatClassifications",
|
|
452
|
+
{
|
|
453
|
+
get = function(self)
|
|
454
|
+
return BlzGetUnitWeaponIntegerField(self.unit.handle, UNIT_WEAPON_IF_ATTACK_TARGETS_ALLOWED, self.index)
|
|
455
|
+
end,
|
|
456
|
+
set = function(self, allowedTargetCombatClassifications)
|
|
457
|
+
BlzSetUnitWeaponIntegerField(self.unit.handle, UNIT_WEAPON_IF_ATTACK_TARGETS_ALLOWED, self.index, allowedTargetCombatClassifications)
|
|
458
|
+
end
|
|
459
|
+
},
|
|
460
|
+
true
|
|
461
|
+
)
|
|
449
462
|
__TS__SetDescriptor(
|
|
450
463
|
UnitWeapon.prototype,
|
|
451
464
|
"damageBase",
|
|
@@ -650,7 +663,8 @@ local function delayHealthChecksCallback(unit)
|
|
|
650
663
|
end
|
|
651
664
|
end
|
|
652
665
|
local nextSyncId = 1
|
|
653
|
-
local unitBySyncId = setmetatable({}, {__mode = "
|
|
666
|
+
local unitBySyncId = setmetatable({}, {__mode = "v"})
|
|
667
|
+
local damagingEventByTarget = setmetatable({}, {__mode = "k"})
|
|
654
668
|
____exports.Unit = __TS__Class()
|
|
655
669
|
local Unit = ____exports.Unit
|
|
656
670
|
Unit.name = "Unit"
|
|
@@ -803,16 +817,25 @@ function Unit.prototype.playAnimation(self, animation, rarity)
|
|
|
803
817
|
if type(animation) == "number" then
|
|
804
818
|
setUnitAnimationByIndex(self.handle, animation)
|
|
805
819
|
elseif rarity then
|
|
806
|
-
|
|
820
|
+
SetUnitAnimationWithRarity(self.handle, animation, rarity)
|
|
807
821
|
else
|
|
808
822
|
setUnitAnimation(self.handle, animation)
|
|
809
823
|
end
|
|
810
824
|
end
|
|
811
825
|
function Unit.prototype.resetAnimation(self)
|
|
812
|
-
|
|
826
|
+
ResetUnitAnimation(self.handle)
|
|
813
827
|
end
|
|
814
828
|
function Unit.prototype.queueAnimation(self, animation)
|
|
815
|
-
|
|
829
|
+
QueueUnitAnimation(self.handle, animation)
|
|
830
|
+
end
|
|
831
|
+
function Unit.prototype.chooseWeapon(self, target)
|
|
832
|
+
if target:isAllowedTarget(self, self.firstWeapon.allowedTargetCombatClassifications) then
|
|
833
|
+
return self.firstWeapon
|
|
834
|
+
end
|
|
835
|
+
if target:isAllowedTarget(target, self.secondWeapon.allowedTargetCombatClassifications) then
|
|
836
|
+
return self.secondWeapon
|
|
837
|
+
end
|
|
838
|
+
return nil
|
|
816
839
|
end
|
|
817
840
|
function Unit.prototype.delayHealthChecks(self)
|
|
818
841
|
self[103] = (self[103] or 0) + 1
|
|
@@ -825,7 +848,7 @@ function Unit.prototype.isSelected(self, player)
|
|
|
825
848
|
return IsUnitSelected(self.handle, player.handle)
|
|
826
849
|
end
|
|
827
850
|
function Unit.prototype.explode(self)
|
|
828
|
-
|
|
851
|
+
SetUnitExploded(self.handle, true)
|
|
829
852
|
killUnit(self.handle)
|
|
830
853
|
end
|
|
831
854
|
function Unit.prototype.kill(self)
|
|
@@ -1439,7 +1462,7 @@ __TS__SetDescriptor(
|
|
|
1439
1462
|
return not self[106]
|
|
1440
1463
|
end,
|
|
1441
1464
|
set = function(self, isTeamGlowVisible)
|
|
1442
|
-
|
|
1465
|
+
BlzShowUnitTeamGlow(self.handle, isTeamGlowVisible)
|
|
1443
1466
|
local ____temp_6
|
|
1444
1467
|
if not isTeamGlowVisible then
|
|
1445
1468
|
____temp_6 = true
|
|
@@ -1455,9 +1478,9 @@ __TS__SetDescriptor(
|
|
|
1455
1478
|
Unit.prototype,
|
|
1456
1479
|
"color",
|
|
1457
1480
|
{set = function(self, color)
|
|
1458
|
-
|
|
1481
|
+
SetUnitColor(self.handle, color.handle)
|
|
1459
1482
|
if self[106] then
|
|
1460
|
-
|
|
1483
|
+
BlzShowUnitTeamGlow(self.handle, false)
|
|
1461
1484
|
end
|
|
1462
1485
|
end},
|
|
1463
1486
|
true
|
|
@@ -1725,10 +1748,10 @@ __TS__SetDescriptor(
|
|
|
1725
1748
|
"gold",
|
|
1726
1749
|
{
|
|
1727
1750
|
get = function(self)
|
|
1728
|
-
return
|
|
1751
|
+
return GetResourceAmount(self.handle)
|
|
1729
1752
|
end,
|
|
1730
1753
|
set = function(self, gold)
|
|
1731
|
-
|
|
1754
|
+
SetResourceAmount(self.handle, gold)
|
|
1732
1755
|
end
|
|
1733
1756
|
},
|
|
1734
1757
|
true
|
|
@@ -2050,6 +2073,14 @@ __TS__SetDescriptor(
|
|
|
2050
2073
|
end},
|
|
2051
2074
|
true
|
|
2052
2075
|
)
|
|
2076
|
+
__TS__SetDescriptor(
|
|
2077
|
+
Unit.prototype,
|
|
2078
|
+
"targetAcquiredEvent",
|
|
2079
|
+
{get = function(self)
|
|
2080
|
+
return self:getEvent(EVENT_UNIT_ACQUIRED_TARGET)
|
|
2081
|
+
end},
|
|
2082
|
+
true
|
|
2083
|
+
)
|
|
2053
2084
|
__TS__SetDescriptor(
|
|
2054
2085
|
Unit.prototype,
|
|
2055
2086
|
"onSelect",
|
|
@@ -2411,13 +2442,19 @@ Unit.onDamaging = (function()
|
|
|
2411
2442
|
if source and source.typeId == dummyUnitId then
|
|
2412
2443
|
source = nil
|
|
2413
2444
|
end
|
|
2414
|
-
local target = BlzGetEventDamageTarget()
|
|
2445
|
+
local target = ____exports.Unit:of(BlzGetEventDamageTarget())
|
|
2446
|
+
local metadata = damageMetadataByTarget[target]
|
|
2447
|
+
damageMetadataByTarget[target] = nil
|
|
2415
2448
|
local data = {
|
|
2416
2449
|
amount = GetEventDamage(),
|
|
2417
2450
|
attackType = nativeToAttackType(BlzGetEventAttackType()),
|
|
2418
2451
|
damageType = BlzGetEventDamageType(),
|
|
2419
2452
|
weaponType = BlzGetEventWeaponType(),
|
|
2420
|
-
|
|
2453
|
+
metadata = metadata,
|
|
2454
|
+
isAttack = BlzGetEventIsAttack(),
|
|
2455
|
+
originalAmount = GetEventDamage(),
|
|
2456
|
+
originalMetadata = metadata,
|
|
2457
|
+
preventRetaliation = damagingEventPreventRetaliation
|
|
2421
2458
|
}
|
|
2422
2459
|
if data.isAttack and source then
|
|
2423
2460
|
local weapon = BlzGetUnitWeaponBooleanField(source.handle, UNIT_WEAPON_BF_ATTACKS_ENABLED, 1) and (BlzGetUnitWeaponBooleanField(source.handle, UNIT_WEAPON_BF_ATTACKS_ENABLED, 0) and -1 or 1) or 0
|
|
@@ -2431,18 +2468,36 @@ Unit.onDamaging = (function()
|
|
|
2431
2468
|
invoke(
|
|
2432
2469
|
event,
|
|
2433
2470
|
source,
|
|
2434
|
-
|
|
2471
|
+
target,
|
|
2435
2472
|
setmetatable(
|
|
2436
2473
|
{},
|
|
2437
2474
|
{
|
|
2438
2475
|
__index = data,
|
|
2439
2476
|
__newindex = function(self, key, value)
|
|
2440
|
-
damageSetters[key]
|
|
2477
|
+
local damageSetter = damageSetters[key]
|
|
2478
|
+
if damageSetter ~= nil then
|
|
2479
|
+
damageSetter(value)
|
|
2480
|
+
end
|
|
2441
2481
|
data[key] = value
|
|
2442
2482
|
end
|
|
2443
2483
|
}
|
|
2444
2484
|
)
|
|
2445
2485
|
)
|
|
2486
|
+
if data[0] and source then
|
|
2487
|
+
local sourceOwner = source.owner.handle
|
|
2488
|
+
data[1] = sourceOwner
|
|
2489
|
+
local targetOwner = target.owner.handle
|
|
2490
|
+
data[2] = targetOwner
|
|
2491
|
+
if not GetPlayerAlliance(sourceOwner, targetOwner, ALLIANCE_PASSIVE) then
|
|
2492
|
+
SetPlayerAlliance(sourceOwner, targetOwner, ALLIANCE_PASSIVE, true)
|
|
2493
|
+
data[3] = true
|
|
2494
|
+
end
|
|
2495
|
+
if not GetPlayerAlliance(targetOwner, sourceOwner, ALLIANCE_PASSIVE) then
|
|
2496
|
+
SetPlayerAlliance(targetOwner, sourceOwner, ALLIANCE_PASSIVE, true)
|
|
2497
|
+
data[4] = true
|
|
2498
|
+
end
|
|
2499
|
+
end
|
|
2500
|
+
damagingEventByTarget[target] = data
|
|
2446
2501
|
return
|
|
2447
2502
|
end
|
|
2448
2503
|
BlzSetEventDamage(0)
|
|
@@ -2450,7 +2505,7 @@ Unit.onDamaging = (function()
|
|
|
2450
2505
|
BlzSetEventDamageType(DAMAGE_TYPE_UNKNOWN)
|
|
2451
2506
|
BlzSetEventWeaponType(WEAPON_TYPE_WHOKNOWS)
|
|
2452
2507
|
local sourceOwner = source.owner.handle
|
|
2453
|
-
local targetOwner =
|
|
2508
|
+
local targetOwner = target.owner.handle
|
|
2454
2509
|
if not GetPlayerAlliance(sourceOwner, targetOwner, ALLIANCE_PASSIVE) then
|
|
2455
2510
|
SetPlayerAlliance(sourceOwner, targetOwner, ALLIANCE_PASSIVE, true)
|
|
2456
2511
|
Timer:run(function()
|
|
@@ -2466,19 +2521,15 @@ Unit.onDamaging = (function()
|
|
|
2466
2521
|
for ____, ____value in ipairs(source._attackHandlers) do
|
|
2467
2522
|
local condition = ____value[1]
|
|
2468
2523
|
local action = ____value[2]
|
|
2469
|
-
if condition(
|
|
2470
|
-
source,
|
|
2471
|
-
____exports.Unit:of(target),
|
|
2472
|
-
data
|
|
2473
|
-
) then
|
|
2524
|
+
if condition(source, target, data) then
|
|
2474
2525
|
action(
|
|
2475
2526
|
source,
|
|
2476
|
-
|
|
2527
|
+
target,
|
|
2477
2528
|
setmetatable(
|
|
2478
2529
|
{fire = function()
|
|
2479
2530
|
UnitDamageTarget(
|
|
2480
2531
|
source.handle,
|
|
2481
|
-
target,
|
|
2532
|
+
target.handle,
|
|
2482
2533
|
data.amount,
|
|
2483
2534
|
true,
|
|
2484
2535
|
true,
|
|
@@ -2509,26 +2560,50 @@ Unit.onDamage = __TS__New(
|
|
|
2509
2560
|
if source and source.typeId == dummyUnitId then
|
|
2510
2561
|
source = nil
|
|
2511
2562
|
end
|
|
2563
|
+
local target = ____exports.Unit:of(BlzGetEventDamageTarget())
|
|
2564
|
+
local damagingEvent = damagingEventByTarget[target]
|
|
2565
|
+
damagingEventByTarget[target] = nil
|
|
2512
2566
|
local data = {
|
|
2513
2567
|
amount = GetEventDamage(),
|
|
2514
2568
|
attackType = nativeToAttackType(BlzGetEventAttackType()),
|
|
2515
2569
|
damageType = BlzGetEventDamageType(),
|
|
2516
2570
|
weaponType = BlzGetEventWeaponType(),
|
|
2571
|
+
metadata = damagingEvent and damagingEvent.metadata,
|
|
2517
2572
|
isAttack = BlzGetEventIsAttack(),
|
|
2518
|
-
originalAmount = GetEventDamage(),
|
|
2573
|
+
originalAmount = damagingEvent and damagingEvent.originalAmount or GetEventDamage(),
|
|
2574
|
+
originalMetadata = damagingEvent and damagingEvent.originalMetadata,
|
|
2519
2575
|
preventDeath = damageEventPreventDeath
|
|
2520
2576
|
}
|
|
2577
|
+
if damagingEvent then
|
|
2578
|
+
for key, value in pairs(damagingEvent) do
|
|
2579
|
+
if isAttribute(key) then
|
|
2580
|
+
data[key] = value
|
|
2581
|
+
end
|
|
2582
|
+
end
|
|
2583
|
+
local sourceOwner = damagingEvent[1]
|
|
2584
|
+
if sourceOwner then
|
|
2585
|
+
local targetOwner = damagingEvent[2]
|
|
2586
|
+
if damagingEvent[3] then
|
|
2587
|
+
SetPlayerAlliance(sourceOwner, targetOwner, ALLIANCE_PASSIVE, false)
|
|
2588
|
+
end
|
|
2589
|
+
if damagingEvent[4] then
|
|
2590
|
+
SetPlayerAlliance(targetOwner, sourceOwner, ALLIANCE_PASSIVE, false)
|
|
2591
|
+
end
|
|
2592
|
+
end
|
|
2593
|
+
end
|
|
2521
2594
|
local evData = setmetatable(
|
|
2522
2595
|
{},
|
|
2523
2596
|
{
|
|
2524
2597
|
__index = data,
|
|
2525
2598
|
__newindex = function(self, key, value)
|
|
2526
|
-
damageSetters[key]
|
|
2599
|
+
local damageSetter = damageSetters[key]
|
|
2600
|
+
if damageSetter ~= nil then
|
|
2601
|
+
damageSetter(value)
|
|
2602
|
+
end
|
|
2527
2603
|
data[key] = value
|
|
2528
2604
|
end
|
|
2529
2605
|
}
|
|
2530
2606
|
)
|
|
2531
|
-
local target = ____exports.Unit:of(BlzGetEventDamageTarget())
|
|
2532
2607
|
invoke(event, source, target, evData)
|
|
2533
2608
|
if evData[0] ~= nil and target.health - evData.amount < 0.405 then
|
|
2534
2609
|
local bonusHealth = math.ceil(evData.amount)
|
|
@@ -2607,6 +2682,21 @@ Unit.itemStackedEvent = __TS__New(
|
|
|
2607
2682
|
EVENT_PLAYER_UNIT_STACK_ITEM,
|
|
2608
2683
|
function() return ____exports.Unit:of(getTriggerUnit()), Item:of(getManipulatedItem()) end
|
|
2609
2684
|
)
|
|
2685
|
+
__TS__ObjectDefineProperty(
|
|
2686
|
+
Unit,
|
|
2687
|
+
"itemChargesChangedEvent",
|
|
2688
|
+
{get = function(self)
|
|
2689
|
+
local event = __TS__New(Event)
|
|
2690
|
+
Item.chargesChangedEvent:addListener(function(item)
|
|
2691
|
+
local unit = item.owner
|
|
2692
|
+
if unit ~= nil then
|
|
2693
|
+
invoke(event, unit, item)
|
|
2694
|
+
end
|
|
2695
|
+
end)
|
|
2696
|
+
rawset(self, "itemChargesChangedEvent", event)
|
|
2697
|
+
return event
|
|
2698
|
+
end}
|
|
2699
|
+
)
|
|
2610
2700
|
__TS__ObjectDefineProperty(
|
|
2611
2701
|
Unit,
|
|
2612
2702
|
"itemUseOrderEvent",
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** @noSelfInFile */
|
|
2
|
+
import { AbilityType, AbilityTypeId } from "../ability-type";
|
|
3
|
+
import { ObjectDataEntryLevelFieldValueSupplier } from "../../entry";
|
|
4
|
+
export declare class PermanentInvisibilityAbilityType extends AbilityType {
|
|
5
|
+
static readonly BASE_ID: AbilityTypeId;
|
|
6
|
+
get shouldAutoAcquireAttackTargets(): boolean[];
|
|
7
|
+
set shouldAutoAcquireAttackTargets(shouldAutoAcquireAttackTargets: ObjectDataEntryLevelFieldValueSupplier<boolean>);
|
|
8
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
local ____lualib = require("lualib_bundle")
|
|
2
|
+
local __TS__Class = ____lualib.__TS__Class
|
|
3
|
+
local __TS__ClassExtends = ____lualib.__TS__ClassExtends
|
|
4
|
+
local __TS__SetDescriptor = ____lualib.__TS__SetDescriptor
|
|
5
|
+
local ____exports = {}
|
|
6
|
+
local ____ability_2Dtype = require("engine.object-data.entry.ability-type")
|
|
7
|
+
local AbilityType = ____ability_2Dtype.AbilityType
|
|
8
|
+
____exports.PermanentInvisibilityAbilityType = __TS__Class()
|
|
9
|
+
local PermanentInvisibilityAbilityType = ____exports.PermanentInvisibilityAbilityType
|
|
10
|
+
PermanentInvisibilityAbilityType.name = "PermanentInvisibilityAbilityType"
|
|
11
|
+
__TS__ClassExtends(PermanentInvisibilityAbilityType, AbilityType)
|
|
12
|
+
PermanentInvisibilityAbilityType.BASE_ID = fourCC("Apiv")
|
|
13
|
+
__TS__SetDescriptor(
|
|
14
|
+
PermanentInvisibilityAbilityType.prototype,
|
|
15
|
+
"shouldAutoAcquireAttackTargets",
|
|
16
|
+
{
|
|
17
|
+
get = function(self)
|
|
18
|
+
return self:getBooleanLevelField("Gho1")
|
|
19
|
+
end,
|
|
20
|
+
set = function(self, shouldAutoAcquireAttackTargets)
|
|
21
|
+
self:setBooleanLevelField("Gho1", shouldAutoAcquireAttackTargets)
|
|
22
|
+
end
|
|
23
|
+
},
|
|
24
|
+
true
|
|
25
|
+
)
|
|
26
|
+
return ____exports
|
package/engine/object-field.d.ts
CHANGED
|
@@ -5,9 +5,10 @@ import { ObjectDataEntry, ObjectDataEntryIdType, ObjectDataEntryLevelFieldValueS
|
|
|
5
5
|
export type ObjectFieldId = number & {
|
|
6
6
|
readonly __objectDataEntryFieldId: unique symbol;
|
|
7
7
|
};
|
|
8
|
-
export type ObjectFieldConstructor<T extends ObjectFieldBase<any, any, any, any>> = OmitConstructor<typeof ObjectFieldBase> & (new (id: number) => T);
|
|
8
|
+
export type ObjectFieldConstructor<T extends ObjectFieldBase<any, any, any, any>> = OmitConstructor<typeof ObjectFieldBase> & (new (id: number, isGlobal?: boolean) => T);
|
|
9
9
|
export type ObjectFieldAbstractConstructor<T extends ObjectFieldBase<any, any, any, any>> = OmitConstructor<typeof ObjectFieldBase> & (abstract new (id: number) => T);
|
|
10
10
|
declare abstract class ObjectFieldBase<ObjectDataEntryType extends ObjectDataEntry, InstanceType extends AnyNotNil, ValueType, NativeFieldType> {
|
|
11
|
+
readonly isGlobal: boolean;
|
|
11
12
|
protected abstract readonly instanceClass: AbstractConstructor<InstanceType> | Function;
|
|
12
13
|
supports(instance: AnyNotNil): instance is InstanceType & {
|
|
13
14
|
readonly __oneSidedTypeGuard: unique symbol;
|
|
@@ -18,8 +19,8 @@ declare abstract class ObjectFieldBase<ObjectDataEntryType extends ObjectDataEnt
|
|
|
18
19
|
protected abstract getObjectDataEntryId(instance: InstanceType): ObjectDataEntryIdType<ObjectDataEntryType>;
|
|
19
20
|
protected abstract hasNativeFieldValue(instance: InstanceType): boolean;
|
|
20
21
|
hasValue(instance: InstanceType): boolean;
|
|
21
|
-
constructor(id: number);
|
|
22
|
-
static create<T extends ObjectFieldBase<any, any, any, any>>(this: ObjectFieldConstructor<T>, id?: number): T & symbol;
|
|
22
|
+
constructor(id: number, isGlobal?: boolean);
|
|
23
|
+
static create<T extends ObjectFieldBase<any, any, any, any>>(this: ObjectFieldConstructor<T>, id?: number, isGlobal?: boolean): T & symbol;
|
|
23
24
|
static of<T extends ObjectFieldBase<any, any, any, any>>(this: ObjectFieldAbstractConstructor<T>, id: number): T | undefined;
|
|
24
25
|
}
|
|
25
26
|
export type ObjectFieldValueChangeEvent<T extends ObjectField<any, any, any, any> | ReadonlyObjectFieldType<ObjectField<any, any, any, any>>> = T extends ObjectField<any, infer InstanceType, infer ValueType, any> ? DispatchingEvent<[
|
|
@@ -79,6 +80,8 @@ export declare abstract class ObjectArrayField<ObjectDataEntryType extends Objec
|
|
|
79
80
|
setValue(entry: ObjectDataEntryType | InstanceType, value: ValueType[]): boolean;
|
|
80
81
|
}
|
|
81
82
|
export declare abstract class ObjectLevelField<ObjectDataEntryType extends ObjectDataEntry = ObjectDataEntry, InstanceType extends AnyNotNil = AnyNotNil, ValueType extends number | string | boolean = number | string | boolean, InputValueType extends ValueType = never, NativeFieldType = unknown> extends ObjectFieldBase<ObjectDataEntryType, InstanceType, ValueType[], NativeFieldType> {
|
|
83
|
+
private originalValueByLevelByInstance?;
|
|
84
|
+
private modifiersByInstance?;
|
|
82
85
|
protected abstract readonly defaultValue: ValueType;
|
|
83
86
|
protected abstract getNativeFieldValue(instance: InstanceType, level: number): ValueType;
|
|
84
87
|
protected abstract setNativeFieldValue(instance: InstanceType, level: number, value: ValueType): boolean;
|