1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
local _M = loadPrevious(...)
local rime_wraith_jump = function(self, eff)
-- JUMP!
local list = table.values(self:projectCollect({type="ball", radius=10, selffire=false}, self.x, self.y, map.ACTOR))
if #list == 0 then return end
local has = function(t) return t.target:hasEffect(t.target.EFF_HOARFROST_GOOD) or t.target:hasEffect(t.target.EFF_HOARFROST_BAD) end
local has_wraith = function(t) return t:hasEffect(t.EFF_RIME_WRAITH) or t:hasEffect(t.EFF_RIME_WRAITH_GELID_HOST) end
local list_has, list_not = {}, {}
for _, t in ipairs(list) do if has(t) then list_has[#list_has+1] = t else list_not[#list_not+1] = t end end
local use_list = #list_not > 0 and list_not or list_has
local target
if eff.src:knowTalent(eff.src.T_FRIGID_PLUNGE) then
table.sort(use_list, "dist")
while #use_list > 0 do
target = table.remove(use_list).target
if not (has_wraith(target) and #use_list > 0) then break end
end
else
while #use_list > 0 do
target = rng.table(use_list).target
if not (has_wraith(target) and #user_list > 0) then break end
end
end
self:removeEffect(eff.effect_id) -- is this still necessary? self should be dead, after all
target:setEffect(eff.effect_id, eff.dur, eff)
game.level.map:particleEmitter(self.x, self.y, 1, "rime_wraith_move", {tx=target.x-self.x, ty=target.y-self.y})
if eff.src:knowTalent(eff.src.T_FRIGID_PLUNGE) then
local heal = eff.src:callTalent(eff.src.T_FRIGID_PLUNGE, "getHeal")
local dam = eff.src:callTalent(eff.src.T_FRIGID_PLUNGE, "getDamage")
eff.src.projectApply({type="beam", range=10, x=self.x, y=self.y}, target.x, target.y, Map.ACTOR, function(m)
if eff.src.reactionToward(m) <0 then
eff.src:attr("damage_shield_penetrate", 100)
pcall(function() DamageType:get(DamageType.COLD).projector(eff.src, m.x, m.y, DamageType.COLD, dam) end)
eff.src:attr("damage_shield_penetrate", -100)
else
m:heal(heal, eff.src)
end
end)
end
end
TemporaryEffects.tempeffect_def.EFF_RIME_WRAITH.callbackOnDeath = rime_wraith_jump
TemporaryEffects.tempeffect_def.EFF_RIME_WRAITH_GELID_HOST.callbackOnDeath = rime_wraith_jump
return _M
|