warscript 0.0.1-dev.fae1c72 → 0.0.1-dev.ff2a62d

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.
package/engine/buff.lua CHANGED
@@ -107,7 +107,11 @@ local buffParametersKeys = {
107
107
  disablesAutoAttack = true,
108
108
  destroysOnDamage = true,
109
109
  maximumAutoAttackCount = true,
110
- uniqueGroup = true
110
+ uniqueGroup = true,
111
+ damageOnExpiration = true,
112
+ healingOnExpiration = true,
113
+ killsOnExpiration = true,
114
+ explodesOnExpiration = true
111
115
  }
112
116
  local function resolveNumberValue(ability, level, value)
113
117
  if value == nil or type(value) == "number" then
@@ -145,7 +149,14 @@ local function resolveAndSetNumberValue(buff, property, ability, level, value, d
145
149
  buff[property] = resolvedValue
146
150
  end
147
151
  end
148
- local buffBooleanParameters = {"stuns", "ignoresStunImmunity", "disablesAutoAttack", "providesInvulnerability"}
152
+ local buffBooleanParameters = {
153
+ "stuns",
154
+ "ignoresStunImmunity",
155
+ "disablesAutoAttack",
156
+ "providesInvulnerability",
157
+ "killsOnExpiration",
158
+ "explodesOnExpiration"
159
+ }
149
160
  local buffNumberParameters = {
150
161
  "durationIncreaseOnAutoAttack",
151
162
  "attackSpeedIncreaseFactor",
@@ -158,7 +169,9 @@ local buffNumberParameters = {
158
169
  "damageOverDuration",
159
170
  "healingInterval",
160
171
  "healingPerInterval",
161
- "healingOverDuration"
172
+ "healingOverDuration",
173
+ "damageOnExpiration",
174
+ "healingOnExpiration"
162
175
  }
163
176
  local unsuccessfulApplicationMarker = {}
164
177
  local function selectBuffTypeIdWithLeastDuration(buffTypeIds, unit)
@@ -207,6 +220,7 @@ local function expireBuff(buff)
207
220
  end
208
221
  end
209
222
  Timer:run(destroyBuff, buff)
223
+ buff:onExpiration()
210
224
  end
211
225
  local function buffDamageIntervalInitialTimerCallback(buff)
212
226
  buffDamageIntervalTimerCallback(buff)
@@ -530,11 +544,11 @@ function Buff.prototype.onDestroy(self)
530
544
  behavior:destroy()
531
545
  end
532
546
  end
533
- if self[130] then
547
+ if self[132] then
534
548
  unit:decrementDisableAutoAttackCounter()
535
549
  end
536
- if self[128] then
537
- if self[129] then
550
+ if self[130] then
551
+ if self[131] then
538
552
  unit:decrementStunCounter()
539
553
  end
540
554
  unit:decrementStunCounter()
@@ -583,20 +597,34 @@ function Buff.getByTypeId(self, unit, typeId)
583
597
  end
584
598
  return nil
585
599
  end
586
- function Buff.prototype.onDeath(self, source)
600
+ function Buff.prototype.onExpiration(self)
587
601
  local unit = self.unit
588
602
  if self[119] ~= nil then
603
+ (self[101] or unit):damageTarget(unit, self[119] or 0)
604
+ end
605
+ if self[120] ~= nil then
606
+ (self[101] or unit):healTarget(unit, self[119] or 0)
607
+ end
608
+ if self[135] then
609
+ unit:explode()
610
+ elseif self[134] then
611
+ unit:kill()
612
+ end
613
+ end
614
+ function Buff.prototype.onDeath(self, source)
615
+ local unit = self.unit
616
+ if self[121] ~= nil then
589
617
  damageArea(
590
618
  self[101] or unit,
591
- self[119],
619
+ self[121],
592
620
  unit.x,
593
621
  unit.y,
594
- self[121] or 0,
595
- self[120] or 0,
596
622
  self[123] or 0,
597
623
  self[122] or 0,
598
624
  self[125] or 0,
599
- self[124] or 0
625
+ self[124] or 0,
626
+ self[127] or 0,
627
+ self[126] or 0
600
628
  )
601
629
  end
602
630
  end
@@ -618,9 +646,9 @@ function Buff.prototype.onDamageDealt(self, target, event)
618
646
  end
619
647
  self.remainingDuration = remainingDuration
620
648
  end
621
- local autoAttackCount = (self[126] or 0) + 1
622
- self[126] = autoAttackCount
623
- if autoAttackCount == self[127] then
649
+ local autoAttackCount = (self[128] or 0) + 1
650
+ self[128] = autoAttackCount
651
+ if autoAttackCount == self[129] then
624
652
  self:destroy()
625
653
  end
626
654
  end
@@ -802,6 +830,32 @@ __TS__SetDescriptor(
802
830
  },
803
831
  true
804
832
  )
833
+ __TS__SetDescriptor(
834
+ Buff.prototype,
835
+ "damageOnExpiration",
836
+ {
837
+ get = function(self)
838
+ return self[119] or 0
839
+ end,
840
+ set = function(self, damageOnExpiration)
841
+ self[119] = damageOnExpiration ~= 0 and damageOnExpiration or nil
842
+ end
843
+ },
844
+ true
845
+ )
846
+ __TS__SetDescriptor(
847
+ Buff.prototype,
848
+ "healingOnExpiration",
849
+ {
850
+ get = function(self)
851
+ return self[120] or 0
852
+ end,
853
+ set = function(self, healingOnExpiration)
854
+ self[120] = healingOnExpiration ~= 0 and healingOnExpiration or nil
855
+ end
856
+ },
857
+ true
858
+ )
805
859
  __TS__SetDescriptor(
806
860
  Buff.prototype,
807
861
  "receivedDamageFactor",
@@ -833,25 +887,25 @@ __TS__SetDescriptor(
833
887
  "stuns",
834
888
  {
835
889
  get = function(self)
836
- local ____self__128_52 = self[128]
837
- if ____self__128_52 == nil then
838
- ____self__128_52 = false
890
+ local ____self__130_52 = self[130]
891
+ if ____self__130_52 == nil then
892
+ ____self__130_52 = false
839
893
  end
840
- return ____self__128_52
894
+ return ____self__130_52
841
895
  end,
842
896
  set = function(self, stuns)
843
- if not stuns and self[128] then
844
- if self[129] then
897
+ if not stuns and self[130] then
898
+ if self[131] then
845
899
  self.object:decrementStunCounter()
846
900
  end
847
901
  self.object:decrementStunCounter()
848
- self[128] = nil
849
- elseif stuns and not self[128] then
850
- if self[129] then
902
+ self[130] = nil
903
+ elseif stuns and not self[130] then
904
+ if self[131] then
851
905
  self.object:incrementStunCounter()
852
906
  end
853
907
  self.object:incrementStunCounter()
854
- self[128] = true
908
+ self[130] = true
855
909
  end
856
910
  end
857
911
  },
@@ -862,23 +916,23 @@ __TS__SetDescriptor(
862
916
  "ignoresStunImmunity",
863
917
  {
864
918
  get = function(self)
865
- local ____self__129_53 = self[129]
866
- if ____self__129_53 == nil then
867
- ____self__129_53 = false
919
+ local ____self__131_53 = self[131]
920
+ if ____self__131_53 == nil then
921
+ ____self__131_53 = false
868
922
  end
869
- return ____self__129_53
923
+ return ____self__131_53
870
924
  end,
871
925
  set = function(self, ignoresStunImmunity)
872
- if not ignoresStunImmunity and self[129] then
873
- if self[128] then
926
+ if not ignoresStunImmunity and self[131] then
927
+ if self[130] then
874
928
  self.object:decrementStunCounter()
875
929
  end
876
- self[129] = nil
877
- elseif ignoresStunImmunity and not self[129] then
878
- if self[128] then
930
+ self[131] = nil
931
+ elseif ignoresStunImmunity and not self[131] then
932
+ if self[130] then
879
933
  self.object:incrementStunCounter()
880
934
  end
881
- self[129] = true
935
+ self[131] = true
882
936
  end
883
937
  end
884
938
  },
@@ -889,19 +943,19 @@ __TS__SetDescriptor(
889
943
  "disablesAutoAttack",
890
944
  {
891
945
  get = function(self)
892
- local ____self__130_54 = self[130]
893
- if ____self__130_54 == nil then
894
- ____self__130_54 = false
946
+ local ____self__132_54 = self[132]
947
+ if ____self__132_54 == nil then
948
+ ____self__132_54 = false
895
949
  end
896
- return ____self__130_54
950
+ return ____self__132_54
897
951
  end,
898
952
  set = function(self, disablesAutoAttack)
899
- if not disablesAutoAttack and self[130] then
953
+ if not disablesAutoAttack and self[132] then
900
954
  self.object:decrementDisableAutoAttackCounter()
901
- self[130] = nil
902
- elseif disablesAutoAttack and not self[130] then
955
+ self[132] = nil
956
+ elseif disablesAutoAttack and not self[132] then
903
957
  self.object:incrementDisableAutoAttackCounter()
904
- self[130] = true
958
+ self[132] = true
905
959
  end
906
960
  end
907
961
  },
@@ -912,19 +966,61 @@ __TS__SetDescriptor(
912
966
  "providesInvulnerability",
913
967
  {
914
968
  get = function(self)
915
- local ____self__131_55 = self[131]
916
- if ____self__131_55 == nil then
917
- ____self__131_55 = false
969
+ local ____self__133_55 = self[133]
970
+ if ____self__133_55 == nil then
971
+ ____self__133_55 = false
918
972
  end
919
- return ____self__131_55
973
+ return ____self__133_55
920
974
  end,
921
975
  set = function(self, providesInvulnerability)
922
- if not providesInvulnerability and self[131] then
976
+ if not providesInvulnerability and self[133] then
923
977
  self.object:decrementInvulnerabilityCounter()
924
- self[131] = nil
925
- elseif providesInvulnerability and not self[131] then
978
+ self[133] = nil
979
+ elseif providesInvulnerability and not self[133] then
926
980
  self.object:incrementInvulnerabilityCounter()
927
- self[131] = true
981
+ self[133] = true
982
+ end
983
+ end
984
+ },
985
+ true
986
+ )
987
+ __TS__SetDescriptor(
988
+ Buff.prototype,
989
+ "killsOnExpiration",
990
+ {
991
+ get = function(self)
992
+ local ____self__134_56 = self[134]
993
+ if ____self__134_56 == nil then
994
+ ____self__134_56 = false
995
+ end
996
+ return ____self__134_56
997
+ end,
998
+ set = function(self, killsOnExpiration)
999
+ if not killsOnExpiration and self[134] then
1000
+ self[134] = nil
1001
+ elseif killsOnExpiration and not self[134] then
1002
+ self[134] = true
1003
+ end
1004
+ end
1005
+ },
1006
+ true
1007
+ )
1008
+ __TS__SetDescriptor(
1009
+ Buff.prototype,
1010
+ "explodesOnExpiration",
1011
+ {
1012
+ get = function(self)
1013
+ local ____self__135_57 = self[135]
1014
+ if ____self__135_57 == nil then
1015
+ ____self__135_57 = false
1016
+ end
1017
+ return ____self__135_57
1018
+ end,
1019
+ set = function(self, killsOnExpiration)
1020
+ if not killsOnExpiration and self[135] then
1021
+ self[135] = nil
1022
+ elseif killsOnExpiration and not self[135] then
1023
+ self[135] = true
928
1024
  end
929
1025
  end
930
1026
  },
@@ -935,13 +1031,13 @@ __TS__SetDescriptor(
935
1031
  "maximumAutoAttackCount",
936
1032
  {
937
1033
  get = function(self)
938
- return self[127] or 0
1034
+ return self[129] or 0
939
1035
  end,
940
1036
  set = function(self, maximumAutoAttackCount)
941
1037
  if maximumAutoAttackCount == 0 then
942
- self[127] = nil
1038
+ self[129] = nil
943
1039
  else
944
- self[127] = maximumAutoAttackCount
1040
+ self[129] = maximumAutoAttackCount
945
1041
  end
946
1042
  end
947
1043
  },
@@ -999,13 +1095,13 @@ __TS__SetDescriptor(
999
1095
  "remainingDuration",
1000
1096
  {
1001
1097
  get = function(self)
1002
- local ____opt_56 = self._timer
1003
- return ____opt_56 and ____opt_56.remaining or 0
1098
+ local ____opt_58 = self._timer
1099
+ return ____opt_58 and ____opt_58.remaining or 0
1004
1100
  end,
1005
1101
  set = function(self, remainingDuration)
1006
- local ____remainingDuration_60 = remainingDuration
1007
- local ____opt_58 = self._timer
1008
- local remainingDurationDelta = ____remainingDuration_60 - (____opt_58 and ____opt_58.remaining or 0)
1102
+ local ____remainingDuration_62 = remainingDuration
1103
+ local ____opt_60 = self._timer
1104
+ local remainingDurationDelta = ____remainingDuration_62 - (____opt_60 and ____opt_60.remaining or 0)
1009
1105
  if remainingDurationDelta ~= 0 then
1010
1106
  self[102] = self[102] + remainingDurationDelta
1011
1107
  if remainingDuration <= 0 then
@@ -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
@@ -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)
@@ -227,7 +227,7 @@ export declare class Unit extends Handle<junit> {
227
227
  isSelected(player: Player): boolean;
228
228
  explode(): void;
229
229
  kill(): void;
230
- revive(pos: Vec2, doEffect: boolean): void;
230
+ revive(x: number, y: number, doEffect?: boolean): void;
231
231
  healTarget(target: Widget, amount: number): void;
232
232
  useItem(item: Item): boolean;
233
233
  issueImmediateOrder(order: number): boolean;
@@ -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
@@ -1385,13 +1392,13 @@ __TS__SetDescriptor(
1385
1392
  end,
1386
1393
  set = function(self, isTeamGlowVisible)
1387
1394
  showUnitTeamGlow(self.handle, isTeamGlowVisible)
1388
- local ____temp_2
1395
+ local ____temp_5
1389
1396
  if not isTeamGlowVisible then
1390
- ____temp_2 = true
1397
+ ____temp_5 = true
1391
1398
  else
1392
- ____temp_2 = nil
1399
+ ____temp_5 = nil
1393
1400
  end
1394
- self[105] = ____temp_2
1401
+ self[105] = ____temp_5
1395
1402
  end
1396
1403
  },
1397
1404
  true
@@ -2055,7 +2062,6 @@ Unit.onDecay = __TS__New(
2055
2062
  Unit.onResurrect = __TS__New(
2056
2063
  InitializingEvent,
2057
2064
  function(event)
2058
- local invoke = Event.invoke
2059
2065
  local dead = setmetatable({}, {__mode = "k"})
2060
2066
  ____exports.Unit.deathEvent:addListener(function(unit)
2061
2067
  dead[unit] = true
@@ -2071,10 +2077,15 @@ Unit.onResurrect = __TS__New(
2071
2077
  Unit.morphEvent = __TS__New(
2072
2078
  InitializingEvent,
2073
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
2074
2086
  ____exports.Unit.onImmediateOrder[orderId("undefend")]:addListener(function(unit)
2075
2087
  if getUnitAbilityLevel(unit.handle, morphDetectAbilityId) == 0 then
2076
- assert(unitAddAbility(unit.handle, morphDetectAbilityId))
2077
- Timer:run(Event.invoke, event, unit)
2088
+ Timer:run(ifNotLeft, unit)
2078
2089
  end
2079
2090
  end)
2080
2091
  end
@@ -2112,27 +2123,26 @@ Unit.onSpellEffect = dispatchId(__TS__New(
2112
2123
  Unit.onTargetCast = dispatchId(__TS__New(
2113
2124
  InitializingEvent,
2114
2125
  function(event)
2115
- local invoke = Event.invoke
2116
2126
  local function listener(unit, id)
2117
- local ____GetSpellTargetUnit_result_5
2127
+ local ____GetSpellTargetUnit_result_8
2118
2128
  if GetSpellTargetUnit() then
2119
- ____GetSpellTargetUnit_result_5 = ____exports.Unit:of(GetSpellTargetUnit())
2129
+ ____GetSpellTargetUnit_result_8 = ____exports.Unit:of(GetSpellTargetUnit())
2120
2130
  else
2121
- local ____GetSpellTargetItem_result_4
2131
+ local ____GetSpellTargetItem_result_7
2122
2132
  if GetSpellTargetItem() then
2123
- ____GetSpellTargetItem_result_4 = Item:of(GetSpellTargetItem())
2133
+ ____GetSpellTargetItem_result_7 = Item:of(GetSpellTargetItem())
2124
2134
  else
2125
- local ____GetSpellTargetDestructable_result_3
2135
+ local ____GetSpellTargetDestructable_result_6
2126
2136
  if GetSpellTargetDestructable() then
2127
- ____GetSpellTargetDestructable_result_3 = Destructable:of(GetSpellTargetDestructable())
2137
+ ____GetSpellTargetDestructable_result_6 = Destructable:of(GetSpellTargetDestructable())
2128
2138
  else
2129
- ____GetSpellTargetDestructable_result_3 = nil
2139
+ ____GetSpellTargetDestructable_result_6 = nil
2130
2140
  end
2131
- ____GetSpellTargetItem_result_4 = ____GetSpellTargetDestructable_result_3
2141
+ ____GetSpellTargetItem_result_7 = ____GetSpellTargetDestructable_result_6
2132
2142
  end
2133
- ____GetSpellTargetUnit_result_5 = ____GetSpellTargetItem_result_4
2143
+ ____GetSpellTargetUnit_result_8 = ____GetSpellTargetItem_result_7
2134
2144
  end
2135
- local target = ____GetSpellTargetUnit_result_5
2145
+ local target = ____GetSpellTargetUnit_result_8
2136
2146
  if target then
2137
2147
  invoke(event, unit, id, target)
2138
2148
  end
@@ -2329,7 +2339,6 @@ Unit.autoAttackStartEvent = __TS__New(
2329
2339
  )
2330
2340
  Unit.onDamaging = (function()
2331
2341
  local event = __TS__New(Event)
2332
- local invoke = Event.invoke
2333
2342
  local trigger = CreateTrigger()
2334
2343
  TriggerRegisterAnyUnitEventBJ(trigger, EVENT_PLAYER_UNIT_DAMAGING)
2335
2344
  TriggerAddCondition(
@@ -2428,7 +2437,6 @@ end)()
2428
2437
  Unit.onDamage = __TS__New(
2429
2438
  InitializingEvent,
2430
2439
  function(event)
2431
- local invoke = Event.invoke
2432
2440
  local trigger = CreateTrigger()
2433
2441
  TriggerRegisterAnyUnitEventBJ(trigger, EVENT_PLAYER_UNIT_DAMAGED)
2434
2442
  TriggerAddCondition(
package/lualib_bundle.lua CHANGED
@@ -1094,6 +1094,11 @@ do
1094
1094
  end
1095
1095
  if __TS__StringIncludes(_VERSION, "Lua 5.0") then
1096
1096
  return debug.traceback(("[Level " .. tostring(level)) .. "]")
1097
+ elseif _VERSION == "Lua 5.1" then
1098
+ return string.sub(
1099
+ debug.traceback("", level),
1100
+ 2
1101
+ )
1097
1102
  else
1098
1103
  return debug.traceback(nil, level)
1099
1104
  end
@@ -1102,7 +1107,7 @@ do
1102
1107
  return function(self)
1103
1108
  local description = getDescription(self)
1104
1109
  local caller = debug.getinfo(3, "f")
1105
- local isClassicLua = __TS__StringIncludes(_VERSION, "Lua 5.0") or _VERSION == "Lua 5.1"
1110
+ local isClassicLua = __TS__StringIncludes(_VERSION, "Lua 5.0")
1106
1111
  if isClassicLua or caller and caller.func ~= error then
1107
1112
  return description
1108
1113
  else
@@ -1126,7 +1131,7 @@ do
1126
1131
  end
1127
1132
  self.message = message
1128
1133
  self.name = "Error"
1129
- self.stack = getErrorStack(nil, self.constructor.new)
1134
+ self.stack = getErrorStack(nil, __TS__New)
1130
1135
  local metatable = getmetatable(self)
1131
1136
  if metatable and not metatable.__errorToStringPatched then
1132
1137
  metatable.__errorToStringPatched = true
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.fae1c72",
4
+ "version": "0.0.1-dev.ff2a62d",
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.4",
26
26
  "lua-types": "^2.13.1",
27
- "warpack": "0.0.1-dev.07dd222"
27
+ "warpack": "0.0.1-dev.2c4e71e"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@typescript-eslint/eslint-plugin": "^8.13.0",