warscript 0.0.1-dev.cc63edd → 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.
- package/attributes.d.ts +0 -1
- package/binaryreader.d.ts +1 -0
- package/binaryreader.lua +3 -0
- package/core/types/frame.d.ts +2 -1
- package/core/types/frame.lua +2 -0
- package/core/types/group.d.ts +0 -1
- package/core/types/image.d.ts +0 -1
- package/core/types/unit.lua +8 -0
- package/decl/index.d.ts +1 -0
- package/engine/ability.d.ts +1 -1
- package/engine/behavior.d.ts +10 -10
- package/engine/behaviour/ability/apply-unit-behavior.d.ts +6 -1
- package/engine/behaviour/ability/damage.d.ts +33 -11
- package/engine/behaviour/ability/damage.lua +89 -31
- package/engine/behaviour/ability/heal.d.ts +33 -6
- package/engine/behaviour/ability/heal.lua +89 -10
- package/engine/behaviour/ability/restore-mana.d.ts +15 -0
- package/engine/behaviour/ability/restore-mana.lua +29 -0
- package/engine/behaviour/unit/stun-immunity.d.ts +0 -1
- package/engine/behaviour/unit.d.ts +3 -2
- package/engine/behaviour/unit.lua +7 -0
- package/engine/buff.d.ts +36 -15
- package/engine/buff.lua +162 -68
- package/engine/game-map.d.ts +7 -0
- package/engine/game-map.lua +32 -0
- package/engine/internal/unit/bonus.d.ts +5 -6
- package/engine/internal/unit+transport.lua +4 -10
- package/engine/internal/unit.d.ts +1 -2
- package/engine/internal/unit.lua +34 -26
- package/engine/object-data/auxiliary/attachment-preset.d.ts +0 -1
- package/engine/object-data/auxiliary/combat-classification.d.ts +0 -2
- package/engine/object-data/entry/ability-type/blank-configurable.d.ts +0 -1
- package/engine/object-data/entry/ability-type/blank-passive.d.ts +0 -1
- package/engine/object-data/entry/ability-type/channel.d.ts +0 -1
- package/engine/object-data/entry/ability-type.d.ts +0 -1
- package/engine/object-data/entry/buff-type/applicable.d.ts +0 -1
- package/engine/object-data/entry/buff-type/blank.d.ts +0 -1
- package/engine/object-data/entry/buff-type.d.ts +0 -1
- package/engine/object-data/entry/destructible-type.d.ts +0 -1
- package/engine/object-data/entry/item-type/blank.d.ts +0 -1
- package/engine/object-data/entry/item-type.d.ts +0 -1
- package/engine/object-data/entry/lightning-type.d.ts +0 -1
- package/engine/object-data/entry/unit-type.d.ts +0 -1
- package/engine/object-data/entry/upgrade/blank.d.ts +0 -1
- package/engine/object-data/entry/upgrade.d.ts +0 -1
- package/engine/object-data/entry.d.ts +2 -3
- package/engine/object-field/ability.d.ts +1 -1
- package/engine/object-field.d.ts +0 -1
- package/engine/random.d.ts +1 -0
- package/engine/random.lua +9 -0
- package/engine/unit.lua +9 -2
- package/event.d.ts +2 -3
- package/event.lua +9 -5
- package/lualib_bundle.lua +146 -42
- package/math/vec2.d.ts +2 -9
- package/math.d.ts +0 -2
- package/objutil/ability.d.ts +0 -1
- package/objutil/buff.d.ts +0 -1
- package/objutil/object.d.ts +0 -1
- package/objutil/unit.d.ts +0 -1
- package/package.json +13 -13
- package/property.d.ts +55 -0
- package/property.lua +374 -0
- package/string.d.ts +16 -0
- package/string.lua +5 -0
- package/util/stream.d.ts +0 -1
- package/utility/arrays.d.ts +3 -4
- package/utility/bit-set.d.ts +0 -2
- package/utility/linked-set.d.ts +1 -2
- package/utility/lua-maps.d.ts +1 -2
- package/utility/lua-sets.d.ts +1 -2
- package/core/mapbounds.d.ts +0 -8
- package/core/mapbounds.lua +0 -12
package/engine/buff.d.ts
CHANGED
|
@@ -64,8 +64,12 @@ export type BuffParameters<T extends Buff<any> = Buff> = Buff extends T ? {
|
|
|
64
64
|
disablesAutoAttack?: BooleanParameterValueType;
|
|
65
65
|
destroysOnDamage?: BooleanParameterValueType;
|
|
66
66
|
maximumAutoAttackCount?: IntegerParameterValueType;
|
|
67
|
+
damageOnExpiration?: NumberParameterValueType;
|
|
68
|
+
healingOnExpiration?: NumberParameterValueType;
|
|
69
|
+
killsOnExpiration?: BooleanParameterValueType;
|
|
70
|
+
explodesOnExpiration?: BooleanParameterValueType;
|
|
67
71
|
uniqueGroup?: BuffUniqueGroup;
|
|
68
|
-
} : BuffParameters & (T extends Buff<infer AdditionalParameters> ? AdditionalParameters :
|
|
72
|
+
} : BuffParameters & (T extends Buff<infer AdditionalParameters> ? AdditionalParameters : object);
|
|
69
73
|
declare const enum BuffPropertyKey {
|
|
70
74
|
UNIT = 100,
|
|
71
75
|
SOURCE = 101,
|
|
@@ -86,19 +90,23 @@ declare const enum BuffPropertyKey {
|
|
|
86
90
|
HEALING_INTERVAL = 116,
|
|
87
91
|
REMAINING_HEALING_OVER_DURATION = 117,
|
|
88
92
|
HEALING_INTERVAL_TIMER = 118,
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
93
|
+
DAMAGE_ON_EXPIRATION = 119,
|
|
94
|
+
HEALING_ON_EXPIRATION = 120,
|
|
95
|
+
DAMAGE_UPON_DEATH_ALLOWED_TARGET_CLASSIFICATIONS = 121,
|
|
96
|
+
DAMAGE_UPON_DEATH = 122,
|
|
97
|
+
DAMAGE_UPON_DEATH_RANGE = 123,
|
|
98
|
+
MEDIUM_DAMAGE_UPON_DEATH = 124,
|
|
99
|
+
MEDIUM_DAMAGE_UPON_DEATH_RANGE = 125,
|
|
100
|
+
SMALL_DAMAGE_UPON_DEATH = 126,
|
|
101
|
+
SMALL_DAMAGE_UPON_DEATH_RANGE = 127,
|
|
102
|
+
AUTO_ATTACK_COUNT = 128,
|
|
103
|
+
MAXIMUM_AUTO_ATTACK_COUNT = 129,
|
|
104
|
+
STUNS = 130,
|
|
105
|
+
IGNORES_STUN_IMMUNITY = 131,
|
|
106
|
+
DISABLES_AUTO_ATTACK = 132,
|
|
107
|
+
PROVIDES_INVULNERABILITY = 133,
|
|
108
|
+
KILLS_ON_EXPIRATION = 134,
|
|
109
|
+
EXPLODES_ON_EXPIRATION = 135
|
|
102
110
|
}
|
|
103
111
|
export declare const enum BuffTypeIdSelectionPolicy {
|
|
104
112
|
LEAST_DURATION = 0
|
|
@@ -116,7 +124,7 @@ export type BuffConstructorParameters<AdditionalParameters extends BuffAdditiona
|
|
|
116
124
|
parameters?: BuffParameters & Omit<AdditionalParameters, keyof BuffParameters>
|
|
117
125
|
] | [parameters?: BuffParameters & Omit<AdditionalParameters, keyof BuffParameters>]
|
|
118
126
|
];
|
|
119
|
-
export declare class Buff<AdditionalParameters extends Prohibit<Record<string, any>, keyof BuffParameters> =
|
|
127
|
+
export declare class Buff<AdditionalParameters extends Prohibit<Record<string, any>, keyof BuffParameters> = object> extends UnitBehavior {
|
|
120
128
|
private _unit;
|
|
121
129
|
protected readonly __additionalParametersBrand?: AdditionalParameters;
|
|
122
130
|
private [BuffPropertyKey.UNIT];
|
|
@@ -138,6 +146,8 @@ export declare class Buff<AdditionalParameters extends Prohibit<Record<string, a
|
|
|
138
146
|
private [BuffPropertyKey.HEALING_INTERVAL]?;
|
|
139
147
|
private [BuffPropertyKey.REMAINING_HEALING_OVER_DURATION]?;
|
|
140
148
|
private [BuffPropertyKey.HEALING_INTERVAL_TIMER]?;
|
|
149
|
+
private [BuffPropertyKey.DAMAGE_ON_EXPIRATION]?;
|
|
150
|
+
private [BuffPropertyKey.HEALING_ON_EXPIRATION]?;
|
|
141
151
|
private [BuffPropertyKey.DAMAGE_UPON_DEATH_ALLOWED_TARGET_CLASSIFICATIONS]?;
|
|
142
152
|
private [BuffPropertyKey.DAMAGE_UPON_DEATH]?;
|
|
143
153
|
private [BuffPropertyKey.DAMAGE_UPON_DEATH_RANGE]?;
|
|
@@ -151,6 +161,8 @@ export declare class Buff<AdditionalParameters extends Prohibit<Record<string, a
|
|
|
151
161
|
private [BuffPropertyKey.IGNORES_STUN_IMMUNITY]?;
|
|
152
162
|
private [BuffPropertyKey.DISABLES_AUTO_ATTACK]?;
|
|
153
163
|
private [BuffPropertyKey.PROVIDES_INVULNERABILITY]?;
|
|
164
|
+
private [BuffPropertyKey.KILLS_ON_EXPIRATION]?;
|
|
165
|
+
private [BuffPropertyKey.EXPLODES_ON_EXPIRATION]?;
|
|
154
166
|
protected static readonly defaultParameters: BuffParameters;
|
|
155
167
|
get source(): Unit;
|
|
156
168
|
readonly typeId: ApplicableBuffTypeId;
|
|
@@ -187,6 +199,10 @@ export declare class Buff<AdditionalParameters extends Prohibit<Record<string, a
|
|
|
187
199
|
set healingPerInterval(healingPerInterval: number);
|
|
188
200
|
get healingInterval(): number;
|
|
189
201
|
set healingInterval(healingInterval: number);
|
|
202
|
+
get damageOnExpiration(): number;
|
|
203
|
+
set damageOnExpiration(damageOnExpiration: number);
|
|
204
|
+
get healingOnExpiration(): number;
|
|
205
|
+
set healingOnExpiration(healingOnExpiration: number);
|
|
190
206
|
get receivedDamageFactor(): number;
|
|
191
207
|
set receivedDamageFactor(receivedDamageFactor: number);
|
|
192
208
|
get armorIncrease(): number;
|
|
@@ -199,6 +215,10 @@ export declare class Buff<AdditionalParameters extends Prohibit<Record<string, a
|
|
|
199
215
|
set disablesAutoAttack(disablesAutoAttack: boolean);
|
|
200
216
|
get providesInvulnerability(): boolean;
|
|
201
217
|
set providesInvulnerability(providesInvulnerability: boolean);
|
|
218
|
+
get killsOnExpiration(): boolean;
|
|
219
|
+
set killsOnExpiration(killsOnExpiration: boolean);
|
|
220
|
+
get explodesOnExpiration(): boolean;
|
|
221
|
+
set explodesOnExpiration(killsOnExpiration: boolean);
|
|
202
222
|
get maximumAutoAttackCount(): number;
|
|
203
223
|
set maximumAutoAttackCount(maximumAutoAttackCount: number);
|
|
204
224
|
get durationIncreaseOnAutoAttack(): number;
|
|
@@ -215,6 +235,7 @@ export declare class Buff<AdditionalParameters extends Prohibit<Record<string, a
|
|
|
215
235
|
protected onDestroy(): Destructor;
|
|
216
236
|
static apply<T extends Buff<any>, Args extends any[]>(this: BuffConstructor<T, Args>, ...args: Args): T | undefined;
|
|
217
237
|
static getByTypeId<T extends Buff<any>, Args extends any[]>(this: BuffConstructor<T, Args>, unit: Unit, typeId: ApplicableBuffTypeId): T | undefined;
|
|
238
|
+
onExpiration(): void;
|
|
218
239
|
onDeath(source: Unit | undefined): void;
|
|
219
240
|
onDamageDealt(target: Unit, event: DamageEvent): void;
|
|
220
241
|
}
|
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 = {
|
|
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[
|
|
547
|
+
if self[132] then
|
|
534
548
|
unit:decrementDisableAutoAttackCounter()
|
|
535
549
|
end
|
|
536
|
-
if self[
|
|
537
|
-
if self[
|
|
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.
|
|
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[
|
|
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[
|
|
622
|
-
self[
|
|
623
|
-
if autoAttackCount == self[
|
|
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
|
|
837
|
-
if
|
|
838
|
-
|
|
890
|
+
local ____self__130_52 = self[130]
|
|
891
|
+
if ____self__130_52 == nil then
|
|
892
|
+
____self__130_52 = false
|
|
839
893
|
end
|
|
840
|
-
return
|
|
894
|
+
return ____self__130_52
|
|
841
895
|
end,
|
|
842
896
|
set = function(self, stuns)
|
|
843
|
-
if not stuns and self[
|
|
844
|
-
if self[
|
|
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[
|
|
849
|
-
elseif stuns and not self[
|
|
850
|
-
if self[
|
|
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[
|
|
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
|
|
866
|
-
if
|
|
867
|
-
|
|
919
|
+
local ____self__131_53 = self[131]
|
|
920
|
+
if ____self__131_53 == nil then
|
|
921
|
+
____self__131_53 = false
|
|
868
922
|
end
|
|
869
|
-
return
|
|
923
|
+
return ____self__131_53
|
|
870
924
|
end,
|
|
871
925
|
set = function(self, ignoresStunImmunity)
|
|
872
|
-
if not ignoresStunImmunity and self[
|
|
873
|
-
if self[
|
|
926
|
+
if not ignoresStunImmunity and self[131] then
|
|
927
|
+
if self[130] then
|
|
874
928
|
self.object:decrementStunCounter()
|
|
875
929
|
end
|
|
876
|
-
self[
|
|
877
|
-
elseif ignoresStunImmunity and not self[
|
|
878
|
-
if self[
|
|
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[
|
|
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
|
|
893
|
-
if
|
|
894
|
-
|
|
946
|
+
local ____self__132_54 = self[132]
|
|
947
|
+
if ____self__132_54 == nil then
|
|
948
|
+
____self__132_54 = false
|
|
895
949
|
end
|
|
896
|
-
return
|
|
950
|
+
return ____self__132_54
|
|
897
951
|
end,
|
|
898
952
|
set = function(self, disablesAutoAttack)
|
|
899
|
-
if not disablesAutoAttack and self[
|
|
953
|
+
if not disablesAutoAttack and self[132] then
|
|
900
954
|
self.object:decrementDisableAutoAttackCounter()
|
|
901
|
-
self[
|
|
902
|
-
elseif disablesAutoAttack and not self[
|
|
955
|
+
self[132] = nil
|
|
956
|
+
elseif disablesAutoAttack and not self[132] then
|
|
903
957
|
self.object:incrementDisableAutoAttackCounter()
|
|
904
|
-
self[
|
|
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
|
|
916
|
-
if
|
|
917
|
-
|
|
969
|
+
local ____self__133_55 = self[133]
|
|
970
|
+
if ____self__133_55 == nil then
|
|
971
|
+
____self__133_55 = false
|
|
918
972
|
end
|
|
919
|
-
return
|
|
973
|
+
return ____self__133_55
|
|
920
974
|
end,
|
|
921
975
|
set = function(self, providesInvulnerability)
|
|
922
|
-
if not providesInvulnerability and self[
|
|
976
|
+
if not providesInvulnerability and self[133] then
|
|
923
977
|
self.object:decrementInvulnerabilityCounter()
|
|
924
|
-
self[
|
|
925
|
-
elseif providesInvulnerability and not self[
|
|
978
|
+
self[133] = nil
|
|
979
|
+
elseif providesInvulnerability and not self[133] then
|
|
926
980
|
self.object:incrementInvulnerabilityCounter()
|
|
927
|
-
self[
|
|
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[
|
|
1034
|
+
return self[129] or 0
|
|
939
1035
|
end,
|
|
940
1036
|
set = function(self, maximumAutoAttackCount)
|
|
941
1037
|
if maximumAutoAttackCount == 0 then
|
|
942
|
-
self[
|
|
1038
|
+
self[129] = nil
|
|
943
1039
|
else
|
|
944
|
-
self[
|
|
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
|
|
1003
|
-
return
|
|
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
|
|
1007
|
-
local
|
|
1008
|
-
local remainingDurationDelta =
|
|
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
|
|
@@ -1035,24 +1131,22 @@ __TS__SetDescriptor(
|
|
|
1035
1131
|
true
|
|
1036
1132
|
);
|
|
1037
1133
|
(function(self)
|
|
1134
|
+
local function destroyBuffIfNeeded(buff)
|
|
1135
|
+
if getUnitAbility(buff[100].handle, buff.typeId) ~= buff.handle then
|
|
1136
|
+
buff:destroy()
|
|
1137
|
+
end
|
|
1138
|
+
end
|
|
1038
1139
|
____exports.checkBuff = function(unit, buffTypeId)
|
|
1039
1140
|
local buffByTypeId = buffByTypeIdByUnit[unit]
|
|
1040
1141
|
if buffByTypeId ~= nil then
|
|
1041
1142
|
local buff = buffByTypeId[buffTypeId]
|
|
1042
|
-
if buff ~= nil
|
|
1043
|
-
buff
|
|
1143
|
+
if buff ~= nil then
|
|
1144
|
+
destroyBuffIfNeeded(buff)
|
|
1044
1145
|
end
|
|
1045
1146
|
end
|
|
1046
1147
|
end
|
|
1047
1148
|
____exports.checkBuffs = function(unit)
|
|
1048
|
-
|
|
1049
|
-
if buffByTypeId ~= nil then
|
|
1050
|
-
for ____, buff in pairs(buffByTypeId) do
|
|
1051
|
-
if getUnitAbility(unit.handle, buff.typeId) ~= buff.handle then
|
|
1052
|
-
buff:destroy()
|
|
1053
|
-
end
|
|
1054
|
-
end
|
|
1055
|
-
end
|
|
1149
|
+
____exports.Buff:forAll(unit, destroyBuffIfNeeded)
|
|
1056
1150
|
end
|
|
1057
1151
|
Unit.abilityChannelingStartEvent:addListener(
|
|
1058
1152
|
0,
|
|
@@ -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
|
|
38
|
-
export declare const removeUnitBonus: <Id extends UnitBonusId
|
|
39
|
-
export declare const updateUnitBonus: <Id extends UnitBonusId
|
|
40
|
-
export declare const addOrUpdateOrRemoveUnitBonus: <Id extends UnitBonusId
|
|
41
|
-
export declare const getUnitBonus: <Id extends UnitBonusId
|
|
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
|
|
10
|
-
local
|
|
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 =
|
|
62
|
-
unit.y =
|
|
60
|
+
unit.x = GameMap.worldBoundsRect.maxX
|
|
61
|
+
unit.y = GameMap.worldBoundsRect.maxY
|
|
63
62
|
end
|
|
64
63
|
local transport = Unit:of(getTransportUnit())
|
|
65
64
|
transportByUnit[unit] = transport
|
|
@@ -68,11 +67,6 @@ triggerAddCondition(
|
|
|
68
67
|
eventInvoke(onBoardEvent, unit, transport)
|
|
69
68
|
end)
|
|
70
69
|
)
|
|
71
|
-
boundRegion.onUnitEnter:addListener(function(unit)
|
|
72
|
-
if transportByUnit[unit] ~= nil and not isUnitLoaded(unit.handle) then
|
|
73
|
-
deboard(unit)
|
|
74
|
-
end
|
|
75
|
-
end)
|
|
76
70
|
Unit.deathEvent:addListener(function(unit)
|
|
77
71
|
if transportByUnit[unit] ~= nil then
|
|
78
72
|
deboard(unit)
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="@typescript-to-lua/language-extensions" />
|
|
2
1
|
/** @noSelfInFile */
|
|
3
2
|
import { Handle, HandleDestructor } from "../../core/types/handle";
|
|
4
3
|
import { Player } from "../../core/types/player";
|
|
@@ -228,7 +227,7 @@ export declare class Unit extends Handle<junit> {
|
|
|
228
227
|
isSelected(player: Player): boolean;
|
|
229
228
|
explode(): void;
|
|
230
229
|
kill(): void;
|
|
231
|
-
revive(
|
|
230
|
+
revive(x: number, y: number, doEffect?: boolean): void;
|
|
232
231
|
healTarget(target: Widget, amount: number): void;
|
|
233
232
|
useItem(item: Item): boolean;
|
|
234
233
|
issueImmediateOrder(order: number): boolean;
|