[v1.3.0+] Fungal Regeneration

A place to post your add ons and ideas for them

Moderator: Moderator

Post Reply
Message
Author
Zizzo
Sher'Tul Godslayer
Posts: 2517
Joined: Thu Jan 23, 2003 8:13 pm
Location: A shallow water area south of Bree
Contact:

[v1.3.0+] Fungal Regeneration

#1 Post by Zizzo »

It's apparently a common annoyance for users of the Wild-Gift/Fungus tree: the relatively anemic regeneration effect triggered by Fungal Growth blocks other, actually useful regeneration talents from being used. This can be bypassed by right-clicking on the mini-regeneration effect to end it early, of course, but that's still a hassle.

The obvious solution, it seems, would be to have Fungal Growth use its own regeration-like effect that doesn't block the usual regeneration effect. To that end, I offer my new Fungal Growth addon.

The new Fungal Regeneration effect triggered by Fungal Growth stacks normally with other regeneration effects; since it's usually a pretty small effect (notably because it isn't [and wasn't] enhanced by Wild Growth), I figure that's not a huge power boost. If the assembled commentariat disagrees, then a later version we can always have Fungal Regeneration auto-cancel itself when a Regeneration effect is active.

[Implementation notes:]

Code: Select all

Hooks:
  ToME:load [to load our Fungal Regeneration effect and install our callbackOnHeal on Wild Growth]
Superload:
  mod.class.Actor:
    setEffect() [to block Fungal Growth's Regeneration effect in favor of ours]
"Blessed are the yeeks, for they shall inherit Arda..."

St_ranger_er
Thalore
Posts: 172
Joined: Fri Jul 18, 2014 11:48 am

Re: [v1.3.0+] Fungal Regeneration

#2 Post by St_ranger_er »

At first use healing ability that applied new regen efffect, an error pop-up:

Code: Select all

[LOG]	Player's healing fungi accelerate.
stack traceback:
	[C]: in function 'error'
	/engine/interface/ActorTalents.lua:150: in function </engine/interface/ActorTalents.lua:140>
Lua Error: /engine/interface/GameTargeting.lua:119: /engine/interface/ActorTalents.lua:150: /data-fungal_regen/timed-effects.lua:43: attempt to index global 'Particles' (a nil value)
stack traceback:
	/data-fungal_regen/timed-effects.lua:43: in function 'activate'
	/engine/interface/ActorTemporaryEffects.lua:147: in function 'setEffect'
	/hooks/fungal_regen/load.lua:29: in function 'callTalent'
	/mod/class/Actor.lua:5026: in function 'cb'
	/mod/class/Actor.lua:2042: in function 'onHeal'
	/engine/interface/ActorLife.lua:57: in function 'heal'
	/data/talents/gifts/call.lua:96: in function </data/talents/gifts/call.lua:90>
	[C]: in function 'xpcall'
	/engine/interface/ActorTalents.lua:147: in function </engine/interface/ActorTalents.lua:140>
	At [C]:-1 
	At [C]:-1 error
	At /engine/interface/GameTargeting.lua:119 fct
	At /engine/interface/GameTargeting.lua:125 targetMode
	At /engine/interface/GameTargeting.lua:254 targetMouse
	At /mod/class/Game.lua:2157 fct
	At /engine/Mouse.lua:58 
Then new effect going to negative number of turns, and cannot be canceled via right click even in dev mode.

edit: game version 1.4.9 with embers and ashes.

Zizzo
Sher'Tul Godslayer
Posts: 2517
Joined: Thu Jan 23, 2003 8:13 pm
Location: A shallow water area south of Bree
Contact:

Re: [v1.3.0+] Fungal Regeneration

#3 Post by Zizzo »

St_ranger_er wrote:At first use healing ability that applied new regen efffect, an error pop-up: [...]
[sound F/X: source diving] …I swear I tested that code before releasing it. *sigh* Pushing out v1a to fix this. We Apologize for the Error.™
"Blessed are the yeeks, for they shall inherit Arda..."

St_ranger_er
Thalore
Posts: 172
Joined: Fri Jul 18, 2014 11:48 am

Re: [v1.3.0+] Fungal Regeneration

#4 Post by St_ranger_er »

Found a bug/feature: when fungi regen caused by healing infusion, direct heal from nature's touch doesn't overwrite old one, and therefore can not provide extra turn (through ancestral life). Personally i'm fine with don"t overwrite part, but if i want use heals for extra turns it does't prevent me from manually-cancel-regen tediousness, which is, i think, one of two most importent things about this ancestral life/fungal growth interaction.

Zizzo
Sher'Tul Godslayer
Posts: 2517
Joined: Thu Jan 23, 2003 8:13 pm
Location: A shallow water area south of Bree
Contact:

Re: [v1.3.0+] Fungal Regeneration

#5 Post by Zizzo »

St_ranger_er wrote:Found a bug/feature: when fungi regen caused by healing infusion, direct heal from nature's touch doesn't overwrite old one, and therefore can not provide extra turn (through ancestral life). Personally i'm fine with don"t overwrite part, but if i want use heals for extra turns it does't prevent me from manually-cancel-regen tediousness, which is, i think, one of two most importent things about this ancestral life/fungal growth interaction.
[sound F/X: source diving] Hmm, tricky. The Ancestral Life energy refund happens inside the Regeneration effect's activate() method, and thus also in Fungal Regeneration's activate() method; to get it to happen in the case you describe, since activate() isn't being called, we'd have to arrange for it to happen somewhere else. Give me a little time on this one.
"Blessed are the yeeks, for they shall inherit Arda..."

St_ranger_er
Thalore
Posts: 172
Joined: Fri Jul 18, 2014 11:48 am

Re: [v1.3.0+] Fungal Regeneration

#6 Post by St_ranger_er »

I have the idea how it can be done, maybe it helps:
add callbackOnHeal in ancestral life talent. something like that:

Code: Select all

	
callbackOnHeal = function(self, t, value)
    game.log("===callbackOnHeal start===")
	  
    if self:attr("fungal_growth") and self:attr("allow_on_heal") and value > 0 then
      if self:knowTalent(self.T_ANCESTRAL_LIFE) and not self:attr("disable_ancestral_life") then
        local t = self:getTalentFromId(self.T_ANCESTRAL_LIFE)
        self.energy.value = self.energy.value + (t.getTurn(self, t) * game.energy_to_act / 100)
      end
    end  
    
    game.log("===callbackOnHeal end===")
	end
and remove added turns when new fungi applied.

edit:
or add the same code as on_merge in fungi regen timed effect.

Zizzo
Sher'Tul Godslayer
Posts: 2517
Joined: Thu Jan 23, 2003 8:13 pm
Location: A shallow water area south of Bree
Contact:

Re: [v1.3.0+] Fungal Regeneration

#7 Post by Zizzo »

St_ranger_er wrote:edit:
or add the same code as on_merge in fungi regen timed effect.
GMTA. :wink: That's now up as v1b.
"Blessed are the yeeks, for they shall inherit Arda..."

HousePet
Perspiring Physicist
Posts: 6215
Joined: Sun Sep 09, 2012 7:43 am

Re: [v1.3.0+] Fungal Regeneration

#8 Post by HousePet »

Healing Infusion can't trigger Ancestral Life... Deliberately disables it.
My feedback meter decays into coding. Give me feedback and I make mods.

Zizzo
Sher'Tul Godslayer
Posts: 2517
Joined: Thu Jan 23, 2003 8:13 pm
Location: A shallow water area south of Bree
Contact:

Re: [v1.3.0+] Fungal Regeneration

#9 Post by Zizzo »

HousePet wrote:Healing Infusion can't trigger Ancestral Life... Deliberately disables it.
Right, but it does trigger Fungal Growth. The sequence of events AIUI is:
  • Player uses healing infusion. This triggers Fungal Growth's Regeneration (without this addon) or Fungal Regeneration (with this addon) effect,, which normally would trigger Ancestral Life but does not due to the disabling you mention.
  • While the above effect is still active, player uses Nature's Touch. Because a Regeneration/Fungal Regeneration effect is active, no regeneration effect is triggered and so Ancestral Life isn't triggered.
That second step is the key; even with (the previous version of) this addon, the player would have to manually deactivate Fungal Regeneration before using a non-infusion healing effect to get Ancestral Life to trigger, and obviating that manual deactivation step was pretty much the point of this addon in the first place.
"Blessed are the yeeks, for they shall inherit Arda..."

jenx
Sher'Tul Godslayer
Posts: 2263
Joined: Mon Feb 14, 2011 11:16 pm

Re: [v1.3.0+] Fungal Regeneration

#10 Post by jenx »

Zizzo wrote:
HousePet wrote:Healing Infusion can't trigger Ancestral Life... Deliberately disables it.
Right, but it does trigger Fungal Growth. The sequence of events AIUI is:
  • Player uses healing infusion. This triggers Fungal Growth's Regeneration (without this addon) or Fungal Regeneration (with this addon) effect,, which normally would trigger Ancestral Life but does not due to the disabling you mention.
  • While the above effect is still active, player uses Nature's Touch. Because a Regeneration/Fungal Regeneration effect is active, no regeneration effect is triggered and so Ancestral Life isn't triggered.
That second step is the key; even with (the previous version of) this addon, the player would have to manually deactivate Fungal Regeneration before using a non-infusion healing effect to get Ancestral Life to trigger, and obviating that manual deactivation step was pretty much the point of this addon in the first place.
Hope this makes it into the core game
MADNESS rocks

Zizzo
Sher'Tul Godslayer
Posts: 2517
Joined: Thu Jan 23, 2003 8:13 pm
Location: A shallow water area south of Bree
Contact:

Re: [v1.3.0+] Fungal Regeneration

#11 Post by Zizzo »

…So, turns out the Wild Gift/Fungus tree gets a bit of an overhaul in the 1.6 release, and renders our Fungal Regeneration effect completely irrelevant. I am therefore officially deprecating this addon. Since AFAICT there's no way to set a "maximum" compatible game version for an addon, just a minimum one, v1b.1 just silently does nothing if used with game version 1.6.0 or later (well, engine version; AFAICT the module version isn't available from the ToME:load hook).
"Blessed are the yeeks, for they shall inherit Arda..."

Post Reply