warscript 0.0.1-dev.ccd5725 → 0.0.1-dev.d30161d

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 (88) 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-missile-launch.lua +1 -1
  34. package/engine/internal/unit.d.ts +37 -10
  35. package/engine/internal/unit.lua +248 -88
  36. package/engine/object-data/auxiliary/attachment-preset.d.ts +0 -1
  37. package/engine/object-data/auxiliary/combat-classification.d.ts +0 -2
  38. package/engine/object-data/entry/ability-type/blank-configurable.d.ts +0 -1
  39. package/engine/object-data/entry/ability-type/blank-passive.d.ts +0 -1
  40. package/engine/object-data/entry/ability-type/channel.d.ts +0 -1
  41. package/engine/object-data/entry/ability-type/mine.d.ts +10 -0
  42. package/engine/object-data/entry/ability-type/mine.lua +39 -0
  43. package/engine/object-data/entry/ability-type/spirit-touch.d.ts +2 -2
  44. package/engine/object-data/entry/ability-type/spirit-touch.lua +6 -6
  45. package/engine/object-data/entry/ability-type.d.ts +0 -1
  46. package/engine/object-data/entry/buff-type/applicable.d.ts +0 -1
  47. package/engine/object-data/entry/buff-type/blank.d.ts +0 -1
  48. package/engine/object-data/entry/buff-type.d.ts +0 -1
  49. package/engine/object-data/entry/destructible-type.d.ts +0 -1
  50. package/engine/object-data/entry/item-type/blank.d.ts +0 -1
  51. package/engine/object-data/entry/item-type.d.ts +0 -1
  52. package/engine/object-data/entry/lightning-type.d.ts +0 -1
  53. package/engine/object-data/entry/unit-type.d.ts +25 -2
  54. package/engine/object-data/entry/unit-type.lua +255 -49
  55. package/engine/object-data/entry/upgrade/blank.d.ts +0 -1
  56. package/engine/object-data/entry/upgrade.d.ts +0 -1
  57. package/engine/object-data/entry.d.ts +2 -3
  58. package/engine/object-field/ability.d.ts +1 -1
  59. package/engine/object-field.d.ts +0 -1
  60. package/engine/random.d.ts +1 -0
  61. package/engine/random.lua +9 -0
  62. package/engine/standard/entries/unit-type.d.ts +39 -1
  63. package/engine/standard/entries/unit-type.lua +39 -1
  64. package/engine/standard/fields/ability.d.ts +1 -1
  65. package/engine/standard/fields/ability.lua +1 -1
  66. package/engine/unit.lua +9 -2
  67. package/event.d.ts +2 -3
  68. package/event.lua +9 -5
  69. package/lualib_bundle.lua +146 -42
  70. package/math/vec2.d.ts +2 -9
  71. package/math.d.ts +0 -2
  72. package/objutil/ability.d.ts +0 -1
  73. package/objutil/buff.d.ts +0 -1
  74. package/objutil/object.d.ts +0 -1
  75. package/objutil/unit.d.ts +0 -1
  76. package/package.json +13 -14
  77. package/property.d.ts +55 -0
  78. package/property.lua +374 -0
  79. package/string.d.ts +30 -0
  80. package/string.lua +14 -0
  81. package/util/stream.d.ts +0 -1
  82. package/utility/arrays.d.ts +3 -4
  83. package/utility/bit-set.d.ts +0 -2
  84. package/utility/linked-set.d.ts +1 -2
  85. package/utility/lua-maps.d.ts +1 -2
  86. package/utility/lua-sets.d.ts +1 -2
  87. package/core/mapbounds.d.ts +0 -8
  88. 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)
@@ -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)
@@ -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";
@@ -68,23 +67,44 @@ declare const modifiers: {
68
67
  speed: (unit: junit, value: number) => void;
69
68
  armor: (unit: junit, value: number) => void;
70
69
  };
