warscript 0.0.1-dev.2bde093 → 0.0.1-dev.2cd2e68

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.
@@ -1,26 +1,33 @@
1
1
  local ____lualib = require("lualib_bundle")
2
+ local __TS__New = ____lualib.__TS__New
2
3
  local __TS__Class = ____lualib.__TS__Class
3
4
  local __TS__ClassExtends = ____lualib.__TS__ClassExtends
4
5
  local __TS__SetDescriptor = ____lualib.__TS__SetDescriptor
5
6
  local __TS__ObjectDefineProperty = ____lualib.__TS__ObjectDefineProperty
6
7
  local __TS__Delete = ____lualib.__TS__Delete
7
8
  local ____exports = {}
9
+ local invoke
8
10
  local ____handle = require("core.types.handle")
9
11
  local Handle = ____handle.Handle
10
12
  local ____color = require("core.types.color")
11
13
  local Color = ____color.Color
14
+ local ____event = require("event")
15
+ local Event = ____event.Event
12
16
  local ____rect = require("core.types.rect")
13
17
  local Rect = ____rect.Rect
14
18
  local ____ability = require("engine.internal.ability")
15
19
  local ItemAbility = ____ability.ItemAbility
16
20
  local ____ability = require("engine.internal.item.ability")
17
21
  local doAbilityAction = ____ability.doAbilityAction
22
+ local doAbilityActionForceDummy = ____ability.doAbilityActionForceDummy
23
+ local itemAbilityDummy = ____ability.itemAbilityDummy
18
24
  local ____dummy_2Ditem = require("engine.internal.object-data.dummy-item")
19
25
  local DUMMY_ITEM_ID = ____dummy_2Ditem.DUMMY_ITEM_ID
20
26
  local ____add_2Ditem_2Dto_2Dslot = require("engine.internal.unit.add-item-to-slot")
21
27
  local SLOT_FILLER_ITEM_TYPE_ID = ____add_2Ditem_2Dto_2Dslot.SLOT_FILLER_ITEM_TYPE_ID
22
28
  local ____vec2 = require("math.vec2")
23
29
  local distance = ____vec2.distance
30
+ local itemChargesChangeEvent = __TS__New(Event)
24
31
  local itemAddAbility = BlzItemAddAbility
25
32
  local itemRemoveAbility = BlzItemRemoveAbility
26
33
  local getItemAbility = BlzGetItemAbility
@@ -36,10 +43,26 @@ local getEnumItem = GetEnumItem
36
43
  local getItemTypeId = GetItemTypeId
37
44
  local getItemX = GetItemX
38
45
  local getItemY = GetItemY
46
+ local getItemCharges = GetItemCharges
47
+ local setItemCharges = SetItemCharges
48
+ local unitRemoveAbility = UnitRemoveAbility
49
+ local unitUseItem = UnitUseItem
50
+ local unitUseItemPoint = UnitUseItemPoint
51
+ local unitUseItemTarget = UnitUseItemTarget
52
+ _G.SetItemCharges = function(whichItem, charges)
53
+ setItemCharges(whichItem, charges)
54
+ invoke(
55
+ itemChargesChangeEvent,
56
+ ____exports.Item:of(whichItem)
57
+ )
58
+ end
39
59
  local getItemIntegerField = BlzGetItemIntegerField
40
60
  local setItemBooleanField = BlzSetItemBooleanField
41
61
  local getItemBooleanField = BlzGetItemBooleanField
62
+ invoke = Event.invoke
42
63
  local enumRect = Rect:create(0, 0, 0, 0).handle
64
+ ---
65
+ -- @internal For use by internal systems only.
43
66
  ____exports.addAndGetAbility = function(handle, abilityTypeId)
44
67
  if itemAddAbility(handle, abilityTypeId) then
45
68
  return getItemAbility(handle, abilityTypeId)
@@ -65,6 +88,23 @@ local function getItemAbilities(handle, item)
65
88
  end
66
89
  return abilities
67
90
  end
91
+ local function consumeCharge(handle)
92
+ do
93
+ local i = 0
94
+ local ability = getItemAbilityByIndex(handle, i)
95
+ while ability ~= nil do
96
+ unitRemoveAbility(
97
+ itemAbilityDummy,
98
+ getAbilityId(ability)
99
+ )
100
+ do
101
+ i = i + 1
102
+ ability = getItemAbilityByIndex(handle, i)
103
+ end
104
+ end
105
+ end
106
+ return unitUseItem(itemAbilityDummy, handle) or unitUseItemPoint(itemAbilityDummy, handle, 0, 0) or unitUseItemTarget(itemAbilityDummy, handle, itemAbilityDummy)
107
+ end
68
108
  local targetCollection
