summary refs log tree commit diff
path: root/whispers-bugfix
diff options
context:
space:
mode:
Diffstat (limited to 'whispers-bugfix')
-rw-r--r--whispers-bugfix/CHANGELOG.md13
-rw-r--r--whispers-bugfix/data/.keep0
-rw-r--r--whispers-bugfix/hooks/load.lua16
-rw-r--r--whispers-bugfix/init.lua19
-rw-r--r--whispers-bugfix/overload/.keep0
-rw-r--r--whispers-bugfix/superload/data/timed_effects/magical.lua47
-rw-r--r--whispers-bugfix/superload/mod/class/Actor.lua11
7 files changed, 106 insertions, 0 deletions
diff --git a/whispers-bugfix/CHANGELOG.md b/whispers-bugfix/CHANGELOG.md
new file mode 100644
index 0000000..a1373b1
--- /dev/null
+++ b/whispers-bugfix/CHANGELOG.md
@@ -0,0 +1,13 @@
+# Changelog
+
+All ntoable changes to this project will be documented in this file.
+
+This format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
+
+## [Unreleased]
+
+### Added
+
+- 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/whispers-bugfix/data/.keep b/whispers-bugfix/data/.keep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/whispers-bugfix/data/.keep
diff --git a/whispers-bugfix/hooks/load.lua b/whispers-bugfix/hooks/load.lua
new file mode 100644
index 0000000..55290e7
--- /dev/null
+++ b/whispers-bugfix/hooks/load.lua
@@ -0,0 +1,16 @@
+class:bindHook("ToME:load", function(self, data)
+	local Talents = require 'engine.interface.ActorTalents'
+
+	-- update passives when adept is taken
+	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
+				self._updating_adept = true
+				self:updateAllTalentsPassives()
+				self._updating_adept = nil
+			end
+		end
+	end
+end)
diff --git a/whispers-bugfix/init.lua b/whispers-bugfix/init.lua
new file mode 100644
index 0000000..f7f3976
--- /dev/null
+++ b/whispers-bugfix/init.lua
@@ -0,0 +1,19 @@
+long_name = "Whispers' Bugfixes"
+short_name = "whispers_bugfix"
+for_module = "tome"
+addon_version = {0,1,0}
+version = {1,7,6}
+weight = 0
+author = {'Rabbit Whispers'}
+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 = {}
+
+data = false
+hooks = true
+overload = false
+superload = true
diff --git a/whispers-bugfix/overload/.keep b/whispers-bugfix/overload/.keep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/whispers-bugfix/overload/.keep
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
diff --git a/whispers-bugfix/superload/mod/class/Actor.lua b/whispers-bugfix/superload/mod/class/Actor.lua
new file mode 100644
index 0000000..6084cd6
--- /dev/null
+++ b/whispers-bugfix/superload/mod/class/Actor.lua
@@ -0,0 +1,11 @@
+local _M = loadPrevious(...)
+
+local base_onTemporaryValueChange = _M.onTemporaryValueChange
+function _M:onTemporaryValueChange(prop, v, base)
+	if base == self.talents_mastery_bonus then
+		self:updateAllTalentsPassives()
+	end
+	base_onTemporaryValueChange(self, prop, v, base)
+end
+
+return _M