PDA

View Full Version : Saving Throw issue



mr900rr
June 28th, 2018, 05:39
Sorry to post another but it seems that in 3.5E when you do a save vs a DC such as in the party sheet or when a spell with a save is cast, it is not counting a roll of 1 or 20 properly. As I recall in 3.5E for Attack rolls and Saving Throws a roll of a 1 on the dice is always a miss or fail and a roll of a 20 on the dice is always a hit or success, but in Fantasy Grounds its purely going off of roll total vs DC. So I can roll a 1 and succeed as long as it was higher then the DC and I can roll a 20 and fail.

mr900rr
June 28th, 2018, 08:00
Ok so I think I found how to fix this, its all in manager_action_save.lua in functions handleApplySave, notifyApplySave and applySave. I will post those 3 functions below with the code changes.


function handleApplySave(msgOOB)
local rSource = ActorManager.getActor(msgOOB.sSourceType, msgOOB.sSourceNode);
local rOrigin = ActorManager.getActor(msgOOB.sTargetType, msgOOB.sTargetNode);

local rAction = {};
rAction.bSecret = (tonumber(msgOOB.nSecret) == 1);
rAction.sDesc = msgOOB.sDesc;
rAction.nTotal = tonumber(msgOOB.nTotal) or 0;
rAction.nMod = tonumber(msgOOB.nMod) or 0; -- added
rAction.sSaveDesc = msgOOB.sSaveDesc;
rAction.nTarget = tonumber(msgOOB.nTarget) or 0;
rAction.bRemoveOnMiss = (tonumber(msgOOB.nRemoveOnMiss) == 1);

applySave(rSource, rOrigin, rAction);
end


function notifyApplySave(rSource, rRoll)
local msgOOB = {};
msgOOB.type = OOB_MSGTYPE_APPLYSAVE;

if rRoll.bTower then
msgOOB.nSecret = 1;
else
msgOOB.nSecret = 0;
end
msgOOB.sDesc = rRoll.sDesc;
msgOOB.nTotal = ActionsManager.total(rRoll); -- nTotal = nTotal + rRoll.nMod;
msgOOB.nMod = rRoll.nMod; -- added
msgOOB.sSaveDesc = rRoll.sSaveDesc;
msgOOB.nTarget = rRoll.nTarget;
if rRoll.bRemoveOnMiss then msgOOB.nRemoveOnMiss = 1; end

local sSourceType, sSourceNode = ActorManager.getTypeAndNodeName(rSource);
msgOOB.sSourceType = sSourceType;
msgOOB.sSourceNode = sSourceNode;

if rRoll.sSource ~= "" then
msgOOB.sTargetType = "ct";
msgOOB.sTargetNode = rRoll.sSource;
else
msgOOB.sTargetType = "";
msgOOB.sTargetNode = "";
end

Comm.deliverOOBMessage(msgOOB, "");
end



function applySave(rSource, rOrigin, rAction, sUser)
local msgShort = {font = "msgfont"};
local msgLong = {font = "msgfont"};

msgShort.text = "Save";
msgLong.text = "Save [" .. rAction.nTotal .. "]";
if rAction.nTarget then
msgLong.text = msgLong.text .. "[vs. DC " .. rAction.nTarget .. "]";
end
msgShort.text = msgShort.text .. " ->";
msgLong.text = msgLong.text .. " ->";
if rSource then
msgShort.text = msgShort.text .. " [for " .. rSource.sName .. "]";
msgLong.text = msgLong.text .. " [for " .. rSource.sName .. "]";
end
if rOrigin then
msgShort.text = msgShort.text .. " [vs " .. rOrigin.sName .. "]";
msgLong.text = msgLong.text .. " [vs " .. rOrigin.sName .. "]";
end

msgShort.icon = "roll_cast";

local sAttack = "";
local bHalfMatch = false;
if rAction.sSaveDesc then
sAttack = rAction.sSaveDesc:match("%[SAVE VS[^]]*%] ([^[]+)") or "";
bHalfMatch = (rAction.sSaveDesc:match("%[HALF ON SAVE%]") ~= nil);
end
rAction.sResult = "";
-- added
local nDieRoll = rAction.nTotal - rAction.nMod;
-- end added
if (nDieRoll > 1 and rAction.nTotal >= rAction.nTarget) or nDieRoll == 20 then -- added
msgLong.text = msgLong.text .. " [SUCCESS]";

