File src/abla.j changed (mode: 100644) (index 6e4502d..f671138) |
... |
... |
globals |
21 |
21 |
constant real ABLA_DAMAGE_AMOUNT_MIN = 0.0 |
constant real ABLA_DAMAGE_AMOUNT_MIN = 0.0 |
22 |
22 |
constant real ABLA_HEAL_AMOUNT_MAX = 100000.0 |
constant real ABLA_HEAL_AMOUNT_MAX = 100000.0 |
23 |
23 |
constant real ABLA_HEAL_AMOUNT_MIN = 0.0 |
constant real ABLA_HEAL_AMOUNT_MIN = 0.0 |
|
24 |
|
|
24 |
25 |
integer abla_super_abilityid = 0 |
integer abla_super_abilityid = 0 |
25 |
26 |
real abla_super_damage = 0.0 |
real abla_super_damage = 0.0 |
26 |
27 |
real abla_super_heal = 0.0 |
real abla_super_heal = 0.0 |
27 |
28 |
unit abla_super_caster = null |
unit abla_super_caster = null |
|
29 |
|
|
|
30 |
|
effect array abla_channel_effect |
|
31 |
|
unit array abla_channel_unit |
28 |
32 |
endglobals |
endglobals |
29 |
33 |
|
|
30 |
34 |
// src/abla.j functions |
// src/abla.j functions |
|
... |
... |
function abla_apply takes integer abilityid, unit caster, location destination, |
178 |
182 |
call RemoveLocation(destination) |
call RemoveLocation(destination) |
179 |
183 |
endfunction |
endfunction |
180 |
184 |
|
|
|
185 |
|
function abla_channel_effect_create takes integer ability_id, unit caster, location target returns effect |
|
186 |
|
local effect e = null |
|
187 |
|
local integer i = 0 |
|
188 |
|
local boolean flag = false |
|
189 |
|
|
|
190 |
|
if null == caster then |
|
191 |
|
return null |
|
192 |
|
endif |
|
193 |
|
|
|
194 |
|
if null == target then |
|
195 |
|
return null |
|
196 |
|
endif |
|
197 |
|
|
|
198 |
|
set i = 0 |
|
199 |
|
loop |
|
200 |
|
exitwhen i >= JASS_MAX_ARRAY_SIZE or flag |
|
201 |
|
if null == abla_channel_unit[i] then |
|
202 |
|
set abla_channel_unit[i] = caster |
|
203 |
|
call DestroyEffect(abla_channel_effect[i]) |
|
204 |
|
set e = AddSpellEffectByIdLoc(ability_id, EFFECT_TYPE_AREA_EFFECT, target) |
|
205 |
|
set abla_channel_effect[i] = e |
|
206 |
|
set flag = true |
|
207 |
|
endif |
|
208 |
|
set i = i + 1 |
|
209 |
|
endloop |
|
210 |
|
|
|
211 |
|
return e |
|
212 |
|
endfunction |
|
213 |
|
|
|
214 |
|
function abla_channel_effect_destroy takes unit caster returns nothing |
|
215 |
|
local integer i = 0 |
|
216 |
|
local integer j = 0 |
|
217 |
|
local boolean flag = false |
|
218 |
|
|
|
219 |
|
set i = 0 |
|
220 |
|
loop |
|
221 |
|
exitwhen i >= JASS_MAX_ARRAY_SIZE or flag |
|
222 |
|
set flag = abla_channel_unit[i] == caster or flag |
|
223 |
|
if flag then |
|
224 |
|
call DestroyEffect(abla_channel_effect[i]) |
|
225 |
|
set abla_channel_unit[i] = null |
|
226 |
|
endif |
|
227 |
|
set i = i + 1 |
|
228 |
|
endloop |
|
229 |
|
endfunction |
|
230 |
|
|
181 |
231 |
function abla_trig_filter takes nothing returns boolean |
function abla_trig_filter takes nothing returns boolean |
182 |
232 |
return ABLA_ABILITY_ID == GetSpellAbilityId() |
return ABLA_ABILITY_ID == GetSpellAbilityId() |
183 |
233 |
endfunction |
endfunction |
184 |
234 |
|
|
185 |
|
function abla_trig_action takes nothing returns nothing |
|
|
235 |
|
function abla_channel_action takes nothing returns nothing |
|
236 |
|
local integer abilityid = GetSpellAbilityId() |
|
237 |
|
local unit caster = GetSpellAbilityUnit() |
|
238 |
|
local effect e = null |
|
239 |
|
local location loc = GetSpellTargetLoc() |
|
240 |
|
set e = abla_channel_effect_create(abilityid, caster, loc) |
|
241 |
|
call RemoveLocation(loc) |
|
242 |
|
endfunction |
|
243 |
|
|
|
244 |
|
function abla_endcast_action takes nothing returns nothing |
|
245 |
|
local unit caster = GetSpellAbilityUnit() |
|
246 |
|
// The channel effect destructor must be triggered by SPELL_ENDCAST event. |
|
247 |
|
// If it's called by the same action as for example SPELL_EFFECT, runtime errors occurr. |
|
248 |
|
// The exact cause is unclear and the investigation isn't worth it at the time. |
|
249 |
|
call abla_channel_effect_destroy(caster) |
|
250 |
|
endfunction |
|
251 |
|
|
|
252 |
|
function abla_effect_action takes nothing returns nothing |
186 |
253 |
local integer abilityid = 0 |
local integer abilityid = 0 |
187 |
|
local unit caster = null |
|
|
254 |
|
local unit caster = GetSpellAbilityUnit() |
188 |
255 |
local location destination = null |
local location destination = null |
189 |
256 |
local real area = 0.0 |
local real area = 0.0 |
190 |
257 |
local real damage = 0.0 |
local real damage = 0.0 |
|
... |
... |
endfunction |
206 |
273 |
|
|
207 |
274 |
function abla_init takes nothing returns nothing |
function abla_init takes nothing returns nothing |
208 |
275 |
local conditionfunc filter = Condition(function abla_trig_filter) |
local conditionfunc filter = Condition(function abla_trig_filter) |
209 |
|
call spell_trig_init(filter, function abla_trig_action) |
|
|
276 |
|
local trigger t0 = null |
|
277 |
|
local trigger t2 = null |
|
278 |
|
local trigger t4 = null |
|
279 |
|
local player p = null |
|
280 |
|
local integer i = 0 |
|
281 |
|
|
|
282 |
|
set t0 = CreateTrigger() |
|
283 |
|
set t2 = CreateTrigger() |
|
284 |
|
set t4 = CreateTrigger() |
|
285 |
|
set i = 0 |
|
286 |
|
loop |
|
287 |
|
// bj_MAX_PLAYERS is max amount of users. |
|
288 |
|
// bj_MAX_PLAYER_SLOTS is max amount players, including neutral utility presets. |
|
289 |
|
exitwhen i >= bj_MAX_PLAYER_SLOTS |
|
290 |
|
set p = Player(i) |
|
291 |
|
call TriggerRegisterPlayerUnitEvent(t0, p, EVENT_PLAYER_UNIT_SPELL_CHANNEL, null) |
|
292 |
|
call TriggerRegisterPlayerUnitEvent(t2, p, EVENT_PLAYER_UNIT_SPELL_EFFECT, null) |
|
293 |
|
call TriggerRegisterPlayerUnitEvent(t4, p, EVENT_PLAYER_UNIT_SPELL_ENDCAST, null) |
|
294 |
|
set i = i + 1 |
|
295 |
|
endloop |
|
296 |
|
|
|
297 |
|
if filter != null then |
|
298 |
|
call TriggerAddCondition(t0, filter) |
|
299 |
|
call TriggerAddCondition(t2, filter) |
|
300 |
|
call TriggerAddCondition(t4, filter) |
|
301 |
|
endif |
|
302 |
|
call TriggerAddAction(t0, function abla_channel_action) |
|
303 |
|
call TriggerAddAction(t2, function abla_effect_action) |
|
304 |
|
call TriggerAddAction(t4, function abla_endcast_action) |
210 |
305 |
endfunction |
endfunction |