summary refs log tree commit diff
path: root/whispers-bugfix/superload/data/timed_effects/magical.lua
diff options
context:
space:
mode:
authorRabbit Whispers <us@starfall.systems>2025-06-20 22:00:16 -0500
committerRabbit Whispers <us@starfall.systems>2025-06-20 23:29:33 -0500
commit893937108bdd308f6ad35b415fbc1dcb1df03e91 (patch)
tree08f134d4ba5ddff3eddbcec1d1eac1588b258ecd /whispers-bugfix/superload/data/timed_effects/magical.lua
parent4a4709db06185acceaa9aa22ae449d193115a1f8 (diff)
whispers-qol: patch auto-transmo-gems to ignore stun resist and damage pen gems HEAD main
Diffstat (limited to 'whispers-bugfix/superload/data/timed_effects/magical.lua')
-rw-r--r--whispers-bugfix/superload/data/timed_effects/magical.lua47
1 files changed, 47 insertions, 0 deletions
diff --git a/whispers-bugfix/superload/data/timed_effects/magical.lua b/whispers-bugfix/superload/data/timed_effects/magical.lua
new file mode 100644
index 0000000..c9d2e8c
--- /dev/null
+++ b/whispers-bugfix/superload/data/timed_effects/magical.lua
@@ -0,0 +1,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