mr900rr
June 24th, 2018, 22:28
So I noticed that in order for Evasion and Improved Evasion to be calculated against a spell save you had to put the condition/effect "Evasion" or "Improved Evasion" on the PC in the combat tracker, now that works fine but my combat tracker is getting very long with all the condition/effects that are having to be put in. So I was wondering why that isn't auto calculated by the program, sure as with all things there could be situations where its not going to apply but I would rather do the extra steps for the minority of cases rather than the majority. So below I have changed the code in manager_action_save.lua in function applySave(), to check if the PC has the ability Evasion or Improved Evasion and to check if they are under a condition that would prevent Evasion from applying (helpless, paralyzed, unconscious, grappled), and check to make sure the armor they have equipped is not medium or heavy. To do the armor check I changed the code in manager_char.lua in function calcItemArmorClass() to add a node for encumbrance.armortype which gets the Subtype (None, Light, Medium, Heavy) for the armor you have equiped.
Could this be maybe added to a future release or is there another instance/issue I am not foreseeing?
For 3.5E users you will need to add to your classes .mod file the pathfinder style entries in your classes for drag and drop, Evasion example below.
<rogue>
<name type="string">Rogue</name>
<classfeatures>
<id-00004>
<level type="number">2</level>
<locked type="number">1</locked>
<name type="string">Evasion</name>
<source type="string">Rogue</source>
<text type="formattedtext">
<p>At 2nd level and higher, a rogue can avoid even magical and unusual attacks with great agility. If she makes a successful Reflex saving throw against an attack that normally deals half damage on a successful save, she instead takes no damage. Evasion can be used only if the rogue is wearing light armor or no armor. A helpless rogue does not gain the benefit of evasion.</p>
</text>
</id-00004>
</classfeatures>
... etc
Manager_action_save.lua changes are marked in comments -- added and colored
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 bHasImpEvasion = false;
local bHasEvasion = false;
local sSourceType, nodeSource = ActorManager.getTypeAndNode(rSource);
if not EffectManager35E.hasEffectCondition(rSource, "Helpless") or EffectManager35E.hasEffectCondition(rSource, "Paralyzed") or EffectManager35E.hasEffectCondition(rSource, "Unconscious") or EffectManager35E.hasEffectCondition(rSource, "Grappled") then
local sArmorType = DB.getValue(nodeSource, "encumbrance.armortype", "");
if sArmorType == "None" or sArmorType == "Light" then
for _,v in pairs(DB.getChildren(nodeSource, "specialabilitylist")) do
if DB.getValue(v, "name", "") == "Improved Evasion" then
bHasImpEvasion = true;
elseif DB.getValue(v, "name", "") == "Evasion" then
bHasEvasion = true;
end
end
end
end
-- end added
if rAction.nTotal >= rAction.nTarget then
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") or bHasImpEvasion then -- added the or condition
bAvoidDamage = true;
msgLong.text = msgLong.text .. " [IMPROVED EVASION]";
elseif EffectManager35E.hasEffectCondition(rSource, "Evasion") or bHasEvasion then -- added the or condition
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") or bHasImpEvasion then -- added the or condition
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
Will have to add Manager_char.lua changes in post below this since its too long to submit all together
Could this be maybe added to a future release or is there another instance/issue I am not foreseeing?
For 3.5E users you will need to add to your classes .mod file the pathfinder style entries in your classes for drag and drop, Evasion example below.
<rogue>
<name type="string">Rogue</name>
<classfeatures>
<id-00004>
<level type="number">2</level>
<locked type="number">1</locked>
<name type="string">Evasion</name>
<source type="string">Rogue</source>
<text type="formattedtext">
<p>At 2nd level and higher, a rogue can avoid even magical and unusual attacks with great agility. If she makes a successful Reflex saving throw against an attack that normally deals half damage on a successful save, she instead takes no damage. Evasion can be used only if the rogue is wearing light armor or no armor. A helpless rogue does not gain the benefit of evasion.</p>
</text>
</id-00004>
</classfeatures>
... etc
Manager_action_save.lua changes are marked in comments -- added and colored
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 bHasImpEvasion = false;
local bHasEvasion = false;
local sSourceType, nodeSource = ActorManager.getTypeAndNode(rSource);
if not EffectManager35E.hasEffectCondition(rSource, "Helpless") or EffectManager35E.hasEffectCondition(rSource, "Paralyzed") or EffectManager35E.hasEffectCondition(rSource, "Unconscious") or EffectManager35E.hasEffectCondition(rSource, "Grappled") then
local sArmorType = DB.getValue(nodeSource, "encumbrance.armortype", "");
if sArmorType == "None" or sArmorType == "Light" then
for _,v in pairs(DB.getChildren(nodeSource, "specialabilitylist")) do
if DB.getValue(v, "name", "") == "Improved Evasion" then
bHasImpEvasion = true;
elseif DB.getValue(v, "name", "") == "Evasion" then
bHasEvasion = true;
end
end
end
end
-- end added
if rAction.nTotal >= rAction.nTarget then
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") or bHasImpEvasion then -- added the or condition
bAvoidDamage = true;
msgLong.text = msgLong.text .. " [IMPROVED EVASION]";
elseif EffectManager35E.hasEffectCondition(rSource, "Evasion") or bHasEvasion then -- added the or condition
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") or bHasImpEvasion then -- added the or condition
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
Will have to add Manager_char.lua changes in post below this since its too long to submit all together