warscript 0.0.1-dev.2af030d → 0.0.1-dev.38f0dea

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 (86) hide show
  1. package/attributes.d.ts +0 -1
  2. package/binaryreader.d.ts +1 -0
  3. package/binaryreader.lua +3 -0
  4. package/core/types/frame.d.ts +2 -1
  5. package/core/types/frame.lua +2 -0
  6. package/core/types/group.d.ts +0 -1
  7. package/core/types/image.d.ts +0 -1
  8. package/core/types/missile.d.ts +2 -2
  9. package/core/types/missile.lua +8 -2
  10. package/core/types/unit.lua +8 -0
  11. package/decl/index.d.ts +1 -0
  12. package/engine/ability.d.ts +1 -1
  13. package/engine/behavior.d.ts +10 -10
  14. package/engine/behaviour/ability/apply-unit-behavior.d.ts +6 -1
  15. package/engine/behaviour/ability/damage.d.ts +33 -11
  16. package/engine/behaviour/ability/damage.lua +89 -31
  17. package/engine/behaviour/ability/heal.d.ts +33 -6
  18. package/engine/behaviour/ability/heal.lua +89 -10
  19. package/engine/behaviour/ability/instant-impact.lua +4 -0
  20. package/engine/behaviour/ability/restore-mana.d.ts +15 -0
  21. package/engine/behaviour/ability/restore-mana.lua +29 -0
  22. package/engine/behaviour/ability.d.ts +8 -1
  23. package/engine/behaviour/ability.lua +62 -0
  24. package/engine/behaviour/unit/stun-immunity.d.ts +0 -1
  25. package/engine/behaviour/unit.d.ts +3 -2
  26. package/engine/behaviour/unit.lua +7 -0
  27. package/engine/buff.d.ts +36 -15
  28. package/engine/buff.lua +162 -68
  29. package/engine/game-map.d.ts +7 -0
  30. package/engine/game-map.lua +32 -0
  31. package/engine/internal/unit/bonus.d.ts +5 -6
  32. package/engine/internal/unit+transport.lua +4 -10
  33. package/engine/internal/unit.d.ts +2 -2
  34. package/engine/internal/unit.lua +37 -26
  35. package/engine/object-data/auxiliary/attachment-preset.d.ts +0 -1
  36. package/engine/object-data/auxiliary/combat-classification.d.ts +0 -2
  37. package/engine/object-data/entry/ability-type/blank-configurable.d.ts +0 -1
  38. package/engine/object-data/entry/ability-type/blank-passive.d.ts +0 -1
  39. package/engine/object-data/entry/ability-type/channel.d.ts +0 -1
  40. package/engine/object-data/entry/ability-type/mine.d.ts +10 -0
  41. package/engine/object-data/entry/ability-type/mine.lua +39 -0
  42. package/engine/object-data/entry/ability-type/spirit-touch.d.ts +2 -2
  43. package/engine/object-data/entry/ability-type/spirit-touch.lua +6 -6
  44. package/engine/object-data/entry/ability-type.d.ts +0 -1
  45. package/engine/object-data/entry/buff-type/applicable.d.ts +0 -1
  46. package/engine/object-data/entry/buff-type/blank.d.ts +0 -1
  47. package/engine/object-data/entry/buff-type.d.ts +0 -1
  48. package/engine/object-data/entry/destructible-type.d.ts +0 -1
  49. package/engine/object-data/entry/item-type/blank.d.ts +0 -1
  50. package/engine/object-data/entry/item-type.d.ts +0 -1
  51. package/engine/object-data/entry/lightning-type.d.ts +0 -1
  52. package/engine/object-data/entry/unit-type.d.ts +0 -1
  53. package/engine/object-data/entry/upgrade/blank.d.ts +0 -1
  54. package/engine/object-data/entry/upgrade.d.ts +0 -1
  55. package/engine/object-data/entry.d.ts +2 -3
  56. package/engine/object-field/ability.d.ts +1 -1
  57. package/engine/object-field.d.ts +0 -1
  58. package/engine/random.d.ts +1 -0
  59. package/engine/random.lua +9 -0
  60. package/engine/standard/entries/unit-type.d.ts +18 -0
  61. package/engine/standard/entries/unit-type.lua +18 -0
  62. package/engine/standard/fields/ability.d.ts +1 -1
  63. package/engine/standard/fields/ability.lua +1 -1
  64. package/engine/unit.lua +9 -2
  65. package/event.d.ts +2 -3
  66. package/event.lua +9 -5
  67. package/lualib_bundle.lua +146 -42
  68. package/math/vec2.d.ts +2 -9
  69. package/math.d.ts +0 -2
  70. package/objutil/ability.d.ts +0 -1
  71. package/objutil/buff.d.ts +0 -1
  72. package/objutil/object.d.ts +0 -1
  73. package/objutil/unit.d.ts +0 -1
  74. package/package.json +13 -13
  75. package/property.d.ts +55 -0
  76. package/property.lua +374 -0
  77. package/string.d.ts +16 -0
  78. package/string.lua +5 -0
  79. package/util/stream.d.ts +0 -1
  80. package/utility/arrays.d.ts +3 -4
  81. package/utility/bit-set.d.ts +0 -2
  82. package/utility/linked-set.d.ts +1 -2
  83. package/utility/lua-maps.d.ts +1 -2
  84. package/utility/lua-sets.d.ts +1 -2
  85. package/core/mapbounds.d.ts +0 -8
  86. package/core/mapbounds.lua +0 -12
