warscript 0.0.1-dev.c37d12c → 0.0.1-dev.c963f13

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.
Files changed (39) hide show
  1. package/attributes.d.ts +13 -0
  2. package/attributes.lua +16 -0
  3. package/core/types/handle.d.ts +2 -1
  4. package/core/types/handle.lua +5 -0
  5. package/engine/behaviour/ability/apply-unit-behavior.d.ts +8 -4
  6. package/engine/behaviour/ability/apply-unit-behavior.lua +31 -9
  7. package/engine/internal/ability.d.ts +1 -1
  8. package/engine/internal/mechanics/ability-duration.d.ts +1 -3
  9. package/engine/internal/mechanics/ability-duration.lua +2 -0
  10. package/engine/internal/mechanics/cast-ability.d.ts +2 -0
  11. package/engine/internal/mechanics/cast-ability.lua +86 -0
  12. package/engine/internal/unit/detach-missiles.d.ts +7 -0
  13. package/engine/internal/unit/detach-missiles.lua +30 -0
  14. package/engine/internal/unit.d.ts +10 -2
  15. package/engine/internal/unit.lua +34 -9
  16. package/engine/object-data/entry/ability-type/blink.d.ts +10 -0
  17. package/engine/object-data/entry/ability-type/blink.lua +39 -0
  18. package/engine/object-data/entry/ability-type.d.ts +1 -0
  19. package/engine/object-data/entry/ability-type.lua +1 -0
  20. package/engine/object-data/entry/buff-type/applicable.lua +27 -71
  21. package/engine/object-data/entry/unit-type.d.ts +42 -1
  22. package/engine/object-data/entry/unit-type.lua +378 -50
  23. package/engine/object-field/ability.d.ts +7 -5
  24. package/engine/object-field/ability.lua +6 -0
  25. package/engine/object-field/unit.d.ts +1 -0
  26. package/engine/object-field/unit.lua +3 -0
  27. package/engine/object-field.d.ts +6 -5
  28. package/engine/object-field.lua +37 -18
  29. package/engine/standard/entries/unit-type.d.ts +24 -1
  30. package/engine/standard/entries/unit-type.lua +24 -1
  31. package/engine/unit.d.ts +1 -0
  32. package/engine/unit.lua +1 -0
  33. package/global/vec2.lua +1 -0
  34. package/package.json +3 -4
  35. package/string.d.ts +14 -0
  36. package/string.lua +9 -0
  37. package/utility/linked-set.d.ts +1 -0
  38. package/utility/linked-set.lua +16 -0
  39. package/utility/types.d.ts +2 -2
@@ -0,0 +1,13 @@
1
+ /// <reference types="@typescript-to-lua/language-extensions" />
2
+ /** @noSelfInFile */
3
+ export type Attribute<T> = {
4
+ readonly __attribute: unique symbol;
5
+ readonly __type: T;
6
+ } & symbol;
7
+ export declare namespace Attribute {
8
+ const create: <T>() => Attribute<T>;
9
+ }
10
+ export declare class AttributesHolder {
11
+ readonly get: (<T>(attribute: Attribute<T>) => T | undefined) & LuaExtension<"TableGetMethod">;
12
+ readonly set: (<T>(attribute: Attribute<T>, value: T | undefined) => void) & LuaExtension<"TableSetMethod">;
13
+ }
package/attributes.lua ADDED
@@ -0,0 +1,16 @@
1
+ local ____lualib = require("lualib_bundle")
2
+ local __TS__Class = ____lualib.__TS__Class
3
+ local ____exports = {}
4
+ ____exports.Attribute = {}
5
+ local Attribute = ____exports.Attribute
6
+ do
7
+ Attribute.create = function()
8
+ return {}
9
+ end
10
+ end
11
+ ____exports.AttributesHolder = __TS__Class()
12
+ local AttributesHolder = ____exports.AttributesHolder
13
+ AttributesHolder.name = "AttributesHolder"
14
+ function AttributesHolder.prototype.____constructor(self)
15
+ end
16
+ return ____exports
@@ -1,5 +1,6 @@
1
1
  /** @noSelfInFile */
