Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
Shane Parker committed Dec 31, 2021
2 parents 78f79cd + 889e873 commit f513ced
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
1 change: 1 addition & 0 deletions extension.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ SOFTWARE.

<root release="3.0" version="3">
<properties>
<loadorder>121</loadorder>
<name>Feature: Blissful Ignorance</name>
<version>dev_version</version>
<author>MeAndUnique</author>
Expand Down
22 changes: 20 additions & 2 deletions scripts/manager_action_damage_bi.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ local bIgnored = false;
local tReductions = {};
local bPreventCalculateRecursion = false;
local nAbsorbed = 0;
local aAbsorbed = {};
local bIsAbsorbed = false;
local bUnhealable = false;

Expand All @@ -36,6 +37,10 @@ function onInit()

messageDamageOriginal = ActionDamage.messageDamage;
ActionDamage.messageDamage = messageDamage;

if EffectsManagerBCEDND then
EffectsManagerBCEDND.processAbsorb = function() end;
end
end

function getReductionType(rSource, rTarget, sEffectType)
Expand Down Expand Up @@ -254,6 +259,7 @@ function getDamageAdjust(rSource, rTarget, nDamage, rDamageOutput)

local nDamageAdjust, bVulnerable, bResist = getDamageAdjustOriginal(rSource, rTarget, rDamageOutput.nVal, rDamageOutput);

local tUniqueTypes = {};
for k, v in pairs(rDamageOutput.aDamageTypes) do
-- Get individual damage types for each damage clause
local aSrcDmgClauseTypes = {};
Expand All @@ -266,11 +272,23 @@ function getDamageAdjust(rSource, rTarget, nDamage, rDamageOutput)

local nLocalAbsorb = ActionDamage.checkNumericalReductionType(tReductions["ABSORB"], aSrcDmgClauseTypes);
if nLocalAbsorb ~= 0 then
bIsAbsorbed = true;
nDamageAdjust = nDamageAdjust - (v * nLocalAbsorb);
for _,sDamageType in ipairs(aSrcDmgClauseTypes) do
if sDamageType:sub(1,1) ~= "!" and sDamageType:sub(1,1) ~= "~" then
tUniqueTypes[sDamageType] = true;
end
end
end
end
nAbsorbed = nDamage + nDamageAdjust;

for sDamageType,_ in pairs(tUniqueTypes) do
table.insert(aAbsorbed, sDamageType);
end
table.sort(aAbsorbed);


if bAdjusted then
table.insert(rDamageOutput.tNotifications, "[RESISTANCE ADJUSTED]");
bAdjusted = false;
Expand Down Expand Up @@ -300,15 +318,15 @@ function messageDamage(rSource, rTarget, bSecret, sDamageType, sDamageDesc, sTot
if nAbsorbed < 0 then
local nDamage = nAbsorbed;
nAbsorbed = 0;
bIsAbsorbed = true;
ActionDamage.applyDamage(rSource, rTarget, bSecret, sDamageType, nDamage);
else
if bIsAbsorbed then
if sExtraResult ~= "" then
sExtraResult = sExtraResult .. " ";
end
sExtraResult = sExtraResult .. "[ABSORBED]";
sExtraResult = sExtraResult .. "[ABSORBED: " .. table.concat(aAbsorbed, ",") .. "]";
bIsAbsorbed = false;
aAbsorbed = {};
end
if bUnhealable then
if sExtraResult ~= "" then
Expand Down

0 comments on commit f513ced

Please sign in to comment.