@@ -0,0 +1,7 @@
1
+ /** @noSelfInFile */
2
+ import { Rect } from "../core/types/rect";
3
+ import { Region } from "../core/types/region";
4
+ export declare class GameMap {
5
+ static get worldBoundsRect(): Rect;
6
+ static get worldBoundsRegion(): Region;
7
+ }
@@ -0,0 +1,32 @@
1
+ local ____lualib = require("lualib_bundle")
2
+ local __TS__Class = ____lualib.__TS__Class
3
+ local __TS__ObjectDefineProperty = ____lualib.__TS__ObjectDefineProperty
4
+ local ____exports = {}
5
+ local ____rect = require("core.types.rect")
6
+ local Rect = ____rect.Rect
7
+ local ____region = require("core.types.region")
8
+ local Region = ____region.Region
9
+ ____exports.GameMap = __TS__Class()
10
+ local GameMap = ____exports.GameMap
11
+ GameMap.name = "GameMap"
12
+ function GameMap.prototype.____constructor(self)
13
+ end
14
+ __TS__ObjectDefineProperty(
15
+ GameMap,
16
+ "worldBoundsRect",
17
+ {get = function(self)
18
+ local rect = Rect:of(GetWorldBounds())
19
+ rawset(self, "worldBoundsRect", rect)
20
+ return rect
21
+ end}
22
+ )
23
+ __TS__ObjectDefineProperty(
24
+ GameMap,
25
+ "worldBoundsRegion",
26
+ {get = function(self)
27
+ local region = Region:create(self.worldBoundsRect)
28
+ rawset(self, "worldBoundsRegion", region)
29
+ return region
30
+ end}
31
+ )
32
+ return ____exports
@@ -1,4 +1,3 @@
1
- /// <reference types="@typescript-to-lua/language-extensions" />
2
1
  /** @noSelfInFile */
3
2
  import { Unit } from "../unit";
4
3
  import { AbilityTypeId } from "../../object-data/entry/ability-type";
@@ -34,8 +33,8 @@ export declare namespace UnitBonusType {
34
33
  const DAMAGE: UnitBonusType<UnitDamageBonusId>;
35
34
  const RECEIVED_DAMAGE_FACTOR: UnitBonusType<UnitReceivedDamageFactorBonusId>;
36
35
  }
