warscript 0.0.1-dev.f5421e8 → 0.0.1-dev.f9321c0

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.
@@ -121,6 +121,11 @@ local customSoundPresetDataByLabel = postcompile(function()
121
121
  end
122
122
  return customSoundPresetDataByLabel
123
123
  end)
124
+ ---
125
+ -- @internal For use by internal systems only.
126
+ ____exports.isSoundLabelCustom = function(label)
127
+ return customSoundPresetDataByLabel[label] ~= nil
128
+ end
124
129
  local function createPresetSound(fileName, preset)
125
130
  local ____fileName_1 = fileName
126
131
  local ____preset_looping_0 = preset.looping
@@ -10,6 +10,9 @@ local MANA_COST_ABILITY_INTEGER_LEVEL_FIELD = ____ability.MANA_COST_ABILITY_INTE
10
10
  local ____math = require("math")
11
11
  local max = ____math.max
12
12
  local MINIMUM_POSITIVE_NORMALIZED_FLOAT = ____math.MINIMUM_POSITIVE_NORMALIZED_FLOAT
13
+ local ____sound = require("core.types.sound")
14
+ local Sound3D = ____sound.Sound3D
15
+ local SoundSettings = ____sound.SoundSettings
13
16
  ____exports.EmulateImpactAbilityBehavior = __TS__Class()
14
17
  local EmulateImpactAbilityBehavior = ____exports.EmulateImpactAbilityBehavior
15
18
  EmulateImpactAbilityBehavior.name = "EmulateImpactAbilityBehavior"
@@ -23,6 +26,10 @@ function EmulateImpactAbilityBehavior.prototype.emulateImpact(self, caster)
23
26
  caster.mana = caster.mana - manaCost
24
27
  self.ability.cooldownRemaining = max(cooldown, MINIMUM_POSITIVE_NORMALIZED_FLOAT)
25
28
  self:flashCasterEffect(caster)
29
+ local soundPresetId = self.ability:getField(ABILITY_SF_EFFECT_SOUND)
30
+ if soundPresetId ~= "" then
31
+ Sound3D:playFromLabel(soundPresetId, SoundSettings.Ability, caster)
32
+ end
26
33
  AbilityBehavior:forAll(self.ability, "onImpact", caster)
27
34
  end
28
35
  return ____exports
@@ -11,6 +11,8 @@ import { Ability, UnitAbility } from "./ability";
11
11
  import { Widget } from "../../core/types/widget";
12
12
  import type { UnitTypeId } from "../object-data/entry/unit-type";
13
13
  import { CombatClassification, CombatClassifications } from "../object-data/auxiliary/combat-classification";
14
+ import { MovementType } from "../object-data/auxiliary/movement-type";
15
+ import { UnitAttribute } from "../object-data/auxiliary/unit-attribute";
14
16
  export type UnitClassification = junittype;
