warscript 0.0.1-dev.38f0dea → 0.0.1-dev.4363c65
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/core/types/frame.d.ts +2 -0
- package/core/types/frame.lua +20 -1
- package/engine/buff.d.ts +21 -6
- package/engine/buff.lua +127 -61
- package/engine/object-field/ability.d.ts +17 -0
- package/engine/object-field/ability.lua +50 -0
- package/package.json +1 -1
- package/utility/linked-set.d.ts +11 -2
- package/utility/linked-set.lua +5 -2
- package/utility/types.d.ts +1 -0
package/core/types/frame.d.ts
CHANGED
|
@@ -25,11 +25,13 @@ export declare class Frame extends Handle<jframehandle> {
|
|
|
25
25
|
static readonly GAME_UI: Frame;
|
|
26
26
|
static readonly CONSOLE_UI: Frame;
|
|
27
27
|
static readonly CONSOLE_UI_BACKDROP: Frame;
|
|
28
|
+
private static readonly CONSOLE_UI_BACKDROP_UI_SCALE_HELPER_CHILD;
|
|
28
29
|
static readonly CONSOLE_TOP_BAR: Frame;
|
|
29
30
|
static readonly CONSOLE_BOTTOM_BAR: Frame;
|
|
30
31
|
static readonly WORLD: Frame;
|
|
31
32
|
static readonly CHAT: Frame;
|
|
32
33
|
static readonly TIME_OF_DAY_CLOCK: Frame;
|
|
34
|
+
static get uiScale(): number;
|
|
33
35
|
static get leftBorder(): Frame;
|
|
34
36
|
static get rightBorder(): Frame;
|
|
35
37
|
static get minX(): number;
|
package/core/types/frame.lua
CHANGED
|
@@ -62,8 +62,10 @@ local function updateBorders()
|
|
|
62
62
|
local width4by3 = (w - h / 600 * 800) / 2
|
|
63
63
|
local pxtodpi = 0.6 / h
|
|
64
64
|
BlzFrameSetAbsPoint(leftBorder, FRAMEPOINT_TOPLEFT, -width4by3 * pxtodpi, 0.6)
|
|
65
|
+
BlzFrameSetScale(leftBorder, 1)
|
|
65
66
|
BlzFrameSetSize(leftBorder, 0.001, 0.6)
|
|
66
67
|
BlzFrameSetAbsPoint(rightBorder, FRAMEPOINT_TOPRIGHT, (-width4by3 + w) * pxtodpi, 0.6)
|
|
68
|
+
BlzFrameSetScale(rightBorder, 1)
|
|
67
69
|
BlzFrameSetSize(rightBorder, 0.001, 0.6)
|
|
68
70
|
end
|
|
69
71
|
local worldFrame = BlzGetOriginFrame(ORIGIN_FRAME_WORLD_FRAME, 0)
|
|
@@ -267,7 +269,16 @@ function Frame.createSimple(self, name, parent, createContext)
|
|
|
267
269
|
))
|
|
268
270
|
end
|
|
269
271
|
function Frame.create(self, name, parent, priority, createContext)
|
|
270
|
-
|
|
272
|
+
if parent == ____exports.Frame.CONSOLE_UI_BACKDROP then
|
|
273
|
+
local helper = ____exports.Frame.CONSOLE_UI_BACKDROP_UI_SCALE_HELPER_CHILD.handle
|
|
274
|
+
BlzFrameSetScale(helper, 1)
|
|
275
|
+
local frame = BlzCreateFrame(name, helper, priority or 0, createContext or 0)
|
|
276
|
+
BlzFrameSetScale(helper, ____exports.Frame.uiScale)
|
|
277
|
+
BlzFrameSetParent(frame, ____exports.Frame.CONSOLE_UI_BACKDROP.handle)
|
|
278
|
+
return self:of(frame)
|
|
279
|
+
else
|
|
280
|
+
return self:of(BlzCreateFrame(name, parent.handle, priority or 0, createContext or 0))
|
|
281
|
+
end
|
|
271
282
|
end
|
|
272
283
|
function Frame.createByType(self, typeName, name, parent, inherits, createContext)
|
|
273
284
|
return self:of(BlzCreateFrameByType(
|
|
@@ -293,11 +304,19 @@ end
|
|
|
293
304
|
Frame.GAME_UI = ____exports.Frame:byOrigin(ORIGIN_FRAME_GAME_UI)
|
|
294
305
|
Frame.CONSOLE_UI = ____exports.Frame:byOrigin(ORIGIN_FRAME_SIMPLE_UI_PARENT)
|
|
295
306
|
Frame.CONSOLE_UI_BACKDROP = ____exports.Frame:byName("ConsoleUIBackdrop")
|
|
307
|
+
Frame.CONSOLE_UI_BACKDROP_UI_SCALE_HELPER_CHILD = ____exports.Frame:createByType("FRAME", "ConsoleUIBackdropUIScaleHelperChild", ____exports.Frame.CONSOLE_UI_BACKDROP)
|
|
296
308
|
Frame.CONSOLE_TOP_BAR = ____exports.Frame:byName("ConsoleTopBar")
|
|
297
309
|
Frame.CONSOLE_BOTTOM_BAR = ____exports.Frame:byName("ConsoleBottomBar")
|
|
298
310
|
Frame.WORLD = ____exports.Frame:byOrigin(ORIGIN_FRAME_WORLD_FRAME)
|
|
299
311
|
Frame.CHAT = ____exports.Frame:byOrigin(ORIGIN_FRAME_CHAT_MSG)
|
|
300
312
|
Frame.TIME_OF_DAY_CLOCK = ____exports.Frame.GAME_UI:getChild(5):getChild(0)
|
|
313
|
+
__TS__ObjectDefineProperty(
|
|
314
|
+
Frame,
|
|
315
|
+
"uiScale",
|
|
316
|
+
{get = function(self)
|
|
317
|
+
return ____exports.Frame.CONSOLE_BOTTOM_BAR.width / 0.8
|
|
318
|
+
end}
|
|
319
|
+
)
|
|
301
320
|
__TS__ObjectDefineProperty(
|
|
302
321
|
Frame,
|
|
303
322
|
"leftBorder",
|
package/engine/buff.d.ts
CHANGED
|
@@ -64,6 +64,8 @@ export type BuffParameters<T extends Buff<any> = Buff> = Buff extends T ? {
|
|
|
64
64
|
disablesAutoAttack?: BooleanParameterValueType;
|
|
65
65
|
destroysOnDamage?: BooleanParameterValueType;
|
|
66
66
|
maximumAutoAttackCount?: IntegerParameterValueType;
|
|
67
|
+
maximumDamageDealtEventCount?: IntegerParameterValueType;
|
|
68
|
+
maximumDamageReceivedEventCount?: IntegerParameterValueType;
|
|
67
69
|
damageOnExpiration?: NumberParameterValueType;
|
|
68
70
|
healingOnExpiration?: NumberParameterValueType;
|
|
69
71
|
killsOnExpiration?: BooleanParameterValueType;
|
|
@@ -101,12 +103,16 @@ declare const enum BuffPropertyKey {
|
|
|
101
103
|
SMALL_DAMAGE_UPON_DEATH_RANGE = 127,
|
|
102
104
|
AUTO_ATTACK_COUNT = 128,
|
|
103
105
|
MAXIMUM_AUTO_ATTACK_COUNT = 129,
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
106
|
+
DAMAGE_DEALT_EVENT_COUNT = 130,
|
|
107
|
+
MAXIMUM_DAMAGE_DEALT_EVENT_COUNT = 131,
|
|
108
|
+
DAMAGE_RECEIVED_EVENT_COUNT = 132,
|
|
109
|
+
MAXIMUM_DAMAGE_RECEIVED_EVENT_COUNT = 133,
|
|
110
|
+
STUNS = 134,
|
|
111
|
+
IGNORES_STUN_IMMUNITY = 135,
|
|
112
|
+
DISABLES_AUTO_ATTACK = 136,
|
|
113
|
+
PROVIDES_INVULNERABILITY = 137,
|
|
114
|
+
KILLS_ON_EXPIRATION = 138,
|
|
115
|
+
EXPLODES_ON_EXPIRATION = 139
|
|
110
116
|
}
|
|
111
117
|
export declare const enum BuffTypeIdSelectionPolicy {
|
|
112
118
|
LEAST_DURATION = 0
|
|
@@ -157,6 +163,10 @@ export declare class Buff<AdditionalParameters extends Prohibit<Record<string, a
|
|
|
157
163
|
private [BuffPropertyKey.SMALL_DAMAGE_UPON_DEATH_RANGE]?;
|
|
158
164
|
private [BuffPropertyKey.MAXIMUM_AUTO_ATTACK_COUNT]?;
|
|
159
165
|
private [BuffPropertyKey.AUTO_ATTACK_COUNT]?;
|
|
166
|
+
private [BuffPropertyKey.MAXIMUM_DAMAGE_DEALT_EVENT_COUNT]?;
|
|
167
|
+
private [BuffPropertyKey.DAMAGE_DEALT_EVENT_COUNT]?;
|
|
168
|
+
private [BuffPropertyKey.MAXIMUM_DAMAGE_RECEIVED_EVENT_COUNT]?;
|
|
169
|
+
private [BuffPropertyKey.DAMAGE_RECEIVED_EVENT_COUNT]?;
|
|
160
170
|
private [BuffPropertyKey.STUNS]?;
|
|
161
171
|
private [BuffPropertyKey.IGNORES_STUN_IMMUNITY]?;
|
|
162
172
|
private [BuffPropertyKey.DISABLES_AUTO_ATTACK]?;
|
|
@@ -219,6 +229,10 @@ export declare class Buff<AdditionalParameters extends Prohibit<Record<string, a
|
|
|
219
229
|
set killsOnExpiration(killsOnExpiration: boolean);
|
|
220
230
|
get explodesOnExpiration(): boolean;
|
|
221
231
|
set explodesOnExpiration(killsOnExpiration: boolean);
|
|
232
|
+
get maximumDamageDealtEventCount(): number;
|
|
233
|
+
set maximumDamageDealtEventCount(maximumDamageDealtEventCount: number);
|
|
234
|
+
get maximumDamageReceivedEventCount(): number;
|
|
235
|
+
set maximumDamageReceivedEventCount(maximumDamageReceivedEventCount: number);
|
|
222
236
|
get maximumAutoAttackCount(): number;
|
|
223
237
|
set maximumAutoAttackCount(maximumAutoAttackCount: number);
|
|
224
238
|
get durationIncreaseOnAutoAttack(): number;
|
|
@@ -238,5 +252,6 @@ export declare class Buff<AdditionalParameters extends Prohibit<Record<string, a
|
|
|
238
252
|
onExpiration(): void;
|
|
239
253
|
onDeath(source: Unit | undefined): void;
|
|
240
254
|
onDamageDealt(target: Unit, event: DamageEvent): void;
|
|
255
|
+
onDamageReceived(source: Unit | undefined, event: DamageEvent): void;
|
|
241
256
|
}
|
|
242
257
|
export {};
|
package/engine/buff.lua
CHANGED
|
@@ -107,12 +107,26 @@ local buffParametersKeys = {
|
|
|
107
107
|
disablesAutoAttack = true,
|
|
108
108
|
destroysOnDamage = true,
|
|
109
109
|
maximumAutoAttackCount = true,
|
|
110
|
+
maximumDamageDealtEventCount = true,
|
|
111
|
+
maximumDamageReceivedEventCount = true,
|
|
110
112
|
uniqueGroup = true,
|
|
111
113
|
damageOnExpiration = true,
|
|
112
114
|
healingOnExpiration = true,
|
|
113
115
|
killsOnExpiration = true,
|
|
114
116
|
explodesOnExpiration = true
|
|
115
117
|
}
|
|
118
|
+
local function resolveEnumValue(ability, level, value)
|
|
119
|
+
if value == nil or type(value) == "number" then
|
|
120
|
+
return value
|
|
121
|
+
end
|
|
122
|
+
if ability == nil then
|
|
123
|
+
error(
|
|
124
|
+
__TS__New(IllegalArgumentException),
|
|
125
|
+
0
|
|
126
|
+
)
|
|
127
|
+
end
|
|
128
|
+
return value:getValue(ability, level or ability.level)
|
|
129
|
+
end
|
|
116
130
|
local function resolveNumberValue(ability, level, value)
|
|
117
131
|
if value == nil or type(value) == "number" then
|
|
118
132
|
return value
|
|
@@ -164,6 +178,8 @@ local buffNumberParameters = {
|
|
|
164
178
|
"armorIncrease",
|
|
165
179
|
"receivedDamageFactor",
|
|
166
180
|
"maximumAutoAttackCount",
|
|
181
|
+
"maximumDamageDealtEventCount",
|
|
182
|
+
"maximumDamageReceivedEventCount",
|
|
167
183
|
"damageInterval",
|
|
168
184
|
"damagePerInterval",
|
|
169
185
|
"damageOverDuration",
|
|
@@ -310,8 +326,6 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
|
|
|
310
326
|
end
|
|
311
327
|
end
|
|
312
328
|
self.typeId = typeId
|
|
313
|
-
self.polarity = polarity
|
|
314
|
-
self.resistanceType = resistanceType
|
|
315
329
|
if not __TS__InstanceOf(ability, Ability) then
|
|
316
330
|
parameters = ability
|
|
317
331
|
ability = nil
|
|
@@ -338,6 +352,8 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
|
|
|
338
352
|
learnLevelMinimum = learnLevelMinimum or ability:getField(ABILITY_IF_REQUIRED_LEVEL)
|
|
339
353
|
duration = duration or getAbilityDuration(ability, _unit)
|
|
340
354
|
end
|
|
355
|
+
self.polarity = resolveEnumValue(ability, level, polarity)
|
|
356
|
+
self.resistanceType = resolveEnumValue(ability, level, resistanceType)
|
|
341
357
|
local buffByTypeId = buffByTypeIdByUnit[_unit]
|
|
342
358
|
if buffByTypeId == nil then
|
|
343
359
|
buffByTypeId = {}
|
|
@@ -354,8 +370,8 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
|
|
|
354
370
|
if not internalApplyBuff(
|
|
355
371
|
_unit,
|
|
356
372
|
typeId,
|
|
357
|
-
polarity,
|
|
358
|
-
resistanceType,
|
|
373
|
+
self.polarity,
|
|
374
|
+
self.resistanceType,
|
|
359
375
|
level,
|
|
360
376
|
duration,
|
|
361
377
|
spellStealPriority,
|
|
@@ -544,11 +560,11 @@ function Buff.prototype.onDestroy(self)
|
|
|
544
560
|
behavior:destroy()
|
|
545
561
|
end
|
|
546
562
|
end
|
|
547
|
-
if self[
|
|
563
|
+
if self[136] then
|
|
548
564
|
unit:decrementDisableAutoAttackCounter()
|
|
549
565
|
end
|
|
550
|
-
if self[
|
|
551
|
-
if self[
|
|
566
|
+
if self[134] then
|
|
567
|
+
if self[135] then
|
|
552
568
|
unit:decrementStunCounter()
|
|
553
569
|
end
|
|
554
570
|
unit:decrementStunCounter()
|
|
@@ -605,9 +621,9 @@ function Buff.prototype.onExpiration(self)
|
|
|
605
621
|
if self[120] ~= nil then
|
|
606
622
|
(self[101] or unit):healTarget(unit, self[119] or 0)
|
|
607
623
|
end
|
|
608
|
-
if self[
|
|
624
|
+
if self[139] then
|
|
609
625
|
unit:explode()
|
|
610
|
-
elseif self[
|
|
626
|
+
elseif self[138] then
|
|
611
627
|
unit:kill()
|
|
612
628
|
end
|
|
613
629
|
end
|
|
@@ -652,6 +668,22 @@ function Buff.prototype.onDamageDealt(self, target, event)
|
|
|
652
668
|
self:destroy()
|
|
653
669
|
end
|
|
654
670
|
end
|
|
671
|
+
if event.amount ~= 0 then
|
|
672
|
+
local damageDealtEventCount = (self[130] or 0) + 1
|
|
673
|
+
self[130] = damageDealtEventCount
|
|
674
|
+
if damageDealtEventCount == self[131] then
|
|
675
|
+
self:destroy()
|
|
676
|
+
end
|
|
677
|
+
end
|
|
678
|
+
end
|
|
679
|
+
function Buff.prototype.onDamageReceived(self, source, event)
|
|
680
|
+
if event.amount ~= 0 then
|
|
681
|
+
local damageReceivedEventCount = (self[132] or 0) + 1
|
|
682
|
+
self[132] = damageReceivedEventCount
|
|
683
|
+
if damageReceivedEventCount == self[133] then
|
|
684
|
+
self:destroy()
|
|
685
|
+
end
|
|
686
|
+
end
|
|
655
687
|
end
|
|
656
688
|
Buff.defaultParameters = {}
|
|
657
689
|
__TS__SetDescriptor(
|
|
@@ -887,25 +919,25 @@ __TS__SetDescriptor(
|
|
|
887
919
|
"stuns",
|
|
888
920
|
{
|
|
889
921
|
get = function(self)
|
|
890
|
-
local
|
|
891
|
-
if
|
|
892
|
-
|
|
922
|
+
local ____self__134_52 = self[134]
|
|
923
|
+
if ____self__134_52 == nil then
|
|
924
|
+
____self__134_52 = false
|
|
893
925
|
end
|
|
894
|
-
return
|
|
926
|
+
return ____self__134_52
|
|
895
927
|
end,
|
|
896
928
|
set = function(self, stuns)
|
|
897
|
-
if not stuns and self[
|
|
898
|
-
if self[
|
|
929
|
+
if not stuns and self[134] then
|
|
930
|
+
if self[135] then
|
|
899
931
|
self.object:decrementStunCounter()
|
|
900
932
|
end
|
|
901
933
|
self.object:decrementStunCounter()
|
|
902
|
-
self[
|
|
903
|
-
elseif stuns and not self[
|
|
904
|
-
if self[
|
|
934
|
+
self[134] = nil
|
|
935
|
+
elseif stuns and not self[134] then
|
|
936
|
+
if self[135] then
|
|
905
937
|
self.object:incrementStunCounter()
|
|
906
938
|
end
|
|
907
939
|
self.object:incrementStunCounter()
|
|
908
|
-
self[
|
|
940
|
+
self[134] = true
|
|
909
941
|
end
|
|
910
942
|
end
|
|
911
943
|
},
|
|
@@ -916,23 +948,23 @@ __TS__SetDescriptor(
|
|
|
916
948
|
"ignoresStunImmunity",
|
|
917
949
|
{
|
|
918
950
|
get = function(self)
|
|
919
|
-
local
|
|
920
|
-
if
|
|
921
|
-
|
|
951
|
+
local ____self__135_53 = self[135]
|
|
952
|
+
if ____self__135_53 == nil then
|
|
953
|
+
____self__135_53 = false
|
|
922
954
|
end
|
|
923
|
-
return
|
|
955
|
+
return ____self__135_53
|
|
924
956
|
end,
|
|
925
957
|
set = function(self, ignoresStunImmunity)
|
|
926
|
-
if not ignoresStunImmunity and self[
|
|
927
|
-
if self[
|
|
958
|
+
if not ignoresStunImmunity and self[135] then
|
|
959
|
+
if self[134] then
|
|
928
960
|
self.object:decrementStunCounter()
|
|
929
961
|
end
|
|
930
|
-
self[
|
|
931
|
-
elseif ignoresStunImmunity and not self[
|
|
932
|
-
if self[
|
|
962
|
+
self[135] = nil
|
|
963
|
+
elseif ignoresStunImmunity and not self[135] then
|
|
964
|
+
if self[134] then
|
|
933
965
|
self.object:incrementStunCounter()
|
|
934
966
|
end
|
|
935
|
-
self[
|
|
967
|
+
self[135] = true
|
|
936
968
|
end
|
|
937
969
|
end
|
|
938
970
|
},
|
|
@@ -943,19 +975,19 @@ __TS__SetDescriptor(
|
|
|
943
975
|
"disablesAutoAttack",
|
|
944
976
|
{
|
|
945
977
|
get = function(self)
|
|
946
|
-
local
|
|
947
|
-
if
|
|
948
|
-
|
|
978
|
+
local ____self__136_54 = self[136]
|
|
979
|
+
if ____self__136_54 == nil then
|
|
980
|
+
____self__136_54 = false
|
|
949
981
|
end
|
|
950
|
-
return
|
|
982
|
+
return ____self__136_54
|
|
951
983
|
end,
|
|
952
984
|
set = function(self, disablesAutoAttack)
|
|
953
|
-
if not disablesAutoAttack and self[
|
|
985
|
+
if not disablesAutoAttack and self[136] then
|
|
954
986
|
self.object:decrementDisableAutoAttackCounter()
|
|
955
|
-
self[
|
|
956
|
-
elseif disablesAutoAttack and not self[
|
|
987
|
+
self[136] = nil
|
|
988
|
+
elseif disablesAutoAttack and not self[136] then
|
|
957
989
|
self.object:incrementDisableAutoAttackCounter()
|
|
958
|
-
self[
|
|
990
|
+
self[136] = true
|
|
959
991
|
end
|
|
960
992
|
end
|
|
961
993
|
},
|
|
@@ -966,19 +998,19 @@ __TS__SetDescriptor(
|
|
|
966
998
|
"providesInvulnerability",
|
|
967
999
|
{
|
|
968
1000
|
get = function(self)
|
|
969
|
-
local
|
|
970
|
-
if
|
|
971
|
-
|
|
1001
|
+
local ____self__137_55 = self[137]
|
|
1002
|
+
if ____self__137_55 == nil then
|
|
1003
|
+
____self__137_55 = false
|
|
972
1004
|
end
|
|
973
|
-
return
|
|
1005
|
+
return ____self__137_55
|
|
974
1006
|
end,
|
|
975
1007
|
set = function(self, providesInvulnerability)
|
|
976
|
-
if not providesInvulnerability and self[
|
|
1008
|
+
if not providesInvulnerability and self[137] then
|
|
977
1009
|
self.object:decrementInvulnerabilityCounter()
|
|
978
|
-
self[
|
|
979
|
-
elseif providesInvulnerability and not self[
|
|
1010
|
+
self[137] = nil
|
|
1011
|
+
elseif providesInvulnerability and not self[137] then
|
|
980
1012
|
self.object:incrementInvulnerabilityCounter()
|
|
981
|
-
self[
|
|
1013
|
+
self[137] = true
|
|
982
1014
|
end
|
|
983
1015
|
end
|
|
984
1016
|
},
|
|
@@ -989,17 +1021,17 @@ __TS__SetDescriptor(
|
|
|
989
1021
|
"killsOnExpiration",
|
|
990
1022
|
{
|
|
991
1023
|
get = function(self)
|
|
992
|
-
local
|
|
993
|
-
if
|
|
994
|
-
|
|
1024
|
+
local ____self__138_56 = self[138]
|
|
1025
|
+
if ____self__138_56 == nil then
|
|
1026
|
+
____self__138_56 = false
|
|
995
1027
|
end
|
|
996
|
-
return
|
|
1028
|
+
return ____self__138_56
|
|
997
1029
|
end,
|
|
998
1030
|
set = function(self, killsOnExpiration)
|
|
999
|
-
if not killsOnExpiration and self[
|
|
1000
|
-
self[
|
|
1001
|
-
elseif killsOnExpiration and not self[
|
|
1002
|
-
self[
|
|
1031
|
+
if not killsOnExpiration and self[138] then
|
|
1032
|
+
self[138] = nil
|
|
1033
|
+
elseif killsOnExpiration and not self[138] then
|
|
1034
|
+
self[138] = true
|
|
1003
1035
|
end
|
|
1004
1036
|
end
|
|
1005
1037
|
},
|
|
@@ -1010,17 +1042,51 @@ __TS__SetDescriptor(
|
|
|
1010
1042
|
"explodesOnExpiration",
|
|
1011
1043
|
{
|
|
1012
1044
|
get = function(self)
|
|
1013
|
-
local
|
|
1014
|
-
if
|
|
1015
|
-
|
|
1045
|
+
local ____self__139_57 = self[139]
|
|
1046
|
+
if ____self__139_57 == nil then
|
|
1047
|
+
____self__139_57 = false
|
|
1016
1048
|
end
|
|
1017
|
-
return
|
|
1049
|
+
return ____self__139_57
|
|
1018
1050
|
end,
|
|
1019
1051
|
set = function(self, killsOnExpiration)
|
|
1020
|
-
if not killsOnExpiration and self[
|
|
1021
|
-
self[
|
|
1022
|
-
elseif killsOnExpiration and not self[
|
|
1023
|
-
self[
|
|
1052
|
+
if not killsOnExpiration and self[139] then
|
|
1053
|
+
self[139] = nil
|
|
1054
|
+
elseif killsOnExpiration and not self[139] then
|
|
1055
|
+
self[139] = true
|
|
1056
|
+
end
|
|
1057
|
+
end
|
|
1058
|
+
},
|
|
1059
|
+
true
|
|
1060
|
+
)
|
|
1061
|
+
__TS__SetDescriptor(
|
|
1062
|
+
Buff.prototype,
|
|
1063
|
+
"maximumDamageDealtEventCount",
|
|
1064
|
+
{
|
|
1065
|
+
get = function(self)
|
|
1066
|
+
return self[131] or 0
|
|
1067
|
+
end,
|
|
1068
|
+
set = function(self, maximumDamageDealtEventCount)
|
|
1069
|
+
if maximumDamageDealtEventCount == 0 then
|
|
1070
|
+
self[131] = nil
|
|
1071
|
+
else
|
|
1072
|
+
self[131] = maximumDamageDealtEventCount
|
|
1073
|
+
end
|
|
1074
|
+
end
|
|
1075
|
+
},
|
|
1076
|
+
true
|
|
1077
|
+
)
|
|
1078
|
+
__TS__SetDescriptor(
|
|
1079
|
+
Buff.prototype,
|
|
1080
|
+
"maximumDamageReceivedEventCount",
|
|
1081
|
+
{
|
|
1082
|
+
get = function(self)
|
|
1083
|
+
return self[133] or 0
|
|
1084
|
+
end,
|
|
1085
|
+
set = function(self, maximumDamageReceivedEventCount)
|
|
1086
|
+
if maximumDamageReceivedEventCount == 0 then
|
|
1087
|
+
self[133] = nil
|
|
1088
|
+
else
|
|
1089
|
+
self[133] = maximumDamageReceivedEventCount
|
|
1024
1090
|
end
|
|
1025
1091
|
end
|
|
1026
1092
|
},
|
|
@@ -6,6 +6,9 @@ import { ObjectDataEntryId } from "../object-data/entry";
|
|
|
6
6
|
import { LightningTypeId } from "../object-data/entry/lightning-type";
|
|
7
7
|
import { CombatClassifications } from "../object-data/auxiliary/combat-classification";
|
|
8
8
|
import { UnitTypeId } from "../object-data/entry/unit-type";
|
|
9
|
+
import { BuffResistanceType } from "../object-data/auxiliary/buff-resistance-type";
|
|
10
|
+
import { BuffPolarity } from "../object-data/auxiliary/buff-polarity";
|
|
11
|
+
import { ReadonlyNonEmptyLinkedSet } from "../../utility/linked-set";
|
|
9
12
|
export declare abstract class AbilityField<ValueType extends number | string | boolean = number | string | boolean, NativeFieldType extends jabilityfield = jabilityfield> extends ObjectField<AbilityType, Ability, ValueType, NativeFieldType> {
|
|
10
13
|
protected get instanceClass(): typeof Ability;
|
|
11
14
|
protected getObjectDataEntryId(instance: Ability): AbilityTypeId;
|
|
@@ -107,6 +110,20 @@ export declare class AbilityAbilityTypeIdLevelField extends AbilityObjectDataEnt
|
|
|
107
110
|
}
|
|
108
111
|
export declare class AbilityUnitTypeIdLevelField extends AbilityObjectDataEntryIdLevelField<UnitTypeId> {
|
|
109
112
|
}
|
|
113
|
+
export declare abstract class AbilityEnumLevelField<T extends number> extends AbilityLevelField<T, T, jabilityintegerlevelfield> {
|
|
114
|
+
protected abstract values: ReadonlyNonEmptyLinkedSet<T>;
|
|
115
|
+
protected get defaultValue(): T;
|
|
116
|
+
protected getNativeFieldById(id: number): jabilityintegerlevelfield;
|
|
117
|
+
protected getNativeFieldValue(instance: Ability, level: number): T;
|
|
118
|
+
protected setNativeFieldValue(instance: Ability, level: number, value: T): boolean;
|
|
119
|
+
static get valueChangeEvent(): ObjectLevelFieldValueChangeEvent<AbilityBooleanLevelField>;
|
|
120
|
+
}
|
|
121
|
+
export declare class AbilityBuffPolarityLevelField extends AbilityEnumLevelField<BuffPolarity> {
|
|
122
|
+
protected values: ReadonlyNonEmptyLinkedSet<BuffPolarity>;
|
|
123
|
+
}
|
|
124
|
+
export declare class AbilityBuffResistanceTypeLevelField extends AbilityEnumLevelField<BuffResistanceType> {
|
|
125
|
+
protected values: ReadonlyNonEmptyLinkedSet<BuffResistanceType>;
|
|
126
|
+
}
|
|
110
127
|
export declare class AbilityCombatClassificationsLevelField extends AbilityLevelField<CombatClassifications, CombatClassifications, jabilityintegerlevelfield> {
|
|
111
128
|
protected get defaultValue(): CombatClassifications;
|
|
112
129
|
protected getNativeFieldById(id: number): jabilityintegerlevelfield;
|
|
@@ -13,6 +13,8 @@ local ObjectField = ____object_2Dfield.ObjectField
|
|
|
13
13
|
local ObjectLevelField = ____object_2Dfield.ObjectLevelField
|
|
14
14
|
local ____ability_2Dtype = require("engine.object-data.entry.ability-type")
|
|
15
15
|
local AbilityType = ____ability_2Dtype.AbilityType
|
|
16
|
+
local ____linked_2Dset = require("utility.linked-set")
|
|
17
|
+
local nonEmptyLinkedSetOf = ____linked_2Dset.nonEmptyLinkedSetOf
|
|
16
18
|
local convertAbilityBooleanField = _G.ConvertAbilityBooleanField
|
|
17
19
|
local convertAbilityIntegerField = _G.ConvertAbilityIntegerField
|
|
18
20
|
local convertAbilityRealField = _G.ConvertAbilityRealField
|
|
@@ -431,6 +433,54 @@ ____exports.AbilityUnitTypeIdLevelField = __TS__Class()
|
|
|
431
433
|
local AbilityUnitTypeIdLevelField = ____exports.AbilityUnitTypeIdLevelField
|
|
432
434
|
AbilityUnitTypeIdLevelField.name = "AbilityUnitTypeIdLevelField"
|
|
433
435
|
__TS__ClassExtends(AbilityUnitTypeIdLevelField, ____exports.AbilityObjectDataEntryIdLevelField)
|
|
436
|
+
____exports.AbilityEnumLevelField = __TS__Class()
|
|
437
|
+
local AbilityEnumLevelField = ____exports.AbilityEnumLevelField
|
|
438
|
+
AbilityEnumLevelField.name = "AbilityEnumLevelField"
|
|
439
|
+
__TS__ClassExtends(AbilityEnumLevelField, ____exports.AbilityLevelField)
|
|
440
|
+
function AbilityEnumLevelField.prototype.getNativeFieldById(self, id)
|
|
441
|
+
return convertAbilityIntegerLevelField(id)
|
|
442
|
+
end
|
|
443
|
+
function AbilityEnumLevelField.prototype.getNativeFieldValue(self, instance, level)
|
|
444
|
+
local value = instance:getField(self.nativeField, level)
|
|
445
|
+
if self.values:contains(value) then
|
|
446
|
+
return value
|
|
447
|
+
end
|
|
448
|
+
return self.values:first()
|
|
449
|
+
end
|
|
450
|
+
function AbilityEnumLevelField.prototype.setNativeFieldValue(self, instance, level, value)
|
|
451
|
+
return instance:setField(self.nativeField, level, value)
|
|
452
|
+
end
|
|
453
|
+
__TS__SetDescriptor(
|
|
454
|
+
AbilityEnumLevelField.prototype,
|
|
455
|
+
"defaultValue",
|
|
456
|
+
{get = function(self)
|
|
457
|
+
return self.values:first()
|
|
458
|
+
end},
|
|
459
|
+
true
|
|
460
|
+
)
|
|
461
|
+
__TS__ObjectDefineProperty(
|
|
462
|
+
AbilityEnumLevelField,
|
|
463
|
+
"valueChangeEvent",
|
|
464
|
+
{get = function(self)
|
|
465
|
+
return self:getOrCreateValueChangeEvent()
|
|
466
|
+
end}
|
|
467
|
+
)
|
|
468
|
+
____exports.AbilityBuffPolarityLevelField = __TS__Class()
|
|
469
|
+
local AbilityBuffPolarityLevelField = ____exports.AbilityBuffPolarityLevelField
|
|
470
|
+
AbilityBuffPolarityLevelField.name = "AbilityBuffPolarityLevelField"
|
|
471
|
+
__TS__ClassExtends(AbilityBuffPolarityLevelField, ____exports.AbilityEnumLevelField)
|
|
472
|
+
function AbilityBuffPolarityLevelField.prototype.____constructor(self, ...)
|
|
473
|
+
AbilityBuffPolarityLevelField.____super.prototype.____constructor(self, ...)
|
|
474
|
+
self.values = nonEmptyLinkedSetOf(0, 1, 2)
|
|
475
|
+
end
|
|
476
|
+
____exports.AbilityBuffResistanceTypeLevelField = __TS__Class()
|
|
477
|
+
local AbilityBuffResistanceTypeLevelField = ____exports.AbilityBuffResistanceTypeLevelField
|
|
478
|
+
AbilityBuffResistanceTypeLevelField.name = "AbilityBuffResistanceTypeLevelField"
|
|
479
|
+
__TS__ClassExtends(AbilityBuffResistanceTypeLevelField, ____exports.AbilityEnumLevelField)
|
|
480
|
+
function AbilityBuffResistanceTypeLevelField.prototype.____constructor(self, ...)
|
|
481
|
+
AbilityBuffResistanceTypeLevelField.____super.prototype.____constructor(self, ...)
|
|
482
|
+
self.values = nonEmptyLinkedSetOf(1, 2, 3)
|
|
483
|
+
end
|
|
434
484
|
local allowedTargetCombatClassificationsByLevelByAbilityTypeId = postcompile(function()
|
|
435
485
|
local allowedTargetCombatClassificationsByLevelByAbilityTypeId = {}
|
|
436
486
|
for ____, abilityType in ipairs(AbilityType:getAll()) do
|
package/package.json
CHANGED
package/utility/linked-set.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/** @noSelfInFile */
|
|
2
|
+
import { NonEmptyArray, ReadonlyNonEmptyArray } from "./types";
|
|
2
3
|
type IteratorState<T extends AnyNotNil> = {
|
|
3
4
|
t: LuaMap<T, T>;
|
|
4
5
|
n?: T;
|
|
@@ -18,6 +19,11 @@ export interface ReadonlyLinkedSet<T extends AnyNotNil> extends LuaPairsKeyItera
|
|
|
18
19
|
toArray(): T[];
|
|
19
20
|
sumOf(selector: ((value: T) => number) | KeysOfType<T, number>): number;
|
|
20
21
|
}
|
|
22
|
+
export interface ReadonlyNonEmptyLinkedSet<T extends AnyNotNil> extends ReadonlyLinkedSet<T> {
|
|
23
|
+
first(): T;
|
|
24
|
+
last(): T;
|
|
25
|
+
toArray(): NonEmptyArray<T>;
|
|
26
|
+
}
|
|
21
27
|
export interface LinkedSet<T extends AnyNotNil> extends LuaPairsKeyIterable<T> {
|
|
22
28
|
readonly __linkedSet: unique symbol;
|
|
23
29
|
}
|
|
@@ -44,6 +50,9 @@ export declare class LinkedSet<T extends AnyNotNil> implements ReadonlyLinkedSet
|
|
|
44
50
|
protected __pairs(this: LinkedSet<T>): LuaIterator<T | undefined, IteratorState<T>>;
|
|
45
51
|
}
|
|
46
52
|
export declare const emptyLinkedSet: <T extends AnyNotNil>() => ReadonlyLinkedSet<T>;
|
|
47
|
-
export declare const
|
|
48
|
-
export declare const
|
|
53
|
+
export declare const mutableLinkedSetOf: <T extends AnyNotNil>(...elements: ReadonlyArray<T>) => LinkedSet<T>;
|
|
54
|
+
export declare const mutableLinkedSetOfNotNull: <T extends AnyNotNil>(...elements: readonly (T | undefined | null)[]) => LinkedSet<T>;
|
|
55
|
+
export declare const linkedSetOf: <T extends AnyNotNil>(...elements: ReadonlyArray<T>) => ReadonlyLinkedSet<T>;
|
|
56
|
+
export declare const linkedSetOfNotNull: <T extends AnyNotNil>(...elements: ReadonlyArray<T>) => ReadonlyLinkedSet<T>;
|
|
57
|
+
export declare const nonEmptyLinkedSetOf: <T extends AnyNotNil>(...elements: ReadonlyNonEmptyArray<T>) => ReadonlyNonEmptyLinkedSet<T>;
|
|
49
58
|
export {};
|
package/utility/linked-set.lua
CHANGED
|
@@ -177,14 +177,14 @@ local EMPTY_LINKED_SET = __TS__New(EmptyLinkedSet)
|
|
|
177
177
|
____exports.emptyLinkedSet = function()
|
|
178
178
|
return EMPTY_LINKED_SET
|
|
179
179
|
end
|
|
180
|
-
____exports.
|
|
180
|
+
____exports.mutableLinkedSetOf = function(...)
|
|
181
181
|
local linkedSet = __TS__New(____exports.LinkedSet)
|
|
182
182
|
for i = 1, select("#", ...) do
|
|
183
183
|
linkedSet:add((select(i, ...)))
|
|
184
184
|
end
|
|
185
185
|
return linkedSet
|
|
186
186
|
end
|
|
187
|
-
____exports.
|
|
187
|
+
____exports.mutableLinkedSetOfNotNull = function(...)
|
|
188
188
|
local linkedSet = __TS__New(____exports.LinkedSet)
|
|
189
189
|
for i = 1, select("#", ...) do
|
|
190
190
|
local element = (select(i, ...))
|
|
@@ -194,4 +194,7 @@ ____exports.linkedSetOfNotNull = function(...)
|
|
|
194
194
|
end
|
|
195
195
|
return linkedSet
|
|
196
196
|
end
|
|
197
|
+
____exports.linkedSetOf = function(...) return ____exports.mutableLinkedSetOf(...) end
|
|
198
|
+
____exports.linkedSetOfNotNull = function(...) return ____exports.mutableLinkedSetOfNotNull(...) end
|
|
199
|
+
____exports.nonEmptyLinkedSetOf = function(...) return ____exports.linkedSetOf(...) end
|
|
197
200
|
return ____exports
|
package/utility/types.d.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
export type AnyNonNullable = {};
|
|
3
3
|
export type IsExactlyAny<T> = boolean extends (T extends never ? true : false) ? true : false;
|
|
4
4
|
export type NonEmptyArray<T> = [T, ...T[]];
|
|
5
|
+
export type ReadonlyNonEmptyArray<T> = readonly [T, ...T[]];
|
|
5
6
|
export type InvertRecordType<T extends Record<PropertyKey, PropertyKey | null | undefined>> = {
|
|
6
7
|
[P in keyof T as NonNullable<T[P]>]: P;
|
|
7
8
|
};
|