if rSource then
local bHalfDamage = bHalfMatch;
local bAvoidDamage = false;
if bHalfDamage then
local sSave = rAction.sDesc:match("%[SAVE%] (%w+)");
if sSave then
sSave = sSave:lower();
end
if sSave == "reflex" then
if EffectManager35E.hasEffectCondition(rSource, "Improved Evasion") then
bAvoidDamage = true;
msgLong.text = msgLong.text .. " [IMPROVED EVASION]";
elseif EffectManager35E.hasEffectCondition(rSource, "Evasion") then
bAvoidDamage = true;
msgLong.text = msgLong.text .. " [EVASION]";
end
end
end

if bAvoidDamage then
rAction.sResult = "none";
rAction.bRemoveOnMiss = false;
elseif bHalfDamage then
rAction.sResult = "half_success";
rAction.bRemoveOnMiss = false;
end

if rOrigin and rAction.bRemoveOnMiss then
TargetingManager.removeTarget(ActorManager.getCTNo deName(rOrigin), ActorManager.getCTNodeName(rSource));
end
end
else
msgLong.text = msgLong.text .. " [FAILURE]";

if rSource then
local bHalfDamage = false;
if bHalfMatch then
local sSave = rAction.sDesc:match("%[SAVE%] (%w+)");
if sSave then
sSave = sSave:lower();
end
if sSave == "reflex" then
if EffectManager35E.hasEffectCondition(rSource, "Improved Evasion") then
bHalfDamage = true;
msgLong.text = msgLong.text .. " [IMPROVED EVASION]";
end
end
end

if bHalfDamage then
rAction.sResult = "half_failure";
end
end
end

ActionsManager.outputResult(rAction.bSecret, rSource, rOrigin, msgLong, msgShort);

if rSource and rOrigin then
ActionDamage.setDamageState(rOrigin, rSource, StringManager.trim(sAttack), rAction.sResult);
end
end

that should be it.

Targas
July 4th, 2018, 16:29
I guess you have to put it into the Pathfinder Modules Bug Report thread to get noticed, or The House of Healing...

Zacchaeus
July 4th, 2018, 17:55
Is this not fixed? https://www.fantasygrounds.com/forums/showthread.php?44204-Test-Release-v3-3-6&p=395248&viewfull=1#post395248

mr900rr
July 5th, 2018, 02:24
At the time of my post I didn't know that it was to be fixed in the future release (never looked at the beta) but when I deleted my rule set for 3.5E and updated to Dev version it still wasn't working. Might be they were still working on it at that time and hadn't put it into the "Dev" file.

Zacchaeus
July 5th, 2018, 09:17
At the time of my post I didn't know that it was to be fixed in the future release (never looked at the beta) but when I deleted my rule set for 3.5E and updated to Dev version it still wasn't working. Might be they were still working on it at that time and hadn't put it into the "Dev" file.

I was just guessing it had been fixed; I don't play 3.5 so I have no idea what the issue is but I saw that in the test release and thought it might be your issue. But if it isn't then it hasn't been fixed. Incidentally Dev is not for you but Test is if you want to.

Trenloe
July 5th, 2018, 17:10
This is a different issue to the one reported as fixed in the current test version.

mr900rr
July 6th, 2018, 02:42
Not sure I understand the "Dev is not for you" part in your comment, in the updater there is three options "Live", "Test" and "Dev", am I not supposed to click the "Dev" option which I assume is the beta?

Trenloe
July 6th, 2018, 02:45
Not sure I understand the "Dev is not for you" part in your comment, in the updater there is three options "Live", "Test" and "Dev", am I not supposed to click the "Dev" option which I assume is the beta?
See the information on testing here: https://www.fantasygrounds.com/forums/showthread.php?9966-Welcome-to-public-testing!

The current beta test package is in the "test" channel. "Dev" is reserved for the developers and they can load anything into that channel at anytime, such as custom debug code to try to catch a specific issue - don't use it unless the FG devs ask you specifically to use it. Use "test" to access the current version of FG in test.

mr900rr
July 6th, 2018, 04:29
Oh, well they need to have a window pop up when you select that option informing of this with a confirm button, I don't think a majority of users would know that and come to the forums to ask before clicking it to try the latest version. I have had the software since like 2013 and never knew this till now.