summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--rabbit-bugfix/CHANGELOG.md1
-rw-r--r--rabbit-bugfix/hooks/load.lua5
-rw-r--r--rabbit-bugfix/init.lua3
-rw-r--r--rabbit-bugfix/superload/data/timed_effects/magical.lua47
4 files changed, 52 insertions, 4 deletions
diff --git a/rabbit-bugfix/CHANGELOG.md b/rabbit-bugfix/CHANGELOG.md
index 92b688e..a1373b1 100644
--- a/rabbit-bugfix/CHANGELOG.md
+++ b/rabbit-bugfix/CHANGELOG.md
@@ -10,3 +10,4 @@ This format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/)
 
 - Passives update when taking Adept or equipping/unequipping talents\_mastery\_bonus items.
   (This change by yutio888 was merged to the t-engine4 master branch but wasn't included in tome-1.7)
+- Rime Wraith jumps when target is killed instead of disappearing entirely.
diff --git a/rabbit-bugfix/hooks/load.lua b/rabbit-bugfix/hooks/load.lua
index 7ae7c8d..55290e7 100644
--- a/rabbit-bugfix/hooks/load.lua
+++ b/rabbit-bugfix/hooks/load.lua
@@ -1,10 +1,9 @@
 class:bindHook("ToME:load", function(self, data)
 	local Talents = require 'engine.interface.ActorTalents'
-	local TD = Talents.talents_def
 
 	-- update passives when adept is taken
-	if TD.T_ADEPT then
-		TD.T_ADEPT.passives = function(self, t, p)
+	if Talents.talents_def.T_ADEPT then
+		Talents.talents_def.T_ADEPT.passives = function(self, t, p)
 			self:talentTemporaryValue(p, "all_talents_bonus_level", 1.5)
 
 			if not self._updating_adept then
diff --git a/rabbit-bugfix/init.lua b/rabbit-bugfix/init.lua
index 4172d02..8b4dbcf 100644
--- a/rabbit-bugfix/init.lua
+++ b/rabbit-bugfix/init.lua
@@ -1,7 +1,7 @@
 long_name = "Rabbit Bugfixes"
 short_name = "rabbit-bugfix"
 for_module = "tome"
-addon_version = {0,0,1}
+addon_version = {0,1,0}
 version = {1,7,6}
 weight = 0
 author = {'Rabbit Whispers'}
@@ -9,6 +9,7 @@ homepage = {'starfall.systems'}
 description = [[Rabbit Whispers' bugfix collection:
 
 - Adept and talents_mastery_bonus items now update passives (h/t yutio888)
+- Rime Wraith jumps when target is killed
 ]]
 tags = {}
 
diff --git a/rabbit-bugfix/superload/data/timed_effects/magical.lua b/rabbit-bugfix/superload/data/timed_effects/magical.lua
new file mode 100644
index 0000000..c9d2e8c
--- /dev/null
+++ b/rabbit-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