Page 1 of 1

[v1.3.0+] Fungal Regeneration

Posted: Sun Dec 18, 2016 4:32 pm
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]

Re: [v1.3.0+] Fungal Regeneration

Posted: Sun Dec 18, 2016 6:21 pm
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.

Re: [v1.3.0+] Fungal Regeneration

Posted: Sun Dec 18, 2016 9:47 pm
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.™

Re: [v1.3.0+] Fungal Regeneration

Posted: Mon Dec 19, 2016 2:40 pm
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.

Re: [v1.3.0+] Fungal Regeneration

Posted: Tue Dec 20, 2016 1:01 am
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.

Re: [v1.3.0+] Fungal Regeneration

Posted: Wed Dec 21, 2016 11:48 am
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.

Re: [v1.3.0+] Fungal Regeneration

Posted: Wed Dec 21, 2016 10:30 pm
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.

Re: [v1.3.0+] Fungal Regeneration

Posted: Thu Dec 22, 2016 12:11 am
by HousePet
Healing Infusion can't trigger Ancestral Life... Deliberately disables it.

Re: [v1.3.0+] Fungal Regeneration

Posted: Thu Dec 22, 2016 4:10 pm
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.

Re: [v1.3.0+] Fungal Regeneration

Posted: Thu Dec 22, 2016 10:03 pm
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

Re: [v1.3.0+] Fungal Regeneration

Posted: Thu Oct 24, 2019 11:56 pm
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).