warscript 0.0.1-dev.c37d12c → 0.0.1-dev.c963f13
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 +13 -0
- package/attributes.lua +16 -0
- package/core/types/handle.d.ts +2 -1
- package/core/types/handle.lua +5 -0
- package/engine/behaviour/ability/apply-unit-behavior.d.ts +8 -4
- package/engine/behaviour/ability/apply-unit-behavior.lua +31 -9
- 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/detach-missiles.d.ts +7 -0
- package/engine/internal/unit/detach-missiles.lua +30 -0
- package/engine/internal/unit.d.ts +10 -2
- package/engine/internal/unit.lua +34 -9
- 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.d.ts +1 -0
- package/engine/object-data/entry/ability-type.lua +1 -0
- package/engine/object-data/entry/buff-type/applicable.lua +27 -71
- package/engine/object-data/entry/unit-type.d.ts +42 -1
- package/engine/object-data/entry/unit-type.lua +378 -50
- package/engine/object-field/ability.d.ts +7 -5
- 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 -5
- package/engine/object-field.lua +37 -18
- package/engine/standard/entries/unit-type.d.ts +24 -1
- package/engine/standard/entries/unit-type.lua +24 -1
- package/engine/unit.d.ts +1 -0
- package/engine/unit.lua +1 -0
- package/global/vec2.lua +1 -0
- package/package.json +3 -4
- package/string.d.ts +14 -0
- package/string.lua +9 -0
- package/utility/linked-set.d.ts +1 -0
- package/utility/linked-set.lua +16 -0
- package/utility/types.d.ts +2 -2
|
@@ -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)
|
|
@@ -13,6 +13,7 @@ import { ObjectDataEntryIdGenerator } from "../utility/object-data-entry-id-gene
|
|
|
13
13
|
import type { AbilityTypeId } from "./ability-type";
|
|
14
14
|
import type { UpgradeId } from "./upgrade";
|
|
15
15
|
import { AnimationQualifier } from "../auxiliary/animation-qualifier";
|
|
16
|
+
import { AttackType } from "../auxiliary/attack-type";
|
|
16
17
|
export type UnitTypeId = ObjectDataEntryId & {
|
|
17
18
|
readonly __unitTypeId: unique symbol;
|
|
18
19
|
};
|
|
@@ -23,12 +24,26 @@ export declare class UnitTypeWeapon {
|
|
|
23
24
|
private readonly unitType;
|
|
24
25
|
private readonly index;
|
|
25
26
|
private constructor();
|
|
27
|
+
get attackType(): AttackType;
|
|
28
|
+
set attackType(attackType: AttackType);
|
|
26
29
|
get backSwingDuration(): number;
|
|
27
30
|
set backSwingDuration(backSwingDuration: number);
|
|
31
|
+
get cooldown(): number;
|
|
32
|
+
set cooldown(cooldown: number);
|
|
33
|
+
get damage(): [minimumDamage: number, maximumDamage: number];
|
|
34
|
+
set damage([minimumDamage, maximumDamage]: [number, number]);
|
|
35
|
+
get damageBase(): number;
|
|
36
|
+
set damageBase(damageBase: number);
|
|
37
|
+
get damageDiceCount(): number;
|
|
38
|
+
set damageDiceCount(damageDiceNumber: number);
|
|
39
|
+
get damageDiceSideCount(): number;
|
|
40
|
+
set damageDiceSideCount(damageDiceSideCount: number);
|
|
28
41
|
get impactDelay(): number;
|
|
29
42
|
set impactDelay(impactDelay: number);
|
|
30
43
|
get missileModelPath(): string;
|
|
31
44
|
set missileModelPath(missileModelPath: string);
|
|
45
|
+
get range(): number;
|
|
46
|
+
set range(range: number);
|
|
32
47
|
get soundType(): WeaponSoundType;
|
|
33
48
|
set soundType(soundType: WeaponSoundType);
|
|
34
49
|
get soundTypeSD(): WeaponSoundType;
|
|
@@ -117,6 +132,12 @@ export declare abstract class UnitType<Id extends UnitTypeId = UnitTypeId> exten
|
|
|
117
132
|
set modelPathSD(modelPathSD: string);
|
|
118
133
|
get modelPathHD(): string;
|
|
119
134
|
set modelPathHD(modelPathHD: string);
|
|
135
|
+
get runSpeed(): number;
|
|
136
|
+
set runSpeed(runSpeed: number);
|
|
137
|
+
get runSpeedSD(): number;
|
|
138
|
+
set runSpeedSD(runSpeedSD: number);
|
|
139
|
+
get runSpeedHD(): number;
|
|
140
|
+
set runSpeedHD(runSpeedHD: number);
|
|
120
141
|
get selectionCircleScale(): number;
|
|
121
142
|
set selectionCircleScale(selectionCircleScale: number);
|
|
122
143
|
get selectionCircleScaleSD(): number;
|
|
@@ -149,6 +170,12 @@ export declare abstract class UnitType<Id extends UnitTypeId = UnitTypeId> exten
|
|
|
149
170
|
set shadowImageXOffset(shadowImageXOffset: number);
|
|
150
171
|
get shadowImageYOffset(): number;
|
|
151
172
|
set shadowImageYOffset(shadowImageYOffset: number);
|
|
173
|
+
get walkSpeed(): number;
|
|
174
|
+
set walkSpeed(walkSpeed: number);
|
|
175
|
+
get walkSpeedSD(): number;
|
|
176
|
+
set walkSpeedSD(walkSpeedSD: number);
|
|
177
|
+
get walkSpeedHD(): number;
|
|
178
|
+
set walkSpeedHD(walkSpeedHD: number);
|
|
152
179
|
get armorSoundType(): ArmorSoundType;
|
|
153
180
|
set armorSoundType(armorSoundType: ArmorSoundType);
|
|
154
181
|
get armorSoundTypeSD(): ArmorSoundType;
|
|
@@ -159,9 +186,9 @@ export declare abstract class UnitType<Id extends UnitTypeId = UnitTypeId> exten
|
|
|
159
186
|
set combatClassifications(combatClassifications: CombatClassifications);
|
|
160
187
|
get unitClassifications(): UnitClassifications;
|
|
161
188
|
set unitClassifications(unitClassifications: UnitClassifications);
|
|
189
|
+
get weapons(): TupleOf<UnitTypeWeapon, 2>;
|
|
162
190
|
get firstWeapon(): UnitTypeWeapon;
|
|
163
191
|
get secondWeapon(): UnitTypeWeapon;
|
|
164
|
-
get weapons(): TupleOf<UnitTypeWeapon, 2>;
|
|
165
192
|
get flyHeight(): number;
|
|
166
193
|
set flyHeight(flyHeight: number);
|
|
167
194
|
get flyHeightMinimum(): number;
|
|
@@ -190,6 +217,16 @@ export declare abstract class UnitType<Id extends UnitTypeId = UnitTypeId> exten
|
|
|
190
217
|
set formationRank(formationRank: number);
|
|
191
218
|
get goldCost(): number;
|
|
192
219
|
set goldCost(goldCost: number);
|
|
220
|
+
get healthRegenerationRate(): number;
|
|
221
|
+
set healthRegenerationRate(healthRegenerationRate: number);
|
|
222
|
+
get manaRegenerationRate(): number;
|
|
223
|
+
set manaRegenerationRate(manaRegenerationRate: number);
|
|
224
|
+
get maximumHealth(): number;
|
|
225
|
+
set maximumHealth(maximumHealth: number);
|
|
226
|
+
get maximumMana(): number;
|
|
227
|
+
set maximumMana(maximumMana: number);
|
|
228
|
+
get initialMana(): number;
|
|
229
|
+
set initialMana(initialMana: number);
|
|
193
230
|
get isStructure(): boolean;
|
|
194
231
|
set isStructure(isStructure: boolean);
|
|
195
232
|
get race(): Race;
|
|
@@ -215,4 +252,8 @@ export declare abstract class HeroUnitType<Id extends HeroUnitTypeId = HeroUnitT
|
|
|
215
252
|
protected static generateId(): number;
|
|
216
253
|
get heroAbilityTypeIds(): AbilityTypeId[];
|
|
217
254
|
set heroAbilityTypeIds(heroAbilityTypeIds: AbilityTypeId[]);
|
|
255
|
+
get properNames(): string[];
|
|
256
|
+
set properNames(properNames: string | string[]);
|
|
257
|
+
get properNameCount(): number;
|
|
258
|
+
set properNameCount(properNameCount: number);
|
|
218
259
|
}
|