15
17
  export declare namespace UnitClassification {
16
18
  const STRUCTURE: junittype;
@@ -161,6 +163,8 @@ export declare class Unit extends Handle<junit> {
161
163
  set level(v: number);
162
164
  get xp(): number;
163
165
  set xp(v: number);
166
+ get primaryAttribute(): UnitAttribute;
167
+ set primaryAttribute(primaryAttribute: UnitAttribute);
164
168
  get strengthBase(): number;
165
169
  set strengthBase(strengthBase: number);
166
170
  get strengthBonus(): number;
@@ -235,6 +239,8 @@ export declare class Unit extends Handle<junit> {
235
239
  set timeScale(v: number);
236
240
  get collisionSize(): number;
237
241
  get pathingCollisionRange(): number;
242
+ get movementType(): MovementType;
243
+ set movementType(movementType: MovementType);
238
244
  set pathing(v: boolean);
239
245
  isSelected(player: Player): boolean;
240
246
  explode(): void;
@@ -1292,6 +1292,19 @@ __TS__SetDescriptor(
1292
1292
  },
1293
1293
  true
1294
1294
  )
1295
+ __TS__SetDescriptor(
1296
+ Unit.prototype,
1297
+ "primaryAttribute",
1298
+ {
1299
+ get = function(self)
1300
+ return getUnitIntegerField(self.handle, UNIT_IF_PRIMARY_ATTRIBUTE)
1301
+ end,
1302
+ set = function(self, primaryAttribute)
1303
+ setUnitIntegerField(self.handle, UNIT_IF_PRIMARY_ATTRIBUTE, primaryAttribute)
1304
+ end
1305
+ },
1306
+ true
1307
+ )
1295
1308
  __TS__SetDescriptor(
1296
1309
  Unit.prototype,
1297
1310
  "strengthBase",
@@ -1833,6 +1846,19 @@ __TS__SetDescriptor(
1833
1846
  end},
1834
1847
  true
1835
1848
  )
1849
+ __TS__SetDescriptor(
1850
+ Unit.prototype,
1851
+ "movementType",
1852
+ {
1853
+ get = function(self)
1854
+ return getUnitIntegerField(self.handle, UNIT_IF_MOVE_TYPE)
1855
+ end,
1856
+ set = function(self, movementType)
1857
+ setUnitIntegerField(self.handle, UNIT_IF_MOVE_TYPE, movementType)
1858
+ end
1859
+ },
1860
+ true
1861
+ )
1836
1862
  __TS__SetDescriptor(
1837
1863
  Unit.prototype,
1838
1864
  "pathing",
@@ -1,10 +1,10 @@
1
1
  /** @noSelfInFile */
2
2
  export declare const enum MovementType {
3
- NONE = "",
4
- FLOAT = "float",
5
- FLY = "fly",
6
- FOOT = "foot",
7
- HORSE = "horse",
8
- HOVER = "hover",
9
- AMPHIBIOUS = "amph"
3
+ NONE = 0,
4
+ FOOT = 1,
5
+ FLY = 2,
6
+ HORSE = 4,
7
+ HOVER = 8,
8
+ FLOAT = 16,
9
+ AMPHIBIOUS = 32
10
10
  }
@@ -1,2 +1,24 @@
1
1
  local ____exports = {}
2
+ local ____records = require("utility.records")
3
+ local invertRecord = ____records.invertRecord
4
+ local stringByMovementType = {
5
+ [0] = "",
6
+ [16] = "float",
7
+ [2] = "fly",
8
+ [1] = "foot",
9
+ [4] = "horse",
10
+ [8] = "hover",
11
+ [32] = "amph"
12
+ }
13
+ local movementTypeByString = invertRecord(stringByMovementType)
14
+ ---
15
+ -- @internal For use by internal systems only.
16
+ ____exports.movementTypeToString = function(movementType)
17
+ return stringByMovementType[movementType]
18
+ end
19
+ ---
20
+ -- @internal For use by internal systems only.
21
+ ____exports.stringToMovementType = function(____string)
22
+ return movementTypeByString[____string] or 0
23
+ end
2
24
  return ____exports
@@ -0,0 +1,6 @@
1
+ /** @noSelfInFile */
2
+ export declare enum UnitAttribute {
3
+ STRENGTH = 1,
4
+ INTELLIGENCE = 2,
5
+ AGILITY = 3
6
+ }
@@ -0,0 +1,9 @@
1
+ local ____exports = {}
2
+ ____exports.UnitAttribute = UnitAttribute or ({})
3
+ ____exports.UnitAttribute.STRENGTH = 1
4
+ ____exports.UnitAttribute[____exports.UnitAttribute.STRENGTH] = "STRENGTH"
5
+ ____exports.UnitAttribute.INTELLIGENCE = 2
6
+ ____exports.UnitAttribute[____exports.UnitAttribute.INTELLIGENCE] = "INTELLIGENCE"
7
+ ____exports.UnitAttribute.AGILITY = 3
8
+ ____exports.UnitAttribute[____exports.UnitAttribute.AGILITY] = "AGILITY"
9
+ return ____exports
@@ -7,4 +7,6 @@ export declare class BerserkAbilityType extends AbilityType {
7
7
  set movementSpeedIncreaseFactor(movementSpeedIncreaseFactor: ObjectDataEntryLevelFieldValueSupplier<number>);
8
8
  get attackSpeedIncreaseFactor(): number[];
9
9
  set attackSpeedIncreaseFactor(attackSpeedIncreaseFactor: ObjectDataEntryLevelFieldValueSupplier<number>);
10
+ get receivedDamageIncreaseFactor(): number[];
11
+ set receivedDamageIncreaseFactor(receivedDamageIncreaseFactor: ObjectDataEntryLevelFieldValueSupplier<number>);
10
12
  }
@@ -36,4 +36,17 @@ __TS__SetDescriptor(
36
36
  },
37
37
  true
38
38
  )
39
+ __TS__SetDescriptor(
40
+ BerserkAbilityType.prototype,
41
+ "receivedDamageIncreaseFactor",
42
+ {
43
+ get = function(self)
44
+ return self:getNumberLevelField("bsk3")
45
+ end,
46
+ set = function(self, receivedDamageIncreaseFactor)
47
+ self:setNumberLevelField("bsk3", receivedDamageIncreaseFactor)
48
+ end
49
+ },
50
+ true
51
+ )
39
52
  return ____exports
@@ -9,4 +9,14 @@ export declare class SlowPoisonAbilityType extends AbilityType {
9
9
  set movementSpeedDecreaseFactor(movementSpeedDecreaseFactor: ObjectDataEntryLevelFieldValueSupplier<number>);
10
10
  get attackSpeedDecreaseFactor(): number[];
11
11
  set attackSpeedDecreaseFactor(attackSpeedDecreaseFactor: ObjectDataEntryLevelFieldValueSupplier<number>);
12
+ get isDamageStacking(): boolean[];
13
+ set isDamageStacking(isDamageStacking: ObjectDataEntryLevelFieldValueSupplier<boolean>);
14
+ get isMovementSpeedFactorStacking(): boolean[];
15
+ set isMovementSpeedFactorStacking(isMovementSpeedFactorStacking: ObjectDataEntryLevelFieldValueSupplier<boolean>);
16
+ get isAttackSpeedFactorStacking(): boolean[];
17
+ set isAttackSpeedFactorStacking(isAttackSpeedFactorStacking: ObjectDataEntryLevelFieldValueSupplier<boolean>);
18
+ get isAbleToKill(): boolean[];
19
+ set isAbleToKill(isAbleToKill: ObjectDataEntryLevelFieldValueSupplier<boolean>);
20
+ private setOption;
21
+ private getOption;
12
22
  }
@@ -9,6 +9,12 @@ ____exports.SlowPoisonAbilityType = __TS__Class()
9
9
  local SlowPoisonAbilityType = ____exports.SlowPoisonAbilityType
10
10
  SlowPoisonAbilityType.name = "SlowPoisonAbilityType"
11
11
  __TS__ClassExtends(SlowPoisonAbilityType, AbilityType)
12
+ function SlowPoisonAbilityType.prototype.setOption(self, option, supplier)
13
+ self:setFlagLevelFieldValue("Spo4", option, supplier)
14
+ end
15
+ function SlowPoisonAbilityType.prototype.getOption(self, option)
16
+ return self:getFlagLevelFieldValue("Spo4", option)
17
+ end
12
18
  SlowPoisonAbilityType.BASE_ID = fourCC("Aspo")
13
19
  __TS__SetDescriptor(
14
20
  SlowPoisonAbilityType.prototype,
@@ -49,4 +55,56 @@ __TS__SetDescriptor(
49
55
  },
50
56
  true
51
57
  )
58
+ __TS__SetDescriptor(
59
+ SlowPoisonAbilityType.prototype,
60
+ "isDamageStacking",
61
+ {
62
+ get = function(self)
63
+ return self:getOption(1)
64
+ end,
65
+ set = function(self, isDamageStacking)
66
+ self:setOption(1, isDamageStacking)
67
+ end
68
+ },
69
+ true
70
+ )
71
+ __TS__SetDescriptor(
72
+ SlowPoisonAbilityType.prototype,
73
+ "isMovementSpeedFactorStacking",
74
+ {
75
+ get = function(self)
76
+ return self:getOption(2)
77
+ end,
78
+ set = function(self, isMovementSpeedFactorStacking)
79
+ self:setOption(2, isMovementSpeedFactorStacking)
80
+ end
81
+ },
82
+ true
83
+ )
84
+ __TS__SetDescriptor(
85
+ SlowPoisonAbilityType.prototype,
86
+ "isAttackSpeedFactorStacking",
87
+ {
88
+ get = function(self)
89
+ return self:getOption(4)
90
+ end,
91
+ set = function(self, isAttackSpeedFactorStacking)
92
+ self:setOption(4, isAttackSpeedFactorStacking)
93
+ end
94
+ },
95
+ true
96
+ )
97
+ __TS__SetDescriptor(
98
+ SlowPoisonAbilityType.prototype,
99
+ "isAbleToKill",
100
+ {
101
+ get = function(self)
102
+ return self:getOption(8)
103
+ end,
104
+ set = function(self, isAbleToKill)
105
+ self:setOption(8, isAbleToKill)
106
+ end
107
+ },
108
+ true
109
+ )
52
110
  return ____exports
@@ -35,6 +35,7 @@ local abilityTypeIdGenerator = ____object_2Ddata_2Dentry_2Did_2Dgenerator.abilit
35
35
  local ____upgrade = require("engine.object-data.entry.upgrade")
36
36
  local Upgrade = ____upgrade.Upgrade
37
37
  local ____sound = require("core.types.sound")
38
+ local isSoundLabelCustom = ____sound.isSoundLabelCustom
38
39
  local Sound3D = ____sound.Sound3D
39
40
  local SoundSettings = ____sound.SoundSettings
40
41
  local castAnimationFQNByAbilityTypeId = {}
@@ -1005,6 +1006,12 @@ for abilityTypeId, soundPresetId in pairs(postcompile(function() return targetEf
1005
1006
  )
1006
1007
  end
1007
1008
  end
1009
+ Unit.abilityChannelingStartEvent:addListener(function(caster, ability)
1010
+ local soundPresetId = ability:getField(ABILITY_SF_EFFECT_SOUND)
1011
+ if isSoundLabelCustom(soundPresetId) then
1012
+ Sound3D:playFromLabel(soundPresetId, SoundSettings.Ability, caster)
1013
+ end
1014
+ end)
1008
1015
  local casterCastingEffectModelPathsByAbilityTypeId = postcompile(function()
1009
1016
  return mapValues(
1010
1017
  casterCastingEffectPresetsByAbilityTypeId,
@@ -121,6 +121,10 @@ local applicatorAbilityTypeIdByApplicatorTypeByApplicableBuffTypeId, applicatorU
121
121
  applicatorAbilityType.damagePerSecond = 0
122
122
  applicatorAbilityType.movementSpeedDecreaseFactor = 0
123
123
  applicatorAbilityType.attackSpeedDecreaseFactor = 0
124
+ applicatorAbilityType.isDamageStacking = false
125
+ applicatorAbilityType.isMovementSpeedFactorStacking = false
126
+ applicatorAbilityType.isAttackSpeedFactorStacking = false
127
+ applicatorAbilityType.isAbleToKill = false
124
128
  applicatorAbilityType.buffTypeIds = {applicableBuffType.id, applicableBuffType.id}
125
129
  applicatorAbilityTypeIdByApplicatorType[852173] = applicatorAbilityType.id
126
130
  end
@@ -128,6 +132,7 @@ local applicatorAbilityTypeIdByApplicatorTypeByApplicableBuffTypeId, applicatorU
128
132
  local applicatorAbilityType = prepareAbilityType(BerserkAbilityType, applicableBuffType)
129
133
  applicatorAbilityType.attackSpeedIncreaseFactor = 0
130
134
  applicatorAbilityType.movementSpeedIncreaseFactor = 0
135
+ applicatorAbilityType.receivedDamageIncreaseFactor = 0
131
136
  applicatorAbilityType.buffTypeIds = {applicableBuffType.id}
132
137
  if applicatorAbilityType.levelCount > 1 then
133
138
  multilevelPhysicalPositiveApplicatorAbilityTypes[#multilevelPhysicalPositiveApplicatorAbilityTypes + 1] = applicatorAbilityType
@@ -3,12 +3,16 @@ import { TupleOf } from "../../../utility/types";
3
3
  import { AttachmentPreset, AttachmentPresetInput } from "../auxiliary/attachment-preset";
4
4
  import { Race } from "../auxiliary/race";
5
5
  import { SoundPresetName } from "../auxiliary/sound-preset-name";
6
- import { ObjectDataEntry, ObjectDataEntryId } from "../entry";
6
+ import { ObjectDataEntry, ObjectDataEntryConstructor, ObjectDataEntryId } from "../entry";
7
7
  import { LightningTypeId } from "./lightning-type";
8
8
  export type BuffTypeId = ObjectDataEntryId & number & {
9
9
  readonly __buffTypeId: unique symbol;
10
10
  };
11
+ export type StandardBuffTypeId = BuffTypeId & {
12
+ readonly __standardBuffTypeId: unique symbol;
13
+ };
11
14
  export declare abstract class BuffType<Id extends BuffTypeId = BuffTypeId> extends ObjectDataEntry<Id> {
15
+ static readonly [id: StandardBuffTypeId]: ObjectDataEntryConstructor<BuffType>;
12
16
  private static readonly idGenerator;
13
17
  protected static generateId(): number;
14
18
  protected static getObjectData(map: WarMap): WarObjects;
@@ -51,13 +55,3 @@ export declare abstract class BuffType<Id extends BuffTypeId = BuffTypeId> exten
51
55
  get tooltipExtendedText(): string;
52
56
  set tooltipExtendedText(tooltipText: string);
53
57
  }
54
- declare const AvatarBuffType_base: typeof BuffType;
55
- export declare class AvatarBuffType extends AvatarBuffType_base {
56
- }
57
- declare const DevotionAuraBuffType_base: typeof BuffType;
58
- export declare class DevotionAuraBuffType extends DevotionAuraBuffType_base {
59
- }
60
- declare const DivineShieldBuffType_base: typeof BuffType;
61
- export declare class DivineShieldBuffType extends DivineShieldBuffType_base {
62
- }
63
- export {};
@@ -6,6 +6,8 @@ local __TS__SetDescriptor = ____lualib.__TS__SetDescriptor
6
6
  local ____exports = {}
7
7
  local ____arrays = require("utility.arrays")
8
8
  local array = ____arrays.array
9
+ local ____reflection = require("utility.reflection")
10
+ local implementReadonlyNumberIndexSupplier = ____reflection.implementReadonlyNumberIndexSupplier
9
11
  local ____entry = require("engine.object-data.entry")
10
12
  local ObjectDataEntry = ____entry.ObjectDataEntry
11
13
  local ____object_2Ddata_2Dentry_2Did_2Dgenerator = require("engine.object-data.utility.object-data-entry-id-generator")
@@ -285,32 +287,14 @@ __TS__SetDescriptor(
285
287
  },
286
288
  true
287
289
  )
288
- local function makeBaseBuffType(id)
289
- local BaseBuffType = __TS__Class()
290
- BaseBuffType.name = "BaseBuffType"
291
- __TS__ClassExtends(BaseBuffType, ____exports.BuffType)
292
- BaseBuffType.BASE_ID = id
293
- return BaseBuffType
294
- end
295
- ____exports.AvatarBuffType = __TS__Class()
296
- local AvatarBuffType = ____exports.AvatarBuffType
297
- AvatarBuffType.name = "AvatarBuffType"
298
- __TS__ClassExtends(
299
- AvatarBuffType,
300
- makeBaseBuffType(fourCC("BHav"))
301
- )
302
- ____exports.DevotionAuraBuffType = __TS__Class()
303
- local DevotionAuraBuffType = ____exports.DevotionAuraBuffType
304
- DevotionAuraBuffType.name = "DevotionAuraBuffType"
305
- __TS__ClassExtends(
306
- DevotionAuraBuffType,
307
- makeBaseBuffType(fourCC("BHad"))
308
- )
309
- ____exports.DivineShieldBuffType = __TS__Class()
310
- local DivineShieldBuffType = ____exports.DivineShieldBuffType
311
- DivineShieldBuffType.name = "DivineShieldBuffType"
312
- __TS__ClassExtends(
313
- DivineShieldBuffType,
314
- makeBaseBuffType(fourCC("BHds"))
290
+ implementReadonlyNumberIndexSupplier(
291
+ ____exports.BuffType,
292
+ function(id)
293
+ local ____class_0 = __TS__Class()
294
+ ____class_0.name = ____class_0.name
295
+ __TS__ClassExtends(____class_0, ____exports.BuffType)
296
+ ____class_0.BASE_ID = id
297
+ return ____class_0
298
+ end
315
299
  )
316
300
  return ____exports
@@ -12,6 +12,9 @@ local implementReadonlyNumberIndexSupplier = ____reflection.implementReadonlyNum
12
12
  local ____combat_2Dclassification = require("engine.object-data.auxiliary.combat-classification")
13
13
  local combatClassificationsToStringArray = ____combat_2Dclassification.combatClassificationsToStringArray
14
14
  local stringArrayToCombatClassifications = ____combat_2Dclassification.stringArrayToCombatClassifications
15
+ local ____movement_2Dtype = require("engine.object-data.auxiliary.movement-type")
16
+ local movementTypeToString = ____movement_2Dtype.movementTypeToString
17
+ local stringToMovementType = ____movement_2Dtype.stringToMovementType
15
18
  local ____unit_2Dclassification = require("engine.object-data.auxiliary.unit-classification")
16
19
  local stringArrayToUnitClassifications = ____unit_2Dclassification.stringArrayToUnitClassifications
17
20
  local unitClassificationsToStringArray = ____unit_2Dclassification.unitClassificationsToStringArray
@@ -1341,10 +1344,13 @@ __TS__SetDescriptor(
1341
1344
  "movementType",
1342
1345
  {
1343
1346
  get = function(self)
1344
- return self:getStringField("umvt")
1347
+ return stringToMovementType(self:getStringField("umvt"))
1345
1348
  end,
1346
1349
  set = function(self, movementType)
1347
- self:setStringField("umvt", movementType)
1350
+ self:setStringField(
1351
+ "umvt",
1352
+ movementTypeToString(movementType)
1353
+ )
1348
1354
  end
1349
1355
  },
1350
1356
  true
@@ -0,0 +1,3 @@
1
+ /** @noSelfInFile */
2
+ import { StandardBuffTypeId } from "../../object-data/entry/buff-type";
3
+ export declare const CHEMICAL_RAGE_BUFF_TYPE_ID: StandardBuffTypeId;
@@ -0,0 +1,3 @@
1
+ local ____exports = {}
2
+ ____exports.CHEMICAL_RAGE_BUFF_TYPE_ID = fourCC("BNcr")
3
+ return ____exports
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.f5421e8",
4
+ "version": "0.0.1-dev.f9321c0",
5
5
  "description": "A typescript library for Warcraft III using Warpack.",
6
6
  "keywords": [
7
7
  "warcraft",