71
- interface UnitWeapon {
70
+ export declare class UnitWeapon {
71
+ readonly unit: Unit;
72
72
  readonly index: 0 | 1;
73
- cooldown: number;
74
- projectileArc: number;
75
- projectileArt: string;
76
- projectileSpeed: number;
77
- attackPoint: number;
73
+ constructor(unit: Unit, index: 0 | 1);
74
+ get cooldown(): number;
75
+ set cooldown(cooldown: number);
76
+ get damage(): [minimumDamage: number, maximumDamage: number];
77
+ set damage([minimumDamage, maximumDamage]: [number, number]);
78
+ get damageBase(): number;
79
+ set damageBase(damageBase: number);
80
+ get damageDiceCount(): number;
81
+ set damageDiceCount(damageDiceCount: number);
82
+ get damageDiceSideCount(): number;
83
+ set damageDiceSideCount(damageDiceSideCount: number);
84
+ get range(): number;
85
+ set range(range: number);
86
+ get impactDelay(): number;
87
+ set impactDelay(impactDelay: number);
88
+ get missileArc(): number;
89
+ set missileArc(missileArc: number);
90
+ get missileModelPath(): string;
91
+ set missileModelPath(missileModelPath: string);
92
+ get missileSpeed(): number;
93
+ set missileSpeed(missileSpeed: number);
78
94
  }
79
95
  declare const enum UnitPropertyKey {
80
96
  IS_PAUSED = 100,
81
97
  STUN_COUNTER = 101,
82
- PREVENT_DEATH_HEALTH_BONUS = 102,
83
- IS_TEAM_GLOW_HIDDEN = 103
98
+ DELAY_HEALTH_CHECKS_COUNTER = 102,
99
+ DELAY_HEALTH_CHECKS_HEALTH_BONUS = 103,
100
+ PREVENT_DEATH_HEALTH_BONUS = 104,
101
+ IS_TEAM_GLOW_HIDDEN = 105
84
102
  }
85
103
  export declare class Unit extends Handle<junit> {
86
104
  private [UnitPropertyKey.IS_PAUSED]?;
87
105
  private [UnitPropertyKey.STUN_COUNTER]?;
106
+ private [UnitPropertyKey.DELAY_HEALTH_CHECKS_COUNTER]?;
107
+ private [UnitPropertyKey.DELAY_HEALTH_CHECKS_HEALTH_BONUS]?;
88
108
  private [UnitPropertyKey.PREVENT_DEATH_HEALTH_BONUS]?;
89
109
  private [UnitPropertyKey.IS_TEAM_GLOW_HIDDEN]?;
90
110
  private _owner?;
@@ -123,6 +143,8 @@ export declare class Unit extends Handle<junit> {
123
143
  playAnimation(animation: number): void;
124
144
  queueAnimation(animation: string): void;
125
145
  get weapons(): [UnitWeapon, UnitWeapon];
146
+ get firstWeapon(): UnitWeapon;
147
+ get secondWeapon(): UnitWeapon;
126
148
  get level(): number;
127
149
  set level(v: number);
128
150
  get xp(): number;
@@ -148,6 +170,10 @@ export declare class Unit extends Handle<junit> {
148
170
  set color(color: PlayerColor);
149
171
  get acquisitionRange(): number;
150
172
  set acquisitionRange(v: number);
173
+ /**
174
+ * Keeps this unit alive even if its health becomes negative until the current game thread yields.
175
+ */
176
+ delayHealthChecks(): void;
151
177
  get maxHealth(): number;
152
178
  set maxHealth(maxHealth: number);
153
179
  get healthRegenerationRate(): number;
@@ -201,7 +227,7 @@ export declare class Unit extends Handle<junit> {
201
227
  isSelected(player: Player): boolean;
202
228
  explode(): void;
203
229
  kill(): void;
204
- revive(pos: Vec2, doEffect: boolean): void;
230
+ revive(x: number, y: number, doEffect?: boolean): void;
205
231
  healTarget(target: Widget, amount: number): void;
206
232
  useItem(item: Item): boolean;
207
233
  issueImmediateOrder(order: number): boolean;
@@ -222,6 +248,7 @@ export declare class Unit extends Handle<junit> {
222
248
  getAbilityById(abilityId: number): UnitAbility | undefined;
223
249
  removeAbility(abilityId: number): boolean;
224
250
  hideAbility(abilityId: number, flag: boolean): void;
251
+ getAbilityRemainingCooldown(abilityId: number): number;
225
252
  startAbilityCooldown(abilityId: number, cooldown: number): void;
226
253
  endAbilityCooldown(abilityId: number): void;
227
254
  interruptAttack(): void;