warscript 0.0.1-dev.ea69747 → 0.0.1-dev.fa6dee5
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 +12 -0
- package/attributes.lua +16 -0
- package/core/types/frame.d.ts +0 -1
- package/core/types/group.d.ts +0 -1
- package/core/types/handle.d.ts +2 -1
- package/core/types/handle.lua +5 -0
- package/core/types/image.d.ts +0 -1
- package/core/types/missile.d.ts +2 -2
- package/core/types/missile.lua +8 -2
- package/core/types/unit.lua +8 -0
- package/core/util.lua +1 -1
- package/engine/ability.d.ts +1 -1
- package/engine/behavior.d.ts +6 -6
- package/engine/behaviour/ability/apply-unit-behavior.d.ts +13 -4
- package/engine/behaviour/ability/apply-unit-behavior.lua +31 -9
- package/engine/behaviour/ability/instant-impact.lua +4 -0
- package/engine/behaviour/ability.d.ts +8 -1
- package/engine/behaviour/ability.lua +62 -0
- package/engine/behaviour/unit/stun-immunity.d.ts +0 -1
- package/engine/buff.d.ts +2 -2
- package/engine/internal/ability.d.ts +1 -1
- package/engine/internal/mechanics/ability-duration.d.ts +1 -3
- package/engine/internal/mechanics/ability-duration.lua +2 -0
- package/engine/internal/mechanics/cast-ability.d.ts +2 -0
- package/engine/internal/mechanics/cast-ability.lua +86 -0
- package/engine/internal/unit/bonus.d.ts +5 -6
- package/engine/internal/unit/detach-missiles.d.ts +7 -0
- package/engine/internal/unit/detach-missiles.lua +30 -0
- package/engine/internal/unit-missile-launch.lua +1 -1
- package/engine/internal/unit.d.ts +36 -9
- package/engine/internal/unit.lua +215 -63
- 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/blink.d.ts +10 -0
- package/engine/object-data/entry/ability-type/blink.lua +39 -0
- package/engine/object-data/entry/ability-type/channel.d.ts +0 -1
- package/engine/object-data/entry/ability-type/engineering-upgrade.lua +2 -2
- package/engine/object-data/entry/ability-type/mine.d.ts +10 -0
- package/engine/object-data/entry/ability-type/mine.lua +39 -0
- package/engine/object-data/entry/ability-type/spirit-touch.d.ts +2 -2
- package/engine/object-data/entry/ability-type/spirit-touch.lua +6 -6
- package/engine/object-data/entry/ability-type.d.ts +1 -1
- package/engine/object-data/entry/ability-type.lua +1 -0
- package/engine/object-data/entry/buff-type/applicable.d.ts +0 -1
- package/engine/object-data/entry/buff-type/applicable.lua +27 -71
- 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 +42 -2
- package/engine/object-data/entry/unit-type.lua +378 -50
- 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 +8 -6
- package/engine/object-field/ability.lua +6 -0
- package/engine/object-field/unit.d.ts +1 -0
- package/engine/object-field/unit.lua +3 -0
- package/engine/object-field.d.ts +6 -4
- package/engine/object-field.lua +38 -12
- package/engine/random.d.ts +1 -0
- package/engine/random.lua +9 -0
- package/engine/standard/entries/unit-type.d.ts +42 -1
- package/engine/standard/entries/unit-type.lua +42 -1
- package/engine/standard/fields/ability.d.ts +1 -1
- package/engine/standard/fields/ability.lua +1 -1
- package/engine/unit.d.ts +1 -0
- package/engine/unit.lua +10 -2
- package/event.d.ts +0 -1
- package/exception.d.ts +2 -0
- package/exception.lua +4 -0
- package/global/vec2.lua +1 -0
- package/lualib_bundle.lua +139 -40
- 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 -14
- package/string.d.ts +30 -0
- package/string.lua +14 -0
- package/util/stream.d.ts +0 -1
- package/utility/arrays.d.ts +4 -5
- package/utility/arrays.lua +4 -1
- package/utility/bit-set.d.ts +0 -2
- package/utility/linked-set.d.ts +21 -8
- package/utility/linked-set.lua +16 -0
- package/utility/lua-maps.d.ts +1 -2
- package/utility/lua-sets.d.ts +1 -2
- package/utility/types.d.ts +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/// <reference types="warpack-types/warpack" />
|
|
2
1
|
/** @noSelfInFile */
|
|
2
|
+
import "../../internal/unit/ability";
|
|
3
3
|
import { TupleOf } from "../../../utility/types";
|
|
4
4
|
import { AnimationName } from "../auxiliary/animation-name";
|
|
5
5
|
import { AnimationQualifier } from "../auxiliary/animation-qualifier";
|
|
@@ -6,6 +6,7 @@ local __TS__SetDescriptor = ____lualib.__TS__SetDescriptor
|
|
|
6
6
|
local ____exports = {}
|
|
7
7
|
local ____unit = require("engine.internal.unit")
|
|
8
8
|
local Unit = ____unit.Unit
|
|
9
|
+
require("engine.internal.unit.ability")
|
|
9
10
|
local ____timer = require("core.types.timer")
|
|
10
11
|
local Timer = ____timer.Timer
|
|
11
12
|
local ____effect = require("core.types.effect")
|
|
@@ -7,6 +7,7 @@ local __TS__SparseArrayNew = ____lualib.__TS__SparseArrayNew
|
|
|
7
7
|
local __TS__SparseArrayPush = ____lualib.__TS__SparseArrayPush
|
|
8
8
|
local __TS__SparseArraySpread = ____lualib.__TS__SparseArraySpread
|
|
9
9
|
local ____exports = {}
|
|
10
|
+
local preparePhysicalPositiveApplicatorAbility
|
|
10
11
|
local ____ability_2Dtype = require("engine.object-data.entry.ability-type")
|
|
11
12
|
local AbilityType = ____ability_2Dtype.AbilityType
|
|
12
13
|
local ____cripple = require("engine.object-data.entry.ability-type.cripple")
|
|
@@ -34,20 +35,14 @@ local ____blood_2Dlust = require("engine.object-data.entry.ability-type.blood-lu
|
|
|
34
35
|
local BloodLustAbilityType = ____blood_2Dlust.BloodLustAbilityType
|
|
35
36
|
local ____berserk = require("engine.object-data.entry.ability-type.berserk")
|
|
36
37
|
local BerserkAbilityType = ____berserk.BerserkAbilityType
|
|
37
|
-
local ____dummy_2Ditem = require("engine.internal.object-data.dummy-item")
|
|
38
|
-
local DUMMY_ITEM_ID = ____dummy_2Ditem.DUMMY_ITEM_ID
|
|
39
|
-
local ____dummy_2Dinventory = require("engine.internal.object-data.dummy-inventory")
|
|
40
|
-
local INVENTORY_ABILITY_TYPE_ID = ____dummy_2Dinventory.INVENTORY_ABILITY_TYPE_ID
|
|
41
38
|
local ____blank = require("engine.object-data.entry.upgrade.blank")
|
|
42
39
|
local BlankUpgrade = ____blank.BlankUpgrade
|
|
43
|
-
local ____dummy_2Dunits = require("engine.internal.misc.dummy-units")
|
|
44
|
-
local INVENTORY_DUMMY_NATIVE_UNIT = ____dummy_2Dunits.INVENTORY_DUMMY_NATIVE_UNIT
|
|
45
|
-
local ____preconditions = require("utility.preconditions")
|
|
46
|
-
local checkNotNull = ____preconditions.checkNotNull
|
|
47
40
|
local ____unit_2Dtype = require("engine.object-data.entry.unit-type")
|
|
48
41
|
local UnitType = ____unit_2Dtype.UnitType
|
|
49
42
|
local ____permanent_2Dimmolation = require("engine.object-data.entry.ability-type.permanent-immolation")
|
|
50
43
|
local PermanentImmolationAbilityType = ____permanent_2Dimmolation.PermanentImmolationAbilityType
|
|
44
|
+
local ____cast_2Dability = require("engine.internal.mechanics.cast-ability")
|
|
45
|
+
local castAbility = ____cast_2Dability.castAbility
|
|
51
46
|
local createItem = CreateItem
|
|
52
47
|
local getAbilityId = BlzGetAbilityId
|
|
53
48
|
local getItemAbility = BlzGetItemAbility
|
|
@@ -260,75 +255,25 @@ ____exports.internalApplyBuff = function(unit, applicableBuffTypeId, polarity, r
|
|
|
260
255
|
return unitAddAbility(unit.handle, applicatorAbilityTypeId)
|
|
261
256
|
end
|
|
262
257
|
if applicatorType == 852100 then
|
|
263
|
-
local
|
|
264
|
-
|
|
265
|
-
local nativeItem = createItem(DUMMY_ITEM_ID, 0, 0)
|
|
266
|
-
unitAddItem(INVENTORY_DUMMY_NATIVE_UNIT, nativeItem)
|
|
267
|
-
itemAddAbility(nativeItem, applicatorAbilityTypeId)
|
|
268
|
-
local applicatorAbility = checkNotNull(getItemAbility(nativeItem, applicatorAbilityTypeId))
|
|
269
|
-
if level == nil then
|
|
270
|
-
level = 0
|
|
271
|
-
setAbilityIntegerField(applicatorAbility, ABILITY_IF_LEVELS, 1)
|
|
272
|
-
end
|
|
273
|
-
setAbilityRealLevelField(applicatorAbility, ABILITY_RLF_DURATION_NORMAL, level, duration or 0)
|
|
274
|
-
setAbilityRealLevelField(applicatorAbility, ABILITY_RLF_DURATION_HERO, level, duration or 0)
|
|
275
|
-
if movementSpeedIncreaseFactor ~= nil then
|
|
276
|
-
setAbilityRealLevelField(applicatorAbility, ABILITY_RLF_MOVEMENT_SPEED_INCREASE_BSK1, level, movementSpeedIncreaseFactor)
|
|
277
|
-
end
|
|
278
|
-
setItemBooleanField(nativeItem, ITEM_BF_ACTIVELY_USED, true)
|
|
279
|
-
setItemBooleanField(nativeItem, ITEM_BF_USE_AUTOMATICALLY_WHEN_ACQUIRED, true)
|
|
280
|
-
if level > 0 then
|
|
258
|
+
local nativePlayer = unit.owner.handle
|
|
259
|
+
if level ~= nil and level > 0 then
|
|
281
260
|
local upgradeId = applicatorUpgradeIdByApplicatorAbilityTypeId[applicatorAbilityTypeId]
|
|
282
261
|
if upgradeId ~= nil then
|
|
283
|
-
setPlayerTechResearched(
|
|
284
|
-
getOwningPlayer(nativeUnit),
|
|
285
|
-
upgradeId,
|
|
286
|
-
level
|
|
287
|
-
)
|
|
288
|
-
end
|
|
289
|
-
end
|
|
290
|
-
if not unitAddItem(nativeUnit, nativeItem) then
|
|
291
|
-
local latestInventoryAbilityTypeId = 0
|
|
292
|
-
local nativeItemBySlot = {}
|
|
293
|
-
local inventorySize = unitInventorySize(nativeUnit)
|
|
294
|
-
if inventorySize ~= 0 then
|
|
295
|
-
for slot = 0, inventorySize - 1 do
|
|
296
|
-
nativeItemBySlot[slot] = UnitRemoveItemFromSlot(nativeUnit, slot)
|
|
297
|
-
end
|
|
298
|
-
local unitNativeAbility = getUnitAbilityByIndex(nativeUnit, 0)
|
|
299
|
-
local i = 1
|
|
300
|
-
while unitNativeAbility ~= nil do
|
|
301
|
-
local abilityTypeId = getAbilityId(unitNativeAbility)
|
|
302
|
-
if INVENTORY_ABILITY_TYPE_IDS[abilityTypeId] ~= nil then
|
|
303
|
-
latestInventoryAbilityTypeId = abilityTypeId
|
|
304
|
-
end
|
|
305
|
-
unitNativeAbility = getUnitAbilityByIndex(nativeUnit, i)
|
|
306
|
-
i = i + 1
|
|
307
|
-
end
|
|
308
|
-
unitRemoveAbility(nativeUnit, latestInventoryAbilityTypeId)
|
|
262
|
+
setPlayerTechResearched(nativePlayer, upgradeId, level)
|
|
309
263
|
end
|
|
310
|
-
unitAddAbility(nativeUnit, INVENTORY_ABILITY_TYPE_ID)
|
|
311
|
-
success = unitAddItem(nativeUnit, nativeItem)
|
|
312
|
-
unitRemoveAbility(nativeUnit, INVENTORY_ABILITY_TYPE_ID)
|
|
313
|
-
if latestInventoryAbilityTypeId ~= 0 then
|
|
314
|
-
unitAddAbility(nativeUnit, latestInventoryAbilityTypeId)
|
|
315
|
-
for slot, nativeItem in pairs(nativeItemBySlot) do
|
|
316
|
-
unitAddItem(nativeUnit, nativeItem)
|
|
317
|
-
unitDropItemSlot(nativeUnit, nativeItem, slot)
|
|
318
|
-
end
|
|
319
|
-
end
|
|
320
|
-
else
|
|
321
|
-
success = true
|
|
322
264
|
end
|
|
323
|
-
|
|
324
|
-
|
|
265
|
+
local success = castAbility(
|
|
266
|
+
unit.handle,
|
|
267
|
+
applicatorAbilityTypeId,
|
|
268
|
+
preparePhysicalPositiveApplicatorAbility,
|
|
269
|
+
level,
|
|
270
|
+
duration or 0,
|
|
271
|
+
movementSpeedIncreaseFactor
|
|
272
|
+
)
|
|
273
|
+
if level ~= nil and level > 0 then
|
|
325
274
|
local upgradeId = applicatorUpgradeIdByApplicatorAbilityTypeId[applicatorAbilityTypeId]
|
|
326
275
|
if upgradeId ~= nil then
|
|
327
|
-
setPlayerTechResearched(
|
|
328
|
-
getOwningPlayer(nativeUnit),
|
|
329
|
-
upgradeId,
|
|
330
|
-
0
|
|
331
|
-
)
|
|
276
|
+
setPlayerTechResearched(nativePlayer, upgradeId, 0)
|
|
332
277
|
end
|
|
333
278
|
end
|
|
334
279
|
return success
|
|
@@ -364,6 +309,17 @@ ____exports.internalApplyBuff = function(unit, applicableBuffTypeId, polarity, r
|
|
|
364
309
|
end
|
|
365
310
|
return success
|
|
366
311
|
end
|
|
312
|
+
preparePhysicalPositiveApplicatorAbility = function(ability, level, duration, movementSpeedIncreaseFactor)
|
|
313
|
+
if level == nil then
|
|
314
|
+
setAbilityIntegerField(ability, ABILITY_IF_LEVELS, 1)
|
|
315
|
+
level = 1
|
|
316
|
+
end
|
|
317
|
+
setAbilityRealLevelField(ability, ABILITY_RLF_DURATION_NORMAL, level, duration)
|
|
318
|
+
setAbilityRealLevelField(ability, ABILITY_RLF_DURATION_HERO, level, duration)
|
|
319
|
+
if movementSpeedIncreaseFactor ~= nil then
|
|
320
|
+
setAbilityRealLevelField(ability, ABILITY_RLF_MOVEMENT_SPEED_INCREASE_BSK1, level, movementSpeedIncreaseFactor)
|
|
321
|
+
end
|
|
322
|
+
end
|
|
367
323
|
---
|
|
368
324
|
-- @internal For use by internal systems only.
|
|
369
325
|
____exports.removeBuff = function(unit, applicableBuffTypeId)
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="warpack-types/warpack" />
|
|
2
1
|
/** @noSelfInFile */
|
|
3
2
|
import { TupleOf } from "../../../utility/types";
|
|
4
3
|
import { ArmorSoundType } from "../auxiliary/armor-sound-type";
|
|
@@ -13,6 +12,7 @@ import { ObjectDataEntryIdGenerator } from "../utility/object-data-entry-id-gene
|
|
|
13
12
|
import type { AbilityTypeId } from "./ability-type";
|
|
14
13
|
import type { UpgradeId } from "./upgrade";
|
|
15
14
|
import { AnimationQualifier } from "../auxiliary/animation-qualifier";
|
|
15
|
+
import { AttackType } from "../auxiliary/attack-type";
|
|
16
16
|
export type UnitTypeId = ObjectDataEntryId & {
|
|
17
17
|
readonly __unitTypeId: unique symbol;
|
|
18
18
|
};
|
|
@@ -23,12 +23,26 @@ export declare class UnitTypeWeapon {
|
|
|
23
23
|
private readonly unitType;
|
|
24
24
|
private readonly index;
|
|
25
25
|
private constructor();
|
|
26
|
+
get attackType(): AttackType;
|
|
27
|
+
set attackType(attackType: AttackType);
|
|
26
28
|
get backSwingDuration(): number;
|
|
27
29
|
set backSwingDuration(backSwingDuration: number);
|
|
30
|
+
get cooldown(): number;
|
|
31
|
+
set cooldown(cooldown: number);
|
|
32
|
+
get damage(): [minimumDamage: number, maximumDamage: number];
|
|
33
|
+
set damage([minimumDamage, maximumDamage]: [number, number]);
|
|
34
|
+
get damageBase(): number;
|
|
35
|
+
set damageBase(damageBase: number);
|
|
36
|
+
get damageDiceCount(): number;
|
|
37
|
+
set damageDiceCount(damageDiceNumber: number);
|
|
38
|
+
get damageDiceSideCount(): number;
|
|
39
|
+
set damageDiceSideCount(damageDiceSideCount: number);
|
|
28
40
|
get impactDelay(): number;
|
|
29
41
|
set impactDelay(impactDelay: number);
|
|
30
42
|
get missileModelPath(): string;
|
|
31
43
|
set missileModelPath(missileModelPath: string);
|
|
44
|
+
get range(): number;
|
|
45
|
+
set range(range: number);
|
|
32
46
|
get soundType(): WeaponSoundType;
|
|
33
47
|
set soundType(soundType: WeaponSoundType);
|
|
34
48
|
get soundTypeSD(): WeaponSoundType;
|
|
@@ -117,6 +131,12 @@ export declare abstract class UnitType<Id extends UnitTypeId = UnitTypeId> exten
|
|
|
117
131
|
set modelPathSD(modelPathSD: string);
|
|
118
132
|
get modelPathHD(): string;
|
|
119
133
|
set modelPathHD(modelPathHD: string);
|
|
134
|
+
get runSpeed(): number;
|
|
135
|
+
set runSpeed(runSpeed: number);
|
|
136
|
+
get runSpeedSD(): number;
|
|
137
|
+
set runSpeedSD(runSpeedSD: number);
|
|
138
|
+
get runSpeedHD(): number;
|
|
139
|
+
set runSpeedHD(runSpeedHD: number);
|
|
120
140
|
get selectionCircleScale(): number;
|
|
121
141
|
set selectionCircleScale(selectionCircleScale: number);
|
|
122
142
|
get selectionCircleScaleSD(): number;
|
|
@@ -149,6 +169,12 @@ export declare abstract class UnitType<Id extends UnitTypeId = UnitTypeId> exten
|
|
|
149
169
|
set shadowImageXOffset(shadowImageXOffset: number);
|
|
150
170
|
get shadowImageYOffset(): number;
|
|
151
171
|
set shadowImageYOffset(shadowImageYOffset: number);
|
|
172
|
+
get walkSpeed(): number;
|
|
173
|
+
set walkSpeed(walkSpeed: number);
|
|
174
|
+
get walkSpeedSD(): number;
|
|
175
|
+
set walkSpeedSD(walkSpeedSD: number);
|
|
176
|
+
get walkSpeedHD(): number;
|
|
177
|
+
set walkSpeedHD(walkSpeedHD: number);
|
|
152
178
|
get armorSoundType(): ArmorSoundType;
|
|
153
179
|
set armorSoundType(armorSoundType: ArmorSoundType);
|
|
154
180
|
get armorSoundTypeSD(): ArmorSoundType;
|
|
@@ -159,9 +185,9 @@ export declare abstract class UnitType<Id extends UnitTypeId = UnitTypeId> exten
|
|
|
159
185
|
set combatClassifications(combatClassifications: CombatClassifications);
|
|
160
186
|
get unitClassifications(): UnitClassifications;
|
|
161
187
|
set unitClassifications(unitClassifications: UnitClassifications);
|
|
188
|
+
get weapons(): TupleOf<UnitTypeWeapon, 2>;
|
|
162
189
|
get firstWeapon(): UnitTypeWeapon;
|
|
163
190
|
get secondWeapon(): UnitTypeWeapon;
|
|
164
|
-
get weapons(): TupleOf<UnitTypeWeapon, 2>;
|
|
165
191
|
get flyHeight(): number;
|
|
166
192
|
set flyHeight(flyHeight: number);
|
|
167
193
|
get flyHeightMinimum(): number;
|
|
@@ -190,6 +216,16 @@ export declare abstract class UnitType<Id extends UnitTypeId = UnitTypeId> exten
|
|
|
190
216
|
set formationRank(formationRank: number);
|
|
191
217
|
get goldCost(): number;
|
|
192
218
|
set goldCost(goldCost: number);
|
|
219
|
+
get healthRegenerationRate(): number;
|
|
220
|
+
set healthRegenerationRate(healthRegenerationRate: number);
|
|
221
|
+
get manaRegenerationRate(): number;
|
|
222
|
+
set manaRegenerationRate(manaRegenerationRate: number);
|
|
223
|
+
get maximumHealth(): number;
|
|
224
|
+
set maximumHealth(maximumHealth: number);
|
|
225
|
+
get maximumMana(): number;
|
|
226
|
+
set maximumMana(maximumMana: number);
|
|
227
|
+
get initialMana(): number;
|
|
228
|
+
set initialMana(initialMana: number);
|
|
193
229
|
get isStructure(): boolean;
|
|
194
230
|
set isStructure(isStructure: boolean);
|
|
195
231
|
get race(): Race;
|
|
@@ -215,4 +251,8 @@ export declare abstract class HeroUnitType<Id extends HeroUnitTypeId = HeroUnitT
|
|
|
215
251
|
protected static generateId(): number;
|
|
216
252
|
get heroAbilityTypeIds(): AbilityTypeId[];
|
|
217
253
|
set heroAbilityTypeIds(heroAbilityTypeIds: AbilityTypeId[]);
|
|
254
|
+
get properNames(): string[];
|
|
255
|
+
set properNames(properNames: string | string[]);
|
|
256
|
+
get properNameCount(): number;
|
|
257
|
+
set properNameCount(properNameCount: number);
|
|
218
258
|
}
|