(Very interested in why...)
Code: Select all
defineTrait{
name = "aura_protection",
uiName = "Aura of Protection",
icon = 96,
description = "Grants the caster's protection bonus to a nearby companion.",
onRecomputeStats = function(champion, level)
if level > 0 then
if champion:isAlive() then
local bonus = champion:getProtection()
for c = 1,4 do
if party.party:getChampion(c):getOrdinal() == champion:getOrdinal() then
party.party:getChampion((c%3)+iff(c~=2,1,-1)):addStatModifier("protection", bonus)
-- The printed results show that the bonus is applied, but if the trait bearer PC is in an earlier [lower numbered] position than the receiver [ie. position #1], then the bonus does not update in the character sheet.
print(party.party:getChampion(c):getName().."("..bonus..")", ">>", party.party:getChampion((c%3)+iff(c~=2,1,-1)):getName().."("..party.party:getChampion((c%3)+iff(c~=2,1,-1)):getProtection()..")")
break
end
end
end
end
end,
}