Thread: damage reduction bug
-
May 30th, 2019, 19:11 #1
- Join Date
- Dec 2016
- Posts
- 84
damage reduction bug
a player or monster with more then one type of DR (damage reduction shouldn't stack)
DR 5/-
DR 10 evil
DR 15 silver
is reading it as if it was DR 30
we notice this when a 10th level barbarian (Invulnerable Rager) with DR 5/- was given the spell buff stoneskin DR 10 adamantine, the monster did 16 damage and he took 1 point of damage, this also affects the Invulnerable Rager when he takes nonlethal damage (DR 10 nonlethal damage), its stacking with its DR 5/-
the rules for DR state that they don't stack
Damage Reduction :
Some magic creatures have the supernatural ability to instantly heal damage from weapons or ignore blows altogether as though they were invulnerable.
The numerical part of a creature’s damage reduction (or DR) is the amount of damage the creature ignores from normal attacks. Usually, a certain type of weapon can overcome this reduction (see Overcoming DR). This information is separated from the damage reduction number by a slash. For example, DR 5/magic means that a creature takes 5 less points of damage from all weapons that are not magic. If a dash follows the slash, then the damage reduction is effective against any attack that does not ignore damage reduction.
Whenever damage reduction completely negates the damage from an attack, it also negates most special effects that accompany the attack, such as injury poison, a monk’s stunning, and injury-based disease. Damage Reduction does not negate touch attacks, energy damage dealt along with an attack, or energy drains. Nor does it affect poisons or diseases delivered by inhalation, ingestion, or contact.
Attacks that deal no damage because of the target’s damage reduction do not disrupt spells.
Spells, spell-like abilities, and energy attacks (even non-magical fire) ignore damage reduction.
Sometimes damage reduction represents instant healing. Sometimes it represents the creature’s tough hide or body. In either case, other characters can see that conventional attacks won’t work.
If a creature has damage reduction from more than one source, the two forms of damage reduction do not stack. Instead, the creature gets the benefit of the best damage reduction in a given situation.
-
May 31st, 2019, 08:51 #2
- Join Date
- Mar 2016
- Location
- Bergen
- Posts
- 313
-
June 3rd, 2019, 16:14 #3
I may be wrong but I think I recall it working "as intended" in the past (so far it almost never happened to me to have actors with more than one kind of DR at once)
-
June 3rd, 2019, 22:22 #4
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,540
I just reviewed the damage automation code; and it's not something that was ever implemented. Probably because it happens so rarely.
The code does already handle the case where damage reduction is applied across multiple damage components that are both resisted by the same DR effect, so that the DR is only applied once.
It will have to be something I look at down the road a bit; because it requires rewriting the logic from scratch to make both scenarios work. I'll add to my list for future version improvements.
Regards,
JPG
-
June 3rd, 2019, 23:29 #5
Could that maybe be fixed by the following code? (In manager_action_damage.lua replacing the whole DR function in line 946 to 978 (v. 3.3.8)) New stuff in blue
Code:if not bHasEnergyType and (v + nLocalDamageAdjust) > 0 then local DRFix = {}; local i = 1; local bMatchAND, nMatchAND, bMatchDMG, aClausesOR; local bApplyDR; for _,vDR in pairs(aDR) do local kDR = table.concat(vDR.remainder, " "); if kDR == "" or kDR == "-" or kDR == "all" then bApplyDR = true; else bApplyDR = true; aClausesOR = decodeAndOrClauses(kDR); if matchAndOrClauses(aClausesOR, aSrcDmgClauseTypes) then bApplyDR = false; end end if bApplyDR then local nApplied = vDR.nApplied or 0; if nApplied < vDR.mod then local nChange = math.min((vDR.mod - nApplied), v + nLocalDamageAdjust); vDR.nApplied = nApplied + nChange; DRFix[i] = nChange; i = i + 1; bResist = true; end end end table.sort(DRFix); nLocalDamageAdjust = nLocalDamageAdjust - DRFix[#DRFix]; end
-
June 3rd, 2019, 23:31 #6
(can somehow not edit my previous post)
In my modding campaign that worked for some little testing; but I didn't test it for a lot of different situations. My idea was just to collect all damage changes coming from all DR effects in the vector DRFix, then (then after the for-loop) I sort them by their values with table.sort such that DRFix[#DRFix] should be the highest value in that table/vector and only that is now used for the change of nLocalDamageAdjust So nLocalDamageAdjust is not changed for each DR effect separately but at the end after the for-loop only taking the highest DR. That is at least my idea, not sure if implemented correctly But probably I oversee now some other special situation of DR-effects which is not correctly handled by that type of codeLast edited by Kelrugem; June 3rd, 2019 at 23:50.
-
June 4th, 2019, 01:16 #7
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,540
You need to be very specific on which damage clauses are affected, so you can't do it after the fact like that. (If you "refund" to the wrong damage type clause, it could throw off any subsequent calculations done within this function or by an extension.) Like I said, it will need to be rewritten completely to account for overlaps both in damage clauses and damage reduction effects.
Regards,
JPG
-
June 4th, 2019, 01:17 #8
-
June 8th, 2019, 21:11 #9
There is also a similar bug with "RESIST" etc. which is the reason why I mention it here As far as I can see effects like RESIST are not stacking but only in the "classes" of "specific damage types" or "all" or "[no mentioned dmg type]" but there is no connection between these with respect to stacking, i.e. e.g. RESIST: 2 all and RESIST: 1 fire results into resistance of 3 against fire. But that is even a rarer occasion, for completeness I wanted to mention that though (since it is nearly at the same place of the code)
EDIT: One mistake, it is more like that RESIST: (N) [damage type] overwrites RESIST: (N) all which overwrites RESIST: (N), regardless of the number (N) (maybe I had some other effect on while testing that)Last edited by Kelrugem; June 16th, 2019 at 21:33.
-
June 9th, 2019, 01:31 #10
I just find now some other bug related to dmg types (therefore again this thread) Now it is a more common situation: VULN doesn't work correctly when there are normal energy types and energy types of critical rolls. See the attached picture: The Aboleth has vulnerability against acid damage and my wolf has some weapon with acid damage and also an effect describing e.g. acid burst. As you can see the vulnerability only increases the damage of one of the damage dice with the type acid. (In that case it was the one of the critical die, the normal acid die is not increased in its damage)
I guess this is due to that the code checks if vulnerability is already applied to avoid doubled uses of vulnerability when one has vulnerability against more than one damage type etc. which is correct but the situation of critical damages has to be treated differently (isn't it?)
PS: I am looking at that code because one of my extensions has a similar problem with damage types; this damage type stuff drives me crazy, I believe So many different special situations depending on which damage types occur...
PPS: How one can embed a picture in a post such that it is shown directly in the post btw?
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks