5E (& originally 2E) ruleset question - is this a bug? - Unsure where to post
While I was looking at rulesets (especially 2E) for my NPC/CT code - I came across getPercentWounded2 and was trying to understand when it would be "pc", "ct" etc and other stuff. I was trying to see if I could put in code in the future for my ruleset to treat PC, Monster, NPC (ie: special "monster") differently when it came to death options in my ruleset.
I was confused as to how "rActor" variable in 2E's manager_actor2.lua code could have a value (is it global?) and I put in a debug and it was nil.
So before I wrote in Discord to Cel, I looked to see how it was in 5E in case it was cut and paste error missing something from 5E. And I saw the same issue in 5E.
So, since 5E is big - I assumed I am reading this wrong? Or is it that no one uses "Stable" so it never is noticed?
Didn't know where to ask since it isn't a ruleset USE question but a code question. When saw Celestian posted on discord he was traveling for "a few weeks" about a week or so back - figured not wait on DM reply.
Apologies if I just read wrong.
Code:
function getPercentWounded2(sNodeType, node)
local nHP, nWounds, nDeathSaveFail;
if sNodeType == "pc" then
nHP = math.max(DB.getValue(node, "hp.total", 0), 0);
nWounds = math.max(DB.getValue(node, "hp.wounds", 0), 0);
nDeathSaveFail = DB.getValue(node, "hp.deathsavefail", 0);
elseif sNodeType == "ct" then
nHP = math.max(DB.getValue(node, "hptotal", 0), 0);
nWounds = math.max(DB.getValue(node, "wounds", 0), 0);
nDeathSaveFail = DB.getValue(node, "deathsavefail", 0);
end
local nPercentWounded = 0;
if nHP > 0 then
nPercentWounded = nWounds / nHP;
end
local sStatus;
if nPercentWounded >= 1 then
if nDeathSaveFail >= 3 then
sStatus = "Dead";
else
if EffectManager5E.hasEffect(rActor, "Stable") then
sStatus = "Unconscious";
else
sStatus = "Dying";
end
if nDeathSaveFail > 0 then
sStatus = sStatus .. " (" .. nDeathSaveFail .. ")";
end
end
elseif OptionsManager.isOption("WNDC", "detailed") then
if nPercentWounded >= .75 then
sStatus = "Critical";
elseif nPercentWounded >= .5 then
sStatus = "Heavy";
elseif nPercentWounded >= .25 then
sStatus = "Moderate";
elseif nPercentWounded > 0 then
sStatus = "Light";
else
sStatus = "Healthy";
end
else
if nPercentWounded >= .5 then
sStatus = "Heavy";
elseif nPercentWounded > 0 then
sStatus = "Wounded";
else
sStatus = "Healthy";
end
end
return nPercentWounded, sStatus;
end