37
- export declare const addUnitBonus: <Id extends UnitBonusId<any>>(unit: Unit, bonusType: UnitBonusType<Id>, value: number) => Id;
38
- export declare const removeUnitBonus: <Id extends UnitBonusId<any>>(unit: Unit, bonusType: UnitBonusType<Id>, id: Id) => boolean;
39
- export declare const updateUnitBonus: <Id extends UnitBonusId<any>>(unit: Unit, bonusType: UnitBonusType<Id>, id: Id, value: number) => boolean;
40
- export declare const addOrUpdateOrRemoveUnitBonus: <Id extends UnitBonusId<any>>(unit: Unit, bonusType: UnitBonusType<Id>, id: Id | undefined, value: number) => Id | undefined;
41
- export declare const getUnitBonus: <Id extends UnitBonusId<any>>(unit: Unit, bonusType: UnitBonusType<Id>, id: Id) => number;
36
+ export declare const addUnitBonus: <Id extends UnitBonusId>(unit: Unit, bonusType: UnitBonusType<Id>, value: number) => Id;
37
+ export declare const removeUnitBonus: <Id extends UnitBonusId>(unit: Unit, bonusType: UnitBonusType<Id>, id: Id) => boolean;
38
+ export declare const updateUnitBonus: <Id extends UnitBonusId>(unit: Unit, bonusType: UnitBonusType<Id>, id: Id, value: number) => boolean;
39
+ export declare const addOrUpdateOrRemoveUnitBonus: <Id extends UnitBonusId>(unit: Unit, bonusType: UnitBonusType<Id>, id: Id | undefined, value: number) => Id | undefined;
40
+ export declare const getUnitBonus: <Id extends UnitBonusId>(unit: Unit, bonusType: UnitBonusType<Id>, id: Id) => number;
@@ -6,9 +6,8 @@ local ____unit = require("engine.internal.unit")
6
6
  local Unit = ____unit.Unit
7
7
  local ____event = require("event")
8
8
  local Event = ____event.Event
9
- local ____mapbounds = require("core.mapbounds")
10
- local boundMax = ____mapbounds.boundMax
11
- local boundRegion = ____mapbounds.boundRegion
9
+ local ____game_2Dmap = require("engine.game-map")
10
+ local GameMap = ____game_2Dmap.GameMap
12
11
  local eventInvoke = Event.invoke
13
12
  local tableRemove = table.remove
14
13
  local ____assert = _G.assert
@@ -58,8 +57,8 @@ triggerAddCondition(
58
57
  deboard(unit)
59
58
  end
60
59
  if not unitAlive(handle) then
61
- unit.x = boundMax.x
62
- unit.y = boundMax.y
60
+ unit.x = GameMap.worldBoundsRect.maxX
61
+ unit.y = GameMap.worldBoundsRect.maxY
63
62
  end
64
63
  local transport = Unit:of(getTransportUnit())
65
64
  transportByUnit[unit] = transport
@@ -68,11 +67,6 @@ triggerAddCondition(
68
67
  eventInvoke(onBoardEvent, unit, transport)
69
68
  end)
70
69
  )