2
2
  import { Event } from "../../event";
3
+ import { AttributesHolder } from "../../attributes";
3
4
  export type HandleConstructor<H extends jhandle, T extends Handle<H>, Args extends any[]> = new (handle: H, ...args: Args) => T;
4
5
  export type HandleDestructor = {
5
6
  readonly __handleDestructor: unique symbol;
@@ -11,7 +12,7 @@ type NoOverride = {
11
12
  declare const enum HandlePropertyKey {
12
13
  STATE = 0
13
14
  }
14
- export declare class Handle<H extends jhandle, DestroyParameters extends any[] = []> implements Destroyable {
15
+ export declare class Handle<H extends jhandle, DestroyParameters extends any[] = []> extends AttributesHolder implements Destroyable {
15
16
  readonly handle: H;
16
17
  private [HandlePropertyKey.STATE]?;
17
18
  private onDestroyEvent?;
@@ -1,5 +1,6 @@
1
1
  local ____lualib = require("lualib_bundle")
2
2
  local __TS__Class = ____lualib.__TS__Class
3
+ local __TS__ClassExtends = ____lualib.__TS__ClassExtends
3
4
  local __TS__New = ____lualib.__TS__New
4
5
  local __TS__Delete = ____lualib.__TS__Delete
5
6
  local __TS__SetDescriptor = ____lualib.__TS__SetDescriptor
@@ -12,13 +13,17 @@ local getClass = ____reflection.getClass
12
13
  local getSuperclass = ____reflection.getSuperclass
13
14
  local ____exception = require("exception")
14
15
  local IllegalStateException = ____exception.IllegalStateException
16
+ local ____attributes = require("attributes")
17
+ local AttributesHolder = ____attributes.AttributesHolder
15
18
  local getHandleId = GetHandleId
16
19
  local onCreateEventByHandleConstructor = {}
17
20
  local onDestroyEventByHandleConstructor = {}
18
21
  ____exports.Handle = __TS__Class()
19
22
  local Handle = ____exports.Handle
20
23
  Handle.name = "Handle"
24
+ __TS__ClassExtends(Handle, AttributesHolder)
21
25
  function Handle.prototype.____constructor(self, handle)
26
+ AttributesHolder.prototype.____constructor(self)
22
27
  self[0] = 0
23
28
  local id = getHandleId(handle)
24
29
  local clazz = self.constructor
@@ -1,12 +1,16 @@
1
1
  /** @noSelfInFile */
2
2
  import { AbilityBehavior } from "../ability";
3
3
  import { Ability } from "../../internal/ability";
4
- import { UnitBehaviorConstructor } from "../unit";
4
+ import { UnitBehavior } from "../unit";
5
5
  import { Unit } from "../../internal/unit";
6
- export declare class ApplyUnitBehaviorAbilityBehavior<Args extends any[]> extends AbilityBehavior {
7
- private readonly createUnitBehavior;
6
+ import { AbilityDependentValue } from "../../object-field/ability";
7
+ export declare class ApplyUnitBehaviorAbilityBehavior<T extends UnitBehavior> extends AbilityBehavior {
8
+ private readonly unitBehaviorConstructor;
9
+ private readonly parameters?;
10
+ private readonly keys?;
8
11
  private unitBehavior?;
9
- constructor(ability: Ability, unitBehaviorConstructor: UnitBehaviorConstructor<Args>, ...args: Args);
12
+ constructor(ability: Ability, unitBehaviorConstructor: new (unit: Unit) => T, parameters?: Partial<{ [K in keyof T & { [P in keyof T]-?: (<T_1>() => T_1 extends { [Q in P]: T[P]; } ? 1 : 2) extends <T_2>() => T_2 extends { -readonly [Q_1 in P]: T[P]; } ? 1 : 2 ? P : never; }[keyof T] & KeysOfType<T, string | number | boolean>]: T[K] extends string | number | boolean ? AbilityDependentValue<T[K]> : never; }> | undefined);
13
+ update(): void;
10
14
  onUnitGainAbility(unit: Unit): void;
11
15
  onUnitLoseAbility(): void;
12
16
  }
@@ -1,23 +1,38 @@
1
1
  local ____lualib = require("lualib_bundle")
2
2
  local __TS__Class = ____lualib.__TS__Class
3
3
  local __TS__ClassExtends = ____lualib.__TS__ClassExtends
4
+ local __TS__ObjectKeys = ____lualib.__TS__ObjectKeys
5
+ local __TS__ArraySort = ____lualib.__TS__ArraySort
4
6
  local __TS__New = ____lualib.__TS__New
5
7
  local ____exports = {}
6
8
  local ____ability = require("engine.behaviour.ability")
7
9
  local AbilityBehavior = ____ability.AbilityBehavior
10
+ local ____ability = require("engine.object-field.ability")
11
+ local AbilityField = ____ability.AbilityField
12
+ local AbilityLevelField = ____ability.AbilityLevelField
8
13
  ____exports.ApplyUnitBehaviorAbilityBehavior = __TS__Class()
9
14
  local ApplyUnitBehaviorAbilityBehavior = ____exports.ApplyUnitBehaviorAbilityBehavior
10
15
  ApplyUnitBehaviorAbilityBehavior.name = "ApplyUnitBehaviorAbilityBehavior"
11
16
  __TS__ClassExtends(ApplyUnitBehaviorAbilityBehavior, AbilityBehavior)
12
- function ApplyUnitBehaviorAbilityBehavior.prototype.____constructor(self, ability, unitBehaviorConstructor, ...)
13
- local args = {...}
17
+ function ApplyUnitBehaviorAbilityBehavior.prototype.____constructor(self, ability, unitBehaviorConstructor, parameters)
14
18
  AbilityBehavior.prototype.____constructor(self, ability)
15
- self.createUnitBehavior = function(____, unit)
16
- return __TS__New(
17
- unitBehaviorConstructor,
18
- unit,
19
- table.unpack(args)
20
- )
19
+ self.unitBehaviorConstructor = unitBehaviorConstructor
20
+ self.parameters = parameters
21
+ if parameters ~= nil then
22
+ self.keys = __TS__ArraySort(__TS__ObjectKeys(parameters))
23
+ end
24
+ end
25
+ function ApplyUnitBehaviorAbilityBehavior.prototype.update(self)
26
+ local unitBehavior = self.unitBehavior
27
+ local parameters = self.parameters
28
+ local keys = self.keys
29
+ if unitBehavior ~= nil and parameters ~= nil and keys ~= nil then
30
+ for ____, key in ipairs(keys) do
31
+ local value = parameters[key]
32
+ if value ~= nil then
33
+ unitBehavior[key] = self:resolveCurrentAbilityDependentValue(value)
34
+ end
35
+ end
21
36
  end
22
37
  end
23
38
  function ApplyUnitBehaviorAbilityBehavior.prototype.onUnitGainAbility(self, unit)
@@ -25,7 +40,8 @@ function ApplyUnitBehaviorAbilityBehavior.prototype.onUnitGainAbility(self, unit
25
40
  if ____opt_0 ~= nil then
26
41
  ____opt_0:destroy()
27
42
  end
28
- self.unitBehavior = self:createUnitBehavior(unit)
43
+ self.unitBehavior = __TS__New(self.unitBehaviorConstructor, unit)
44
+ self:update()
29
45
  end
30
46
  function ApplyUnitBehaviorAbilityBehavior.prototype.onUnitLoseAbility(self)
31
47
  local ____opt_2 = self.unitBehavior
@@ -33,4 +49,10 @@ function ApplyUnitBehaviorAbilityBehavior.prototype.onUnitLoseAbility(self)
33
49
  ____opt_2:destroy()
34
50
  end
35
51
  end
52
+ AbilityField.valueChangeEvent:addListener(function(ability)
53
+ ____exports.ApplyUnitBehaviorAbilityBehavior:forAll(ability, "update")
54
+ end)
55
+ AbilityLevelField.valueChangeEvent:addListener(function(ability)
56
+ ____exports.ApplyUnitBehaviorAbilityBehavior:forAll(ability, "update")
57
+ end)
36
58
  return ____exports
@@ -12,7 +12,7 @@ interface Fields<K, V> {
12
12
  interface AbilityLevel {
13
13
  realFields: Fields<jabilityreallevelfield, number>;
14
14
  }
15
- type jabilityfield = jabilityintegerfield | jabilityrealfield | jabilitybooleanfield | jabilitystringfield | jabilityintegerlevelfield | jabilityreallevelfield | jabilitybooleanlevelfield | jabilitystringlevelfield;
15
+ export type jabilityfield = jabilityintegerfield | jabilityrealfield | jabilitybooleanfield | jabilitystringfield | jabilityintegerlevelfield | jabilityreallevelfield | jabilitybooleanlevelfield | jabilitystringlevelfield;
16
16
  export declare class AbilitySnapshot {
17
17
  }
18
18
  export declare abstract class Ability extends Handle<jability> {
@@ -1,4 +1,2 @@
1
1
  /** @noSelfInFile */
2
- import { Ability } from "../ability";
3
- import { Unit } from "../unit";
4
- export declare const getAbilityDuration: (ability: Ability, target?: Unit) => number;
2
+ export {};
@@ -4,6 +4,8 @@ local UnitClassification = ____unit.UnitClassification
4
4
  local ____ability = require("engine.standard.fields.ability")
5
5
  local DURATION_HERO_ABILITY_FLOAT_LEVEL_FIELD = ____ability.DURATION_HERO_ABILITY_FLOAT_LEVEL_FIELD
6
6
  local DURATION_NORMAL_ABILITY_FLOAT_LEVEL_FIELD = ____ability.DURATION_NORMAL_ABILITY_FLOAT_LEVEL_FIELD
7
+ ---
8
+ -- @internal For use by internal systems only.
7
9
  ____exports.getAbilityDuration = function(ability, target)
8
10
  local level = ability.level
9
11
  return target ~= nil and target:hasClassification(UnitClassification.RESISTANT) and DURATION_HERO_ABILITY_FLOAT_LEVEL_FIELD:getValue(ability, level) or DURATION_NORMAL_ABILITY_FLOAT_LEVEL_FIELD:getValue(ability, level)
@@ -0,0 +1,2 @@
1
+ /** @noSelfInFile */
2
+ export {};
@@ -0,0 +1,86 @@
1
+ local ____exports = {}
2
+ local ____ability_2Dtype = require("engine.object-data.entry.ability-type")
3
+ local AbilityType = ____ability_2Dtype.AbilityType
4
+ local ____dummy_2Ditem = require("engine.internal.object-data.dummy-item")
5
+ local DUMMY_ITEM_ID = ____dummy_2Ditem.DUMMY_ITEM_ID
6
+ local ____dummy_2Dunits = require("engine.internal.misc.dummy-units")
7
+ local INVENTORY_DUMMY_NATIVE_UNIT = ____dummy_2Dunits.INVENTORY_DUMMY_NATIVE_UNIT
8
+ local ____preconditions = require("utility.preconditions")
9
+ local checkNotNull = ____preconditions.checkNotNull
10
+ local ____dummy_2Dinventory = require("engine.internal.object-data.dummy-inventory")
11
+ local INVENTORY_ABILITY_TYPE_ID = ____dummy_2Dinventory.INVENTORY_ABILITY_TYPE_ID
12
+ local ____arrays = require("utility.arrays")
13
+ local map = ____arrays.map
14
+ local toLuaSet = ____arrays.toLuaSet
15
+ local createItem = CreateItem
16
+ local getAbilityId = BlzGetAbilityId
17
+ local getItemAbility = BlzGetItemAbility
18
+ local getUnitAbilityByIndex = BlzGetUnitAbilityByIndex
19
+ local itemAddAbility = BlzItemAddAbility
20
+ local setItemBooleanField = BlzSetItemBooleanField
21
+ local removeItem = RemoveItem
22
+ local unitAddAbility = UnitAddAbility
23
+ local unitAddItem = UnitAddItem
24
+ local unitDropItemSlot = UnitDropItemSlot
25
+ local unitInventorySize = UnitInventorySize
26
+ local unitRemoveAbility = UnitRemoveAbility
27
+ local unitRemoveItemFromSlot = UnitRemoveItemFromSlot
28
+ local INVENTORY_ABILITY_TYPE_IDS = postcompile(function()
29
+ return toLuaSet(AbilityType:getAllIdsByBaseIds(map({
30
+ "AInv",
31
+ "Aihn",
32
+ "Aien",
33
+ "Aion",
34
+ "Aiun"
35
+ }, fourCC)))
36
+ end)
37
+ ---
38
+ -- @internal For use by internal systems only.
39
+ ____exports.castAbility = function(nativeUnit, abilityTypeId, prepareAbility, ...)
40
+ local nativeItem = createItem(DUMMY_ITEM_ID, 0, 0)
41
+ unitAddItem(INVENTORY_DUMMY_NATIVE_UNIT, nativeItem)
42
+ itemAddAbility(nativeItem, abilityTypeId)
43
+ local nativeAbility = checkNotNull(getItemAbility(nativeItem, abilityTypeId))
44
+ if prepareAbility ~= nil then
45
+ prepareAbility(nativeAbility, ...)
46
+ end
47
+ setItemBooleanField(nativeItem, ITEM_BF_ACTIVELY_USED, true)
48
+ setItemBooleanField(nativeItem, ITEM_BF_USE_AUTOMATICALLY_WHEN_ACQUIRED, true)
49
+ local success
50
+ if unitAddItem(nativeUnit, nativeItem) then
51
+ success = true
52
+ else
53
+ local latestInventoryAbilityTypeId = 0
54
+ local nativeItemBySlot = {}
55
+ local inventorySize = unitInventorySize(nativeUnit)
56
+ if inventorySize ~= 0 then
57
+ for slot = 0, inventorySize - 1 do
58
+ nativeItemBySlot[slot] = unitRemoveItemFromSlot(nativeUnit, slot)
59
+ end
60
+ local unitNativeAbility = getUnitAbilityByIndex(nativeUnit, 0)
61
+ local i = 1
62
+ while unitNativeAbility ~= nil do
63
+ local abilityTypeId = getAbilityId(unitNativeAbility)
64
+ if INVENTORY_ABILITY_TYPE_IDS[abilityTypeId] ~= nil then
65
+ latestInventoryAbilityTypeId = abilityTypeId
66
+ end
67
+ unitNativeAbility = getUnitAbilityByIndex(nativeUnit, i)
68
+ i = i + 1
69
+ end
70
+ unitRemoveAbility(nativeUnit, latestInventoryAbilityTypeId)
71
+ end
72
+ unitAddAbility(nativeUnit, INVENTORY_ABILITY_TYPE_ID)
73
+ success = unitAddItem(nativeUnit, nativeItem)
74
+ unitRemoveAbility(nativeUnit, INVENTORY_ABILITY_TYPE_ID)
75
+ if latestInventoryAbilityTypeId ~= 0 then
76
+ unitAddAbility(nativeUnit, latestInventoryAbilityTypeId)
77
+ for slot, nativeItem in pairs(nativeItemBySlot) do
78
+ unitAddItem(nativeUnit, nativeItem)
79
+ unitDropItemSlot(nativeUnit, nativeItem, slot)
80
+ end
81
+ end
82
+ end
83
+ removeItem(nativeItem)
84
+ return success
85
+ end
86
+ return ____exports
@@ -0,0 +1,7 @@
1
+ /** @noSelfInFile */
2
+ declare module "../unit" {
3
+ interface Unit {
4
+ detachMissiles(this: Unit): void;
5
+ }
6
+ }
7
+ export {};
@@ -0,0 +1,30 @@
1
+ local ____exports = {}
2
+ local ____unit = require("engine.internal.unit")
3
+ local Unit = ____unit.Unit
4
+ local ____cast_2Dability = require("engine.internal.mechanics.cast-ability")
5
+ local castAbility = ____cast_2Dability.castAbility
6
+ local ____blink = require("engine.object-data.entry.ability-type.blink")
7
+ local BlinkAbilityType = ____blink.BlinkAbilityType
8
+ local ____math = require("math")
9
+ local MAXIMUM_INTEGER = ____math.MAXIMUM_INTEGER
10
+ local getUnitX = GetUnitX
11
+ local getUnitY = GetUnitY
12
+ local setUnitX = SetUnitX
13
+ local setUnitY = SetUnitY
14
+ local BLINK_ABILITY_TYPE_ID = compiletime(function()
15
+ local abilityType = BlinkAbilityType:create()
16
+ abilityType.minimumRange = 0
17
+ abilityType.maximumRange = MAXIMUM_INTEGER
18
+ abilityType.manaCost = 0
19
+ abilityType.cooldown = 0
20
+ return abilityType.id
21
+ end)
22
+ Unit.prototype.detachMissiles = function(self)
23
+ local nativeUnit = self.handle
24
+ local x = getUnitX(nativeUnit)
25
+ local y = getUnitY(nativeUnit)
26
+ castAbility(nativeUnit, BLINK_ABILITY_TYPE_ID)
27
+ setUnitX(nativeUnit, x)
28
+ setUnitY(nativeUnit, y)
29
+ end
30
+ return ____exports
@@ -79,12 +79,16 @@ interface UnitWeapon {
79
79
  declare const enum UnitPropertyKey {
80
80
  IS_PAUSED = 100,
81
81
  STUN_COUNTER = 101,
82
- PREVENT_DEATH_HEALTH_BONUS = 102,
83
- IS_TEAM_GLOW_HIDDEN = 103
82
+ DELAY_HEALTH_CHECKS_COUNTER = 102,
83
+ DELAY_HEALTH_CHECKS_HEALTH_BONUS = 103,
84
+ PREVENT_DEATH_HEALTH_BONUS = 104,
85
+ IS_TEAM_GLOW_HIDDEN = 105
84
86
  }
85
87
  export declare class Unit extends Handle<junit> {
86
88
  private [UnitPropertyKey.IS_PAUSED]?;
87
89
  private [UnitPropertyKey.STUN_COUNTER]?;
90
+ private [UnitPropertyKey.DELAY_HEALTH_CHECKS_COUNTER]?;
91
+ private [UnitPropertyKey.DELAY_HEALTH_CHECKS_HEALTH_BONUS]?;
88
92
  private [UnitPropertyKey.PREVENT_DEATH_HEALTH_BONUS]?;
89
93
  private [UnitPropertyKey.IS_TEAM_GLOW_HIDDEN]?;
90
94
  private _owner?;
@@ -148,6 +152,10 @@ export declare class Unit extends Handle<junit> {
148
152
  set color(color: PlayerColor);
149
153
  get acquisitionRange(): number;
150
154
  set acquisitionRange(v: number);
155
+ /**
156
+ * Keeps this unit alive even if its health becomes negative until the current game thread yields.
157
+ */
158
+ delayHealthChecks(): void;
151
159
  get maxHealth(): number;
152
160
  set maxHealth(maxHealth: number);
153
161
  get healthRegenerationRate(): number;
@@ -520,6 +520,23 @@ for ____, player in ipairs(Player.all) do
520
520
  ShowUnit(dummy, false)
521
521
  dummies[player] = dummy
522
522
  end
523
+ local function delayHealthChecksCallback(unit)
524
+ local counter = (unit[102] or 0) - 1
525
+ if counter ~= 0 then
526
+ unit[102] = counter
527
+ return
528
+ end
529
+ unit[102] = nil
530
+ local healthBonus = unit[103]
531
+ if healthBonus ~= nil then
532
+ unit[103] = nil
533
+ local handle = unit.handle
534
+ BlzSetUnitMaxHP(
535
+ handle,
536
+ BlzGetUnitMaxHP(handle) - healthBonus
537
+ )
538
+ end
539
+ end
523
540
  ____exports.Unit = __TS__Class()
524
541
  local Unit = ____exports.Unit
525
542
  Unit.name = "Unit"
@@ -674,6 +691,10 @@ end
674
691
  function Unit.prototype.queueAnimation(self, animation)
675
692
  queueUnitAnimation(self.handle, animation)
676
693
  end
694
+ function Unit.prototype.delayHealthChecks(self)
695
+ self[102] = (self[102] or 0) + 1
696
+ Timer:run(delayHealthChecksCallback, self)
697
+ end
677
698
  function Unit.prototype.setPosition(self, x, y)
678
699
  setUnitPosition(self.handle, x, y)
679
700
  end
@@ -1233,7 +1254,7 @@ __TS__SetDescriptor(
1233
1254
  "isTeamGlowVisible",
1234
1255
  {
1235
1256
  get = function(self)
1236
- return not self[103]
1257
+ return not self[105]
1237
1258
  end,
1238
1259
  set = function(self, isTeamGlowVisible)
1239
1260
  showUnitTeamGlow(self.handle, isTeamGlowVisible)
@@ -1243,7 +1264,7 @@ __TS__SetDescriptor(
1243
1264
  else
1244
1265
  ____temp_2 = nil
1245
1266
  end
1246
- self[103] = ____temp_2
1267
+ self[105] = ____temp_2
1247
1268
  end
1248
1269
  },
1249
1270
  true
@@ -1253,7 +1274,7 @@ __TS__SetDescriptor(
1253
1274
  "color",
1254
1275
  {set = function(self, color)
1255
1276
  setUnitColor(self.handle, color.handle)
1256
- if self[103] then
1277
+ if self[105] then
1257
1278
  showUnitTeamGlow(self.handle, false)
1258
1279
  end
1259
1280
  end},
@@ -1277,10 +1298,14 @@ __TS__SetDescriptor(
1277
1298
  "maxHealth",
1278
1299
  {
1279
1300
  get = function(self)
1280
- return BlzGetUnitMaxHP(self.handle) - (self[102] or 0)
1301
+ return BlzGetUnitMaxHP(self.handle) - (self[103] or 0) - (self[104] or 0)
1281
1302
  end,
1282
1303
  set = function(self, maxHealth)
1283
- BlzSetUnitMaxHP(self.handle, maxHealth + (self[102] or 0))
1304
+ if maxHealth < 1 and self[102] ~= nil then
1305
+ self[103] = (self[103] or 0) + (1 - maxHealth)
1306
+ maxHealth = 1
1307
+ end
1308
+ BlzSetUnitMaxHP(self.handle, maxHealth + (self[104] or 0))
1284
1309
  end
1285
1310
  },
1286
1311
  true
@@ -1322,10 +1347,10 @@ __TS__SetDescriptor(
1322
1347
  "health",
1323
1348
  {
1324
1349
  get = function(self)
1325
- return GetWidgetLife(self.handle) - (self[102] or 0)
1350
+ return GetWidgetLife(self.handle) - (self[104] or 0)
1326
1351
  end,
1327
1352
  set = function(self, health)
1328
- SetWidgetLife(self.handle, health + (self[102] or 0))
1353
+ SetWidgetLife(self.handle, health + (self[104] or 0))
1329
1354
  end
1330
1355
  },
1331
1356
  true
@@ -2308,7 +2333,7 @@ Unit.onDamage = __TS__New(
2308
2333
  invoke(event, source, target, evData)
2309
2334
  if evData[0] ~= nil and target.health - evData.amount < 0.405 then
2310
2335
  local bonusHealth = math.ceil(evData.amount)
2311
- target[102] = (target[102] or 0) + bonusHealth
2336
+ target[104] = (target[104] or 0) + bonusHealth
2312
2337
  BlzSetUnitMaxHP(
2313
2338
  target.handle,
2314
2339
  BlzGetUnitMaxHP(target.handle) + bonusHealth
@@ -2322,7 +2347,7 @@ Unit.onDamage = __TS__New(
2322
2347
  evData[0],
2323
2348
  table.unpack(evData, 1 + 1, 1 + (evData[1] or 0))
2324
2349
  )
2325
- target[102] = (target[102] or 0) - bonusHealth
2350
+ target[104] = (target[104] or 0) - bonusHealth
2326
2351
  SetWidgetLife(
2327
2352
  target.handle,
2328
2353
  GetWidgetLife(target.handle) - bonusHealth
@@ -0,0 +1,10 @@
1
+ /** @noSelfInFile */
2
+ import { AbilityType, AbilityTypeId } from "../ability-type";
3
+ import { ObjectDataEntryLevelFieldValueSupplier } from "../../entry";
4
+ export declare class BlinkAbilityType extends AbilityType {
5
+ static readonly BASE_ID: AbilityTypeId;
6
+ get maximumRange(): number[];
7
+ set maximumRange(maximumRange: ObjectDataEntryLevelFieldValueSupplier<number>);
8
+ get minimumRange(): number[];
9
+ set minimumRange(minimumRange: ObjectDataEntryLevelFieldValueSupplier<number>);
10
+ }
@@ -0,0 +1,39 @@
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.BlinkAbilityType = __TS__Class()
9
+ local BlinkAbilityType = ____exports.BlinkAbilityType
10
+ BlinkAbilityType.name = "BlinkAbilityType"
11
+ __TS__ClassExtends(BlinkAbilityType, AbilityType)
12
+ BlinkAbilityType.BASE_ID = fourCC("AEbl")
13
+ __TS__SetDescriptor(
14
+ BlinkAbilityType.prototype,
15
+ "maximumRange",
16
+ {
17
+ get = function(self)
18
+ return self:getNumberLevelField("Ebl1")
19
+ end,
20
+ set = function(self, maximumRange)
21
+ self:setNumberLevelField("Ebl1", maximumRange)
22
+ end
23
+ },
24
+ true
25
+ )
26
+ __TS__SetDescriptor(
27
+ BlinkAbilityType.prototype,
28
+ "minimumRange",
29
+ {
30
+ get = function(self)
31
+ return self:getNumberLevelField("Ebl2")
32
+ end,
33
+ set = function(self, minimumRange)
34
+ self:setNumberLevelField("Ebl2", minimumRange)
35
+ end
36
+ },
37
+ true
38
+ )
39
+ return ____exports
@@ -1,5 +1,6 @@
1
1
  /// <reference types="warpack-types/warpack" />
2
2
  /** @noSelfInFile */
3
+ import "../../internal/unit/ability";
3
4
  import { TupleOf } from "../../../utility/types";
4
5
  import { AnimationName } from "../auxiliary/animation-name";
5
6
  import { AnimationQualifier } from "../auxiliary/animation-qualifier";
@@ -6,6 +6,7 @@ local __TS__SetDescriptor = ____lualib.__TS__SetDescriptor
6
6
  local ____exports = {}
7
7
  local ____unit = require("engine.internal.unit")
8
8
  local Unit = ____unit.Unit
9
+ require("engine.internal.unit.ability")
9
10
  local ____timer = require("core.types.timer")
10
11
  local Timer = ____timer.Timer
11
12
  local ____effect = require("core.types.effect")