69
109
  local targetCollectionNextIndex
70
110
  local centerX
@@ -116,6 +156,36 @@ end
116
156
  function Item.create(self, id, x, y, skinId)
117
157
  return self:of(BlzCreateItemWithSkin(id, x, y, skinId or id))
118
158
  end
159
+ function Item.prototype.consumeCharge(self)
160
+ return self:consumeCharges(1)
161
+ end
162
+ function Item.prototype.consumeCharges(self, count)
163
+ local handle = self.handle
164
+ local charges = getItemCharges(handle)
165
+ if charges > count then
166
+ setItemCharges(handle, charges - count)
167
+ invoke(itemChargesChangeEvent, self)
168
+ return true
169
+ end
170
+ if charges == count then
171
+ if getItemBooleanField(handle, ITEM_BF_PERISHABLE) then
172
+ self:destroy()
173
+ return true
174
+ end
175
+ if not getItemBooleanField(handle, ITEM_BF_ACTIVELY_USED) then
176
+ setItemCharges(handle, 0)
177
+ invoke(itemChargesChangeEvent, self)
178
+ return true
179
+ end
180
+ setItemCharges(handle, 1)
181
+ local ____doAbilityActionForceDummy_2 = doAbilityActionForceDummy
182
+ local ____opt_0 = self.owner
183
+ ____doAbilityActionForceDummy_2(handle, ____opt_0 and ____opt_0.handle, consumeCharge)
184
+ invoke(itemChargesChangeEvent, self)
185
+ return true
186
+ end
187
+ return false
188
+ end
119
189
  function Item.prototype.addAbility(self, abilityTypeId)
120
190
  local nativeAbility = doAbilityAction(self.handle, ____exports.addAndGetAbility, abilityTypeId)
121
191
  if nativeAbility ~= nil then
