PDA

View Full Version : 5E Absorb Effect



mattekure
November 12th, 2021, 17:19
An extension for 5E that adds two new Effects that can be applied to the Combat Tracker. The new effect implements the Damage Absorption trait that some monsters have like the flesh golems Lightning Absorption trait or the Iron Golems Fire Absorption trait. Typically any creature with an Absorption trait will also be immune to that damage type.

Available on the Forge
https://forge.fantasygrounds.com/shop/items/345/view


New Effects
ABSORB: damagetype This effect will trigger whenever the creature receives damage of the specified damage types. You can include multiple damage types in a list separated by a comma. When damage of the specified type is received, the creature will instead be healed for that amount.
ABSORB2: damagetype Same as ABSORB except only heals half the damage taken rounded down.
Example
Creatures
Iron Golem - ABSORB: fire
Flesh Golem - ABSORB: lightning
Clay Golem - ABSORB: acid
Items
Black Dragon Mask - ABSORB2: acid
Green Dragon Mask - ABSORB2: poison
Blue Dragon Mask - ABSORB2: lightning
Red Dragon Mask - ABSORB2: fire
White Dragon Mask - ABSORB2: cold

Drogo210
December 16th, 2021, 11:12
This extension 'conflicts' with Kent's Spell Resistance as this adds 'spell' to damage type

mattekure
December 16th, 2021, 12:51
This extension 'conflicts' with Kent's Spell Resistance as this adds 'spell' to damage type

Can you be more specific in how this extension conflicts? Describe an actual situation where the conflict can be demonstrated? This extension does not add any new damage types. All it does is look for an ABSORB effect when damage is taken.

Drogo210
December 16th, 2021, 13:30
Can you be more specific in how this extension conflicts? Describe an actual situation where the conflict can be demonstrated? This extension does not add any new damage types. All it does is look for an ABSORB effect when damage is taken.

Sure, Spell Resistance adds 'spell' to the type of damage for magical attacks then Fire Bolt for example would look like 1d10 fire, spell. It seems that ABSORB does not like double damage type (fire, spell) and does not trigger. Look at picture for more details.

50348

mattekure
December 16th, 2021, 13:40
thanks, I'll take a look into this and see about ignoring the spell damage type.

mattekure
December 16th, 2021, 16:37
Sure, Spell Resistance adds 'spell' to the type of damage for magical attacks then Fire Bolt for example would look like 1d10 fire, spell. It seems that ABSORB does not like double damage type (fire, spell) and does not trigger. Look at picture for more details.

50348

The fix was pushed, please verify after updating.

