File src/atun.j changed (mode: 100644) (index 99448e7..540ab34) |
... |
... |
globals |
7 |
7 |
constant real ATUN_RESTORE_MANA_COEF = 25.0 |
constant real ATUN_RESTORE_MANA_COEF = 25.0 |
8 |
8 |
constant real ATUN_RESTORE_MANA_MIN = 0.0 |
constant real ATUN_RESTORE_MANA_MIN = 0.0 |
9 |
9 |
constant real ATUN_RESTORE_MANA_MAX = 65536.0 |
constant real ATUN_RESTORE_MANA_MAX = 65536.0 |
|
10 |
|
|
|
11 |
|
ubersplat array atun_decal |
|
12 |
|
timer array atun_decal_timer |
|
13 |
|
effect array atun_decal_effect |
|
14 |
|
integer atun_decal_head = 0 |
10 |
15 |
endglobals |
endglobals |
11 |
16 |
|
|
|
17 |
|
function atun_decal_destroy takes integer i returns nothing |
|
18 |
|
local integer p = 0 |
|
19 |
|
local integer q = 0 |
|
20 |
|
local integer j = 0 |
|
21 |
|
|
|
22 |
|
call DestroyTimer(atun_decal_timer[i]) |
|
23 |
|
call DestroyUbersplat(atun_decal[i]) |
|
24 |
|
call DestroyEffect(atun_decal_effect[i]) |
|
25 |
|
|
|
26 |
|
set p = i |
|
27 |
|
set j = IMinBJ(IMaxBJ(0, atun_decal_head), JASS_MAX_ARRAY_SIZE - 1) |
|
28 |
|
loop |
|
29 |
|
exitwhen p >= j or q >= j |
|
30 |
|
set q = p + 1 |
|
31 |
|
set atun_decal[p] = atun_decal[q] |
|
32 |
|
set atun_decal_timer[p] = atun_decal_timer[q] |
|
33 |
|
set atun_decal_effect[p] = atun_decal_effect[q] |
|
34 |
|
set p = p + 1 |
|
35 |
|
endloop |
|
36 |
|
endfunction |
|
37 |
|
|
|
38 |
|
function atun_decal_timer_callback takes nothing returns nothing |
|
39 |
|
local timer t = GetExpiredTimer() |
|
40 |
|
local integer i = 0 |
|
41 |
|
local integer j = 0 |
|
42 |
|
|
|
43 |
|
set j = IMinBJ(IMaxBJ(0, atun_decal_head), JASS_MAX_ARRAY_SIZE - 1) |
|
44 |
|
loop |
|
45 |
|
exitwhen i >= j |
|
46 |
|
if t == atun_decal_timer[i] then |
|
47 |
|
call atun_decal_destroy(i) |
|
48 |
|
set atun_decal_head = atun_decal_head - 1 |
|
49 |
|
endif |
|
50 |
|
set i = i + 1 |
|
51 |
|
endloop |
|
52 |
|
endfunction |
|
53 |
|
|
|
54 |
|
function atun_decal_create takes location loc, real duration_sec returns integer |
|
55 |
|
local timer t = null |
|
56 |
|
local ubersplat splat = null |
|
57 |
|
local real x = 0.0 |
|
58 |
|
local real y = 0.0 |
|
59 |
|
local effect e = null |
|
60 |
|
|
|
61 |
|
if null == loc then |
|
62 |
|
return 0 |
|
63 |
|
endif |
|
64 |
|
|
|
65 |
|
if duration_sec < 1.0 then |
|
66 |
|
return 0 |
|
67 |
|
endif |
|
68 |
|
|
|
69 |
|
if atun_decal_head >= JASS_MAX_ARRAY_SIZE then |
|
70 |
|
return 0 |
|
71 |
|
endif |
|
72 |
|
|
|
73 |
|
set x = GetLocationX(loc) |
|
74 |
|
set y = GetLocationY(loc) |
|
75 |
|
set splat = CreateUbersplat(x, y, "HCRT", 255, 255, 255, 255, false, false) |
|
76 |
|
//call FinishUbersplat(splat) |
|
77 |
|
call ShowUbersplat(splat, true) |
|
78 |
|
call SetUbersplatRenderAlways(splat, true) |
|
79 |
|
|
|
80 |
|
set t = CreateTimer() |
|
81 |
|
set atun_decal_timer[atun_decal_head] = t |
|
82 |
|
set atun_decal[atun_decal_head] = splat |
|
83 |
|
|
|
84 |
|
set e = AddSpellEffectByIdLoc(ATUN_ABILITY_ID, EFFECT_TYPE_SPECIAL, loc) |
|
85 |
|
set atun_decal_effect[atun_decal_head] = e |
|
86 |
|
|
|
87 |
|
set atun_decal_head = atun_decal_head + 1 |
|
88 |
|
|
|
89 |
|
call TimerStart(t, duration_sec, false, function atun_decal_timer_callback) |
|
90 |
|
|
|
91 |
|
return GetHandleId(t) |
|
92 |
|
endfunction |
|
93 |
|
|
12 |
94 |
function atun_mana_restore_amount_get takes unit caster, unit victim returns real |
function atun_mana_restore_amount_get takes unit caster, unit victim returns real |
13 |
95 |
local effect e = null |
local effect e = null |
14 |
96 |
|
|
|
... |
... |
function atun_mana_restore_amount_get takes unit caster, unit victim returns rea |
50 |
132 |
// TODO src/atun.j: add floating test showing amount of mana restored |
// TODO src/atun.j: add floating test showing amount of mana restored |
51 |
133 |
set t = GetUnitLoc(victim) |
set t = GetUnitLoc(victim) |
52 |
134 |
set e = AddSpellEffectByIdLoc(ATUN_ABILITY_ID, EFFECT_TYPE_TARGET, t) |
set e = AddSpellEffectByIdLoc(ATUN_ABILITY_ID, EFFECT_TYPE_TARGET, t) |
53 |
|
call RemoveLocation(t) |
|
54 |
135 |
call DestroyEffect(e) |
call DestroyEffect(e) |
55 |
136 |
// Assume the victim is dead at this point. |
// Assume the victim is dead at this point. |
56 |
137 |
// Killing and exploding the unit is for graphics only here. |
// Killing and exploding the unit is for graphics only here. |
|
... |
... |
function atun_mana_restore_amount_get takes unit caster, unit victim returns rea |
58 |
139 |
call SetUnitExploded(victim, true) |
call SetUnitExploded(victim, true) |
59 |
140 |
call KillUnit(victim) |
call KillUnit(victim) |
60 |
141 |
call ShowUnit(victim, false) |
call ShowUnit(victim, false) |
|
142 |
|
call atun_decal_create(t, 12.0) |
61 |
143 |
endif |
endif |
|
144 |
|
call RemoveLocation(t) |
62 |
145 |
endif |
endif |
63 |
146 |
|
|
64 |
147 |
return mana |
return mana |