warscript 0.0.1-dev.c963f13 → 0.0.1-dev.cc63edd

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.
@@ -5,7 +5,7 @@ export declare class Missile implements Destroyable {
5
5
  readonly retarget: (this: void, target: Unit | Vec2) => void;
6
6
  private readonly update;
7
7
  protected constructor(effect: jeffect, retarget: (this: void, target: Unit | Vec2) => void, update: (this: Missile) => boolean);
8
- static launch(config: Readonly<{
8
+ static launch<T extends any[]>(config: Readonly<{
9
9
  art: string;
10
10
  scale?: number;
11
11
  acceleration?: number;
@@ -15,7 +15,7 @@ export declare class Missile implements Destroyable {
15
15
  maxSpeed?: number;
16
16
  sourceOffset?: Vec2;
17
17
  targetOffset?: Vec2;
18
- }>, source: Unit | Vec2, target: Unit | Vec2, onArrival: (missile: Missile, success: boolean) => void): Missile;
18
+ }>, source: Unit | Vec2, target: Unit | Vec2, onArrival: (missile: Missile, success: boolean, ...parameters: T) => void, ...parameters: T): Missile;
19
19
  destroy(): void;
20
20
  }
21
21
  export declare namespace Missile {
@@ -41,7 +41,8 @@ function Missile.prototype.____constructor(self, effect, retarget, update)
41
41
  end
42
42
  head = self
43
43
  end
44
- function Missile.launch(self, config, source, target, onArrival)
44
+ function Missile.launch(self, config, source, target, onArrival, ...)
45
+ local parameters = {...}
45
46
  local ____opt_0 = config.sourceOffset
46
47
  local offsetX = ____opt_0 and ____opt_0.x or 0
47
48
  local ____opt_2 = config.sourceOffset
@@ -142,7 +143,12 @@ function Missile.launch(self, config, source, target, onArrival)
142
143
  visualPositionArcY = currentVisualTargetY
143
144
  visualPositionArcZ = currentVisualTargetZ
144
145
  retarget = false
145
- safeCall(onArrival, self, true)
146
+ safeCall(
147
+ onArrival,
148
+ self,
149
+ true,
150
+ table.unpack(parameters)
151
+ )
146
152
  return not retarget
147
153
  end
148
154
  if arcVSpeed ~= 0 and (currentTargetX ~= initialTargetX or currentTargetY ~= initialTargetY) then
@@ -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)
@@ -9,13 +9,20 @@ import { Destructable } from "../../core/types/destructable";
9
9
  import { EffectParameters } from "../../core/types/effect";
10
10
  import { AbilityDependentValue } from "../object-field/ability";
11
11
  export type AbilityBehaviorConstructor<Args extends any[]> = new (ability: Ability, ...args: Args) => AbilityBehavior;
12
- export declare abstract class AbilityBehavior<PeriodicActionParameters extends any[] = any[]> extends Behavior<Ability, PeriodicActionParameters> {
12
+ export declare abstract class AbilityBehavior<Parameters extends {
13
+ periodicActionParameters?: any[];
14
+ missileParameters?: any[];
15
+ } = {}> extends Behavior<Ability, NonNullable<Parameters["periodicActionParameters"]>> {
13
16
  constructor(ability: Ability);
14
17
  get ability(): Ability;
15
18
  protected resolveCurrentAbilityDependentValue<T extends boolean | number | string>(value: AbilityDependentValue<T>): T;
16
19
  protected flashAreaEffect(x: number, y: number, ...parametersOrDuration: [parameters?: EffectParameters] | [duration?: number, parameters?: EffectParameters]): void;
17
20
  protected flashEffect(x: number, y: number, ...parametersOrDuration: [parameters?: EffectParameters] | [duration?: number, parameters?: EffectParameters]): void;
18
21
  protected flashSpecialEffect(...args: [...pointOrWidget: [x: number, y: number] | [widget: Widget], duration?: number]): void;
22
+ private static MissileLaunchConfig;
23
+ private get missileLaunchConfig();
24
+ protected launchMissile(source: Unit, target: Unit, ...parameters: NonNullable<Parameters["missileParameters"]>): void;
25
+ onMissileArrival(...parameters: NonNullable<Parameters["missileParameters"]>): void;
19
26
  onUnitGainAbility(_unit: Unit): void;
20
27
  onUnitLoseAbility(_unit: Unit): void;
21
28
  onCastingStart(caster: Unit): void;
@@ -15,13 +15,52 @@ local Effect = ____effect.Effect
15
15
  local ____ability = require("engine.standard.fields.ability")
16
16
  local AREA_EFFECT_MODEL_PATHS_ABILITY_STRING_ARRAY_FIELD = ____ability.AREA_EFFECT_MODEL_PATHS_ABILITY_STRING_ARRAY_FIELD
17
17
  local EFFECT_MODEL_PATHS_ABILITY_STRING_ARRAY_FIELD = ____ability.EFFECT_MODEL_PATHS_ABILITY_STRING_ARRAY_FIELD
18
+ local MISSILE_ARC_ABILITY_FLOAT_FIELD = ____ability.MISSILE_ARC_ABILITY_FLOAT_FIELD
19
+ local MISSILE_MODEL_PATHS_ABILITY_STRING_ARRAY_FIELD = ____ability.MISSILE_MODEL_PATHS_ABILITY_STRING_ARRAY_FIELD
20
+ local MISSILE_SPEED_ABILITY_INTEGER_FIELD = ____ability.MISSILE_SPEED_ABILITY_INTEGER_FIELD
18
21
  local SPECIAL_EFFECT_ATTACHMENT_POINT_STRING_FIELD = ____ability.SPECIAL_EFFECT_ATTACHMENT_POINT_STRING_FIELD
19
22
  local SPECIAL_EFFECT_MODEL_PATHS_ABILITY_STRING_ARRAY_FIELD = ____ability.SPECIAL_EFFECT_MODEL_PATHS_ABILITY_STRING_ARRAY_FIELD
20
23
  local ____ability = require("engine.object-field.ability")
21
24
  local resolveCurrentAbilityDependentValue = ____ability.resolveCurrentAbilityDependentValue
22
25
  local ____timer = require("core.types.timer")
23
26
  local Timer = ____timer.Timer
27
+ local ____missile = require("core.types.missile")
28
+ local Missile = ____missile.Missile
24
29
  local createBehaviorFunctionsByAbilityTypeId = {}
30
+ local function invokeOnMissileArrival(_missile, success, abilityBehavior, ...)
31
+ if success then
32
+ abilityBehavior:onMissileArrival(...)
33
+ end
34
+ end
35
+ local ____class_0 = __TS__Class()
36
+ ____class_0.name = ""
37
+ function ____class_0.prototype.____constructor(self, abilityBehavior)
38
+ self.abilityBehavior = abilityBehavior
39
+ end
40
+ __TS__SetDescriptor(
41
+ ____class_0.prototype,
42
+ "art",
43
+ {get = function(self)
44
+ return MISSILE_MODEL_PATHS_ABILITY_STRING_ARRAY_FIELD:getValue(self.abilityBehavior.ability, 0)
45
+ end},
46
+ true
47
+ )
48
+ __TS__SetDescriptor(
49
+ ____class_0.prototype,
50
+ "arc",
51
+ {get = function(self)
52
+ return MISSILE_ARC_ABILITY_FLOAT_FIELD:getValue(self.abilityBehavior.ability)
53
+ end},
54
+ true
55
+ )
56
+ __TS__SetDescriptor(
57
+ ____class_0.prototype,
58
+ "speed",
59
+ {get = function(self)
60
+ return MISSILE_SPEED_ABILITY_INTEGER_FIELD:getValue(self.abilityBehavior.ability)
61
+ end},
62
+ true
63
+ )
25
64
  ____exports.AbilityBehavior = __TS__Class()
26
65
  local AbilityBehavior = ____exports.AbilityBehavior
27
66
  AbilityBehavior.name = "AbilityBehavior"
@@ -65,6 +104,18 @@ function AbilityBehavior.prototype.flashSpecialEffect(self, xOrWidget, yOrDurati
65
104
  )
66
105
  end
67
106
  end
107
+ function AbilityBehavior.prototype.launchMissile(self, source, target, ...)
108
+ Missile:launch(
109
+ self.missileLaunchConfig,
110
+ source,
111
+ target,
112
+ invokeOnMissileArrival,
113
+ self,
114
+ ...
115
+ )
116
+ end
117
+ function AbilityBehavior.prototype.onMissileArrival(self, ...)
118
+ end
68
119
  function AbilityBehavior.prototype.onUnitGainAbility(self, _unit)
69
120
  end
70
121
  function AbilityBehavior.prototype.onUnitLoseAbility(self, _unit)
@@ -127,6 +178,17 @@ __TS__SetDescriptor(
127
178
  return self.object
128
179
  end},
129
180
  true
181
+ )
182
+ AbilityBehavior.MissileLaunchConfig = ____class_0
183
+ __TS__SetDescriptor(
184
+ AbilityBehavior.prototype,
185
+ "missileLaunchConfig",
186
+ {get = function(self)
187
+ local missileLaunchConfig = __TS__New(____exports.AbilityBehavior.MissileLaunchConfig, self)
188
+ rawset(self, "missileLaunchConfig", missileLaunchConfig)
189
+ return missileLaunchConfig
190
+ end},
191
+ true
130
192
  );
131
193
  (function(self)
132
194
  local function createUnitEventListener(key)
@@ -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].attackPoint
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,13 +68,30 @@ declare const modifiers: {
68
68
  speed: (unit: junit, value: number) => void;
69
69
  armor: (unit: junit, value: number) => void;
70
70
  };
71
- interface UnitWeapon {
71
+ export declare class UnitWeapon {
72
+ readonly unit: Unit;
72
73
  readonly index: 0 | 1;
73
- cooldown: number;
74
- projectileArc: number;
75
- projectileArt: string;
76
- projectileSpeed: number;
77
- attackPoint: number;
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,
@@ -127,6 +144,8 @@ export declare class Unit extends Handle<junit> {
127
144
  playAnimation(animation: number): void;
128
145
  queueAnimation(animation: string): void;
129
146
  get weapons(): [UnitWeapon, UnitWeapon];
147
+ get firstWeapon(): UnitWeapon;
148
+ get secondWeapon(): UnitWeapon;
130
149
  get level(): number;
131
150
  set level(v: number);
132
151
  get xp(): number;
@@ -230,6 +249,7 @@ export declare class Unit extends Handle<junit> {
230
249
  getAbilityById(abilityId: number): UnitAbility | undefined;
231
250
  removeAbility(abilityId: number): boolean;
232
251
  hideAbility(abilityId: number, flag: boolean): void;
252
+ getAbilityRemainingCooldown(abilityId: number): number;
233
253
  startAbilityCooldown(abilityId: number, cooldown: number): void;
234
254
  endAbilityCooldown(abilityId: number): void;
235
255
  interruptAttack(): void;
@@ -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
- local weaponGetters = {
391
- index = function(self, handle, index)
392
- return index
393
- end,
394
- cooldown = function(self, handle, index)
395
- return BlzGetUnitWeaponRealField(handle, UNIT_WEAPON_RF_ATTACK_BASE_COOLDOWN, index)
396
- end,
397
- projectileArc = function(self, handle, index)
398
- return BlzGetUnitWeaponRealField(handle, UNIT_WEAPON_RF_ATTACK_PROJECTILE_ARC, index)
399
- end,
400
- projectileArt = function(self, handle, index)
401
- return BlzGetUnitWeaponStringField(handle, UNIT_WEAPON_SF_ATTACK_PROJECTILE_ART, index)
402
- end,
403
- projectileSpeed = function(self, handle, index)
404
- return BlzGetUnitWeaponRealField(handle, UNIT_WEAPON_RF_ATTACK_PROJECTILE_SPEED, index)
405
- end,
406
- attackPoint = function(self, handle, index)
407
- return BlzGetUnitWeaponRealField(handle, UNIT_WEAPON_RF_ATTACK_DAMAGE_POINT, index)
408
- end
409
- }
410
- local weaponSetters = {
411
- cooldown = function(self, handle, index, value)
412
- assert(BlzSetUnitWeaponRealField(handle, UNIT_WEAPON_RF_ATTACK_BASE_COOLDOWN, index, value))
413
- end,
414
- projectileArc = function(self, handle, index, value)
415
- assert(BlzSetUnitWeaponRealField(handle, UNIT_WEAPON_RF_ATTACK_PROJECTILE_ARC, index, value))
416
- end,
417
- projectileArt = function(self, handle, index, value)
418
- assert(BlzSetUnitWeaponStringField(handle, UNIT_WEAPON_SF_ATTACK_PROJECTILE_ART, index, value))
419
- end,
420
- projectileSpeed = function(self, handle, index, value)
421
- assert(BlzSetUnitWeaponRealField(handle, UNIT_WEAPON_RF_ATTACK_PROJECTILE_SPEED, index, value))
422
- end,
423
- attackPoint = function(self, handle, index, value)
424
- assert(BlzSetUnitWeaponRealField(handle, UNIT_WEAPON_RF_ATTACK_DAMAGE_POINT, index, value))
425
- end
426
- }
427
- local weaponMetatable = {
428
- __index = function(self, key)
429
- return weaponGetters[key](weaponGetters, self.h, self.i)
430
- end,
431
- __newindex = function(self, key, value)
432
- weaponSetters[key](weaponSetters, self.h, self.i, value)
433
- end
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
@@ -805,6 +914,9 @@ end
805
914
  function Unit.prototype.hideAbility(self, abilityId, flag)
806
915
  BlzUnitHideAbility(self.handle, abilityId, flag)
807
916
  end
917
+ function Unit.prototype.getAbilityRemainingCooldown(self, abilityId)
918
+ return BlzGetUnitAbilityCooldownRemaining(self.handle, abilityId)
919
+ end
808
920
  function Unit.prototype.startAbilityCooldown(self, abilityId, cooldown)
809
921
  BlzStartUnitAbilityCooldown(self.handle, abilityId, cooldown)
810
922
  end
@@ -1092,12 +1204,27 @@ __TS__SetDescriptor(
1092
1204
  Unit.prototype,
1093
1205
  "weapons",
1094
1206
  {get = function(self)
1095
- local weapons = {
1096
- setmetatable({h = self.handle, i = 0}, weaponMetatable),
1097
- setmetatable({h = self.handle, i = 1}, weaponMetatable)
1098
- }
1099
- rawset(self, "weapons", weapons)
1100
- return weapons
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
1101
1228
  end},
1102
1229
  true
1103
1230
  )
@@ -0,0 +1,10 @@
1
+ /** @noSelfInFile */
2
+ import { AbilityType, AbilityTypeId } from "../ability-type";
3
+ import { ObjectDataEntryLevelFieldValueSupplier } from "../../entry";
4
+ export declare class MineAbilityType extends AbilityType {
5
+ static readonly BASE_ID: AbilityTypeId;
6
+ get activationDelay(): number[];
7
+ set activationDelay(activationDelay: ObjectDataEntryLevelFieldValueSupplier<number>);
8
+ get invisibilityDelay(): number[];
9
+ set invisibilityDelay(invisibilityDelay: 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.MineAbilityType = __TS__Class()
9
+ local MineAbilityType = ____exports.MineAbilityType
10
+ MineAbilityType.name = "MineAbilityType"
11
+ __TS__ClassExtends(MineAbilityType, AbilityType)
12
+ MineAbilityType.BASE_ID = fourCC("Amin")
13
+ __TS__SetDescriptor(
14
+ MineAbilityType.prototype,
15
+ "activationDelay",
16
+ {
17
+ get = function(self)
18
+ return self:getNumberLevelField("Min1")
19
+ end,
20
+ set = function(self, activationDelay)
21
+ self:setNumberLevelField("Min1", activationDelay)
22
+ end
23
+ },
24
+ true
25
+ )
26
+ __TS__SetDescriptor(
27
+ MineAbilityType.prototype,
28
+ "invisibilityDelay",
29
+ {
30
+ get = function(self)
31
+ return self:getNumberLevelField("Min2")
32
+ end,
33
+ set = function(self, invisibilityDelay)
34
+ self:setNumberLevelField("Min2", invisibilityDelay)
35
+ end
36
+ },
37
+ true
38
+ )
39
+ return ____exports
@@ -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
- "maximumTargetCount",
41
+ "maximumManaCostFactor",
42
42
  {
43
43
  get = function(self)
44
44
  return self:getNumberLevelField("Rpb5")
45
45
  end,
46
- set = function(self, maximumTargetCount)
47
- self:setNumberLevelField("Rpb5", maximumTargetCount)
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
- "maximumManaCostFactor",
54
+ "maximumTargetCount",
55
55
  {
56
56
  get = function(self)
57
57
  return self:getNumberLevelField("Rpb6")
58
58
  end,
59
- set = function(self, maximumManaCostFactor)
60
- self:setNumberLevelField("Rpb6", maximumManaCostFactor)
59
+ set = function(self, maximumTargetCount)
60
+ self:setNumberLevelField("Rpb6", maximumTargetCount)
61
61
  end
62
62
  },
63
63
  true
@@ -13,7 +13,9 @@ export declare const ARCHMAGE_HERO_UNIT_TYPE_ID: StandardHeroUnitTypeId;
13
13
  export declare const BLOOD_MAGE_HERO_UNIT_TYPE_ID: StandardHeroUnitTypeId;
14
14
  export declare const MOUNTAIN_KING_HERO_UNIT_TYPE_ID: StandardHeroUnitTypeId;
15
15
  export declare const PALADIN_HERO_UNIT_TYPE_ID: StandardHeroUnitTypeId;
16
+ export declare const ARCHER_HIGH_ELF_UNIT_TYPE_ID: StandardUnitTypeId;
16
17
  export declare const CAPTAIN_UNIT_TYPE_ID: StandardUnitTypeId;
18
+ export declare const SWORDSMAN_UNIT_TYPE_ID: StandardUnitTypeId;
17
19
  export declare const ADMIRAL_PROUDMOORE_HERO_UNIT_TYPE_ID: StandardHeroUnitTypeId;
18
20
  export declare const ANASTERIAN_SUNSTRIDER_HERO_UNIT_TYPE_ID: StandardHeroUnitTypeId;
19
21
  export declare const ANTONIDAS_HERO_UNIT_TYPE_ID: StandardHeroUnitTypeId;
@@ -45,7 +47,22 @@ export declare const SPIRIT_WALKER_UNIT_TYPE_ID: StandardUnitTypeId;
45
47
  export declare const TAUREN_UNIT_TYPE_ID: StandardUnitTypeId;
46
48
  export declare const WIND_RIDER_UNIT_TYPE_ID: StandardUnitTypeId;
47
49
  export declare const WITCH_DOCTOR_UNIT_TYPE_ID: StandardUnitTypeId;
50
+ export declare const ARCHER_UNIT_TYPE_ID: StandardUnitTypeId;
51
+ export declare const CHIMAERA_UNIT_TYPE_ID: StandardUnitTypeId;
52
+ export declare const DRUID_OF_THE_CLAW_UNIT_TYPE_ID: StandardUnitTypeId;
53
+ export declare const DRUID_OF_THE_TALON_UNIT_TYPE_ID: StandardUnitTypeId;
54
+ export declare const DRYAD_UNIT_TYPE_ID: StandardUnitTypeId;
55
+ export declare const FAERIE_DRAGON_UNIT_TYPE_ID: StandardUnitTypeId;
56
+ export declare const GLAIVE_THROWER_UNIT_TYPE_ID: StandardUnitTypeId;
57
+ export declare const HIPPOGRYPH_UNIT_TYPE_ID: StandardUnitTypeId;
58
+ export declare const HIPPOGRYPH_RIDER_UNIT_TYPE_ID: StandardUnitTypeId;
59
+ export declare const HUNTRESS_UNIT_TYPE_ID: StandardUnitTypeId;
60
+ export declare const MOUNTAIN_GIANT_THROWER_UNIT_TYPE_ID: StandardUnitTypeId;
61
+ export declare const WISP_UNIT_TYPE_ID: StandardUnitTypeId;
48
62
  export declare const DEMON_HUNTER_HERO_UNIT_TYPE_ID: StandardHeroUnitTypeId;
63
+ export declare const KEEPER_OF_THE_GROVE_HERO_UNIT_TYPE_ID: StandardHeroUnitTypeId;
64
+ export declare const MOON_PRIESTESS_HERO_UNIT_TYPE_ID: StandardHeroUnitTypeId;
65
+ export declare const WARDEN_HERO_UNIT_TYPE_ID: StandardHeroUnitTypeId;
49
66
  export declare const DEMON_HUNTER_DEMON_FORM_HERO_UNIT_TYPE_ID: StandardHeroUnitTypeId;
50
67
  export declare const ABOMINATION_UNIT_TYPE_ID: StandardUnitTypeId;
51
68
  export declare const GHOUL_UNIT_TYPE_ID: StandardUnitTypeId;
@@ -81,6 +98,7 @@ export declare const WENDIGO_UNIT_TYPE_ID: StandardUnitTypeId;
81
98
  export declare const WENDIGO_SHAMAN_UNIT_TYPE_ID: StandardUnitTypeId;
82
99
  export declare const WILDKIN_UNIT_TYPE_ID: StandardUnitTypeId;
83
100
  export declare const WRAITH_UNIT_TYPE_ID: StandardUnitTypeId;
101
+ export declare const GOBLIN_LAND_MINE_UNIT_TYPE_ID: StandardUnitTypeId;
84
102
  export declare const CIRCLE_OF_POWER_UNIT_TYPE_ID: StandardUnitTypeId;
85
103
  export declare const CIRCLE_OF_POWER_MEDIUM_UNIT_TYPE_ID: StandardUnitTypeId;
86
104
  export declare const CIRCLE_OF_POWER_LARGE_UNIT_TYPE_ID: StandardUnitTypeId;
@@ -12,7 +12,9 @@ ____exports.ARCHMAGE_HERO_UNIT_TYPE_ID = fourCC("Hamg")
12
12
  ____exports.BLOOD_MAGE_HERO_UNIT_TYPE_ID = fourCC("Hblm")
13
13
  ____exports.MOUNTAIN_KING_HERO_UNIT_TYPE_ID = fourCC("Hmkg")
14
14
  ____exports.PALADIN_HERO_UNIT_TYPE_ID = fourCC("Hpal")
15
+ ____exports.ARCHER_HIGH_ELF_UNIT_TYPE_ID = fourCC("nhea")
15
16
  ____exports.CAPTAIN_UNIT_TYPE_ID = fourCC("hcth")
17
+ ____exports.SWORDSMAN_UNIT_TYPE_ID = fourCC("hhes")
16
18
  ____exports.ADMIRAL_PROUDMOORE_HERO_UNIT_TYPE_ID = fourCC("Hapm")
17
19
  ____exports.ANASTERIAN_SUNSTRIDER_HERO_UNIT_TYPE_ID = fourCC("Hssa")
18
20
  ____exports.ANTONIDAS_HERO_UNIT_TYPE_ID = fourCC("Hant")
@@ -44,7 +46,22 @@ ____exports.SPIRIT_WALKER_UNIT_TYPE_ID = fourCC("ospw")
44
46
  ____exports.TAUREN_UNIT_TYPE_ID = fourCC("otau")
45
47
  ____exports.WIND_RIDER_UNIT_TYPE_ID = fourCC("owyv")
46
48
  ____exports.WITCH_DOCTOR_UNIT_TYPE_ID = fourCC("odoc")
49
+ ____exports.ARCHER_UNIT_TYPE_ID = fourCC("earc")
50
+ ____exports.CHIMAERA_UNIT_TYPE_ID = fourCC("echm")
51
+ ____exports.DRUID_OF_THE_CLAW_UNIT_TYPE_ID = fourCC("edoc")
52
+ ____exports.DRUID_OF_THE_TALON_UNIT_TYPE_ID = fourCC("edot")
53
+ ____exports.DRYAD_UNIT_TYPE_ID = fourCC("edry")
54
+ ____exports.FAERIE_DRAGON_UNIT_TYPE_ID = fourCC("efdr")
55
+ ____exports.GLAIVE_THROWER_UNIT_TYPE_ID = fourCC("ebal")
56
+ ____exports.HIPPOGRYPH_UNIT_TYPE_ID = fourCC("ehip")
57
+ ____exports.HIPPOGRYPH_RIDER_UNIT_TYPE_ID = fourCC("ehpr")
58
+ ____exports.HUNTRESS_UNIT_TYPE_ID = fourCC("esen")
59
+ ____exports.MOUNTAIN_GIANT_THROWER_UNIT_TYPE_ID = fourCC("emtg")
60
+ ____exports.WISP_UNIT_TYPE_ID = fourCC("ewsp")
47
61
  ____exports.DEMON_HUNTER_HERO_UNIT_TYPE_ID = fourCC("Edem")
62
+ ____exports.KEEPER_OF_THE_GROVE_HERO_UNIT_TYPE_ID = fourCC("Ekee")
63
+ ____exports.MOON_PRIESTESS_HERO_UNIT_TYPE_ID = fourCC("Emoo")
64
+ ____exports.WARDEN_HERO_UNIT_TYPE_ID = fourCC("Ewar")
48
65
  ____exports.DEMON_HUNTER_DEMON_FORM_HERO_UNIT_TYPE_ID = fourCC("Edmm")
49
66
  ____exports.ABOMINATION_UNIT_TYPE_ID = fourCC("uabo")
50
67
  ____exports.GHOUL_UNIT_TYPE_ID = fourCC("ugho")
@@ -80,6 +97,7 @@ ____exports.WENDIGO_UNIT_TYPE_ID = fourCC("nwen")
80
97
  ____exports.WENDIGO_SHAMAN_UNIT_TYPE_ID = fourCC("nwns")
81
98
  ____exports.WILDKIN_UNIT_TYPE_ID = fourCC("nowb")
82
99
  ____exports.WRAITH_UNIT_TYPE_ID = fourCC("ngh2")
100
+ ____exports.GOBLIN_LAND_MINE_UNIT_TYPE_ID = fourCC("nglm")
83
101
  ____exports.CIRCLE_OF_POWER_UNIT_TYPE_ID = fourCC("ncop")
84
102
  ____exports.CIRCLE_OF_POWER_MEDIUM_UNIT_TYPE_ID = fourCC("ncp2")
85
103
  ____exports.CIRCLE_OF_POWER_LARGE_UNIT_TYPE_ID = fourCC("ncp3")
@@ -16,7 +16,7 @@ export declare const LEVEL_SKIP_REQUIREMENT_ABILITY_INTEGER_FIELD: AbilityIntege
16
16
  export declare const HERO_ABILITY_ABILITY_BOOLEAN_FIELD: AbilityBooleanField & symbol;
17
17
  export declare const ITEM_ABILITY_ABILITY_BOOLEAN_FIELD: AbilityBooleanField & symbol;
18
18
  export declare const CHECK_DEPENDENCIES_ABILITY_BOOLEAN_FIELD: AbilityBooleanField & symbol;
19
- export declare const ARF_MISSILE_ARC_ABILITY_FLOAT_FIELD: AbilityFloatField & symbol;
19
+ export declare const MISSILE_ARC_ABILITY_FLOAT_FIELD: AbilityFloatField & symbol;
20
20
  export declare const NAME_ABILITY_STRING_FIELD: AbilityStringField & symbol;
21
21
  export declare const ICON_ACTIVATED_ABILITY_STRING_FIELD: AbilityStringField & symbol;
22
22
  export declare const ICON_RESEARCH_ABILITY_STRING_FIELD: AbilityStringField & symbol;
@@ -27,7 +27,7 @@ ____exports.LEVEL_SKIP_REQUIREMENT_ABILITY_INTEGER_FIELD = AbilityIntegerField:c
27
27
  ____exports.HERO_ABILITY_ABILITY_BOOLEAN_FIELD = AbilityBooleanField:create(fourCC("aher"))
28
28
  ____exports.ITEM_ABILITY_ABILITY_BOOLEAN_FIELD = AbilityBooleanField:create(fourCC("aite"))
29
29
  ____exports.CHECK_DEPENDENCIES_ABILITY_BOOLEAN_FIELD = AbilityBooleanField:create(fourCC("achd"))
30
- ____exports.ARF_MISSILE_ARC_ABILITY_FLOAT_FIELD = AbilityFloatField:create(fourCC("amac"))
30
+ ____exports.MISSILE_ARC_ABILITY_FLOAT_FIELD = AbilityFloatField:create(fourCC("amac"))
31
31
  ____exports.NAME_ABILITY_STRING_FIELD = AbilityStringField:create(fourCC("anam"))
32
32
  ____exports.ICON_ACTIVATED_ABILITY_STRING_FIELD = AbilityStringField:create(fourCC("auar"))
33
33
  ____exports.ICON_RESEARCH_ABILITY_STRING_FIELD = AbilityStringField:create(fourCC("arar"))
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.c963f13",
4
+ "version": "0.0.1-dev.cc63edd",
5
5
  "description": "A typescript library for Warcraft III using Warpack.",
6
6
  "keywords": [
7
7
  "warcraft",
@@ -24,7 +24,7 @@
24
24
  "@warscript/language-extensions": "^0.0.1",
25
25
  "@warscript/tstl-plugin": "^0.0.3",
26
26
  "lua-types": "^2.13.1",
27
- "warpack": "0.0.1-dev.ec41c86"
27
+ "warpack": "0.0.1-dev.1976a88"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@typescript-eslint/eslint-plugin": "^5.59.11",