warscript 0.0.1-dev.ec4cf89 → 0.0.1-dev.eda504c
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 +6 -0
- package/attributes.lua +17 -1
- package/config.d.ts +5 -0
- package/config.lua +10 -0
- package/core/types/effect.d.ts +14 -6
- package/core/types/effect.lua +131 -35
- package/core/types/frame.d.ts +6 -0
- package/core/types/frame.lua +115 -22
- package/core/types/player.lua +3 -1
- package/core/types/playerCamera.d.ts +2 -0
- package/core/types/playerCamera.lua +123 -5
- package/core/types/sound.d.ts +17 -24
- package/core/types/sound.lua +99 -24
- package/core/types/tileCell.d.ts +9 -0
- package/core/types/tileCell.lua +92 -0
- package/core/types/timer.d.ts +9 -8
- package/core/types/timer.lua +45 -23
- package/core/util.d.ts +1 -1
- package/core/util.lua +18 -1
- package/decl/native.d.ts +846 -790
- package/engine/behavior.d.ts +7 -2
- package/engine/behavior.lua +112 -33
- package/engine/behaviour/ability/always-enabled.d.ts +7 -0
- package/engine/behaviour/ability/always-enabled.lua +31 -0
- package/engine/behaviour/ability/apply-buff.d.ts +8 -5
- package/engine/behaviour/ability/apply-buff.lua +32 -0
- package/engine/behaviour/ability/apply-unit-behavior.lua +1 -0
- package/engine/behaviour/ability/damage.d.ts +9 -3
- package/engine/behaviour/ability/damage.lua +26 -38
- package/engine/behaviour/ability/emulate-impact.d.ts +6 -0
- package/engine/behaviour/ability/emulate-impact.lua +43 -0
- package/engine/behaviour/ability/instant-impact.d.ts +2 -2
- package/engine/behaviour/ability/instant-impact.lua +4 -19
- package/engine/behaviour/ability/on-command-impact.d.ts +8 -0
- package/engine/behaviour/ability/on-command-impact.lua +25 -0
- package/engine/behaviour/ability/remove-buffs.d.ts +16 -0
- package/engine/behaviour/ability/remove-buffs.lua +28 -0
- package/engine/behaviour/ability/restore-mana.d.ts +1 -1
- package/engine/behaviour/ability/restore-mana.lua +6 -6
- package/engine/behaviour/ability.d.ts +20 -4
- package/engine/behaviour/ability.lua +111 -47
- package/engine/behaviour/unit/stun-immunity.d.ts +7 -3
- package/engine/behaviour/unit/stun-immunity.lua +52 -27
- package/engine/behaviour/unit.d.ts +39 -0
- package/engine/behaviour/unit.lua +210 -4
- package/engine/buff.d.ts +85 -46
- package/engine/buff.lua +373 -229
- package/engine/internal/ability.d.ts +23 -14
- package/engine/internal/ability.lua +129 -85
- package/engine/internal/item/ability.lua +162 -4
- package/engine/internal/item+owner.lua +12 -6
- package/engine/internal/item.d.ts +20 -19
- package/engine/internal/item.lua +191 -74
- package/engine/internal/mechanics/ability-duration.lua +1 -1
- package/engine/internal/misc/ability-disable-counter.d.ts +2 -0
- package/engine/internal/misc/ability-disable-counter.lua +13 -0
- package/engine/internal/misc/damage-metadata-by-target.d.ts +2 -0
- package/engine/internal/misc/damage-metadata-by-target.lua +5 -0
- package/engine/internal/misc/frame-coordinates.d.ts +2 -0
- package/engine/internal/misc/frame-coordinates.lua +21 -0
- package/engine/internal/misc/get-terrain-z.d.ts +2 -0
- package/engine/internal/misc/get-terrain-z.lua +11 -0
- package/engine/internal/misc/player-local-handle.d.ts +2 -0
- package/engine/internal/misc/player-local-handle.lua +5 -0
- package/engine/internal/object-data/auto-attack-speed-increase.d.ts +1 -1
- package/engine/internal/object-data/auto-attack-speed-increase.lua +2 -0
- package/engine/internal/object-data/evasion-probability.d.ts +2 -0
- package/engine/internal/object-data/evasion-probability.lua +16 -0
- package/engine/internal/unit/ability.d.ts +45 -1
- package/engine/internal/unit/ability.lua +128 -17
- package/engine/internal/unit/add-item-to-slot-init.d.ts +2 -0
- package/engine/internal/unit/add-item-to-slot-init.lua +23 -0
- package/engine/internal/unit/add-item-to-slot.d.ts +2 -0
- package/engine/internal/unit/add-item-to-slot.lua +52 -0
- package/engine/internal/unit/allowed-targets.d.ts +1 -1
- package/engine/internal/unit/allowed-targets.lua +9 -1
- package/engine/internal/unit/bonus.d.ts +6 -2
- package/engine/internal/unit/bonus.lua +23 -1
- package/engine/internal/unit/ignore-events-items.d.ts +2 -0
- package/engine/internal/unit/ignore-events-items.lua +5 -0
- package/engine/internal/unit/item.d.ts +24 -0
- package/engine/internal/unit/item.lua +78 -0
- package/engine/internal/unit/main-selected.d.ts +13 -0
- package/engine/internal/unit/main-selected.lua +51 -0
- package/engine/internal/unit/order.d.ts +20 -0
- package/engine/internal/unit/order.lua +136 -0
- package/engine/internal/unit+ability.lua +12 -3
- package/engine/internal/unit+damage.d.ts +2 -11
- package/engine/internal/unit+damage.lua +10 -14
- package/engine/internal/unit+spellSteal.lua +1 -2
- package/engine/internal/unit-missile-launch.lua +60 -13
- package/engine/internal/unit.d.ts +58 -18
- package/engine/internal/unit.lua +399 -161
- package/engine/internal/utility.lua +12 -0
- package/engine/lightning.d.ts +12 -5
- package/engine/lightning.lua +48 -14
- package/engine/local-client.d.ts +7 -2
- package/engine/local-client.lua +82 -0
- package/engine/object-data/auxiliary/animation-name.d.ts +1 -0
- package/engine/object-data/auxiliary/animation-name.lua +16 -0
- 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/auxiliary/attachment-preset.d.ts +7 -2
- package/engine/object-data/auxiliary/attachment-preset.lua +4 -3
- package/engine/object-data/auxiliary/attack-type.d.ts +7 -8
- package/engine/object-data/auxiliary/attack-type.lua +42 -0
- package/engine/object-data/auxiliary/movement-type.d.ts +7 -7
- package/engine/object-data/auxiliary/movement-type.lua +22 -0
- package/engine/object-data/auxiliary/sound-eax.d.ts +10 -0
- package/engine/object-data/auxiliary/sound-eax.lua +2 -0
- package/engine/object-data/auxiliary/sound-preset-name.d.ts +5 -1
- package/engine/object-data/auxiliary/tech-tree-dependency.d.ts +1 -1
- package/engine/object-data/auxiliary/unit-attribute.d.ts +6 -0
- package/engine/object-data/auxiliary/unit-attribute.lua +9 -0
- package/engine/object-data/entry/ability-type/berserk.d.ts +2 -0
- package/engine/object-data/entry/ability-type/berserk.lua +13 -0
- package/engine/object-data/entry/ability-type/blank-configurable.lua +12 -1
- package/engine/object-data/entry/ability-type/carrion-swarm.d.ts +14 -0
- package/engine/object-data/entry/ability-type/carrion-swarm.lua +65 -0
- package/engine/object-data/entry/ability-type/disease-cloud.lua +2 -2
- package/engine/object-data/entry/ability-type/engineering-upgrade.lua +2 -2
- package/engine/object-data/entry/ability-type/ensnare.d.ts +12 -0
- package/engine/object-data/entry/ability-type/ensnare.lua +52 -0
- package/engine/object-data/entry/ability-type/feral-spirit.lua +2 -2
- package/engine/object-data/entry/ability-type/permanent-invisibility.d.ts +8 -0
- package/engine/object-data/entry/ability-type/permanent-invisibility.lua +26 -0
- package/engine/object-data/entry/ability-type/phase-shift.d.ts +10 -0
- package/engine/object-data/entry/ability-type/phase-shift.lua +39 -0
- package/engine/object-data/entry/ability-type/phoenix-morph.lua +4 -4
- package/engine/object-data/entry/ability-type/raise-dead.d.ts +17 -0
- package/engine/object-data/entry/ability-type/raise-dead.lua +78 -0
- package/engine/object-data/entry/ability-type/shock-wave.d.ts +4 -0
- package/engine/object-data/entry/ability-type/shock-wave.lua +26 -0
- package/engine/object-data/entry/ability-type/slow-poison.d.ts +10 -0
- package/engine/object-data/entry/ability-type/slow-poison.lua +58 -0
- package/engine/object-data/entry/ability-type/summon-quilbeast.lua +2 -2
- package/engine/object-data/entry/ability-type/summon-water-elemental.lua +2 -2
- package/engine/object-data/entry/ability-type/web.d.ts +12 -0
- package/engine/object-data/entry/ability-type/web.lua +52 -0
- package/engine/object-data/entry/ability-type.d.ts +19 -17
- package/engine/object-data/entry/ability-type.lua +93 -36
- package/engine/object-data/entry/buff-type/applicable.lua +18 -37
- package/engine/object-data/entry/buff-type.d.ts +6 -12
- package/engine/object-data/entry/buff-type.lua +13 -29
- package/engine/object-data/entry/destructible-type.d.ts +1 -1
- package/engine/object-data/entry/item-type.d.ts +15 -1
- package/engine/object-data/entry/item-type.lua +93 -2
- package/engine/object-data/entry/lightning-type.d.ts +1 -1
- package/engine/object-data/entry/sound-preset.d.ts +33 -0
- package/engine/object-data/entry/sound-preset.lua +140 -0
- package/engine/object-data/entry/unit-type.d.ts +21 -5
- package/engine/object-data/entry/unit-type.lua +214 -93
- package/engine/object-data/entry/upgrade.d.ts +1 -1
- package/engine/object-data/entry/upgrade.lua +4 -4
- package/engine/object-data/entry.d.ts +16 -14
- package/engine/object-data/entry.lua +60 -32
- package/engine/object-data/utility/object-data-entry-id-generator.lua +7 -0
- package/engine/object-field/ability.d.ts +28 -5
- package/engine/object-field/ability.lua +59 -5
- package/engine/object-field/unit.d.ts +57 -3
- package/engine/object-field/unit.lua +207 -7
- package/engine/object-field.d.ts +17 -6
- package/engine/object-field.lua +190 -90
- package/engine/random.d.ts +9 -0
- package/engine/random.lua +13 -0
- package/engine/standard/entries/buff-type.d.ts +3 -0
- package/engine/standard/entries/buff-type.lua +3 -0
- package/engine/standard/entries/sound-preset.d.ts +10 -0
- package/engine/standard/entries/sound-preset.lua +10 -0
- package/engine/standard/fields/ability.d.ts +2 -0
- package/engine/standard/fields/ability.lua +2 -0
- package/engine/standard/fields/unit.d.ts +4 -0
- package/engine/standard/fields/unit.lua +7 -0
- package/engine/text-tag.d.ts +36 -2
- package/engine/text-tag.lua +249 -10
- package/engine/unit.d.ts +4 -0
- package/engine/unit.lua +4 -0
- package/index.d.ts +1 -0
- package/index.lua +1 -0
- package/net/socket.d.ts +7 -1
- package/net/socket.lua +45 -4
- package/network.d.ts +1 -0
- package/network.lua +3 -2
- package/objutil/buff.lua +3 -4
- package/objutil/unit.lua +8 -0
- package/package.json +2 -2
- package/patch-lua.d.ts +0 -0
- package/patch-lua.lua +10 -0
- package/patch-lualib.lua +1 -1
- package/utility/arrays.d.ts +10 -1
- package/utility/arrays.lua +45 -3
- package/utility/callback-array.d.ts +17 -0
- package/utility/callback-array.lua +61 -0
- package/utility/functions.d.ts +8 -0
- package/utility/functions.lua +13 -0
- package/utility/lazy.d.ts +2 -0
- package/utility/lazy.lua +14 -0
- package/utility/linked-set.d.ts +12 -2
- package/utility/linked-set.lua +10 -3
- package/utility/lua-maps.d.ts +15 -2
- package/utility/lua-maps.lua +53 -2
- package/utility/lua-sets.d.ts +2 -0
- package/utility/lua-sets.lua +7 -0
- package/utility/reflection.lua +11 -7
- package/utility/types.d.ts +4 -0
- package/core/types/order.d.ts +0 -25
- package/core/types/order.lua +0 -55
package/engine/object-field.lua
CHANGED
|
@@ -20,6 +20,14 @@ local extractObjectDataEntryLevelFieldValue = ____entry.extractObjectDataEntryLe
|
|
|
20
20
|
local ObjectDataEntry = ____entry.ObjectDataEntry
|
|
21
21
|
local ____object_2Ddata_2Dentry_2Did_2Dgenerator = require("engine.object-data.utility.object-data-entry-id-generator")
|
|
22
22
|
local ObjectDataEntryIdGenerator = ____object_2Ddata_2Dentry_2Did_2Dgenerator.ObjectDataEntryIdGenerator
|
|
23
|
+
local ____linked_2Dset = require("utility.linked-set")
|
|
24
|
+
local mutableLinkedSet = ____linked_2Dset.mutableLinkedSet
|
|
25
|
+
local ____lua_2Dmaps = require("utility.lua-maps")
|
|
26
|
+
local emptyLuaMap = ____lua_2Dmaps.emptyLuaMap
|
|
27
|
+
local getOrPut = ____lua_2Dmaps.getOrPut
|
|
28
|
+
local mutableWeakLuaMap = ____lua_2Dmaps.mutableWeakLuaMap
|
|
29
|
+
local ____arrays = require("utility.arrays")
|
|
30
|
+
local emptyArray = ____arrays.emptyArray
|
|
23
31
|
local compiletimeDefaultValueByObjectDataEntryIdByObjectFieldId = {}
|
|
24
32
|
local defaultValueByObjectDataEntryIdByObjectFieldId = postcompile(function() return compiletimeDefaultValueByObjectDataEntryIdByObjectFieldId end)
|
|
25
33
|
local objectFieldById = {}
|
|
@@ -29,7 +37,11 @@ local idGenerator = __TS__New(
|
|
|
29
37
|
)
|
|
30
38
|
local ObjectFieldBase = __TS__Class()
|
|
31
39
|
ObjectFieldBase.name = "ObjectFieldBase"
|
|
32
|
-
function ObjectFieldBase.prototype.____constructor(self, id)
|
|
40
|
+
function ObjectFieldBase.prototype.____constructor(self, id, isGlobal)
|
|
41
|
+
if isGlobal == nil then
|
|
42
|
+
isGlobal = false
|
|
43
|
+
end
|
|
44
|
+
self.isGlobal = isGlobal
|
|
33
45
|
self.valueByInstance = setmetatable({}, {__mode = "k"})
|
|
34
46
|
if objectFieldById[id] ~= nil then
|
|
35
47
|
error(
|
|
@@ -46,10 +58,15 @@ end
|
|
|
46
58
|
function ObjectFieldBase.prototype.supports(self, instance)
|
|
47
59
|
return __TS__InstanceOf(instance, self.instanceClass)
|
|
48
60
|
end
|
|
49
|
-
function ObjectFieldBase.
|
|
61
|
+
function ObjectFieldBase.prototype.hasValue(self, objectDataEntryId)
|
|
62
|
+
local defaultValueByObjectDataEntryId = defaultValueByObjectDataEntryIdByObjectFieldId[self.id]
|
|
63
|
+
return self.isGlobal or defaultValueByObjectDataEntryId ~= nil and defaultValueByObjectDataEntryId[objectDataEntryId] ~= nil or self:hasNativeFieldValue(objectDataEntryId)
|
|
64
|
+
end
|
|
65
|
+
function ObjectFieldBase.create(self, id, isGlobal)
|
|
50
66
|
return __TS__New(
|
|
51
67
|
self,
|
|
52
|
-
id or idGenerator:next()
|
|
68
|
+
id or idGenerator:next(),
|
|
69
|
+
isGlobal
|
|
53
70
|
)
|
|
54
71
|
end
|
|
55
72
|
function ObjectFieldBase.of(self, id)
|
|
@@ -71,7 +88,7 @@ ____exports.ObjectField = __TS__Class()
|
|
|
71
88
|
local ObjectField = ____exports.ObjectField
|
|
72
89
|
ObjectField.name = "ObjectField"
|
|
73
90
|
__TS__ClassExtends(ObjectField, ObjectFieldBase)
|
|
74
|
-
function ObjectField.prototype.getValue(self, entry)
|
|
91
|
+
function ObjectField.prototype.getValue(self, entry, includeModifiers)
|
|
75
92
|
if __TS__InstanceOf(entry, ObjectDataEntry) then
|
|
76
93
|
local defaultValueByObjectDataEntryId = (warpack.compiletime and compiletimeDefaultValueByObjectDataEntryIdByObjectFieldId or defaultValueByObjectDataEntryIdByObjectFieldId)[self.id]
|
|
77
94
|
if defaultValueByObjectDataEntryId ~= nil then
|
|
@@ -82,22 +99,16 @@ function ObjectField.prototype.getValue(self, entry)
|
|
|
82
99
|
end
|
|
83
100
|
return self.defaultValue
|
|
84
101
|
end
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
____self_valueByInstance_entry_0 = defaultValue
|
|
102
|
+
if includeModifiers == false then
|
|
103
|
+
local originalValueByInstance = self.originalValueByInstance
|
|
104
|
+
if originalValueByInstance ~= nil then
|
|
105
|
+
local originalValue = originalValueByInstance[entry]
|
|
106
|
+
if originalValue ~= nil then
|
|
107
|
+
return originalValue
|
|
92
108
|
end
|
|
93
|
-
return ____self_valueByInstance_entry_0
|
|
94
109
|
end
|
|
95
110
|
end
|
|
96
|
-
|
|
97
|
-
if ____temp_1 == nil then
|
|
98
|
-
____temp_1 = self.defaultValue
|
|
99
|
-
end
|
|
100
|
-
return ____temp_1
|
|
111
|
+
return self:getActualValue(entry)
|
|
101
112
|
end
|
|
102
113
|
function ObjectField.prototype.setValue(self, entry, value)
|
|
103
114
|
if __TS__InstanceOf(entry, ObjectDataEntry) then
|
|
@@ -112,37 +123,53 @@ function ObjectField.prototype.setValue(self, entry, value)
|
|
|
112
123
|
defaultValueByObjectDataEntryId[entry.id] = value
|
|
113
124
|
return true
|
|
114
125
|
end
|
|
115
|
-
local
|
|
116
|
-
if
|
|
117
|
-
local
|
|
118
|
-
if
|
|
119
|
-
local
|
|
120
|
-
if
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
local ____self_valueByInstance_entry_2_3 = ____self_valueByInstance_entry_2
|
|
124
|
-
if ____self_valueByInstance_entry_2_3 == nil then
|
|
125
|
-
____self_valueByInstance_entry_2_3 = self.defaultValue
|
|
126
|
-
end
|
|
127
|
-
local previousValue = ____self_valueByInstance_entry_2_3
|
|
128
|
-
if value ~= previousValue then
|
|
129
|
-
self.valueByInstance[entry] = value
|
|
130
|
-
self:invokeValueChangeEvent(entry, self, previousValue, value)
|
|
126
|
+
local modifiersByInstance = self.modifiersByInstance
|
|
127
|
+
if modifiersByInstance ~= nil then
|
|
128
|
+
local modifiers = modifiersByInstance[entry]
|
|
129
|
+
if modifiers ~= nil and modifiers.size ~= 0 then
|
|
130
|
+
local originalValueByInstance = self.originalValueByInstance
|
|
131
|
+
if originalValueByInstance == nil then
|
|
132
|
+
originalValueByInstance = mutableWeakLuaMap()
|
|
133
|
+
self.originalValueByInstance = originalValueByInstance
|
|
131
134
|
end
|
|
132
|
-
|
|
135
|
+
originalValueByInstance[entry] = value
|
|
136
|
+
value = self:calculateActualValue(entry)
|
|
133
137
|
end
|
|
134
138
|
end
|
|
135
|
-
|
|
136
|
-
|
|
139
|
+
return self:setActualValue(entry, value)
|
|
140
|
+
end
|
|
141
|
+
function ObjectField.prototype.applyModifier(self, instance, modifier)
|
|
142
|
+
local modifiersByInstance = self.modifiersByInstance
|
|
143
|
+
if modifiersByInstance == nil then
|
|
144
|
+
modifiersByInstance = mutableWeakLuaMap()
|
|
145
|
+
self.modifiersByInstance = modifiersByInstance
|
|
146
|
+
end
|
|
147
|
+
if getOrPut(modifiersByInstance, instance, mutableLinkedSet):add(modifier) then
|
|
148
|
+
local originalValueByInstance = self.originalValueByInstance
|
|
149
|
+
if originalValueByInstance == nil then
|
|
150
|
+
originalValueByInstance = mutableWeakLuaMap()
|
|
151
|
+
self.originalValueByInstance = originalValueByInstance
|
|
152
|
+
end
|
|
153
|
+
originalValueByInstance[instance] = self:getActualValue(instance)
|
|
154
|
+
self:setActualValue(
|
|
155
|
+
instance,
|
|
156
|
+
self:calculateActualValue(instance)
|
|
157
|
+
)
|
|
137
158
|
end
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
159
|
+
end
|
|
160
|
+
function ObjectField.prototype.removeModifier(self, instance, modifier)
|
|
161
|
+
local modifiersByInstance = self.modifiersByInstance
|
|
162
|
+
if modifiersByInstance ~= nil then
|
|
163
|
+
local modifiers = modifiersByInstance[instance]
|
|
164
|
+
if modifiers ~= nil and modifiers:remove(modifier) then
|
|
165
|
+
self:setActualValue(
|
|
166
|
+
instance,
|
|
167
|
+
self:calculateActualValue(instance)
|
|
168
|
+
)
|
|
169
|
+
return true
|
|
142
170
|
end
|
|
143
|
-
self:invokeValueChangeEvent(entry, self, previousValue, value)
|
|
144
171
|
end
|
|
145
|
-
return
|
|
172
|
+
return false
|
|
146
173
|
end
|
|
147
174
|
function ObjectField.prototype.removeValue(self, entry)
|
|
148
175
|
if not warpack.compiletime then
|
|
@@ -164,6 +191,78 @@ function ObjectField.prototype.trySetValue(self, entry, value)
|
|
|
164
191
|
end
|
|
165
192
|
return self:setValue(entry, value)
|
|
166
193
|
end
|
|
194
|
+
function ObjectField.prototype.getActualValue(self, instance)
|
|
195
|
+
local defaultValueByObjectDataEntryId = defaultValueByObjectDataEntryIdByObjectFieldId[self.id]
|
|
196
|
+
if defaultValueByObjectDataEntryId ~= nil or self.isGlobal then
|
|
197
|
+
local defaultValue = (defaultValueByObjectDataEntryId or emptyLuaMap())[self:getObjectDataEntryId(instance)]
|
|
198
|
+
if defaultValue ~= nil or self.isGlobal then
|
|
199
|
+
local ____self_valueByInstance_instance_0 = self.valueByInstance[instance]
|
|
200
|
+
if ____self_valueByInstance_instance_0 == nil then
|
|
201
|
+
____self_valueByInstance_instance_0 = defaultValue
|
|
202
|
+
end
|
|
203
|
+
local ____self_valueByInstance_instance_0_1 = ____self_valueByInstance_instance_0
|
|
204
|
+
if ____self_valueByInstance_instance_0_1 == nil then
|
|
205
|
+
____self_valueByInstance_instance_0_1 = self.defaultValue
|
|
206
|
+
end
|
|
207
|
+
return ____self_valueByInstance_instance_0_1
|
|
208
|
+
end
|
|
209
|
+
end
|
|
210
|
+
local ____temp_2 = self:getNativeFieldValue(instance)
|
|
211
|
+
if ____temp_2 == nil then
|
|
212
|
+
____temp_2 = self.defaultValue
|
|
213
|
+
end
|
|
214
|
+
return ____temp_2
|
|
215
|
+
end
|
|
216
|
+
function ObjectField.prototype.setActualValue(self, instance, value)
|
|
217
|
+
local defaultValueByObjectDataEntryId = defaultValueByObjectDataEntryIdByObjectFieldId[self.id]
|
|
218
|
+
local objectDataEntryId = self:getObjectDataEntryId(instance)
|
|
219
|
+
if defaultValueByObjectDataEntryId ~= nil or self.isGlobal then
|
|
220
|
+
local defaultValue = (defaultValueByObjectDataEntryId or emptyLuaMap())[objectDataEntryId]
|
|
221
|
+
if defaultValue ~= nil or self.isGlobal then
|
|
222
|
+
local ____self_valueByInstance_instance_3 = self.valueByInstance[instance]
|
|
223
|
+
if ____self_valueByInstance_instance_3 == nil then
|
|
224
|
+
____self_valueByInstance_instance_3 = defaultValue
|
|
225
|
+
end
|
|
226
|
+
local ____self_valueByInstance_instance_3_4 = ____self_valueByInstance_instance_3
|
|
227
|
+
if ____self_valueByInstance_instance_3_4 == nil then
|
|
228
|
+
____self_valueByInstance_instance_3_4 = self.defaultValue
|
|
229
|
+
end
|
|
230
|
+
local previousValue = ____self_valueByInstance_instance_3_4
|
|
231
|
+
if value ~= previousValue then
|
|
232
|
+
self.valueByInstance[instance] = value
|
|
233
|
+
self:invokeValueChangeEvent(instance, self, previousValue, value)
|
|
234
|
+
end
|
|
235
|
+
return true
|
|
236
|
+
end
|
|
237
|
+
end
|
|
238
|
+
if not self:hasNativeFieldValue(objectDataEntryId) then
|
|
239
|
+
return false
|
|
240
|
+
end
|
|
241
|
+
local previousValue = self:getNativeFieldValue(instance)
|
|
242
|
+
if value ~= previousValue then
|
|
243
|
+
if not self:setNativeFieldValue(instance, value) then
|
|
244
|
+
return false
|
|
245
|
+
end
|
|
246
|
+
self:invokeValueChangeEvent(instance, self, previousValue, value)
|
|
247
|
+
end
|
|
248
|
+
return true
|
|
249
|
+
end
|
|
250
|
+
function ObjectField.prototype.calculateActualValue(self, instance)
|
|
251
|
+
local ____opt_5 = self.originalValueByInstance
|
|
252
|
+
local originalValue = ____opt_5 and ____opt_5[instance]
|
|
253
|
+
local ____opt_7 = self.modifiersByInstance
|
|
254
|
+
local modifiers = ____opt_7 and ____opt_7[instance]
|
|
255
|
+
if originalValue ~= nil then
|
|
256
|
+
local value = originalValue
|
|
257
|
+
if modifiers ~= nil then
|
|
258
|
+
for modifier in pairs(modifiers) do
|
|
259
|
+
value = modifier(instance, value, originalValue)
|
|
260
|
+
end
|
|
261
|
+
end
|
|
262
|
+
return value
|
|
263
|
+
end
|
|
264
|
+
return self.defaultValue
|
|
265
|
+
end
|
|
167
266
|
function ObjectField.prototype.invokeValueChangeEvent(self, ...)
|
|
168
267
|
self:invokeValueChangeEventRecursive(
|
|
169
268
|
getClass(self),
|
|
@@ -217,37 +316,37 @@ function ObjectArrayField.prototype.getValue(self, entry, index)
|
|
|
217
316
|
if defaultValueByObjectDataEntryId ~= nil then
|
|
218
317
|
local value = defaultValueByObjectDataEntryId[entry.id]
|
|
219
318
|
if value ~= nil then
|
|
220
|
-
local
|
|
319
|
+
local ____temp_10
|
|
221
320
|
if index == nil then
|
|
222
|
-
|
|
321
|
+
____temp_10 = value
|
|
223
322
|
else
|
|
224
|
-
local
|
|
225
|
-
if
|
|
226
|
-
|
|
323
|
+
local ____value_index_9 = value[index + 1]
|
|
324
|
+
if ____value_index_9 == nil then
|
|
325
|
+
____value_index_9 = self.defaultValue
|
|
227
326
|
end
|
|
228
|
-
|
|
327
|
+
____temp_10 = ____value_index_9
|
|
229
328
|
end
|
|
230
|
-
return
|
|
329
|
+
return ____temp_10
|
|
231
330
|
end
|
|
232
331
|
end
|
|
233
332
|
return index == nil and ({}) or self.defaultValue
|
|
234
333
|
end
|
|
235
334
|
local defaultValueByObjectDataEntryId = defaultValueByObjectDataEntryIdByObjectFieldId[self.id]
|
|
236
|
-
if defaultValueByObjectDataEntryId ~= nil then
|
|
237
|
-
local defaultValue = defaultValueByObjectDataEntryId[self:getObjectDataEntryId(entry)]
|
|
238
|
-
if defaultValue ~= nil then
|
|
239
|
-
local value = self.valueByInstance[entry] or defaultValue
|
|
240
|
-
local
|
|
335
|
+
if defaultValueByObjectDataEntryId ~= nil or self.isGlobal then
|
|
336
|
+
local defaultValue = (defaultValueByObjectDataEntryId or emptyLuaMap())[self:getObjectDataEntryId(entry)]
|
|
337
|
+
if defaultValue ~= nil or self.isGlobal then
|
|
338
|
+
local value = self.valueByInstance[entry] or defaultValue or emptyArray()
|
|
339
|
+
local ____temp_12
|
|
241
340
|
if index == nil then
|
|
242
|
-
|
|
341
|
+
____temp_12 = value
|
|
243
342
|
else
|
|
244
|
-
local
|
|
245
|
-
if
|
|
246
|
-
|
|
343
|
+
local ____value_index_11 = value[index + 1]
|
|
344
|
+
if ____value_index_11 == nil then
|
|
345
|
+
____value_index_11 = self.defaultValue
|
|
247
346
|
end
|
|
248
|
-
|
|
347
|
+
____temp_12 = ____value_index_11
|
|
249
348
|
end
|
|
250
|
-
return
|
|
349
|
+
return ____temp_12
|
|
251
350
|
end
|
|
252
351
|
end
|
|
253
352
|
if index ~= nil then
|
|
@@ -292,36 +391,36 @@ function ObjectLevelField.prototype.getValue(self, entry, level)
|
|
|
292
391
|
if defaultValueByObjectDataEntryId ~= nil then
|
|
293
392
|
local valueByLevel = defaultValueByObjectDataEntryId[entry.id]
|
|
294
393
|
if valueByLevel ~= nil then
|
|
295
|
-
local
|
|
296
|
-
if
|
|
297
|
-
|
|
394
|
+
local ____valueByLevel_index_13 = valueByLevel[level + 1]
|
|
395
|
+
if ____valueByLevel_index_13 == nil then
|
|
396
|
+
____valueByLevel_index_13 = self.defaultValue
|
|
298
397
|
end
|
|
299
|
-
return
|
|
398
|
+
return ____valueByLevel_index_13
|
|
300
399
|
end
|
|
301
400
|
end
|
|
302
401
|
return self.defaultValue
|
|
303
402
|
end
|
|
304
403
|
local defaultValueByObjectDataEntryId = defaultValueByObjectDataEntryIdByObjectFieldId[self.id]
|
|
305
|
-
if defaultValueByObjectDataEntryId ~= nil then
|
|
306
|
-
local defaultValueByLevel = defaultValueByObjectDataEntryId[self:getObjectDataEntryId(entry)]
|
|
307
|
-
if defaultValueByLevel ~= nil then
|
|
308
|
-
local
|
|
309
|
-
local
|
|
310
|
-
if
|
|
311
|
-
|
|
404
|
+
if defaultValueByObjectDataEntryId ~= nil or self.isGlobal then
|
|
405
|
+
local defaultValueByLevel = (defaultValueByObjectDataEntryId or emptyLuaMap())[self:getObjectDataEntryId(entry)]
|
|
406
|
+
if defaultValueByLevel ~= nil or self.isGlobal then
|
|
407
|
+
local ____opt_14 = self.valueByInstance[entry]
|
|
408
|
+
local ____temp_16 = ____opt_14 and ____opt_14[level + 1]
|
|
409
|
+
if ____temp_16 == nil then
|
|
410
|
+
____temp_16 = (defaultValueByLevel or emptyArray())[level + 1]
|
|
312
411
|
end
|
|
313
|
-
local
|
|
314
|
-
if
|
|
315
|
-
|
|
412
|
+
local ____temp_16_17 = ____temp_16
|
|
413
|
+
if ____temp_16_17 == nil then
|
|
414
|
+
____temp_16_17 = self.defaultValue
|
|
316
415
|
end
|
|
317
|
-
return
|
|
416
|
+
return ____temp_16_17
|
|
318
417
|
end
|
|
319
418
|
end
|
|
320
|
-
local
|
|
321
|
-
if
|
|
322
|
-
|
|
419
|
+
local ____temp_18 = self:getNativeFieldValue(entry, level)
|
|
420
|
+
if ____temp_18 == nil then
|
|
421
|
+
____temp_18 = self.defaultValue
|
|
323
422
|
end
|
|
324
|
-
return
|
|
423
|
+
return ____temp_18
|
|
325
424
|
end
|
|
326
425
|
function ObjectLevelField.prototype.setValue(self, entry, levelOrValue, value)
|
|
327
426
|
if value == nil then
|
|
@@ -362,23 +461,24 @@ function ObjectLevelField.prototype.setValue(self, entry, levelOrValue, value)
|
|
|
362
461
|
return true
|
|
363
462
|
end
|
|
364
463
|
local defaultValueByObjectDataEntryId = defaultValueByObjectDataEntryIdByObjectFieldId[self.id]
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
464
|
+
local objectDataEntryId = self:getObjectDataEntryId(entry)
|
|
465
|
+
if defaultValueByObjectDataEntryId ~= nil or self.isGlobal then
|
|
466
|
+
local defaultValueByLevel = (defaultValueByObjectDataEntryId or emptyLuaMap())[objectDataEntryId]
|
|
467
|
+
if defaultValueByLevel ~= nil or self.isGlobal then
|
|
368
468
|
local valueByLevel = self.valueByInstance[entry]
|
|
369
469
|
if valueByLevel == nil then
|
|
370
470
|
valueByLevel = {}
|
|
371
471
|
self.valueByInstance[entry] = valueByLevel
|
|
372
472
|
end
|
|
373
|
-
local
|
|
374
|
-
if
|
|
375
|
-
|
|
473
|
+
local ____valueByLevel_index_19 = valueByLevel[level + 1]
|
|
474
|
+
if ____valueByLevel_index_19 == nil then
|
|
475
|
+
____valueByLevel_index_19 = (defaultValueByLevel or emptyArray())[level + 1]
|
|
376
476
|
end
|
|
377
|
-
local
|
|
378
|
-
if
|
|
379
|
-
|
|
477
|
+
local ____valueByLevel_index_19_20 = ____valueByLevel_index_19
|
|
478
|
+
if ____valueByLevel_index_19_20 == nil then
|
|
479
|
+
____valueByLevel_index_19_20 = self.defaultValue
|
|
380
480
|
end
|
|
381
|
-
local previousValue =
|
|
481
|
+
local previousValue = ____valueByLevel_index_19_20
|
|
382
482
|
if value ~= previousValue then
|
|
383
483
|
valueByLevel[level + 1] = value
|
|
384
484
|
self:invokeValueChangeEvent(
|
|
@@ -392,7 +492,7 @@ function ObjectLevelField.prototype.setValue(self, entry, levelOrValue, value)
|
|
|
392
492
|
return true
|
|
393
493
|
end
|
|
394
494
|
end
|
|
395
|
-
if not self:hasNativeFieldValue(
|
|
495
|
+
if not self:hasNativeFieldValue(objectDataEntryId) then
|
|
396
496
|
return false
|
|
397
497
|
end
|
|
398
498
|
local previousValue = self:getNativeFieldValue(entry, level)
|
package/engine/random.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/** @noSelfInFile */
|
|
2
|
+
import { ReadonlyNonEmptyArray } from "../utility/types";
|
|
2
3
|
export declare const randomAngle: () => number;
|
|
3
4
|
export declare const randomInteger: {
|
|
4
5
|
(upperBound?: number): number;
|
|
@@ -9,3 +10,11 @@ export declare const randomFloat: {
|
|
|
9
10
|
(lowerBound: number, upperBound: number): number;
|
|
10
11
|
};
|
|
11
12
|
export declare const randomXY: (centerX: number, centerY: number, range: number) => LuaMultiReturn<[x: number, y: number]>;
|
|
13
|
+
export declare const randomElement: {
|
|
14
|
+
<T>(array: ReadonlyNonEmptyArray<T>): T;
|
|
15
|
+
<T>(array: ReadonlyArray<T>): T | undefined;
|
|
16
|
+
};
|
|
17
|
+
export declare const random: {
|
|
18
|
+
<T>(element: T, ...elements: T[]): T;
|
|
19
|
+
<T>(...elements: T[]): T | undefined;
|
|
20
|
+
};
|
package/engine/random.lua
CHANGED
|
@@ -4,6 +4,7 @@ local MAXIMUM_INTEGER = ____math.MAXIMUM_INTEGER
|
|
|
4
4
|
local PI = ____math.PI
|
|
5
5
|
local getRandomInt = GetRandomInt
|
|
6
6
|
local getRandomReal = GetRandomReal
|
|
7
|
+
local select = _G.select
|
|
7
8
|
local cos = math.cos
|
|
8
9
|
local sin = math.sin
|
|
9
10
|
local sqrt = math.sqrt
|
|
@@ -15,4 +16,16 @@ ____exports.randomXY = function(centerX, centerY, range)
|
|
|
15
16
|
local t = getRandomReal(0, 1) * 2 * PI
|
|
16
17
|
return centerX + r * cos(t), centerY + r * sin(t)
|
|
17
18
|
end
|
|
19
|
+
____exports.randomElement = function(array)
|
|
20
|
+
return array[getRandomInt(1, #array)]
|
|
21
|
+
end
|
|
22
|
+
____exports.random = function(...)
|
|
23
|
+
return (select(
|
|
24
|
+
getRandomInt(
|
|
25
|
+
1,
|
|
26
|
+
select("#", ...)
|
|
27
|
+
),
|
|
28
|
+
...
|
|
29
|
+
))
|
|
30
|
+
end
|
|
18
31
|
return ____exports
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** @noSelfInFile */
|
|
2
|
+
import { StandardSoundPresetId } from "../../object-data/entry/sound-preset";
|
|
3
|
+
export declare const ABOMINATION_PISSED_SOUND_PRESET_ID: StandardSoundPresetId;
|
|
4
|
+
export declare const ABOMINATION_READY_SOUND_PRESET_ID: StandardSoundPresetId;
|
|
5
|
+
export declare const ABOMINATION_WAR_CRY_SOUND_PRESET_ID: StandardSoundPresetId;
|
|
6
|
+
export declare const AXE_MEDIUM_CHOP_WOOD_SOUND_PRESET_ID: StandardSoundPresetId;
|
|
7
|
+
export declare const IMPALE_SOUND_PRESET_ID: StandardSoundPresetId;
|
|
8
|
+
export declare const IMPALE_HIT_SOUND_PRESET_ID: StandardSoundPresetId;
|
|
9
|
+
export declare const IMPALE_LAND_SOUND_PRESET_ID: StandardSoundPresetId;
|
|
10
|
+
export declare const IMPALE_CAST_SOUND_PRESET_ID: StandardSoundPresetId;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
local ____exports = {}
|
|
2
|
+
____exports.ABOMINATION_PISSED_SOUND_PRESET_ID = "AbominationPissed"
|
|
3
|
+
____exports.ABOMINATION_READY_SOUND_PRESET_ID = "AbominationReady"
|
|
4
|
+
____exports.ABOMINATION_WAR_CRY_SOUND_PRESET_ID = "AbominationWarcry"
|
|
5
|
+
____exports.AXE_MEDIUM_CHOP_WOOD_SOUND_PRESET_ID = "AxeMediumChopWood"
|
|
6
|
+
____exports.IMPALE_SOUND_PRESET_ID = "Impale"
|
|
7
|
+
____exports.IMPALE_HIT_SOUND_PRESET_ID = "ImpaleHit"
|
|
8
|
+
____exports.IMPALE_LAND_SOUND_PRESET_ID = "ImpaleLand"
|
|
9
|
+
____exports.IMPALE_CAST_SOUND_PRESET_ID = "ImpaleCast"
|
|
10
|
+
return ____exports
|
|
@@ -687,6 +687,8 @@ export declare const DISABLE_OTHER_ABILITIES_ABILITY_BOOLEAN_LEVEL_FIELD: Abilit
|
|
|
687
687
|
export declare const ALLOW_BOUNTY_ABILITY_BOOLEAN_LEVEL_FIELD: AbilityBooleanLevelField & symbol;
|
|
688
688
|
export declare const ICON_NORMAL_ABILITY_STRING_LEVEL_FIELD: AbilityStringLevelField & symbol;
|
|
689
689
|
export declare const CASTER_EFFECT_MODEL_PATHS_ABILITY_STRING_ARRAY_FIELD: AbilityStringArrayField & symbol;
|
|
690
|
+
export declare const CASTER_EFFECT_FIRST_ATTACHMENT_POINT_STRING_FIELD: AbilityStringField & symbol;
|
|
691
|
+
export declare const CASTER_EFFECT_SECOND_ATTACHMENT_POINT_STRING_FIELD: AbilityStringField & symbol;
|
|
690
692
|
export declare const TARGET_EFFECT_MODEL_PATHS_ABILITY_STRING_ARRAY_FIELD: AbilityStringArrayField & symbol;
|
|
691
693
|
export declare const TARGET_EFFECT_FIRST_ATTACHMENT_POINT_STRING_FIELD: AbilityStringField & symbol;
|
|
692
694
|
export declare const TARGET_EFFECT_SECOND_ATTACHMENT_POINT_STRING_FIELD: AbilityStringField & symbol;
|
|
@@ -698,6 +698,8 @@ ____exports.DISABLE_OTHER_ABILITIES_ABILITY_BOOLEAN_LEVEL_FIELD = AbilityBoolean
|
|
|
698
698
|
____exports.ALLOW_BOUNTY_ABILITY_BOOLEAN_LEVEL_FIELD = AbilityBooleanLevelField:create(fourCC("Ntm4"))
|
|
699
699
|
____exports.ICON_NORMAL_ABILITY_STRING_LEVEL_FIELD = AbilityStringLevelField:create(fourCC("aart"))
|
|
700
700
|
____exports.CASTER_EFFECT_MODEL_PATHS_ABILITY_STRING_ARRAY_FIELD = AbilityStringArrayField:create(fourCC("acat"))
|
|
701
|
+
____exports.CASTER_EFFECT_FIRST_ATTACHMENT_POINT_STRING_FIELD = AbilityStringField:create(fourCC("acap"))
|
|
702
|
+
____exports.CASTER_EFFECT_SECOND_ATTACHMENT_POINT_STRING_FIELD = AbilityStringField:create(fourCC("aca1"))
|
|
701
703
|
____exports.TARGET_EFFECT_MODEL_PATHS_ABILITY_STRING_ARRAY_FIELD = AbilityStringArrayField:create(fourCC("atat"))
|
|
702
704
|
____exports.TARGET_EFFECT_FIRST_ATTACHMENT_POINT_STRING_FIELD = AbilityStringField:create(fourCC("ata0"))
|
|
703
705
|
____exports.TARGET_EFFECT_SECOND_ATTACHMENT_POINT_STRING_FIELD = AbilityStringField:create(fourCC("ata1"))
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** @noSelfInFile */
|
|
2
|
+
import { UnitClassificationsField, UnitPropulsionWindowField } from "../../object-field/unit";
|
|
3
|
+
export declare const PROPULSION_WINDOW_UNIT_FLOAT_FIELD: UnitPropulsionWindowField & symbol;
|
|
4
|
+
export declare const UNIT_CLASSIFICATIONS_FIELD: UnitClassificationsField & symbol;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
local ____exports = {}
|
|
2
|
+
local ____unit = require("engine.object-field.unit")
|
|
3
|
+
local UnitClassificationsField = ____unit.UnitClassificationsField
|
|
4
|
+
local UnitPropulsionWindowField = ____unit.UnitPropulsionWindowField
|
|
5
|
+
____exports.PROPULSION_WINDOW_UNIT_FLOAT_FIELD = UnitPropulsionWindowField:create(fourCC("urpw"))
|
|
6
|
+
____exports.UNIT_CLASSIFICATIONS_FIELD = UnitClassificationsField:create(fourCC("utyp"))
|
|
7
|
+
return ____exports
|
package/engine/text-tag.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/** @noSelfInFile */
|
|
2
2
|
import { Color } from "../core/types/color";
|
|
3
|
+
import { Unit } from "./internal/unit";
|
|
4
|
+
import { AbstractDestroyable, Destructor } from "../destroyable";
|
|
3
5
|
export type TextTagPreset = {
|
|
4
6
|
fadepoint: number;
|
|
5
7
|
lifespan: number;
|
|
@@ -10,9 +12,39 @@ export type TextTagPreset = {
|
|
|
10
12
|
velocityY: number;
|
|
11
13
|
color: Color;
|
|
12
14
|
};
|
|
13
|
-
|
|
14
|
-
|
|
15
|
+
declare const enum TextTagPropertyKey {
|
|
16
|
+
UNIT = 100,
|
|
17
|
+
HANDLE = 101,
|
|
18
|
+
CONFIGURATION = 102,
|
|
19
|
+
TEXT = 103,
|
|
20
|
+
FONT_SIZE = 104,
|
|
21
|
+
COLOR = 105,
|
|
22
|
+
X = 106,
|
|
23
|
+
Y = 107
|
|
24
|
+
}
|
|
25
|
+
export declare class TextTag extends AbstractDestroyable {
|
|
26
|
+
private [TextTagPropertyKey.HANDLE]?;
|
|
27
|
+
private [TextTagPropertyKey.CONFIGURATION]?;
|
|
28
|
+
private [TextTagPropertyKey.TEXT]?;
|
|
29
|
+
private [TextTagPropertyKey.FONT_SIZE]?;
|
|
30
|
+
private [TextTagPropertyKey.COLOR]?;
|
|
31
|
+
private [TextTagPropertyKey.UNIT]?;
|
|
32
|
+
private [TextTagPropertyKey.X]?;
|
|
33
|
+
private [TextTagPropertyKey.Y]?;
|
|
15
34
|
private constructor();
|
|
35
|
+
protected onDestroy(): Destructor;
|
|
36
|
+
get text(): string;
|
|
37
|
+
set text(text: string);
|
|
38
|
+
get fontSize(): number;
|
|
39
|
+
set fontSize(fontSize: number);
|
|
40
|
+
get color(): Color;
|
|
41
|
+
set color(color: Color);
|
|
42
|
+
get unit(): Unit | undefined;
|
|
43
|
+
set unit(unit: Unit | undefined);
|
|
44
|
+
get x(): number;
|
|
45
|
+
set x(x: number);
|
|
46
|
+
get y(): number;
|
|
47
|
+
set y(y: number);
|
|
16
48
|
static BASE: Readonly<TextTagPreset>;
|
|
17
49
|
static BASH: Readonly<TextTagPreset>;
|
|
18
50
|
static CRITICAL_STRIKE: Readonly<TextTagPreset>;
|
|
@@ -22,4 +54,6 @@ export declare class TextTag {
|
|
|
22
54
|
static MISS: Readonly<TextTagPreset>;
|
|
23
55
|
static SHADOW_STRIKE: Readonly<TextTagPreset>;
|
|
24
56
|
static flash(configuration: Readonly<TextTagPreset>, text: string, x: number, y: number, z?: number): void;
|
|
57
|
+
static create(configuration: Readonly<TextTagPreset>, text: string, unit: Unit): TextTag;
|
|
25
58
|
}
|
|
59
|
+
export {};
|