@@ -301,7 +371,7 @@ __TS__SetDescriptor(
301
371
  "perishable",
302
372
  {
303
373
  get = function(self)
304
- return BlzGetItemBooleanField(self.handle, ITEM_BF_PERISHABLE)
374
+ return getItemBooleanField(self.handle, ITEM_BF_PERISHABLE)
305
375
  end,
306
376
  set = function(self, v)
307
377
  BlzSetItemBooleanField(self.handle, ITEM_BF_PERISHABLE, v)
@@ -557,10 +627,11 @@ __TS__SetDescriptor(
557
627
  "charges",
558
628
  {
559
629
  get = function(self)
560
- return GetItemCharges(self.handle)
630
+ return getItemCharges(self.handle)
561
631
  end,
562
632
  set = function(self, v)
563
- SetItemCharges(self.handle, v)
633
+ setItemCharges(self.handle, v)
634
+ invoke(itemChargesChangeEvent, self)
564
635
  end
565
636
  },
566
637
  true
@@ -587,6 +658,7 @@ __TS__ObjectDefineProperty(
587
658
  return self.onDestroyEvent
588
659
  end}
589
660
  )
661
+ Item.chargesChangedEvent = itemChargesChangeEvent
590
662
  local getManipulatedItem = GetManipulatedItem
591
663
  local trigger = CreateTrigger()
592
664
  TriggerRegisterAnyUnitEventBJ(trigger, EVENT_PLAYER_UNIT_PICKUP_ITEM)
@@ -131,6 +131,11 @@ declare module "../unit" {
131
131
  const abilityNoTargetChannelingStartEvent: DispatchingEvent<[Unit, Ability]>;
132
132
  }
133
133
  }
134
+ declare module "../unit" {
135
+ namespace Unit {
136
+ const abilityImpactEvent: DispatchingEvent<[Unit, Ability]>;
137
+ }
138
+ }
134
139
  declare module "../unit" {
135
140
  namespace Unit {
136
141
  const abilityChannelingFinishEvent: DispatchingEvent<[Unit, Ability]>;
@@ -21,6 +21,8 @@ local ____preconditions = require("utility.preconditions")
21
21
  local checkNotNull = ____preconditions.checkNotNull
22
22
  local ____lazy = require("utility.lazy")
23
23
  local lazyRecord = ____lazy.lazyRecord
24
+ local ____timer = require("core.types.timer")
25
+ local Timer = ____timer.Timer
24
26
  local eventInvoke = Event.invoke
25
27
  local condition = Condition
26
28
  local createTrigger = CreateTrigger
@@ -345,6 +347,18 @@ rawset(
345
347
  extractAbilityTypeId
346
348
  )
347
349
  )
350
+ local internalAbilityImpactEvent = __TS__New(Event)
351
+ internalAbilityChannelingStartEvent:addListener(function(...)
352
+ Timer:run(eventInvoke, internalAbilityImpactEvent, ...)
353
+ end)
354
+ rawset(
355
+ Unit,
356
+ "abilityImpactEvent",
357
+ createDispatchingEvent(
358
+ createCommonEvent(internalAbilityImpactEvent),
359
+ extractAbilityTypeId
360
+ )
361
+ )
348
362
  rawset(
349
363
  Unit,
350
364
  "abilityChannelingFinishEvent",
@@ -2,7 +2,7 @@
2
2
  import { CombatClassifications } from "../../object-data/auxiliary/combat-classification";
3
3
  declare module "../unit" {
4
4
  interface Unit {
5
- isAllowedTarget(this: Unit, source: Unit, allowedTargetCombatClassifications: CombatClassifications): boolean;
5
+ isAllowedTarget(this: Unit, source: Unit, allowedTargetCombatClassifications?: CombatClassifications): boolean;
6
6
  }
7
7
  }
8
8
  declare module "../unit" {
@@ -5,7 +5,15 @@ local initializeFilterTargetState = ____combat_2Dclassification.initializeFilter
5
5
  local ____unit = require("engine.internal.unit")
6
6
  local Unit = ____unit.Unit
7
7
  Unit.prototype.isAllowedTarget = function(self, source, allowedTargetCombatClassifications)
8
- initializeFilterTargetState(source, allowedTargetCombatClassifications)
8
+ if allowedTargetCombatClassifications ~= nil then
9
+ initializeFilterTargetState(source, allowedTargetCombatClassifications)
10
+ return filterTarget(self)
11
+ end
12
+ initializeFilterTargetState(source, source.firstWeapon.allowedTargetCombatClassifications)
13
+ if filterTarget(self) then
14
+ return true
15
+ end
16
+ initializeFilterTargetState(source, source.secondWeapon.allowedTargetCombatClassifications)
9
17
  return filterTarget(self)
10
18
  end
11
19
  Unit.getAllowedTargetsInRange = function(source, allowedTargetCombatClassifications, x, y, range)
@@ -44,7 +44,7 @@ local function timerCallback(source, target)
44
44
  Event.invoke(autoAttackFinishEvent, source, target)
45
45
  end
46
46
  Unit.autoAttackStartEvent:addListener(function(source, target)
47
- local attackPoint = source.weapons[1].impactDelay
47
+ local attackPoint = (source:chooseWeapon(target) or source.firstWeapon).impactDelay
48
48
  local timer = Timer:simple(attackPoint, timerCallback, source, target)
49
49
  eventTimerByUnit[source] = timer
50
50
  end)
@@ -14,6 +14,7 @@ import { CombatClassification, CombatClassifications } from "../object-data/auxi
14
14
  import { MovementType } from "../object-data/auxiliary/movement-type";
15
15
  import { UnitAttribute } from "../object-data/auxiliary/unit-attribute";
16
16
  import { AttackType } from "../object-data/auxiliary/attack-type";
17
+ import { AttributesHolder } from "../../attributes";
17
18
  export type UnitClassification = junittype;
18
19
  export declare namespace UnitClassification {
19
20
  const STRUCTURE: junittype;
@@ -22,6 +23,7 @@ export declare namespace UnitClassification {
22
23
  const GROUND: junittype;
23
24
  const SUMMONED: junittype;
24
25
  const MECHANICAL: junittype;
26
+ const WORKER: junittype;
25
27
  const ANCIENT: junittype;
26
28
  const SUICIDAL: junittype;
27
29
  const TAUREN: junittype;
@@ -39,7 +41,7 @@ type AbilityDispatcherTable<T extends any[] = []> = {
39
41
  readonly [id: number]: Event<[Unit, Ability, ...T]>;
40
42
  };
41
43
  type AbilityEventDispatcher<T extends any[] = []> = Event<[Unit, Ability, ...T]> & AbilityDispatcherTable<T>;
42
- export interface DamagingEvent {
44
+ export interface DamagingEvent extends AttributesHolder {
43
45
  amount: number;
44
46
  attackType: AttackType;
45
47
  damageType: jdamagetype;
@@ -48,8 +50,9 @@ export interface DamagingEvent {
48
50
  readonly isAttack: boolean;
49
51
  readonly originalAmount: number;
50
52
  readonly originalMetadata: unknown;
53
+ preventRetaliation(this: DamagingEvent): void;
51
54
  }
52
- export type DamageEvent = DamagingEvent & {
55
+ export type DamageEvent = Omit<DamagingEvent, "preventRetaliation"> & {
53
56
  preventDeath<P extends any[]>(this: DamageEvent, callback: (this: void, ...parameters: P) => any, ...parameters: P): void;
54
57
  };
55
58
  export type AttackDamageEvent = DamagingEvent & {
@@ -81,6 +84,8 @@ export declare class UnitWeapon {
81
84
  set cooldown(cooldown: number);
82
85
  get damage(): [minimumDamage: number, maximumDamage: number];
83
86
  set damage([minimumDamage, maximumDamage]: [number, number]);
87
+ get allowedTargetCombatClassifications(): CombatClassifications;
88
+ set allowedTargetCombatClassifications(allowedTargetCombatClassifications: CombatClassifications);
84
89
  get damageBase(): number;
85
90
  set damageBase(damageBase: number);
86
91
  get damageDiceCount(): number;
@@ -162,6 +167,7 @@ export declare class Unit extends Handle<junit> {
162
167
  get weapons(): [UnitWeapon, UnitWeapon];
163
168
  get firstWeapon(): UnitWeapon;
164
169
  get secondWeapon(): UnitWeapon;
170
+ chooseWeapon(target: Unit): UnitWeapon | undefined;
165
171
  get level(): number;
166
172
  set level(v: number);
167
173
  get xp(): number;
@@ -294,6 +300,7 @@ export declare class Unit extends Handle<junit> {
294
300
  get onUnitInRange(): Record<number, Event<[Unit]>>;
295
301
  get onManaEqual(): Record<number, Event<[Unit, number]>>;
296
302
  get manaEvent(): Record<Operator, Record<number, Event<[Unit]>>>;
303
+ get targetAcquiredEvent(): Event;
297
304
  get onSelect(): Event;
298
305
  get onDeselect(): Event;
299
306
  get onImmediateOrder(): Event<[number]>;
@@ -347,6 +354,7 @@ export declare class Unit extends Handle<junit> {
347
354
  static itemPickedUpEvent: UnitTriggerEvent<[Item]>;
348
355
  static itemUsedEvent: UnitTriggerEvent<[Item]>;
349
356
  static itemStackedEvent: UnitTriggerEvent<[Item]>;
357
+ static get itemChargesChangedEvent(): Event<[unit: Unit, item: Item]>;
350
358
  static get itemUseOrderEvent(): Event<[unit: Unit, item: Item]>;
351
359
  static get itemMoveOrderEvent(): Event<[
352
360
  unit: Unit,
@@ -58,13 +58,12 @@ local attackTypeToNative = ____attack_2Dtype.attackTypeToNative
58
58
  local nativeToAttackType = ____attack_2Dtype.nativeToAttackType
59
59
  local ____damage_2Dmetadata_2Dby_2Dtarget = require("engine.internal.misc.damage-metadata-by-target")
60
60
  local damageMetadataByTarget = ____damage_2Dmetadata_2Dby_2Dtarget.damageMetadataByTarget
61
+ local ____attributes = require("attributes")
62
+ local isAttribute = ____attributes.isAttribute
61
63
  local match = string.match
62
64
  local ____tostring = _G.tostring
63
65
  local setUnitAnimation = SetUnitAnimation
64
- local setUnitAnimationWithRarity = SetUnitAnimationWithRarity
65
66
  local setUnitAnimationByIndex = SetUnitAnimationByIndex
66
- local resetUnitAnimation = ResetUnitAnimation
67
- local queueUnitAnimation = QueueUnitAnimation
68
67
  local getUnitIntegerField = BlzGetUnitIntegerField
69
68
  local getUnitRealField = BlzGetUnitRealField
70
69
  local getHeroStr = GetHeroStr
@@ -140,6 +139,7 @@ do
140
139
  UnitClassification.GROUND = UNIT_TYPE_GROUND
141
140
  UnitClassification.SUMMONED = UNIT_TYPE_SUMMONED
142
141
  UnitClassification.MECHANICAL = UNIT_TYPE_MECHANICAL
142
+ UnitClassification.WORKER = UNIT_TYPE_PEON
143
143
  UnitClassification.ANCIENT = UNIT_TYPE_ANCIENT
144
144
  UnitClassification.SUICIDAL = UNIT_TYPE_SAPPER
145
145
  UnitClassification.TAUREN = UNIT_TYPE_TAUREN
@@ -347,6 +347,9 @@ local function dispatchAbility(event)
347
347
  }
348
348
  )
349
349
  end
350
+ local function damagingEventPreventRetaliation(self)
351
+ self[0] = true
352
+ end
350
353
  local function damageEventPreventDeath(self, callback, ...)
351
354
  if self[0] ~= nil then
352
355
  return
@@ -443,6 +446,19 @@ __TS__SetDescriptor(
443
446
  },
444
447
  true
445
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
+ )
446
462
  __TS__SetDescriptor(
447
463
  UnitWeapon.prototype,
448
464
  "damageBase",
@@ -801,16 +817,25 @@ function Unit.prototype.playAnimation(self, animation, rarity)
801
817
  if type(animation) == "number" then
802
818
  setUnitAnimationByIndex(self.handle, animation)
803
819
  elseif rarity then
804
- setUnitAnimationWithRarity(self.handle, animation, rarity)
820
+ SetUnitAnimationWithRarity(self.handle, animation, rarity)
805
821
  else
806
822
  setUnitAnimation(self.handle, animation)
807
823
  end
808
824
  end
809
825
  function Unit.prototype.resetAnimation(self)
810
- resetUnitAnimation(self.handle)
826
+ ResetUnitAnimation(self.handle)
811
827
  end
812
828
  function Unit.prototype.queueAnimation(self, animation)
813
- queueUnitAnimation(self.handle, animation)
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
814
839
  end
815
840
  function Unit.prototype.delayHealthChecks(self)
816
841
  self[103] = (self[103] or 0) + 1
@@ -2048,6 +2073,14 @@ __TS__SetDescriptor(
2048
2073
  end},
2049
2074
  true
2050
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
+ )
2051
2084
  __TS__SetDescriptor(
2052
2085
  Unit.prototype,
2053
2086
  "onSelect",
@@ -2420,7 +2453,8 @@ Unit.onDamaging = (function()
2420
2453
  metadata = metadata,
2421
2454
  isAttack = BlzGetEventIsAttack(),
2422
2455
  originalAmount = GetEventDamage(),
2423
- originalMetadata = metadata
2456
+ originalMetadata = metadata,
2457
+ preventRetaliation = damagingEventPreventRetaliation
2424
2458
  }
2425
2459
  if data.isAttack and source then
2426
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
@@ -2449,6 +2483,20 @@ Unit.onDamaging = (function()
2449
2483
  }
2450
2484
  )
2451
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
2452
2500
  damagingEventByTarget[target] = data
2453
2501
  return
2454
2502
  end
@@ -2526,12 +2574,32 @@ Unit.onDamage = __TS__New(
2526
2574
  originalMetadata = damagingEvent and damagingEvent.originalMetadata,
2527
2575
  preventDeath = damageEventPreventDeath
2528
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
2529
2594
  local evData = setmetatable(
2530
2595
  {},
2531
2596
  {
2532
2597
  __index = data,
2533
2598
  __newindex = function(self, key, value)
2534
- damageSetters[key](value)
2599
+ local damageSetter = damageSetters[key]
2600
+ if damageSetter ~= nil then
2601
+ damageSetter(value)
2602
+ end
2535
2603
  data[key] = value
2536
2604
  end
2537
2605
  }
@@ -2614,6 +2682,21 @@ Unit.itemStackedEvent = __TS__New(
2614
2682
  EVENT_PLAYER_UNIT_STACK_ITEM,
2615
2683
  function() return ____exports.Unit:of(getTriggerUnit()), Item:of(getManipulatedItem()) end
2616
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
+ )
2617
2700
  __TS__ObjectDefineProperty(
2618
2701
  Unit,
2619
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
@@ -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<[