[b41] actors gain saves while under effects

A place to post your add ons and ideas for them

Moderator: Moderator

Post Reply
Message
Author
marvalis
Uruivellas
Posts: 683
Joined: Sun Sep 05, 2010 5:11 am

[b41] actors gain saves while under effects

#1 Post by marvalis »

How to: change the .zip extension to .teaa and put the file in tome/game/addon folder
tome-alertness.zip
(44.3 KiB) Downloaded 111 times
What it does:
  • *edited* Now checks for cross-tier effects and does not trigger on them.
  • Adds a new effect called 'alertness' than can increase your saves.
  • Each turn, while under the influence of a detrimental effect, you will gain 5 save against that effect type (physical, mental, magical).
So if you get stunned for 5 turn, then each turn you will gain +5 physical save, for a total of +25 physical save. The effect last roughly 6 turns. That means the longer an actor is stunned, the harder it will be to stun it again, and if you get stunned again it will probably have a shorter duration.

*note* that if you want to add this to the main game, then you will have to add a check for the effect source, and make sure that the actor is not putting some weak effects on himself to boost saves. As far as I can tell this would require to include src=self every time you call target:setEffect(). Some talents already pass the source of the effect (like bleeding edge) other don't do this (for example stunning blow).

Code: Select all

newEffect{
	name = "ALERTNESS", image = "talents/alertness.png",
	desc = "Alertness",
	long_desc = function(self, eff) return ("Your ability to avoid effects increases the longer you are exposed to them. Increases physical save by %d,mental save by %d and  spell save by %d."):format(eff.physicalsave,eff.mentalsave,eff.spellsave) end,
	type = "other",
	subtype = { miscellaneous=true },
	status = "beneficial",
	parameters = { physicalsave=10, mentalsave=10, spellsave=10 },
	on_merge = function(self, old_eff, new_eff)
		self:removeTemporaryValue("combat_physresist", old_eff.presid)
		self:removeTemporaryValue("combat_mentalresist", old_eff.mresid)
		self:removeTemporaryValue("combat_spellresist", old_eff.sresid)
		old_eff.physicalsave = old_eff.physicalsave + new_eff.physicalsave
		old_eff.mentalsave = old_eff.mentalsave + new_eff.mentalsave
		old_eff.spellsave = old_eff.spellsave + new_eff.spellsave
		old_eff.dur = new_eff.dur
		old_eff.presid = self:addTemporaryValue("combat_physresist", old_eff.physicalsave)
		old_eff.mresid = self:addTemporaryValue("combat_mentalresist", old_eff.mentalsave)
		old_eff.sresid = self:addTemporaryValue("combat_spellresist", old_eff.spellsave)
		return old_eff
	end,
	activate = function(self, eff)
		eff.presid = self:addTemporaryValue("combat_physresist", eff.physicalsave)
		eff.mresid = self:addTemporaryValue("combat_mentalresist", eff.mentalsave)
		eff.sresid = self:addTemporaryValue("combat_spellresist", eff.spellsave)
	end,
	deactivate = function(self, eff)
		self:removeTemporaryValue("combat_physresist", eff.presid)
		self:removeTemporaryValue("combat_mentalresist", eff.mresid)
		self:removeTemporaryValue("combat_spellresist", eff.sresid)
	end,
}

Code: Select all

	--M:actBase() Actor.lua
	-- Handle alertness
	local hasphysical=false
	local hasmental=false
	local hasmagic=false
	for eff_id, p in pairs(self.tmp) do
		local e = self.tempeffect_def[eff_id]
		if e.type == "physical" and e.status == "detrimental" and not e.subtype["cross tier"] and p.src ~= self then
		hasphysical= true
		elseif e.type == "mental" and e.status == "detrimental" and not e.subtype["cross tier"] and p.src ~= self then
		hasmental= true
		elseif e.type == "magical" and e.status == "detrimental" and not e.subtype["cross tier"] and p.src ~= self then
		hasmagic= true
		end
	end
	if hasphysical then self:setEffect(self.EFF_ALERTNESS, 6, {physicalsave=5, mentalsave=0, spellsave=0,}) end
	if hasmental then self:setEffect(self.EFF_ALERTNESS, 6, {physicalsave=0, mentalsave=5, spellsave=0,}) end
	if hasmagic then self:setEffect(self.EFF_ALERTNESS, 6, {physicalsave=0, mentalsave=0, spellsave=5,}) end

Post Reply