Fingersome
February 17th, 2022, 04:00
I have found a conflict between this and Advanced Weapon Damage (https://www.fantasygrounds.com/forums/showthread.php?59741-extension-Advanced-Weapon-Damage-Extension/page13) by bratch9

mattekure
February 17th, 2022, 13:10
I have found a conflict between this and Advanced Weapon Damage (https://www.fantasygrounds.com/forums/showthread.php?59741-extension-Advanced-Weapon-Damage-Extension/page13) by bratch9

I dont own that one, so I have no way to test it. Can you be more specific about what you are seeing? Are there error messages, or functionality that is different?

bratch9
February 22nd, 2022, 19:40
I dont own that one, so I have no way to test it. Can you be more specific about what you are seeing? Are there error messages, or functionality that is different?

I've just grabbed your extension, and will try and get time to take a look at the conflict. (Between yours and AWD)

-pete

bratch9
February 22nd, 2022, 22:29
I dont own that one, so I have no way to test it. Can you be more specific about what you are seeing? Are there error messages, or functionality that is different?

Hi,

I've taken a look and an initial fix would be to add a '<loadorder>111</loadorder>' ( or above.. ) as AWD replaces onDamage ( and does not call to the previous function ) as it has to do a lot of work to deal with its special case additions to the damage type line.

Talking of the damage type, I'd suggest not doing 'if vType == sDmgType then' because this has issues with more complex damage lines that can happen. For example your usage fails if you take a 'longsword+1' and edit its damage type from 'slashing' to 'lightning' and use on a Flesh Golem - ABSORB: lightning effect. This is because the sDmgType is now 'lightning,magic' and does not match your == 'lightning'

The damage type line is normally split into words with the likes of 'local tSplitDmgTypes = StringManager.split(v, ",", true);' 5E manager_action_damage.lua line 299.. so 'lightning,magic' would get split into 2 damage types. ( one of 'lightning' and one of 'magic' )

While the above would get you sort of working with AWD, it would not support the extra special cases when a damage line looks like, 'lightning,type(undead)' as your system will process this first and with the 'StringManager.split' fix would apply healing of the lightning damage to a creature with your ABSORB: lightning effect enabled at its current value. And AWD would apply the rule 'type(undead)' and could later zero out this amount of damage on creatures non-undead ( in this case ). So it can cause complications.

The loadorder will drop your processing before AWD and this is all that would be needed if you don't want to also combine it with the 'effect' type processing that AWD could apply onto each damage clause of a weapon. ( Depending on what the users configure. )

-pete

bratch9
February 22nd, 2022, 23:53
On a 2nd note... You could use the string manager function 'split', 'trim' and 'contains'..

I'd suggest you use split/trim on your 'ABSORB: <damageType>', ie "ABSORB: fire,slashing" to create a table[]="fire","slashing" etc...

and also the split/trim on the clause <damageType>, ie "lightning,spell,magic" to create a table[]="lightning","spell","magic" etc..

then a for pairs loop on one table, and pass the other table into the 'contains' function and if this ever returns true then apply your heal and break out the loop.

While it sounds like more code, its about the same, and it removes the 'gsub()' for the 'spell' special case. ( Which probably should be more like ",%s*spell" to cope with zero or more spaces between the ',' and 'spell'... )

This would allow your 'ABSORB:' to work more like the 'IMMUNE' style ',' split list.

51629

[ You could probably borrow the IMMUNE code to even see and allow the !<type> support, but that might be going a bit over the top.. ]

I'd probably also change the 'ABSORB2' to maybe 'HABSORB' or 'ABSORBH' to follow the likes of the [HLVL] type effect system. ( I know effects do not use the like of 'HATK:' or 'ATKH:' as the type.. )

But 'ABSORB2' reads more as double than half. Totally your call on this one. I just like to see a common effects type rules process..

-pete

mattekure
February 23rd, 2022, 00:31
Appreciate the comments, I'll take a look at making some changes soon.

bratch9
February 23rd, 2022, 14:27
A 3rd suggestion I use in AWD is


<includefile ruleset="3.5E" source="3.5E/3.5E.xml" />

With a folder for ruleset specific files. ie 3.5e.xml has this type of thing,


<script name="Ruleset_awd" file="3.5E/scripts/ruleset_awd.lua" />

Each ruleset has a 'Ruleset_awd' module name and matching functions like,

(3.5e function )


function onDamageRoll()
return "%[TYPE: ([^(]*) %(([^)]*)%) %(([^)]*)%) %(([^)]*)%) %(([^)]*)%) %(([^)]*)%)%]";
end


(5e function )


function onDamageRoll()
return "%[TYPE: ([^(]*) %(([^)]*)%)%(([^)]*)%)%(([^)]*)%)%(([^)]*)%)%]";
end


That selects the difference between rulesets, so the main code can just use 'Ruleset_awd.onDamageRoll()' to grab the parsing differences between the rulesets.

I noticed much of your 4e function difference was the small mid section code to do with the 'TYPE' section, you could process this in a ruleset specific file and have the 5e version do nothing so your core can call one replacement function.

With a small change you can have a common code section that is easy to adjust/debug for both ruleset.

-pete