warscript 0.0.1-dev.e49ec00 → 0.0.1-dev.e561d29
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/timer.d.ts +1 -0
- package/core/types/timer.lua +7 -2
- package/decl/native.d.ts +4 -2
- package/engine/behavior.d.ts +2 -0
- package/engine/behavior.lua +53 -27
- package/engine/behaviour/ability/emulate-impact.d.ts +1 -1
- package/engine/behaviour/ability/emulate-impact.lua +2 -1
- package/engine/internal/unit-missile-launch.lua +8 -1
- package/engine/internal/unit.d.ts +1 -2
- package/engine/object-data/auxiliary/armor-type.d.ts +11 -0
- package/engine/object-data/auxiliary/armor-type.lua +46 -0
- package/engine/object-data/entry/ability-type.lua +1 -3
- package/engine/object-data/entry/unit-type.d.ts +11 -2
- package/engine/object-data/entry/unit-type.lua +59 -1
- package/package.json +2 -2
- package/utility/functions.d.ts +2 -0
- package/utility/functions.lua +2 -0
package/core/types/timer.d.ts
CHANGED
|
@@ -22,6 +22,7 @@ export declare class Timer extends AbstractDestroyable {
|
|
|
22
22
|
pause(): void;
|
|
23
23
|
resume(): void;
|
|
24
24
|
static create(): Timer;
|
|
25
|
+
static run<T, K extends KeysOfType<T, (this: T, ...args: any) => any>>(object: T, key: K, ...parameters: T[K] extends (this: T, ...args: any) => any ? Parameters<T[K]> : never): void;
|
|
25
26
|
static run<Args extends any[]>(callback: (this: void, ...args: Args) => void, ...args: Args): void;
|
|
26
27
|
static simple<Args extends any[]>(timeout: number, callback: (...args: Args) => void, ...args: Args): Timer;
|
|
27
28
|
static periodic<Args extends any[]>(period: number, callback: (this: void, timer: Timer, ...args: Args) => void, ...args: Args): Timer;
|
package/core/types/timer.lua
CHANGED
|
@@ -24,6 +24,7 @@ local getHandleId = GetHandleId
|
|
|
24
24
|
local ____pcall = _G.pcall
|
|
25
25
|
local ____print = _G.print
|
|
26
26
|
local select = _G.select
|
|
27
|
+
local ____type = _G.type
|
|
27
28
|
local safeCall = warpack.safeCall
|
|
28
29
|
local corunning = coroutine.running
|
|
29
30
|
local coresume = coroutine.resume
|
|
@@ -81,8 +82,12 @@ end
|
|
|
81
82
|
function Timer.create(self)
|
|
82
83
|
return __TS__New(____exports.Timer)
|
|
83
84
|
end
|
|
84
|
-
function Timer.run(self,
|
|
85
|
-
|
|
85
|
+
function Timer.run(self, objectOrCallback, keyOrFirstArg, ...)
|
|
86
|
+
if ____type(objectOrCallback) == "function" then
|
|
87
|
+
____exports.Timer:simple(0, objectOrCallback, keyOrFirstArg, ...)
|
|
88
|
+
else
|
|
89
|
+
____exports.Timer:simple(0, objectOrCallback[keyOrFirstArg], objectOrCallback, ...)
|
|
90
|
+
end
|
|
86
91
|
end
|
|
87
92
|
function Timer.simple(self, timeout, callback, ...)
|
|
88
93
|
local timer = __TS__New(____exports.Timer)
|
package/decl/native.d.ts
CHANGED
|
@@ -388,13 +388,15 @@ declare interface jmovetype extends jhandle {
|
|
|
388
388
|
declare interface jtargetflag extends jhandle {
|
|
389
389
|
__jtargetflag: never
|
|
390
390
|
}
|
|
391
|
-
declare
|
|
391
|
+
declare type jarmortype = symbol &
|
|
392
|
+
jhandle & {
|
|
392
393
|
__jarmortype: never
|
|
393
394
|
}
|
|
394
395
|
declare interface jheroattribute extends jhandle {
|
|
395
396
|
__jheroattribute: never
|
|
396
397
|
}
|
|
397
|
-
declare
|
|
398
|
+
declare type jdefensetype = symbol &
|
|
399
|
+
jhandle & {
|
|
398
400
|
__jdefensetype: never
|
|
399
401
|
}
|
|
400
402
|
declare interface jregentype extends jhandle {
|
package/engine/behavior.d.ts
CHANGED
|
@@ -24,5 +24,7 @@ export declare abstract class Behavior<T extends AnyNotNil, PeriodicActionParame
|
|
|
24
24
|
static forFirst<T extends Behavior<AnyNotNil>, ConstructorParameters extends any[], K extends KeysOfType<T, (this: T, ...args: any) => any>>(this: BehaviorConstructor<T, ConstructorParameters>, object: T extends Behavior<infer Object> ? Object : never, count: number, key: K, ...parameters: T[K] extends (this: T, ...args: any) => any ? Parameters<T[K]> : never): number;
|
|
25
25
|
static forAll<T extends Behavior<AnyNotNil>, ConstructorParameters extends any[], ConsumerParameters extends any[]>(this: BehaviorConstructor<T, ConstructorParameters>, object: T extends Behavior<infer Object> ? Object : never, consumer: (this: void, behavior: T, ...parameters: ConsumerParameters) => unknown, ...parameters: ConsumerParameters): number;
|
|
26
26
|
static forAll<T extends Behavior<AnyNotNil>, ConstructorParameters extends any[], K extends KeysOfType<T, (this: T, ...args: any) => any>>(this: BehaviorConstructor<T, ConstructorParameters>, object: T extends Behavior<infer Object> ? Object : never, key: K, ...parameters: T[K] extends (this: T, ...args: any) => any ? Parameters<T[K]> : never): number;
|
|
27
|
+
static reduce<T extends Behavior<AnyNotNil>, ConstructorParameters extends any[], ConsumerParameters extends any[], Accumulator, R>(this: BehaviorConstructor<T, ConstructorParameters>, object: T extends Behavior<infer Object> ? Object : never, operation: (this: void, accumulator: Accumulator, value: R) => Accumulator, initial: Accumulator, consumer: (this: void, behavior: T, ...parameters: ConsumerParameters) => R, ...parameters: ConsumerParameters): Accumulator;
|
|
28
|
+
static reduce<T extends Behavior<AnyNotNil>, ConstructorParameters extends any[], Accumulator, R, K extends KeysOfType<T, (this: T, ...args: any) => R>>(this: BehaviorConstructor<T, ConstructorParameters>, object: T extends Behavior<infer Object> ? Object : never, operation: (this: void, accumulator: Accumulator, value: R) => Accumulator, initial: Accumulator, key: K, ...parameters: T[K] extends (this: T, ...args: any) => R ? Parameters<T[K]> : never): Accumulator;
|
|
27
29
|
}
|
|
28
30
|
export {};
|
package/engine/behavior.lua
CHANGED
|
@@ -1,18 +1,52 @@
|
|
|
1
1
|
local ____lualib = require("lualib_bundle")
|
|
2
|
+
local __TS__InstanceOf = ____lualib.__TS__InstanceOf
|
|
2
3
|
local __TS__Class = ____lualib.__TS__Class
|
|
3
4
|
local __TS__ClassExtends = ____lualib.__TS__ClassExtends
|
|
4
|
-
local __TS__InstanceOf = ____lualib.__TS__InstanceOf
|
|
5
5
|
local ____exports = {}
|
|
6
6
|
local ____destroyable = require("destroyable")
|
|
7
7
|
local AbstractDestroyable = ____destroyable.AbstractDestroyable
|
|
8
8
|
local ____timer = require("core.types.timer")
|
|
9
9
|
local Timer = ____timer.Timer
|
|
10
|
+
local ____functions = require("utility.functions")
|
|
11
|
+
local increment = ____functions.increment
|
|
10
12
|
local safeCall = warpack.safeCall
|
|
11
13
|
local firstBehaviorByObject = {}
|
|
12
14
|
local lastBehaviorByObject = {}
|
|
13
15
|
local function invokeBehaviorOnPeriod(behavior, ...)
|
|
14
16
|
behavior.onPeriod(behavior, ...)
|
|
15
17
|
end
|
|
18
|
+
local function reduceBehaviors(behaviorConstructor, object, operation, initial, consumerOrKey, ...)
|
|
19
|
+
local accumulator = initial
|
|
20
|
+
local behavior = firstBehaviorByObject[object]
|
|
21
|
+
if behavior ~= nil then
|
|
22
|
+
if type(consumerOrKey) == "function" then
|
|
23
|
+
repeat
|
|
24
|
+
do
|
|
25
|
+
if __TS__InstanceOf(behavior, behaviorConstructor) then
|
|
26
|
+
local isSuccessful, result = safeCall(consumerOrKey, behavior, ...)
|
|
27
|
+
if isSuccessful then
|
|
28
|
+
accumulator = operation(accumulator, result)
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
behavior = behavior[1]
|
|
32
|
+
end
|
|
33
|
+
until not (behavior ~= nil)
|
|
34
|
+
else
|
|
35
|
+
repeat
|
|
36
|
+
do
|
|
37
|
+
if __TS__InstanceOf(behavior, behaviorConstructor) then
|
|
38
|
+
local isSuccessful, result = safeCall(behavior[consumerOrKey], behavior, ...)
|
|
39
|
+
if isSuccessful then
|
|
40
|
+
accumulator = operation(accumulator, result)
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
behavior = behavior[1]
|
|
44
|
+
end
|
|
45
|
+
until not (behavior ~= nil)
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
return accumulator
|
|
49
|
+
end
|
|
16
50
|
____exports.Behavior = __TS__Class()
|
|
17
51
|
local Behavior = ____exports.Behavior
|
|
18
52
|
Behavior.name = "Behavior"
|
|
@@ -151,31 +185,23 @@ function Behavior.forFirst(self, object, count, consumerOrKey, ...)
|
|
|
151
185
|
return behaviorsCount
|
|
152
186
|
end
|
|
153
187
|
function Behavior.forAll(self, object, consumerOrKey, ...)
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
behaviorsCount = behaviorsCount + 1
|
|
173
|
-
end
|
|
174
|
-
behavior = behavior[1]
|
|
175
|
-
end
|
|
176
|
-
until not (behavior ~= nil)
|
|
177
|
-
end
|
|
178
|
-
end
|
|
179
|
-
return behaviorsCount
|
|
188
|
+
return reduceBehaviors(
|
|
189
|
+
self,
|
|
190
|
+
object,
|
|
191
|
+
increment,
|
|
192
|
+
0,
|
|
193
|
+
consumerOrKey,
|
|
194
|
+
...
|
|
195
|
+
)
|
|
196
|
+
end
|
|
197
|
+
function Behavior.reduce(self, object, operation, initial, consumerOrKey, ...)
|
|
198
|
+
return reduceBehaviors(
|
|
199
|
+
self,
|
|
200
|
+
object,
|
|
201
|
+
operation,
|
|
202
|
+
initial,
|
|
203
|
+
consumerOrKey,
|
|
204
|
+
...
|
|
205
|
+
)
|
|
180
206
|
end
|
|
181
207
|
return ____exports
|
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
import { AbilityBehavior } from "../ability";
|
|
3
3
|
import { Unit } from "../../internal/unit";
|
|
4
4
|
export declare abstract class EmulateImpactAbilityBehavior extends AbilityBehavior {
|
|
5
|
-
protected emulateImpact(caster: Unit):
|
|
5
|
+
protected emulateImpact(caster: Unit): boolean;
|
|
6
6
|
}
|
|
@@ -28,7 +28,7 @@ function EmulateImpactAbilityBehavior.prototype.emulateImpact(self, caster)
|
|
|
28
28
|
local manaCost = self:resolveCurrentAbilityDependentValue(MANA_COST_ABILITY_INTEGER_LEVEL_FIELD)
|
|
29
29
|
local cooldown = self:resolveCurrentAbilityDependentValue(COOLDOWN_ABILITY_FLOAT_LEVEL_FIELD)
|
|
30
30
|
if self.ability.cooldownRemaining ~= 0 or caster.mana < manaCost or __TS__InstanceOf(self.ability, UnitAbility) and self.ability.isDisabled then
|
|
31
|
-
return
|
|
31
|
+
return false
|
|
32
32
|
end
|
|
33
33
|
caster.mana = caster.mana - manaCost
|
|
34
34
|
self.ability.cooldownRemaining = max(cooldown, MINIMUM_POSITIVE_NORMALIZED_FLOAT)
|
|
@@ -38,5 +38,6 @@ function EmulateImpactAbilityBehavior.prototype.emulateImpact(self, caster)
|
|
|
38
38
|
Sound3D:playFromLabel(soundPresetId, SoundSettings.Ability, caster)
|
|
39
39
|
end
|
|
40
40
|
Event.invoke(Unit.abilityImpactEvent, caster, self.ability)
|
|
41
|
+
return true
|
|
41
42
|
end
|
|
42
43
|
return ____exports
|
|
@@ -9,6 +9,8 @@ local ____timer = require("core.types.timer")
|
|
|
9
9
|
local Timer = ____timer.Timer
|
|
10
10
|
local ____lua_2Dsets = require("utility.lua-sets")
|
|
11
11
|
local luaSetOf = ____lua_2Dsets.luaSetOf
|
|
12
|
+
local ____math = require("math")
|
|
13
|
+
local min = ____math.min
|
|
12
14
|
local autoAttackFinishEvent = __TS__New(Event)
|
|
13
15
|
rawset(Unit, "autoAttackFinishEvent", autoAttackFinishEvent)
|
|
14
16
|
local eventTimerByUnit = {}
|
|
@@ -45,7 +47,12 @@ local function timerCallback(source, target)
|
|
|
45
47
|
end
|
|
46
48
|
Unit.autoAttackStartEvent:addListener(function(source, target)
|
|
47
49
|
local attackPoint = (source:chooseWeapon(target) or source.firstWeapon).impactDelay
|
|
48
|
-
local timer = Timer:simple(
|
|
50
|
+
local timer = Timer:simple(
|
|
51
|
+
attackPoint + min(0.001, attackPoint / 2),
|
|
52
|
+
timerCallback,
|
|
53
|
+
source,
|
|
54
|
+
target
|
|
55
|
+
)
|
|
49
56
|
eventTimerByUnit[source] = timer
|
|
50
57
|
end)
|
|
51
58
|
return ____exports
|
|
@@ -160,8 +160,7 @@ export declare class Unit extends Handle<junit> {
|
|
|
160
160
|
isInRangeOf(unit: Unit, range: number): boolean;
|
|
161
161
|
isAllyOf(unit: Unit): boolean;
|
|
162
162
|
isEnemyOf(unit: Unit): boolean;
|
|
163
|
-
playAnimation(animation: string, rarity?: jraritycontrol): void;
|
|
164
|
-
playAnimation(animation: number): void;
|
|
163
|
+
playAnimation(...parameters: [animation: number] | [animation: string, rarity?: jraritycontrol]): void;
|
|
165
164
|
resetAnimation(): void;
|
|
166
165
|
queueAnimation(animation: string): void;
|
|
167
166
|
get weapons(): [UnitWeapon, UnitWeapon];
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
local ____exports = {}
|
|
2
|
+
local ____records = require("utility.records")
|
|
3
|
+
local invertRecord = ____records.invertRecord
|
|
4
|
+
local stringByArmorType = {
|
|
5
|
+
[0] = "small",
|
|
6
|
+
[1] = "medium",
|
|
7
|
+
[2] = "large",
|
|
8
|
+
[3] = "fort",
|
|
9
|
+
[4] = "normal",
|
|
10
|
+
[5] = "hero",
|
|
11
|
+
[6] = "divine",
|
|
12
|
+
[7] = "none"
|
|
13
|
+
}
|
|
14
|
+
local armorTypeByString = invertRecord(stringByArmorType)
|
|
15
|
+
local nativeByArmorType = {
|
|
16
|
+
[0] = DEFENSE_TYPE_LIGHT,
|
|
17
|
+
[1] = DEFENSE_TYPE_MEDIUM,
|
|
18
|
+
[2] = DEFENSE_TYPE_LARGE,
|
|
19
|
+
[3] = DEFENSE_TYPE_FORT,
|
|
20
|
+
[4] = DEFENSE_TYPE_NORMAL,
|
|
21
|
+
[5] = DEFENSE_TYPE_HERO,
|
|
22
|
+
[6] = DEFENSE_TYPE_DIVINE,
|
|
23
|
+
[7] = DEFENSE_TYPE_NONE
|
|
24
|
+
}
|
|
25
|
+
local armorTypeByNative = invertRecord(nativeByArmorType)
|
|
26
|
+
---
|
|
27
|
+
-- @internal For use by internal systems only.
|
|
28
|
+
____exports.armorTypeToString = function(armorType)
|
|
29
|
+
return stringByArmorType[armorType]
|
|
30
|
+
end
|
|
31
|
+
---
|
|
32
|
+
-- @internal For use by internal systems only.
|
|
33
|
+
____exports.stringToArmorType = function(____string)
|
|
34
|
+
return armorTypeByString[____string] or 7
|
|
35
|
+
end
|
|
36
|
+
---
|
|
37
|
+
-- @internal For use by internal systems only.
|
|
38
|
+
____exports.armorTypeToNative = function(armorType)
|
|
39
|
+
return nativeByArmorType[armorType]
|
|
40
|
+
end
|
|
41
|
+
---
|
|
42
|
+
-- @internal For use by internal systems only.
|
|
43
|
+
____exports.nativeToArmorType = function(armorType)
|
|
44
|
+
return armorTypeByNative[armorType]
|
|
45
|
+
end
|
|
46
|
+
return ____exports
|
|
@@ -979,9 +979,7 @@ for abilityTypeId, animationFQN in pairs(postcompile(function() return castAnima
|
|
|
979
979
|
4,
|
|
980
980
|
function(caster, ability)
|
|
981
981
|
if ability:getField(ABILITY_RLF_CASTING_TIME) ~= 0 then
|
|
982
|
-
Timer:run(
|
|
983
|
-
caster:playAnimation(animationFQN)
|
|
984
|
-
end)
|
|
982
|
+
Timer:run(caster, "playAnimation", animationFQN)
|
|
985
983
|
end
|
|
986
984
|
end
|
|
987
985
|
)
|
|
@@ -13,6 +13,7 @@ import type { AbilityTypeId } from "./ability-type";
|
|
|
13
13
|
import type { UpgradeId } from "./upgrade";
|
|
14
14
|
import { AnimationQualifier } from "../auxiliary/animation-qualifier";
|
|
15
15
|
import { AttackType } from "../auxiliary/attack-type";
|
|
16
|
+
import { ArmorType } from "../auxiliary/armor-type";
|
|
16
17
|
export type UnitTypeId = ObjectDataEntryId & number & {
|
|
17
18
|
readonly __unitTypeId: unique symbol;
|
|
18
19
|
};
|
|
@@ -144,6 +145,8 @@ export declare abstract class UnitType<Id extends UnitTypeId = UnitTypeId> exten
|
|
|
144
145
|
set runSpeedSD(runSpeedSD: number);
|
|
145
146
|
get runSpeedHD(): number;
|
|
146
147
|
set runSpeedHD(runSpeedHD: number);
|
|
148
|
+
get selectionCircleHeight(): number;
|
|
149
|
+
set selectionCircleHeight(height: number);
|
|
147
150
|
get selectionCircleScale(): number;
|
|
148
151
|
set selectionCircleScale(selectionCircleScale: number);
|
|
149
152
|
get selectionCircleScaleSD(): number;
|
|
@@ -182,16 +185,20 @@ export declare abstract class UnitType<Id extends UnitTypeId = UnitTypeId> exten
|
|
|
182
185
|
set walkSpeedSD(walkSpeedSD: number);
|
|
183
186
|
get walkSpeedHD(): number;
|
|
184
187
|
set walkSpeedHD(walkSpeedHD: number);
|
|
188
|
+
get armor(): number;
|
|
189
|
+
set armor(armor: number);
|
|
185
190
|
get armorSoundType(): ArmorSoundType;
|
|
186
191
|
set armorSoundType(armorSoundType: ArmorSoundType);
|
|
187
192
|
get armorSoundTypeSD(): ArmorSoundType;
|
|
188
193
|
set armorSoundTypeSD(armorSoundTypeSD: ArmorSoundType);
|
|
189
194
|
get armorSoundTypeHD(): ArmorSoundType;
|
|
190
195
|
set armorSoundTypeHD(armorSoundTypeHD: ArmorSoundType);
|
|
196
|
+
get armorType(): ArmorType;
|
|
197
|
+
set armorType(armorType: ArmorType);
|
|
191
198
|
get combatClassifications(): CombatClassifications;
|
|
192
199
|
set combatClassifications(combatClassifications: CombatClassifications);
|
|
193
|
-
get
|
|
194
|
-
set
|
|
200
|
+
get classifications(): UnitClassifications;
|
|
201
|
+
set classifications(unitClassifications: UnitClassifications);
|
|
195
202
|
get weapons(): TupleOf<UnitTypeWeapon, 2>;
|
|
196
203
|
get firstWeapon(): UnitTypeWeapon;
|
|
197
204
|
get secondWeapon(): UnitTypeWeapon;
|
|
@@ -225,6 +232,8 @@ export declare abstract class UnitType<Id extends UnitTypeId = UnitTypeId> exten
|
|
|
225
232
|
set goldCost(goldCost: number);
|
|
226
233
|
get healthRegenerationRate(): number;
|
|
227
234
|
set healthRegenerationRate(healthRegenerationRate: number);
|
|
235
|
+
get level(): number;
|
|
236
|
+
set level(level: number);
|
|
228
237
|
get manaRegenerationRate(): number;
|
|
229
238
|
set manaRegenerationRate(manaRegenerationRate: number);
|
|
230
239
|
get maximumHealth(): number;
|
|
@@ -27,6 +27,9 @@ local attackTypeToString = ____attack_2Dtype.attackTypeToString
|
|
|
27
27
|
local stringToAttackType = ____attack_2Dtype.stringToAttackType
|
|
28
28
|
local ____config = require("config")
|
|
29
29
|
local WarscriptConfig = ____config.WarscriptConfig
|
|
30
|
+
local ____armor_2Dtype = require("engine.object-data.auxiliary.armor-type")
|
|
31
|
+
local armorTypeToString = ____armor_2Dtype.armorTypeToString
|
|
32
|
+
local stringToArmorType = ____armor_2Dtype.stringToArmorType
|
|
30
33
|
local getOrCreateUnitTypeWeapons
|
|
31
34
|
____exports.UnitTypeWeapon = __TS__Class()
|
|
32
35
|
local UnitTypeWeapon = ____exports.UnitTypeWeapon
|
|
@@ -936,6 +939,19 @@ __TS__SetDescriptor(
|
|
|
936
939
|
},
|
|
937
940
|
true
|
|
938
941
|
)
|
|
942
|
+
__TS__SetDescriptor(
|
|
943
|
+
UnitType.prototype,
|
|
944
|
+
"selectionCircleHeight",
|
|
945
|
+
{
|
|
946
|
+
get = function(self)
|
|
947
|
+
return self:getNumberField("uslz")
|
|
948
|
+
end,
|
|
949
|
+
set = function(self, height)
|
|
950
|
+
self:setNumberField("uslz", height)
|
|
951
|
+
end
|
|
952
|
+
},
|
|
953
|
+
true
|
|
954
|
+
)
|
|
939
955
|
__TS__SetDescriptor(
|
|
940
956
|
UnitType.prototype,
|
|
941
957
|
"selectionCircleScale",
|
|
@@ -1183,6 +1199,19 @@ __TS__SetDescriptor(
|
|
|
1183
1199
|
},
|
|
1184
1200
|
true
|
|
1185
1201
|
)
|
|
1202
|
+
__TS__SetDescriptor(
|
|
1203
|
+
UnitType.prototype,
|
|
1204
|
+
"armor",
|
|
1205
|
+
{
|
|
1206
|
+
get = function(self)
|
|
1207
|
+
return self:getNumberField("udef")
|
|
1208
|
+
end,
|
|
1209
|
+
set = function(self, armor)
|
|
1210
|
+
self:setNumberField("udef", armor)
|
|
1211
|
+
end
|
|
1212
|
+
},
|
|
1213
|
+
true
|
|
1214
|
+
)
|
|
1186
1215
|
__TS__SetDescriptor(
|
|
1187
1216
|
UnitType.prototype,
|
|
1188
1217
|
"armorSoundType",
|
|
@@ -1222,6 +1251,22 @@ __TS__SetDescriptor(
|
|
|
1222
1251
|
},
|
|
1223
1252
|
true
|
|
1224
1253
|
)
|
|
1254
|
+
__TS__SetDescriptor(
|
|
1255
|
+
UnitType.prototype,
|
|
1256
|
+
"armorType",
|
|
1257
|
+
{
|
|
1258
|
+
get = function(self)
|
|
1259
|
+
return stringToArmorType(self:getStringField("udty"))
|
|
1260
|
+
end,
|
|
1261
|
+
set = function(self, armorType)
|
|
1262
|
+
self:setStringField(
|
|
1263
|
+
"udty",
|
|
1264
|
+
armorTypeToString(armorType)
|
|
1265
|
+
)
|
|
1266
|
+
end
|
|
1267
|
+
},
|
|
1268
|
+
true
|
|
1269
|
+
)
|
|
1225
1270
|
__TS__SetDescriptor(
|
|
1226
1271
|
UnitType.prototype,
|
|
1227
1272
|
"combatClassifications",
|
|
@@ -1240,7 +1285,7 @@ __TS__SetDescriptor(
|
|
|
1240
1285
|
)
|
|
1241
1286
|
__TS__SetDescriptor(
|
|
1242
1287
|
UnitType.prototype,
|
|
1243
|
-
"
|
|
1288
|
+
"classifications",
|
|
1244
1289
|
{
|
|
1245
1290
|
get = function(self)
|
|
1246
1291
|
return stringArrayToUnitClassifications(self:getStringsField("utyp"))
|
|
@@ -1476,6 +1521,19 @@ __TS__SetDescriptor(
|
|
|
1476
1521
|
},
|
|
1477
1522
|
true
|
|
1478
1523
|
)
|
|
1524
|
+
__TS__SetDescriptor(
|
|
1525
|
+
UnitType.prototype,
|
|
1526
|
+
"level",
|
|
1527
|
+
{
|
|
1528
|
+
get = function(self)
|
|
1529
|
+
return self:getNumberField("ulev")
|
|
1530
|
+
end,
|
|
1531
|
+
set = function(self, level)
|
|
1532
|
+
self:setNumberField("ulev", level)
|
|
1533
|
+
end
|
|
1534
|
+
},
|
|
1535
|
+
true
|
|
1536
|
+
)
|
|
1479
1537
|
__TS__SetDescriptor(
|
|
1480
1538
|
UnitType.prototype,
|
|
1481
1539
|
"manaRegenerationRate",
|
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.
|
|
4
|
+
"version": "0.0.1-dev.e561d29",
|
|
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.
|
|
27
|
+
"warpack": "0.0.1-dev.78d2c64"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@typescript-eslint/eslint-plugin": "^8.13.0",
|
package/utility/functions.d.ts
CHANGED
|
@@ -7,3 +7,5 @@ export declare const identity: <T>(value: T) => T;
|
|
|
7
7
|
export declare const firstArgument: <T>(value: T) => T;
|
|
8
8
|
export declare const secondArgument: <T>(_: unknown, value: T) => T;
|
|
9
9
|
export declare const thirdArgument: <T>(_first: unknown, _second: unknown, value: T) => T;
|
|
10
|
+
export declare const increment: (value: number) => number;
|
|
11
|
+
export declare const or: (lhs: boolean, rhs: boolean) => boolean;
|
package/utility/functions.lua
CHANGED
|
@@ -91,4 +91,6 @@ ____exports.identity = function(value) return value end
|
|
|
91
91
|
____exports.firstArgument = ____exports.identity
|
|
92
92
|
____exports.secondArgument = function(_, value) return value end
|
|
93
93
|
____exports.thirdArgument = function(_first, _second, value) return value end
|
|
94
|
+
____exports.increment = function(value) return value + 1 end
|
|
95
|
+
____exports["or"] = function(lhs, rhs) return lhs or rhs end
|
|
94
96
|
return ____exports
|