Fantasy Grounds Merchandise
  1. #1

    Undoing HEAL not working as expected

    Hi,

    Not sure if this is intended behavior or not, but it seems like a edge case is not being handled properly. If I have a PC with 11 pts of damage (shown as "wounds" on the combat tracker) and I have a HEAL spell effect applied to cure 11 hp, but then realize I made a mistake and choose to negate the roll (via the radial menu), because the PC is now at full health, it appears the "negative" healing is not applied (since normally healing someone at full health has no effect), so the PC remains at full health. But, since we are applying negative healing, this should still take effect.

    This only happens when the PC is at full health. If the PC has _any_ damage, a negated healing roll applies as one would expect.

    Here's a screenshot of the chat dialog demonstrating the issue:
    Screen Shot 2022-02-26 at 1.29.33 PM.png
    Note how after the -11 HP are applied, it says the char's status is "Not wounded". If the -11 had really been applied, the char would have been wounded.

    I am testing this with no extensions loaded.
    Perhaps this is intentional since if the previous accideintal heal spell roll was for more than the char needed to reach full health, negating the roll would potentially remove too many HP?

    Also, another oddity, regardless of whether this is intentional behavior or not, is the chat message for the reverse healing, when it does successfully apply, shows as "Heal[0] -> [to charname]"
    Screen Shot 2022-02-26 at 1.39.57 PM.png
    The significant point being the chat message says it is healing ZERO, but actually applies the -11 value properly.

    But when the chat shows in the first screenshot that it is healing -11, it really is applying ZERO. Very strange....

    Cheers,
    Brian

  2. #2
    You can't undo a heal spell in that way. The negation does not work that way for heals in the scripting code to allow simple negation. (i.e. negative healing does not equal damage)

    Regards,
    JPG

  3. #3
    Quote Originally Posted by Moon Wizard View Post
    You can't undo a heal spell in that way. The negation does not work that way for heals in the scripting code to allow simple negation. (i.e. negative healing does not equal damage)
    I might be misunderstanding what you are saying, so please pardon my possibly repeating it inaccurately. Are you saying negative healing should always result in 0 change in wound status? Looking at the code, some code path is definitely applying damage when a negative value is applied as "Heal" damage type. It shows up in the chat with the red + healing icon (not the red damage icon) and says heal and makes my char more wounded. Is that intended to be used to represent damage when "healing" undead and the like? Or is a negative value for healing supposed to be ignored?

    If we aren't supposed to do this to undo a heal roll (or just in general, never apply negative healing), shouldn't the scripting then just not apply the negative value when the char is wounded? The tutorials I recall watching for FG stated something like "If you make a mistake applying a roll, just right click on the value and chose to negative it, then drag it onto the char." If I should not be able to negate a heal roll, shouldn't the right click then not offer the choice and instead apply 0 healing in all cases, not just when the char has no wounds? Maybe I inferred too much when I saw someone suggest negating rolls in that way... I'm not sure. I'm very new to this platform, so maybe I'm just misinformed.

    That question aside (whether I should be doing this in the first place) it looks like there is an issue with how chat reports the heal values when the char is already fully healed. Looking at the code in 3.5E/scripts/manager_action_damage.lua, a simple two line change will correct the inaccurate chat message:

    Code:
    @@ -1314,10 +1314,12 @@
     	-- Healing
     	if rDamageOutput.sType == "heal" or rDamageOutput.sType == "fheal" then
     		-- CHECK COST
     		if nWounds <= 0 and nNonlethal <= 0 then
     			table.insert(rDamageOutput.tNotifications, "[NOT WOUNDED]");
    +			-- If char is fully healed, then set the damage healed amount to 0.
    +			rDamageOutput.sVal = "0";
     		else
     			local nHealAmount = rDamageOutput.nVal;
     			
     			-- CALCULATE HEAL AMOUNTS
     			local nNonlethalHealAmount = math.min(nHealAmount, nNonlethal);
    @@ -1339,11 +1341,12 @@
     					rDamageOutput.sVal = rDamageOutput.sVal .. " (+" .. nNonlethalHealAmount .. " NL)";
     				end
     			elseif nNonlethalHealAmount > 0 then
     				rDamageOutput.sVal = "" .. nNonlethalHealAmount .. " NL";
     			else
    -				rDamageOutput.sVal = "0";
    +				-- If "negative healing" (i.e. negating a previous roll) we should show the value - do NOT set it to zero. This assumes applying negative healing is possible and is properly handled already.
    +				-- rDamageOutput.sVal = "0";
     			end
     		end
     
     	-- Regeneration
     	elseif rDamageOutput.sType == "regen" then
    It could be I'm misunderstanding the intent of the chat message when it says: "Heal [11] -> [to charname] [NOT WOUNDED]" To me, that implies it applied 11 point of healing, which is NOT what it did if the char is already fully healed. It applied 0 points of healing. If my char has 5 wounds and 11 healing is applied, the chat message will correctly adjust the value and say "Heal [5] -> [to charname]" stating the exact number of 5 healing points applied.

    My sample diff above will correct the chat message so it says "Heal [0] -> [to charname] NOT WOUNDED" if the char is not wounded and healing isn't applicable. It seemed to make sense with how I was assuming the chat value changed based on partial healing, but maybe I am misunderstanding something.

    Also, if the code on line 1347 is correctly setting the chat message damage to 0, meaning negative healing is not supposed to be allowed and it was trying to report to the chat that 0 points were applied, then it would appear there is a bug that allows the negative healing to actually occur still, despite this 0 being reported in the chat.

    Not being super familiar with the code, at first glance to me it appears there are possibly 1 or 2 issues:

    1) negative healing values should not be allowed, but there is currently a bug allowing it
    2) the chat message for the "Heal [X] -> [to charname]" does not report the proper value for X when no healing was applied.

    My sample diff above should hopefully address item #2, but I could have overlooked something, or broken something in the process of trying a fix - this is my first time looking at this scripting code.

    Cheers,
    Brian

  4. #4
    Just a quick followup. If negative healing shouldn't be allowed, it seems like a simple fix would be to check the value of nHealAmount immediately after line 1322:
    Code:
    local nHealAmount = rDamageOutput.nVal;
    and don't do any math with it if it is negative - just skip all the "healing" since in reality it is doing damage using a negative value. As implemented now, it does seem like it is unintended behavior in applying the negative healing, since it increases both the char's wounds AND nonlethal damage.

    Cheers,
    Brian

  5. #5
    Sorry... one more update. Assuming negative values for healing are supposed to be ignored, then this is a sample diff of what produces what seems like correct behavior.

    Code:
    @@ -1316,9 +1316,14 @@
     		-- CHECK COST
     		if nWounds <= 0 and nNonlethal <= 0 then
     			table.insert(rDamageOutput.tNotifications, "[NOT WOUNDED]");
    +			-- If char is fully healed, then set the damage healed amount to 0.
    +			rDamageOutput.sVal = "0";
    +		elseif rDamageOutput.nVal < 0 then
    +			table.insert(rDamageOutput.tNotifications, "[NEGATIVE HEALING NOT ALLOWED]");
    +			rDamageOutput.sVal = "0";
     		else
     			local nHealAmount = rDamageOutput.nVal;
    -			
    +
     			-- CALCULATE HEAL AMOUNTS
     			local nNonlethalHealAmount = math.min(nHealAmount, nNonlethal);
     			nNonlethal = nNonlethal - nNonlethalHealAmount;
    If one tries to apply negative healing, the message in the chat will reflect this is not allowed.
    Screen Shot 2022-02-26 at 8.29.25 PM.png

    Apologies if I am totally off track and this is not what you meant in regards to negative healing not being allowed. Worst case, if this is not at all applicable, at least I got to spend some time reading a bit of the damage and healing code and now understand it a little bit better.

    Cheers,
    Brian
    Last edited by MostTornBrain; February 27th, 2022 at 01:38.

  6. #6
    Now I'm totally confused as to what is supposed to be "correct" behavior for negative healing. From the FGU Wiki, it specifically describes negating healing via the radial menu:

    https://fantasygroundsunity.atlassia...rtcuts+Hotkeys

    Direct quote: "Change the damage or heal value inflicted on a target by right-clicking on the damage in the chat bar, then choose Negate value, Double Value, or Half Value. Then drag the value to the NPC or character."

    So... how should negative healing be handled? It would appear as currently scripted in `3.5E/scripts/manager_action_damage.lua` _something_ isn't quite right. Negative healing currently applies both lethal and nonlethal damage, yet in the chat message claims it didn't apply any value (i.e. it reports "Heal [0]"). If the negative application is intentional, I would think it should report something like "Heal [-11 (-11 NL)] similar to how it applies positive healing when nonlethal healing occurs in addition to lethal.

    Cheers,
    Brian
    Last edited by MostTornBrain; February 27th, 2022 at 14:16.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
DICE PACKS BUNDLE

Log in

Log in