warscript 0.0.1-dev.ec4cf89 → 0.0.1-dev.f967846
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 +6 -0
- package/core/types/frame.lua +91 -1
- package/core/util.d.ts +1 -1
- package/core/util.lua +6 -0
- package/engine/behavior.d.ts +2 -2
- package/engine/behavior.lua +6 -6
- package/engine/behaviour/ability/apply-buff.d.ts +3 -5
- package/engine/behaviour/unit.d.ts +5 -0
- package/engine/behaviour/unit.lua +20 -0
- package/engine/buff.d.ts +32 -11
- package/engine/buff.lua +142 -61
- package/engine/internal/ability.d.ts +3 -11
- package/engine/internal/ability.lua +9 -78
- package/engine/internal/item+owner.lua +2 -2
- package/engine/internal/unit/bonus.d.ts +4 -2
- package/engine/internal/unit/bonus.lua +6 -1
- package/engine/internal/unit/item.d.ts +24 -0
- package/engine/internal/unit/item.lua +84 -0
- package/engine/internal/unit/main-selected.d.ts +7 -0
- package/engine/internal/unit/main-selected.lua +40 -0
- package/engine/internal/unit+ability.lua +2 -2
- package/engine/internal/unit-missile-launch.lua +24 -5
- package/engine/internal/unit.d.ts +24 -10
- package/engine/internal/unit.lua +106 -60
- package/engine/local-client.d.ts +7 -2
- package/engine/local-client.lua +82 -0
- package/engine/object-data/entry/item-type.d.ts +12 -0
- package/engine/object-data/entry/item-type.lua +78 -0
- package/engine/object-field/ability.d.ts +17 -0
- package/engine/object-field/ability.lua +51 -1
- package/engine/unit.d.ts +2 -0
- package/engine/unit.lua +2 -0
- package/index.d.ts +1 -0
- package/index.lua +1 -0
- package/net/socket.d.ts +7 -1
- package/net/socket.lua +45 -4
- package/network.d.ts +1 -0
- package/network.lua +3 -2
- package/objutil/buff.lua +1 -1
- package/package.json +2 -2
- package/patch-lua.d.ts +0 -0
- package/patch-lua.lua +10 -0
- package/utility/linked-set.d.ts +11 -2
- package/utility/linked-set.lua +5 -2
- package/utility/types.d.ts +1 -0
package/engine/buff.lua
CHANGED
|
@@ -94,6 +94,7 @@ local buffParametersKeys = {
|
|
|
94
94
|
armorIncreaseFactor = true,
|
|
95
95
|
attackSpeedIncreaseFactor = true,
|
|
96
96
|
movementSpeedIncreaseFactor = true,
|
|
97
|
+
damageFactor = true,
|
|
97
98
|
receivedDamageFactor = true,
|
|
98
99
|
receivedMagicDamageFactor = true,
|
|
99
100
|
durationIncreaseOnAutoAttack = true,
|
|
@@ -107,12 +108,26 @@ local buffParametersKeys = {
|
|
|
107
108
|
disablesAutoAttack = true,
|
|
108
109
|
destroysOnDamage = true,
|
|
109
110
|
maximumAutoAttackCount = true,
|
|
111
|
+
maximumDamageDealtEventCount = true,
|
|
112
|
+
maximumDamageReceivedEventCount = true,
|
|
110
113
|
uniqueGroup = true,
|
|
111
114
|
damageOnExpiration = true,
|
|
112
115
|
healingOnExpiration = true,
|
|
113
116
|
killsOnExpiration = true,
|
|
114
117
|
explodesOnExpiration = true
|
|
115
118
|
}
|
|
119
|
+
local function resolveEnumValue(ability, level, value)
|
|
120
|
+
if value == nil or type(value) == "number" then
|
|
121
|
+
return value
|
|
122
|
+
end
|
|
123
|
+
if ability == nil then
|
|
124
|
+
error(
|
|
125
|
+
__TS__New(IllegalArgumentException),
|
|
126
|
+
0
|
|
127
|
+
)
|
|
128
|
+
end
|
|
129
|
+
return value:getValue(ability, level or ability.level)
|
|
130
|
+
end
|
|
116
131
|
local function resolveNumberValue(ability, level, value)
|
|
117
132
|
if value == nil or type(value) == "number" then
|
|
118
133
|
return value
|
|
@@ -162,8 +177,11 @@ local buffNumberParameters = {
|
|
|
162
177
|
"attackSpeedIncreaseFactor",
|
|
163
178
|
"movementSpeedIncreaseFactor",
|
|
164
179
|
"armorIncrease",
|
|
180
|
+
"damageFactor",
|
|
165
181
|
"receivedDamageFactor",
|
|
166
182
|
"maximumAutoAttackCount",
|
|
183
|
+
"maximumDamageDealtEventCount",
|
|
184
|
+
"maximumDamageReceivedEventCount",
|
|
167
185
|
"damageInterval",
|
|
168
186
|
"damagePerInterval",
|
|
169
187
|
"damageOverDuration",
|
|
@@ -310,8 +328,6 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
|
|
|
310
328
|
end
|
|
311
329
|
end
|
|
312
330
|
self.typeId = typeId
|
|
313
|
-
self.polarity = polarity
|
|
314
|
-
self.resistanceType = resistanceType
|
|
315
331
|
if not __TS__InstanceOf(ability, Ability) then
|
|
316
332
|
parameters = ability
|
|
317
333
|
ability = nil
|
|
@@ -338,6 +354,8 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
|
|
|
338
354
|
learnLevelMinimum = learnLevelMinimum or ability:getField(ABILITY_IF_REQUIRED_LEVEL)
|
|
339
355
|
duration = duration or getAbilityDuration(ability, _unit)
|
|
340
356
|
end
|
|
357
|
+
self.polarity = resolveEnumValue(ability, level, polarity)
|
|
358
|
+
self.resistanceType = resolveEnumValue(ability, level, resistanceType)
|
|
341
359
|
local buffByTypeId = buffByTypeIdByUnit[_unit]
|
|
342
360
|
if buffByTypeId == nil then
|
|
343
361
|
buffByTypeId = {}
|
|
@@ -354,8 +372,8 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
|
|
|
354
372
|
if not internalApplyBuff(
|
|
355
373
|
_unit,
|
|
356
374
|
typeId,
|
|
357
|
-
polarity,
|
|
358
|
-
resistanceType,
|
|
375
|
+
self.polarity,
|
|
376
|
+
self.resistanceType,
|
|
359
377
|
level,
|
|
360
378
|
duration,
|
|
361
379
|
spellStealPriority,
|
|
@@ -544,11 +562,11 @@ function Buff.prototype.onDestroy(self)
|
|
|
544
562
|
behavior:destroy()
|
|
545
563
|
end
|
|
546
564
|
end
|
|
547
|
-
if self[
|
|
565
|
+
if self[136] then
|
|
548
566
|
unit:decrementDisableAutoAttackCounter()
|
|
549
567
|
end
|
|
550
|
-
if self[
|
|
551
|
-
if self[
|
|
568
|
+
if self[134] then
|
|
569
|
+
if self[135] then
|
|
552
570
|
unit:decrementStunCounter()
|
|
553
571
|
end
|
|
554
572
|
unit:decrementStunCounter()
|
|
@@ -605,9 +623,9 @@ function Buff.prototype.onExpiration(self)
|
|
|
605
623
|
if self[120] ~= nil then
|
|
606
624
|
(self[101] or unit):healTarget(unit, self[119] or 0)
|
|
607
625
|
end
|
|
608
|
-
if self[
|
|
626
|
+
if self[139] then
|
|
609
627
|
unit:explode()
|
|
610
|
-
elseif self[
|
|
628
|
+
elseif self[138] then
|
|
611
629
|
unit:kill()
|
|
612
630
|
end
|
|
613
631
|
end
|
|
@@ -652,6 +670,22 @@ function Buff.prototype.onDamageDealt(self, target, event)
|
|
|
652
670
|
self:destroy()
|
|
653
671
|
end
|
|
654
672
|
end
|
|
673
|
+
if event.originalAmount ~= 0 then
|
|
674
|
+
local damageDealtEventCount = (self[130] or 0) + 1
|
|
675
|
+
self[130] = damageDealtEventCount
|
|
676
|
+
if damageDealtEventCount == self[131] then
|
|
677
|
+
self:destroy()
|
|
678
|
+
end
|
|
679
|
+
end
|
|
680
|
+
end
|
|
681
|
+
function Buff.prototype.onDamageReceived(self, source, event)
|
|
682
|
+
if event.originalAmount ~= 0 then
|
|
683
|
+
local damageReceivedEventCount = (self[132] or 0) + 1
|
|
684
|
+
self[132] = damageReceivedEventCount
|
|
685
|
+
if damageReceivedEventCount == self[133] then
|
|
686
|
+
self:destroy()
|
|
687
|
+
end
|
|
688
|
+
end
|
|
655
689
|
end
|
|
656
690
|
Buff.defaultParameters = {}
|
|
657
691
|
__TS__SetDescriptor(
|
|
@@ -856,6 +890,19 @@ __TS__SetDescriptor(
|
|
|
856
890
|
},
|
|
857
891
|
true
|
|
858
892
|
)
|
|
893
|
+
__TS__SetDescriptor(
|
|
894
|
+
Buff.prototype,
|
|
895
|
+
"damageFactor",
|
|
896
|
+
{
|
|
897
|
+
get = function(self)
|
|
898
|
+
return self:getUnitBonus(UnitBonusType.DAMAGE_FACTOR)
|
|
899
|
+
end,
|
|
900
|
+
set = function(self, damageFactor)
|
|
901
|
+
self:addOrUpdateOrRemoveUnitBonus(UnitBonusType.DAMAGE_FACTOR, damageFactor)
|
|
902
|
+
end
|
|
903
|
+
},
|
|
904
|
+
true
|
|
905
|
+
)
|
|
859
906
|
__TS__SetDescriptor(
|
|
860
907
|
Buff.prototype,
|
|
861
908
|
"receivedDamageFactor",
|
|
@@ -887,25 +934,25 @@ __TS__SetDescriptor(
|
|
|
887
934
|
"stuns",
|
|
888
935
|
{
|
|
889
936
|
get = function(self)
|
|
890
|
-
local
|
|
891
|
-
if
|
|
892
|
-
|
|
937
|
+
local ____self__134_52 = self[134]
|
|
938
|
+
if ____self__134_52 == nil then
|
|
939
|
+
____self__134_52 = false
|
|
893
940
|
end
|
|
894
|
-
return
|
|
941
|
+
return ____self__134_52
|
|
895
942
|
end,
|
|
896
943
|
set = function(self, stuns)
|
|
897
|
-
if not stuns and self[
|
|
898
|
-
if self[
|
|
944
|
+
if not stuns and self[134] then
|
|
945
|
+
if self[135] then
|
|
899
946
|
self.object:decrementStunCounter()
|
|
900
947
|
end
|
|
901
948
|
self.object:decrementStunCounter()
|
|
902
|
-
self[
|
|
903
|
-
elseif stuns and not self[
|
|
904
|
-
if self[
|
|
949
|
+
self[134] = nil
|
|
950
|
+
elseif stuns and not self[134] then
|
|
951
|
+
if self[135] then
|
|
905
952
|
self.object:incrementStunCounter()
|
|
906
953
|
end
|
|
907
954
|
self.object:incrementStunCounter()
|
|
908
|
-
self[
|
|
955
|
+
self[134] = true
|
|
909
956
|
end
|
|
910
957
|
end
|
|
911
958
|
},
|
|
@@ -916,23 +963,23 @@ __TS__SetDescriptor(
|
|
|
916
963
|
"ignoresStunImmunity",
|
|
917
964
|
{
|
|
918
965
|
get = function(self)
|
|
919
|
-
local
|
|
920
|
-
if
|
|
921
|
-
|
|
966
|
+
local ____self__135_53 = self[135]
|
|
967
|
+
if ____self__135_53 == nil then
|
|
968
|
+
____self__135_53 = false
|
|
922
969
|
end
|
|
923
|
-
return
|
|
970
|
+
return ____self__135_53
|
|
924
971
|
end,
|
|
925
972
|
set = function(self, ignoresStunImmunity)
|
|
926
|
-
if not ignoresStunImmunity and self[
|
|
927
|
-
if self[
|
|
973
|
+
if not ignoresStunImmunity and self[135] then
|
|
974
|
+
if self[134] then
|
|
928
975
|
self.object:decrementStunCounter()
|
|
929
976
|
end
|
|
930
|
-
self[
|
|
931
|
-
elseif ignoresStunImmunity and not self[
|
|
932
|
-
if self[
|
|
977
|
+
self[135] = nil
|
|
978
|
+
elseif ignoresStunImmunity and not self[135] then
|
|
979
|
+
if self[134] then
|
|
933
980
|
self.object:incrementStunCounter()
|
|
934
981
|
end
|
|
935
|
-
self[
|
|
982
|
+
self[135] = true
|
|
936
983
|
end
|
|
937
984
|
end
|
|
938
985
|
},
|
|
@@ -943,19 +990,19 @@ __TS__SetDescriptor(
|
|
|
943
990
|
"disablesAutoAttack",
|
|
944
991
|
{
|
|
945
992
|
get = function(self)
|
|
946
|
-
local
|
|
947
|
-
if
|
|
948
|
-
|
|
993
|
+
local ____self__136_54 = self[136]
|
|
994
|
+
if ____self__136_54 == nil then
|
|
995
|
+
____self__136_54 = false
|
|
949
996
|
end
|
|
950
|
-
return
|
|
997
|
+
return ____self__136_54
|
|
951
998
|
end,
|
|
952
999
|
set = function(self, disablesAutoAttack)
|
|
953
|
-
if not disablesAutoAttack and self[
|
|
1000
|
+
if not disablesAutoAttack and self[136] then
|
|
954
1001
|
self.object:decrementDisableAutoAttackCounter()
|
|
955
|
-
self[
|
|
956
|
-
elseif disablesAutoAttack and not self[
|
|
1002
|
+
self[136] = nil
|
|
1003
|
+
elseif disablesAutoAttack and not self[136] then
|
|
957
1004
|
self.object:incrementDisableAutoAttackCounter()
|
|
958
|
-
self[
|
|
1005
|
+
self[136] = true
|
|
959
1006
|
end
|
|
960
1007
|
end
|
|
961
1008
|
},
|
|
@@ -966,19 +1013,19 @@ __TS__SetDescriptor(
|
|
|
966
1013
|
"providesInvulnerability",
|
|
967
1014
|
{
|
|
968
1015
|
get = function(self)
|
|
969
|
-
local
|
|
970
|
-
if
|
|
971
|
-
|
|
1016
|
+
local ____self__137_55 = self[137]
|
|
1017
|
+
if ____self__137_55 == nil then
|
|
1018
|
+
____self__137_55 = false
|
|
972
1019
|
end
|
|
973
|
-
return
|
|
1020
|
+
return ____self__137_55
|
|
974
1021
|
end,
|
|
975
1022
|
set = function(self, providesInvulnerability)
|
|
976
|
-
if not providesInvulnerability and self[
|
|
1023
|
+
if not providesInvulnerability and self[137] then
|
|
977
1024
|
self.object:decrementInvulnerabilityCounter()
|
|
978
|
-
self[
|
|
979
|
-
elseif providesInvulnerability and not self[
|
|
1025
|
+
self[137] = nil
|
|
1026
|
+
elseif providesInvulnerability and not self[137] then
|
|
980
1027
|
self.object:incrementInvulnerabilityCounter()
|
|
981
|
-
self[
|
|
1028
|
+
self[137] = true
|
|
982
1029
|
end
|
|
983
1030
|
end
|
|
984
1031
|
},
|
|
@@ -989,17 +1036,17 @@ __TS__SetDescriptor(
|
|
|
989
1036
|
"killsOnExpiration",
|
|
990
1037
|
{
|
|
991
1038
|
get = function(self)
|
|
992
|
-
local
|
|
993
|
-
if
|
|
994
|
-
|
|
1039
|
+
local ____self__138_56 = self[138]
|
|
1040
|
+
if ____self__138_56 == nil then
|
|
1041
|
+
____self__138_56 = false
|
|
995
1042
|
end
|
|
996
|
-
return
|
|
1043
|
+
return ____self__138_56
|
|
997
1044
|
end,
|
|
998
1045
|
set = function(self, killsOnExpiration)
|
|
999
|
-
if not killsOnExpiration and self[
|
|
1000
|
-
self[
|
|
1001
|
-
elseif killsOnExpiration and not self[
|
|
1002
|
-
self[
|
|
1046
|
+
if not killsOnExpiration and self[138] then
|
|
1047
|
+
self[138] = nil
|
|
1048
|
+
elseif killsOnExpiration and not self[138] then
|
|
1049
|
+
self[138] = true
|
|
1003
1050
|
end
|
|
1004
1051
|
end
|
|
1005
1052
|
},
|
|
@@ -1010,17 +1057,51 @@ __TS__SetDescriptor(
|
|
|
1010
1057
|
"explodesOnExpiration",
|
|
1011
1058
|
{
|
|
1012
1059
|
get = function(self)
|
|
1013
|
-
local
|
|
1014
|
-
if
|
|
1015
|
-
|
|
1060
|
+
local ____self__139_57 = self[139]
|
|
1061
|
+
if ____self__139_57 == nil then
|
|
1062
|
+
____self__139_57 = false
|
|
1016
1063
|
end
|
|
1017
|
-
return
|
|
1064
|
+
return ____self__139_57
|
|
1018
1065
|
end,
|
|
1019
1066
|
set = function(self, killsOnExpiration)
|
|
1020
|
-
if not killsOnExpiration and self[
|
|
1021
|
-
self[
|
|
1022
|
-
elseif killsOnExpiration and not self[
|
|
1023
|
-
self[
|
|
1067
|
+
if not killsOnExpiration and self[139] then
|
|
1068
|
+
self[139] = nil
|
|
1069
|
+
elseif killsOnExpiration and not self[139] then
|
|
1070
|
+
self[139] = true
|
|
1071
|
+
end
|
|
1072
|
+
end
|
|
1073
|
+
},
|
|
1074
|
+
true
|
|
1075
|
+
)
|
|
1076
|
+
__TS__SetDescriptor(
|
|
1077
|
+
Buff.prototype,
|
|
1078
|
+
"maximumDamageDealtEventCount",
|
|
1079
|
+
{
|
|
1080
|
+
get = function(self)
|
|
1081
|
+
return self[131] or 0
|
|
1082
|
+
end,
|
|
1083
|
+
set = function(self, maximumDamageDealtEventCount)
|
|
1084
|
+
if maximumDamageDealtEventCount == 0 then
|
|
1085
|
+
self[131] = nil
|
|
1086
|
+
else
|
|
1087
|
+
self[131] = maximumDamageDealtEventCount
|
|
1088
|
+
end
|
|
1089
|
+
end
|
|
1090
|
+
},
|
|
1091
|
+
true
|
|
1092
|
+
)
|
|
1093
|
+
__TS__SetDescriptor(
|
|
1094
|
+
Buff.prototype,
|
|
1095
|
+
"maximumDamageReceivedEventCount",
|
|
1096
|
+
{
|
|
1097
|
+
get = function(self)
|
|
1098
|
+
return self[133] or 0
|
|
1099
|
+
end,
|
|
1100
|
+
set = function(self, maximumDamageReceivedEventCount)
|
|
1101
|
+
if maximumDamageReceivedEventCount == 0 then
|
|
1102
|
+
self[133] = nil
|
|
1103
|
+
else
|
|
1104
|
+
self[133] = maximumDamageReceivedEventCount
|
|
1024
1105
|
end
|
|
1025
1106
|
end
|
|
1026
1107
|
},
|
|
@@ -4,14 +4,6 @@ import { Event } from "../../event";
|
|
|
4
4
|
import type { Item } from "../../core/types/item";
|
|
5
5
|
import type { Unit } from "./unit";
|
|
6
6
|
import type { AbilityTypeId } from "../object-data/entry/ability-type";
|
|
7
|
-
interface Fields<K, V> {
|
|
8
|
-
set(field: K, value: V): boolean;
|
|
9
|
-
get(field: K): V;
|
|
10
|
-
has(field: K): boolean;
|
|
11
|
-
}
|
|
12
|
-
interface AbilityLevel {
|
|
13
|
-
realFields: Fields<jabilityreallevelfield, number>;
|
|
14
|
-
}
|
|
15
7
|
export type jabilityfield = jabilityintegerfield | jabilityrealfield | jabilitybooleanfield | jabilitystringfield | jabilityintegerlevelfield | jabilityreallevelfield | jabilitybooleanlevelfield | jabilitystringlevelfield;
|
|
16
8
|
export declare class AbilitySnapshot {
|
|
17
9
|
}
|
|
@@ -40,8 +32,7 @@ export declare abstract class Ability extends Handle<jability> {
|
|
|
40
32
|
setField(field: jabilityintegerlevelfield | jabilityreallevelfield, level: number, value: number): boolean;
|
|
41
33
|
setField(field: jabilitybooleanlevelfield, level: number, value: boolean): boolean;
|
|
42
34
|
setField(field: jabilitystringlevelfield, level: number, value: string): boolean;
|
|
43
|
-
get
|
|
44
|
-
get levels(): readonly AbilityLevel[];
|
|
35
|
+
get levelCount(): number;
|
|
45
36
|
abstract get level(): number;
|
|
46
37
|
static get onCreate(): Event<[Ability]>;
|
|
47
38
|
static get destroyEvent(): Event<[Ability]>;
|
|
@@ -58,6 +49,8 @@ export declare class UnitAbility extends Ability {
|
|
|
58
49
|
readonly owner: Unit;
|
|
59
50
|
private readonly u;
|
|
60
51
|
constructor(handle: jability, typeId: number, owner: Unit);
|
|
52
|
+
incrementHideCounter(): void;
|
|
53
|
+
decrementHideCounter(): void;
|
|
61
54
|
get level(): number;
|
|
62
55
|
set level(v: number);
|
|
63
56
|
get cooldownRemaining(): number;
|
|
@@ -88,4 +81,3 @@ export declare class ItemAbility extends Ability {
|
|
|
88
81
|
static get onCreate(): Event<[ItemAbility]>;
|
|
89
82
|
static get onDestroy(): Event<[ItemAbility]>;
|
|
90
83
|
}
|
|
91
|
-
export {};
|
|
@@ -2,7 +2,6 @@ local ____lualib = require("lualib_bundle")
|
|
|
2
2
|
local __TS__ArrayMap = ____lualib.__TS__ArrayMap
|
|
3
3
|
local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
|
|
4
4
|
local __TS__Class = ____lualib.__TS__Class
|
|
5
|
-
local __TS__New = ____lualib.__TS__New
|
|
6
5
|
local __TS__ClassExtends = ____lualib.__TS__ClassExtends
|
|
7
6
|
local __TS__InstanceOf = ____lualib.__TS__InstanceOf
|
|
8
7
|
local __TS__SetDescriptor = ____lualib.__TS__SetDescriptor
|
|
@@ -33,7 +32,7 @@ local getAbilityStringLevelField = BlzGetAbilityStringLevelField
|
|
|
33
32
|
local getUnitAbilityCooldownRemaining = BlzGetUnitAbilityCooldownRemaining
|
|
34
33
|
local startUnitAbilityCooldown = BlzStartUnitAbilityCooldown
|
|
35
34
|
local getHandleId = GetHandleId
|
|
36
|
-
local
|
|
35
|
+
local unitHideAbility = BlzUnitHideAbility
|
|
37
36
|
local match = string.match
|
|
38
37
|
local ____type = _G.type
|
|
39
38
|
local ____tostring = _G.tostring
|
|
@@ -151,55 +150,6 @@ local orders = postcompile(function()
|
|
|
151
150
|
end
|
|
152
151
|
return orders
|
|
153
152
|
end)
|
|
154
|
-
local RealFields = __TS__Class()
|
|
155
|
-
RealFields.name = "RealFields"
|
|
156
|
-
function RealFields.prototype.____constructor(self, handle)
|
|
157
|
-
self.handle = handle
|
|
158
|
-
end
|
|
159
|
-
function RealFields.prototype.set(self, field, value)
|
|
160
|
-
return BlzSetAbilityRealField(self.handle, field, value)
|
|
161
|
-
end
|
|
162
|
-
function RealFields.prototype.get(self, field)
|
|
163
|
-
return BlzGetAbilityRealField(self.handle, field)
|
|
164
|
-
end
|
|
165
|
-
function RealFields.prototype.has(self, field)
|
|
166
|
-
local handle = self.handle
|
|
167
|
-
return BlzSetAbilityRealField(
|
|
168
|
-
handle,
|
|
169
|
-
field,
|
|
170
|
-
BlzGetAbilityRealField(handle, field)
|
|
171
|
-
)
|
|
172
|
-
end
|
|
173
|
-
local RealLevelFields = __TS__Class()
|
|
174
|
-
RealLevelFields.name = "RealLevelFields"
|
|
175
|
-
function RealLevelFields.prototype.____constructor(self, handle, level)
|
|
176
|
-
self.handle = handle
|
|
177
|
-
self.level = level
|
|
178
|
-
end
|
|
179
|
-
function RealLevelFields.prototype.set(self, field, value)
|
|
180
|
-
return BlzSetAbilityRealLevelField(self.handle, field, self.level, value)
|
|
181
|
-
end
|
|
182
|
-
function RealLevelFields.prototype.get(self, field)
|
|
183
|
-
return BlzGetAbilityRealLevelField(self.handle, field, self.level)
|
|
184
|
-
end
|
|
185
|
-
function RealLevelFields.prototype.has(self, field)
|
|
186
|
-
local handle = self.handle
|
|
187
|
-
return BlzSetAbilityRealLevelField(
|
|
188
|
-
handle,
|
|
189
|
-
field,
|
|
190
|
-
0,
|
|
191
|
-
BlzGetAbilityRealLevelField(handle, field, 0)
|
|
192
|
-
)
|
|
193
|
-
end
|
|
194
|
-
local realLevelMetatable = {__index = self}
|
|
195
|
-
local levelDescriptors = {realFields = function(self, handle, level)
|
|
196
|
-
return __TS__New(RealLevelFields, handle, level)
|
|
197
|
-
end}
|
|
198
|
-
local levelMetatable = {__index = function(self, key)
|
|
199
|
-
local fields = levelDescriptors[key](levelDescriptors, self.handle, self.level)
|
|
200
|
-
rawset(self, key, fields)
|
|
201
|
-
return fields
|
|
202
|
-
end}
|
|
203
153
|
local fieldGetters = {
|
|
204
154
|
abilityintegerfield = function(ability, field)
|
|
205
155
|
return getAbilityIntegerField(ability.handle, field)
|
|
@@ -355,34 +305,9 @@ __TS__SetDescriptor(
|
|
|
355
305
|
)
|
|
356
306
|
__TS__SetDescriptor(
|
|
357
307
|
Ability.prototype,
|
|
358
|
-
"
|
|
359
|
-
{get = function(self)
|
|
360
|
-
local realFields = __TS__New(RealFields, self.handle)
|
|
361
|
-
rawset(self, "realFields", realFields)
|
|
362
|
-
return realFields
|
|
363
|
-
end},
|
|
364
|
-
true
|
|
365
|
-
)
|
|
366
|
-
__TS__SetDescriptor(
|
|
367
|
-
Ability.prototype,
|
|
368
|
-
"levels",
|
|
308
|
+
"levelCount",
|
|
369
309
|
{get = function(self)
|
|
370
|
-
|
|
371
|
-
local levels = setmetatable(
|
|
372
|
-
{},
|
|
373
|
-
{
|
|
374
|
-
__len = function(self)
|
|
375
|
-
return BlzGetAbilityIntegerField(handle, ABILITY_IF_LEVELS)
|
|
376
|
-
end,
|
|
377
|
-
__index = function(self, i)
|
|
378
|
-
local level = setmetatable({handle = handle, level = i - 1}, levelMetatable)
|
|
379
|
-
self[i] = level
|
|
380
|
-
return level
|
|
381
|
-
end
|
|
382
|
-
}
|
|
383
|
-
)
|
|
384
|
-
rawset(self, "levels", levels)
|
|
385
|
-
return levels
|
|
310
|
+
return self:getField(ABILITY_IF_LEVELS)
|
|
386
311
|
end},
|
|
387
312
|
true
|
|
388
313
|
)
|
|
@@ -433,6 +358,12 @@ function UnitAbility.prototype.____constructor(self, handle, typeId, owner)
|
|
|
433
358
|
self.owner = owner
|
|
434
359
|
self.u = owner.handle
|
|
435
360
|
end
|
|
361
|
+
function UnitAbility.prototype.incrementHideCounter(self)
|
|
362
|
+
unitHideAbility(self.u, self.typeId, true)
|
|
363
|
+
end
|
|
364
|
+
function UnitAbility.prototype.decrementHideCounter(self)
|
|
365
|
+
unitHideAbility(self.u, self.typeId, false)
|
|
366
|
+
end
|
|
436
367
|
__TS__SetDescriptor(
|
|
437
368
|
UnitAbility.prototype,
|
|
438
369
|
"level",
|
|
@@ -6,10 +6,10 @@ local Item = ____item.Item
|
|
|
6
6
|
local ____unit = require("engine.internal.unit")
|
|
7
7
|
local Unit = ____unit.Unit
|
|
8
8
|
local ownerByItem = setmetatable({}, {__mode = "kv"})
|
|
9
|
-
Unit.
|
|
9
|
+
Unit.itemPickedUpEvent:addListener(function(unit, item)
|
|
10
10
|
ownerByItem[item] = unit
|
|
11
11
|
end)
|
|
12
|
-
Unit.
|
|
12
|
+
Unit.itemDroppedEvent:addListener(function(unit, item)
|
|
13
13
|
ownerByItem[item] = nil
|
|
14
14
|
end)
|
|
15
15
|
__TS__ObjectDefineProperty(
|
|
@@ -8,7 +8,8 @@ export type UnitBonusId<Brand extends string = any> = number & {
|
|
|
8
8
|
export type UnitArmorBonusId = UnitBonusId<"armor">;
|
|
9
9
|
export type UnitAttackSpeedFactorBonusId = UnitBonusId<"attackSpeedFactor">;
|
|
10
10
|
export type UnitMovementSpeedFactorBonusId = UnitBonusId<"movementSpeedFactor">;
|
|
11
|
-
export type
|
|
11
|
+
export type UnitAutoAttackDamageBonusId = UnitBonusId<"autoAttackDamage">;
|
|
12
|
+
export type UnitDamageFactorBonusId = UnitBonusId<"damageFactor">;
|
|
12
13
|
export type UnitReceivedDamageFactorBonusId = UnitBonusId<"receivedDamageFactor">;
|
|
13
14
|
export type UnitBonusType<Id extends UnitBonusId = UnitBonusId> = ({
|
|
14
15
|
abilityTypeId: AbilityTypeId;
|
|
@@ -30,7 +31,8 @@ export declare namespace UnitBonusType {
|
|
|
30
31
|
const ARMOR: UnitBonusType<UnitArmorBonusId>;
|
|
31
32
|
const ATTACK_SPEED_FACTOR: UnitBonusType<UnitAttackSpeedFactorBonusId>;
|
|
32
33
|
const MOVEMENT_SPEED_FACTOR: UnitBonusType<UnitAttackSpeedFactorBonusId>;
|
|
33
|
-
const
|
|
34
|
+
const AUTO_ATTACK_DAMAGE: UnitBonusType<UnitAutoAttackDamageBonusId>;
|
|
35
|
+
const DAMAGE_FACTOR: UnitBonusType<UnitReceivedDamageFactorBonusId>;
|
|
34
36
|
const RECEIVED_DAMAGE_FACTOR: UnitBonusType<UnitReceivedDamageFactorBonusId>;
|
|
35
37
|
}
|
|
36
38
|
export declare const addUnitBonus: <Id extends UnitBonusId>(unit: Unit, bonusType: UnitBonusType<Id>, value: number) => Id;
|
|
@@ -21,6 +21,7 @@ local AUTO_ATTACK_DAMAGE_INCREASE_DUMMY_ABILITY_TYPE_ID = ____auto_2Dattack_2Dda
|
|
|
21
21
|
local ____movement_2Dspeed_2Dincrease_2Dfactor = require("engine.internal.object-data.movement-speed-increase-factor")
|
|
22
22
|
local MOVEMENT_SPEED_INCREASE_FACTOR_ABILITY_FIELD = ____movement_2Dspeed_2Dincrease_2Dfactor.MOVEMENT_SPEED_INCREASE_FACTOR_ABILITY_FIELD
|
|
23
23
|
local MOVEMENT_SPEED_INCREASE_FACTOR_DUMMY_ABILITY_TYPE_ID = ____movement_2Dspeed_2Dincrease_2Dfactor.MOVEMENT_SPEED_INCREASE_FACTOR_DUMMY_ABILITY_TYPE_ID
|
|
24
|
+
local damageFactorByUnit = {}
|
|
24
25
|
local receivedDamageFactorByUnit = {}
|
|
25
26
|
____exports.UnitBonusType = {}
|
|
26
27
|
local UnitBonusType = ____exports.UnitBonusType
|
|
@@ -46,13 +47,14 @@ do
|
|
|
46
47
|
reduce = sum,
|
|
47
48
|
initialValue = 0
|
|
48
49
|
}
|
|
49
|
-
UnitBonusType.
|
|
50
|
+
UnitBonusType.AUTO_ATTACK_DAMAGE = {
|
|
50
51
|
abilityTypeId = AUTO_ATTACK_DAMAGE_INCREASE_DUMMY_ABILITY_TYPE_ID,
|
|
51
52
|
field = AUTO_ATTACK_DAMAGE_INCREASE_ABILITY_FIELD,
|
|
52
53
|
integer = false,
|
|
53
54
|
reduce = sum,
|
|
54
55
|
initialValue = 0
|
|
55
56
|
}
|
|
57
|
+
UnitBonusType.DAMAGE_FACTOR = {reduce = product, valueByUnit = damageFactorByUnit, initialValue = 1}
|
|
56
58
|
UnitBonusType.RECEIVED_DAMAGE_FACTOR = {reduce = product, valueByUnit = receivedDamageFactorByUnit, initialValue = 1}
|
|
57
59
|
end
|
|
58
60
|
local bonusesByUnitByBonusType = {}
|
|
@@ -180,6 +182,9 @@ end
|
|
|
180
182
|
Unit.onDamage:addListener(
|
|
181
183
|
4,
|
|
182
184
|
function(source, target, event)
|
|
185
|
+
if source ~= nil and damageFactorByUnit[source] ~= nil then
|
|
186
|
+
event.amount = event.amount * damageFactorByUnit[source]
|
|
187
|
+
end
|
|
183
188
|
if receivedDamageFactorByUnit[target] ~= nil then
|
|
184
189
|
event.amount = event.amount * receivedDamageFactorByUnit[target]
|
|
185
190
|
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/** @noSelfInFile */
|
|
2
|
+
import { Item } from "../item";
|
|
3
|
+
export interface UnitItems extends ReadonlyArray<Item | undefined> {
|
|
4
|
+
readonly length: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
5
|
+
[0]: Item | undefined;
|
|
6
|
+
[1]: Item | undefined;
|
|
7
|
+
[2]: Item | undefined;
|
|
8
|
+
[3]: Item | undefined;
|
|
9
|
+
[4]: Item | undefined;
|
|
10
|
+
[5]: Item | undefined;
|
|
11
|
+
}
|
|
12
|
+
export declare class UnitItems {
|
|
13
|
+
constructor(handle: junit);
|
|
14
|
+
findSlot(item: Item): 0 | 1 | 2 | 3 | 4 | 5 | undefined;
|
|
15
|
+
protected __newindex(slot: number, item: Item | undefined): void;
|
|
16
|
+
protected __index(key: string | number): unknown;
|
|
17
|
+
protected __len(): number;
|
|
18
|
+
protected __ipairs(): LuaIterator<LuaMultiReturn<[number, Item | undefined]>, junit>;
|
|
19
|
+
}
|
|
20
|
+
declare module "../unit" {
|
|
21
|
+
interface Unit {
|
|
22
|
+
readonly items: UnitItems;
|
|
23
|
+
}
|
|
24
|
+
}
|