71
- boundRegion.onUnitEnter:addListener(function(unit)
72
- if transportByUnit[unit] ~= nil and not isUnitLoaded(unit.handle) then
73
- deboard(unit)
74
- end
75
- end)
76
70
  Unit.deathEvent:addListener(function(unit)
77
71
  if transportByUnit[unit] ~= nil then
78
72
  deboard(unit)
@@ -1,4 +1,3 @@
1
- /// <reference types="@typescript-to-lua/language-extensions" />
2
1
  /** @noSelfInFile */
3
2
  import { Handle, HandleDestructor } from "../../core/types/handle";
4
3
  import { Player } from "../../core/types/player";
@@ -228,7 +227,7 @@ export declare class Unit extends Handle<junit> {
228
227
  isSelected(player: Player): boolean;
229
228
  explode(): void;
230
229
  kill(): void;
231
- revive(pos: Vec2, doEffect: boolean): void;
230
+ revive(x: number, y: number, doEffect?: boolean): void;
232
231
  healTarget(target: Widget, amount: number): void;
233
232
  useItem(item: Item): boolean;
234
233
  issueImmediateOrder(order: number): boolean;
@@ -249,6 +248,7 @@ export declare class Unit extends Handle<junit> {
249
248
  getAbilityById(abilityId: number): UnitAbility | undefined;
250
249
  removeAbility(abilityId: number): boolean;
251
250
  hideAbility(abilityId: number, flag: boolean): void;
251
+ getAbilityRemainingCooldown(abilityId: number): number;
252
252
  startAbilityCooldown(abilityId: number, cooldown: number): void;
253
253
  endAbilityCooldown(abilityId: number): void;
254
254
  interruptAttack(): void;
@@ -7,6 +7,9 @@ local __TS__Class = ____lualib.__TS__Class
7
7
  local __TS__ClassExtends = ____lualib.__TS__ClassExtends
8
8
  local __TS__SetDescriptor = ____lualib.__TS__SetDescriptor
9
9
  local __TS__ArraySetLength = ____lualib.__TS__ArraySetLength
10
+ local __TS__SparseArrayNew = ____lualib.__TS__SparseArrayNew
11
+ local __TS__SparseArrayPush = ____lualib.__TS__SparseArrayPush
12
+ local __TS__SparseArraySpread = ____lualib.__TS__SparseArraySpread
10
13
  local __TS__InstanceOf = ____lualib.__TS__InstanceOf
11
14
  local __TS__ObjectDefineProperty = ____lualib.__TS__ObjectDefineProperty
12
15
  local Set = ____lualib.Set
@@ -279,16 +282,14 @@ function UnitTriggerEvent.prototype.____constructor(self, eventType, c)
279
282
  end
280
283
  local function dispatch(event, idGetter, argsGetter)
281
284
  local initialized = false
282
- local x = {}
283
285
  return setmetatable(
284
- x,
286
+ {},
285
287
  {
286
288
  __index = function(self, id)
287
289
  if type(id) ~= "number" then
288
290
  return event[id]
289
291
  end
290
292
  if not initialized then
291
- local invoke = Event.invoke
292
293
  event:addListener(function(...)
293
294
  local id = idGetter(...)
294
295
  local dispatched = rawget(self, id)
@@ -326,7 +327,6 @@ local function dispatchAbility(event)
326
327
  return event[id]
327
328
  end
328
329
  if not initialized then
329
- local invoke = Event.invoke
330
330
  event:addListener(function(unit, ability, ...)
331
331
  local dispatched = rawget(self, ability.typeId)
332
332
  if dispatched ~= nil then
@@ -817,8 +817,15 @@ end
817
817
  function Unit.prototype.kill(self)
818
818
  killUnit(self.handle)
819
819
  end
820
- function Unit.prototype.revive(self, pos, doEffect)
821
- ReviveHero(self.handle, pos.x, pos.y, doEffect)
820
+ function Unit.prototype.revive(self, x, y, doEffect)
821
+ local ____ReviveHero_4 = ReviveHero
822
+ local ____array_3 = __TS__SparseArrayNew(self.handle, x, y)
823
+ local ____doEffect_2 = doEffect
824
+ if ____doEffect_2 == nil then
825
+ ____doEffect_2 = false
826
+ end
827
+ __TS__SparseArrayPush(____array_3, ____doEffect_2)
828
+ ____ReviveHero_4(__TS__SparseArraySpread(____array_3))
822
829
  end
823
830
  function Unit.prototype.healTarget(self, target, amount)
824
831
  if __TS__InstanceOf(target, ____exports.Unit) and target:hasAbility(fourCC("BIhm")) then
@@ -914,6 +921,9 @@ end
914
921
  function Unit.prototype.hideAbility(self, abilityId, flag)
915
922
  BlzUnitHideAbility(self.handle, abilityId, flag)
916
923
  end
924
+ function Unit.prototype.getAbilityRemainingCooldown(self, abilityId)
925
+ return BlzGetUnitAbilityCooldownRemaining(self.handle, abilityId)
926
+ end
917
927
  function Unit.prototype.startAbilityCooldown(self, abilityId, cooldown)
918
928
  BlzStartUnitAbilityCooldown(self.handle, abilityId, cooldown)
919
929
  end
@@ -1382,13 +1392,13 @@ __TS__SetDescriptor(
1382
1392
  end,
1383
1393
  set = function(self, isTeamGlowVisible)
1384
1394
  showUnitTeamGlow(self.handle, isTeamGlowVisible)
1385
- local ____temp_2
1395
+ local ____temp_5
1386
1396
  if not isTeamGlowVisible then
1387
- ____temp_2 = true
1397
+ ____temp_5 = true
1388
1398
  else
1389
- ____temp_2 = nil
1399
+ ____temp_5 = nil
1390
1400
  end
1391
- self[105] = ____temp_2
1401
+ self[105] = ____temp_5
1392
1402
  end
1393
1403
  },
1394
1404
  true
@@ -2052,7 +2062,6 @@ Unit.onDecay = __TS__New(
2052
2062
  Unit.onResurrect = __TS__New(
2053
2063
  InitializingEvent,
2054
2064
  function(event)
2055
- local invoke = Event.invoke
2056
2065
  local dead = setmetatable({}, {__mode = "k"})
2057
2066
  ____exports.Unit.deathEvent:addListener(function(unit)
2058
2067
  dead[unit] = true
@@ -2068,10 +2077,15 @@ Unit.onResurrect = __TS__New(
2068
2077
  Unit.morphEvent = __TS__New(
2069
2078
  InitializingEvent,
2070
2079
  function(event)
2080
+ local function ifNotLeft(unit)
2081
+ local handle = unit.handle
2082
+ if getUnitAbilityLevel(handle, leaveDetectAbilityId) ~= 0 and unitAddAbility(handle, morphDetectAbilityId) then
2083
+ invoke(event, unit)
2084
+ end
2085
+ end
2071
2086
  ____exports.Unit.onImmediateOrder[orderId("undefend")]:addListener(function(unit)
2072
2087
  if getUnitAbilityLevel(unit.handle, morphDetectAbilityId) == 0 then
2073
- assert(unitAddAbility(unit.handle, morphDetectAbilityId))
2074
- Timer:run(Event.invoke, event, unit)
2088
+ Timer:run(ifNotLeft, unit)
2075
2089
  end
2076
2090
  end)
2077
2091
  end
@@ -2109,27 +2123,26 @@ Unit.onSpellEffect = dispatchId(__TS__New(
2109
2123
  Unit.onTargetCast = dispatchId(__TS__New(
2110
2124
  InitializingEvent,
2111
2125
  function(event)
2112
- local invoke = Event.invoke
2113
2126
  local function listener(unit, id)
2114
- local ____GetSpellTargetUnit_result_5
2127
+ local ____GetSpellTargetUnit_result_8
2115
2128
  if GetSpellTargetUnit() then
2116
- ____GetSpellTargetUnit_result_5 = ____exports.Unit:of(GetSpellTargetUnit())
2129
+ ____GetSpellTargetUnit_result_8 = ____exports.Unit:of(GetSpellTargetUnit())
2117
2130
  else
2118
- local ____GetSpellTargetItem_result_4
2131
+ local ____GetSpellTargetItem_result_7
2119
2132
  if GetSpellTargetItem() then
2120
- ____GetSpellTargetItem_result_4 = Item:of(GetSpellTargetItem())
2133
+ ____GetSpellTargetItem_result_7 = Item:of(GetSpellTargetItem())
2121
2134
  else
2122
- local ____GetSpellTargetDestructable_result_3
2135
+ local ____GetSpellTargetDestructable_result_6
2123
2136
  if GetSpellTargetDestructable() then
2124
- ____GetSpellTargetDestructable_result_3 = Destructable:of(GetSpellTargetDestructable())
2137
+ ____GetSpellTargetDestructable_result_6 = Destructable:of(GetSpellTargetDestructable())
2125
2138
  else
2126
- ____GetSpellTargetDestructable_result_3 = nil
2139
+ ____GetSpellTargetDestructable_result_6 = nil
2127
2140
  end
2128
- ____GetSpellTargetItem_result_4 = ____GetSpellTargetDestructable_result_3
2141
+ ____GetSpellTargetItem_result_7 = ____GetSpellTargetDestructable_result_6
2129
2142
  end
2130
- ____GetSpellTargetUnit_result_5 = ____GetSpellTargetItem_result_4
2143
+ ____GetSpellTargetUnit_result_8 = ____GetSpellTargetItem_result_7
2131
2144
  end
2132
- local target = ____GetSpellTargetUnit_result_5
2145
+ local target = ____GetSpellTargetUnit_result_8
2133
2146
  if target then
2134
2147
  invoke(event, unit, id, target)
2135
2148
  end
@@ -2326,7 +2339,6 @@ Unit.autoAttackStartEvent = __TS__New(
2326
2339
  )
2327
2340
  Unit.onDamaging = (function()
2328
2341
  local event = __TS__New(Event)
2329
- local invoke = Event.invoke
2330
2342
  local trigger = CreateTrigger()
2331
2343
  TriggerRegisterAnyUnitEventBJ(trigger, EVENT_PLAYER_UNIT_DAMAGING)
2332
2344
  TriggerAddCondition(
@@ -2425,7 +2437,6 @@ end)()
2425
2437
  Unit.onDamage = __TS__New(
2426
2438
  InitializingEvent,
2427
2439
  function(event)
2428
- local invoke = Event.invoke
2429
2440
  local trigger = CreateTrigger()
2430
2441
  TriggerRegisterAnyUnitEventBJ(trigger, EVENT_PLAYER_UNIT_DAMAGED)
2431
2442
  TriggerAddCondition(
@@ -1,4 +1,3 @@
1
- /// <reference types="@typescript-to-lua/language-extensions" />
2
1
  /** @noSelfInFile */
3
2
  import { ModelNodeName } from "./model-node-name";
4
3
  import { ModelNodeQualifier } from "./model-node-qualifier";
@@ -1,5 +1,3 @@
1
- /// <reference types="@warscript/language-extensions" />
2
- /// <reference types="@typescript-to-lua/language-extensions" />
3
1
  /** @noSelfInFile */
4
2
  export declare const enum CombatClassification {
5
3
  NONE = 1,// 2^0
@@ -1,4 +1,3 @@
1
- /// <reference types="warpack-types/warpack" />
2
1
  /** @noSelfInFile */
3
2
  import { ChannelAbilityType, ChannelAbilityTypeTargetingType } from "./channel";
4
3
  import { ObjectDataEntryLevelFieldValueSupplier } from "../../entry";
@@ -1,4 +1,3 @@
1
- /// <reference types="warpack-types/warpack" />
2
1
  /** @noSelfInFile */
3
2
  import { DiseaseCloudAbilityType } from "./disease-cloud";
4
3
  export declare class BlankPassiveAbilityType extends DiseaseCloudAbilityType {
@@ -1,4 +1,3 @@
1
- /// <reference types="warpack-types/warpack" />
2
1
  /** @noSelfInFile */
3
2
  import { AbilityType, AbilityTypeId } from "../ability-type";
4
3
  import { ObjectDataEntryLevelFieldValueSupplier } from "../../entry";
@@ -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
@@ -1,4 +1,3 @@
1
- /// <reference types="warpack-types/warpack" />
2
1
  /** @noSelfInFile */
3
2
  import "../../internal/unit/ability";
4
3
  import { TupleOf } from "../../../utility/types";
@@ -1,4 +1,3 @@
1
- /// <reference types="warpack-types/warpack" />
2
1
  /** @noSelfInFile */
3
2
  import { BuffPolarity } from "../../auxiliary/buff-polarity";
4
3
  import { BuffResistanceType } from "../../auxiliary/buff-resistance-type";
@@ -1,4 +1,3 @@
1
- /// <reference types="warpack-types/warpack" />
2
1
  /** @noSelfInFile */
3
2
  import { BuffType, BuffTypeId } from "../buff-type";
4
3
  export declare class BlankBuffType extends BuffType {
@@ -1,4 +1,3 @@
1
- /// <reference types="warpack-types/warpack" />
2
1
  /** @noSelfInFile */
3
2
  import { TupleOf } from "../../../utility/types";
4
3
  import { AttachmentPreset, AttachmentPresetInput } from "../auxiliary/attachment-preset";
@@ -1,4 +1,3 @@
1
- /// <reference types="warpack-types/warpack" />
2
1
  /** @noSelfInFile */
3
2
  import { ArmorSoundType } from "../auxiliary/armor-sound-type";
4
3
  import { CombatClassifications } from "../auxiliary/combat-classification";
@@ -1,4 +1,3 @@
1
- /// <reference types="warpack-types/warpack" />
2
1
  /** @noSelfInFile */
3
2
  import { ItemType, ItemTypeId } from "../item-type";
4
3
  export declare class BlankItemType extends ItemType {
@@ -1,4 +1,3 @@
1
- /// <reference types="warpack-types/warpack" />
2
1
  /** @noSelfInFile */
3
2
  import { ArmorSoundType } from "../auxiliary/armor-sound-type";
4
3
  import { ObjectDataEntry, ObjectDataEntryId } from "../entry";
@@ -1,4 +1,3 @@
1
- /// <reference types="warpack-types/warpack" />
2
1
  /** @noSelfInFile */
3
2
  import { ObjectDataEntry, ObjectDataEntryConstructor, ObjectDataEntryId } from "../entry";
4
3
  import { Color } from "../../../core/types/color";
@@ -1,4 +1,3 @@
1
- /// <reference types="warpack-types/warpack" />
2
1
  /** @noSelfInFile */
3
2
  import { TupleOf } from "../../../utility/types";
4
3
  import { ArmorSoundType } from "../auxiliary/armor-sound-type";
@@ -1,4 +1,3 @@
1
- /// <reference types="warpack-types/warpack" />
2
1
  /** @noSelfInFile */
3
2
  import { Upgrade, UpgradeId } from "../upgrade";
4
3
  export declare class BlankUpgrade extends Upgrade {
@@ -1,4 +1,3 @@
1
- /// <reference types="warpack-types/warpack" />
2
1
  /** @noSelfInFile */
3
2
  import { TupleOf } from "../../../utility/types";
4
3
  import { TechTreeDependency, TechTreeDependencyInput } from "../auxiliary/tech-tree-dependency";
@@ -1,4 +1,3 @@
1
- /// <reference types="warpack-types/warpack" />
2
1
  /** @noSelfInFile */
3
2
  import { AttachmentPreset, AttachmentPresetInput } from "./auxiliary/attachment-preset";
4
3
  import { MutableKeys } from "../../utility/types";
@@ -10,8 +9,8 @@ export type ObjectDataEntryConstructor<T extends ObjectDataEntry> = OmitConstruc
10
9
  export type ObjectDataEntryAbstractConstructor<T extends ObjectDataEntry> = OmitConstructor<typeof ObjectDataEntry> & (abstract new (object: WarObject) => T);
11
10
  export type ObjectDataEntryProperties<T extends ObjectDataEntry> = Partial<T[MutableKeys<T>]>;
12
11
  export type ObjectDataEntryLevelFieldValueSupplier<ValueType extends string | number | boolean | undefined | Record<string, any>, InputValueType = ValueType> = ValueType | readonly ValueType[] | ((level: number, currentValue: InputValueType) => ValueType);
13
- export declare const extractObjectDataEntryLevelFieldValue: <ValueType extends string | number | boolean | Record<string, any> | undefined, InputValueType = ValueType>(supplier: ObjectDataEntryLevelFieldValueSupplier<ValueType, InputValueType>, level: number, currentValue: InputValueType) => ValueType;
14
- export declare const extractObjectDataEntryLevelArrayFieldValue: <T extends string | number | boolean | Record<string, any> | undefined, S extends T[]>(supplier: ObjectDataEntryLevelFieldValueSupplier<S, S>, level: number, currentValue: S) => S;
12
+ export declare const extractObjectDataEntryLevelFieldValue: <ValueType extends string | number | boolean | undefined | Record<string, any>, InputValueType = ValueType>(supplier: ObjectDataEntryLevelFieldValueSupplier<ValueType, InputValueType>, level: number, currentValue: InputValueType) => ValueType;
13
+ export declare const extractObjectDataEntryLevelArrayFieldValue: <T extends string | number | boolean | undefined | Record<string, any>, S extends T[]>(supplier: ObjectDataEntryLevelFieldValueSupplier<S>, level: number, currentValue: S) => S;
15
14
  export declare abstract class ObjectDataEntry<Id extends ObjectDataEntryId = ObjectDataEntryId> {
16
15
  protected readonly object: WarObject;
17
16
  static readonly BASE_ID: ObjectDataEntryId;
@@ -114,4 +114,4 @@ export declare class AbilityCombatClassificationsLevelField extends AbilityLevel
114
114
  protected setNativeFieldValue(instance: Ability, level: number, value: CombatClassifications): boolean;
115
115
  }
116
116
  export type AbilityDependentValue<ValueType extends boolean | number | string> = ValueType | AbilityField<ValueType> | AbilityLevelField<ValueType> | ((ability: Ability) => ValueType);
117
- export declare const resolveCurrentAbilityDependentValue: <ValueType extends string | number | boolean>(ability: Ability, value: AbilityDependentValue<ValueType>) => ValueType;
117
+ export declare const resolveCurrentAbilityDependentValue: <ValueType extends boolean | number | string>(ability: Ability, value: AbilityDependentValue<ValueType>) => ValueType;
@@ -1,4 +1,3 @@
1
- /// <reference types="@typescript-to-lua/language-extensions" />
2
1
  /** @noSelfInFile */
3
2
  import { DispatchingEvent } from "../event";
4
3
  import { AbstractConstructor } from "../utility/types";
@@ -8,3 +8,4 @@ export declare const randomFloat: {
8
8
  (upperBound?: number): number;
9
9
  (lowerBound: number, upperBound: number): number;
10
10
  };
11
+ export declare const randomXY: (centerX: number, centerY: number, range: number) => LuaMultiReturn<[x: number, y: number]>;
package/engine/random.lua CHANGED
@@ -1,9 +1,18 @@
1
1
  local ____exports = {}
2
2
  local ____math = require("math")
3
3
  local MAXIMUM_INTEGER = ____math.MAXIMUM_INTEGER
4
+ local PI = ____math.PI
4
5
  local getRandomInt = GetRandomInt
5
6
  local getRandomReal = GetRandomReal
7
+ local cos = math.cos
8
+ local sin = math.sin
9
+ local sqrt = math.sqrt
6
10
  ____exports.randomAngle = function() return getRandomReal(0, 360) end
7
11
  ____exports.randomInteger = function(m, n) return n ~= nil and getRandomInt(m, n) or getRandomInt(0, m or MAXIMUM_INTEGER) end
8
12
  ____exports.randomFloat = function(m, n) return n ~= nil and getRandomReal(m, n) or getRandomReal(0, m or MAXIMUM_INTEGER) end
13
+ ____exports.randomXY = function(centerX, centerY, range)
14
+ local r = range * sqrt(getRandomReal(0, 1))
15
+ local t = getRandomReal(0, 1) * 2 * PI
16
+ return centerX + r * cos(t), centerY + r * sin(t)
17
+ end
9
18
  return ____exports
@@ -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"))