PDA

View Full Version : Stacking AC Bonus 'Types'



Blackfoot
June 15th, 2012, 15:13
It is my understanding that only AC bonuses of the 'dodge' type should 'stack'.

When a character is set to have an armor value of 5 on the Combat Tab and given a 'mage armor' effect of:
AC: 4 armor

When attacked with a roll of '17' this should 'hit' since the armor bonuses do not stack and yet it misses. This is also true for (when these values on the Combat Tab are set):
AC: 4 deflection
AC: 4 natural
AC: 4 size

BUT if you set 2 'effects' to the same type and leave the values on the combat tab blank.. they do stack properly. (or don't stack as the case may be)

(I'm talking about the rules for the PF ruleset.. I'm not sure what is different in 3.5 anymore.)

Moon Wizard
June 15th, 2012, 21:19
The effect system and the armor calculations are currently not integrated, so they calculate independently. Bonuses that overlap between the 2 will have to be adjudicated manually for now.

Regards,
JPG

Callum
June 15th, 2012, 22:46
The other alternative is to put mundane armour in as an effect on the Combat Tracker, which makes the stacking work correctly. I've done this before and it works fine, so long as you don't mind the PCs' armour classes looking oddly low, and an extra effect or two in the CT.

Maxxx26
June 25th, 2012, 14:58
Would it be possible to implement the non-stacking of these bonus types by modifying the following lines from the getDefenseValue function in the manager_actor script?



local aACEffects, nACEffectCount = EffectsManager.getEffectsBonusByType(rDefender, {"AC"}, true, aAttackFilter, rAttacker);

for k,v in pairs(aACEffects) do
if not StringManager.contains(aIgnoreEffects, k) then
nBonusAC = nBonusAC + v.mod;
end
end



And swapping them for:



local aACEffects, nACEffectCount = EffectsManager.getEffectsBonusByType(rDefender, {"AC"}, true, aAttackFilter, rAttacker);

local nDefenseArmorMod = DB.getValue(rDefender.nodeCreature, "ac.sources.armor", 10);
local nDefenseShieldMod = DB.getValue(rDefender.nodeCreature, "ac.sources.shield", 10);
local nDefenseDeflectionMod = DB.getValue(rDefender.nodeCreature, "ac.sources.deflection", 10);
local nDefenseNaturalMod = DB.getValue(rDefender.nodeCreature, "ac.sources.naturalarmor", 10);

for k,v in pairs(aACEffects) do
if not StringManager.contains(aIgnoreEffects, k) then
if string.match(k,"armor") then
if v.mod <= nDefenseArmorMod then
nBonusAC = nBonusAC;
else
nBonusAC = nBonusAC + v.mod - nDefenseArmorMod;
end
elseif string.match(k,"natural") then
if v.mod <= nDefenseNaturalMod then
nBonusAC = nBonusAC;
else
nBonusAC = nBonusAC + v.mod - nDefenseNaturalMod;
end
elseif string.match(k,"shield") then
if v.mod <= nDefenseShieldMod then
nBonusAC = nBonusAC;
else
nBonusAC = nBonusAC + v.mod - nDefenseShieldMod;
end
elseif string.match(k,"deflection") then
if v.mod <= nDefenseDeflectionMod then
nBonusAC = nBonusAC;
else
nBonusAC = nBonusAC + v.mod - nDefenseDeflectionMod;
end
else
nBonusAC = nBonusAC + v.mod;
end
end
end

Moon Wizard
June 25th, 2012, 18:26
I didn't look at the code exactly, but the approach you are taking would only work for PCs. The getDefenseValue() function is a general purpose function for PCs, NPCs and manually created CT entries.

In this case, I would keep it simple and only look at PCs for this extra complexity. You would check that rDefender.sType == "pc", otherwise execute the original code. Your approach seems reasonable. Let me know how it goes. If it's working, with your permission, I can add it to the base ruleset.

Regards,
JPG

Blackfoot
June 25th, 2012, 18:50
Doesn't this become a can of worms if it only works for PCs now that NPC spells are working... or does it not really ID AC 'types' for NPCs currently anyway so the type of bonus AC is moot?

Moon Wizard
June 26th, 2012, 01:04
True, but the challenge is that the NPC armor types are not always spelled out in the AC field of the NPC. It depends on the source for the creature.

If the data is available, you could write a parser to parse all the armor bonus types from the AC field, in order to handle NPCs also.

Regards,
JPG

Callum
June 26th, 2012, 13:22
The other alternative would be to have the character sheet pull its info from the Combat Tracker, and only put the data in the latter.