Thread: Weapon properties, possible bug?
-
December 28th, 2019, 02:10 #1
Weapon properties, possible bug?
So while working on some documentation I ran across the 5e description of weapon properties.
The weapon's properties should follow those noted in the PHB so that Fantasy Grounds recognises what they mean, Thus the acceptable properties would be, light, finesse, thrown, heavy, two-handed, reach etc. Also record here whether the weapon is magical or is made from rare materials. Acceptable words are magic, silver, adamantine. Properties should be listed separated by commas e.g light, finesse, silver, magic. Two further properties are available 'crit range x' will determine whether this weapon criticals on a number less than 20 (crit range 19 for crit on 19-20); and 'reroll x' where a weapon rerolls damage dice (for example reroll 2 will reroll any 1's and 2's that come up on the damage dice and take the rerolled values).
I noticed the same thing in the AD&D ruleset and corrected it. This should work for 5E.
Location: char_weapon.lua
Code:function onDamageAction(draginfo) local nodeWeapon = getDatabaseNode(); local nodeChar = nodeWeapon.getChild("...") local rActor = ActorManager.getActor("pc", nodeChar); local aWeaponProps = StringManager.split(DB.getValue(nodeWeapon, "properties", ""):lower(), ",", true); local rAction = {}; rAction.bWeapon = true; rAction.label = DB.getValue(nodeWeapon, "name", ""); if type.getValue() == 0 then rAction.range = "M"; else rAction.range = "R"; end local sBaseAbility = "strength"; if type.getValue() == 1 then sBaseAbility = "dexterity"; end -- Check for reroll tag for _,vProperty in ipairs(aWeaponProps) do local nPropReroll = tonumber(vProperty:match("reroll (%d+)")) or 0; if nPropReroll > 0 then rAction.nReroll = nPropReroll; end end rAction.clauses = {}; local aDamageNodes = UtilityManager.getSortedTable(DB.getChildren(nodeWeapon, "damagelist")); for _,v in ipairs(aDamageNodes) do local sDmgAbility = DB.getValue(v, "stat", ""); if sDmgAbility == "base" then sDmgAbility = sBaseAbility; end local nAbilityBonus = ActorManager2.getAbilityBonus(rActor, sDmgAbility); local nMult = DB.getValue(v, "statmult", 1); if nAbilityBonus > 0 and nMult ~= 1 then nAbilityBonus = math.floor(nMult * nAbilityBonus); end local aDmgDice = DB.getValue(v, "dice", {}); local aDmgReroll = nil; if rAction.nReroll then aDmgReroll = {}; for kDie,vDie in ipairs(aDmgDice) do aDmgReroll[kDie] = rAction.nReroll; end end local nDmgMod = nAbilityBonus + DB.getValue(v, "bonus", 0); local sDmgType = DB.getValue(v, "type", ""); -- this will check the properties on the weapon and apply addition damage types found local aWeaponDamageTypes = StringManager.split(sDmgType,",",true); for _,sProp in ipairs(aWeaponProps) do if StringManager.contains(DataCommon.dmgtypes, sProp) and not StringManager.contains(aWeaponDamageTypes, sProp) then table.insert(aWeaponDamageTypes, sProp); end end sDmgType = table.concat(aWeaponDamageTypes,", "); -- table.insert(rAction.clauses, { dice = aDmgDice, stat = sDmgAbility, statmult = nMult, modifier = nDmgMod, dmgtype = sDmgType, reroll = aDmgReroll }); end ActionDamage.performRoll(draginfo, rActor, rAction); return true; end
The bold bit is what I added.---
Fantasy Grounds AD&D Reference Bundle, AD&D Adventure Bundle 1, AD&D Adventure Bundle 2
Documentation for AD&D 2E ruleset.
Custom Maps (I2, S4, T1-4, Barrowmaze,Lost City of Barakus)
Note: Please do not message me directly on this site, post in the forums or ping me in FG's discord.
-
December 28th, 2019, 02:34 #2
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,561
It doesn't do it dynamically; it only takes those into account when first adding the weapon to the PC sheet and creating the linked weapon entry.
Regards,
JPG
-
December 28th, 2019, 02:40 #3---
Fantasy Grounds AD&D Reference Bundle, AD&D Adventure Bundle 1, AD&D Adventure Bundle 2
Documentation for AD&D 2E ruleset.
Custom Maps (I2, S4, T1-4, Barrowmaze,Lost City of Barakus)
Note: Please do not message me directly on this site, post in the forums or ping me in FG's discord.
-
December 28th, 2019, 02:44 #4
-
December 28th, 2019, 02:59 #5---
Fantasy Grounds AD&D Reference Bundle, AD&D Adventure Bundle 1, AD&D Adventure Bundle 2
Documentation for AD&D 2E ruleset.
Custom Maps (I2, S4, T1-4, Barrowmaze,Lost City of Barakus)
Note: Please do not message me directly on this site, post in the forums or ping me in FG's discord.
-
December 28th, 2019, 03:03 #6
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,561
That’s right. It only works if you drag and drop from item records to PC sheet. If you create manually, then you have to set up any property modifications manually too.
JPG
-
December 28th, 2019, 07:14 #7
Would it work if I created a new Item group, say "Homebrews", create a weapon in there (or drag one there and then modify it) and drag that to a character's inventory? Or create/modify a weapon in a Package? I'm not at my pc right now to check...
€dit: NM, I just tested (didn't realize I had FG installed on this PC as well, with a demo license) with a newly created weapon: dragged from Equipment sheet to a new Test group in Items, edited that, and dragged that back to the character. Worked like a charm.Last edited by Roach; December 28th, 2019 at 07:28.
-
December 28th, 2019, 18:19 #8
In the case of a manually created weapon, you would need to add the magic keyword to the damage type, not the properties. so piercing, magic for the damage type.
For support with any of my extensions, visit my #mattekure-stuff channel on Rob2e's discord https://discord.gg/rob2e
-
December 28th, 2019, 19:53 #9---
Fantasy Grounds AD&D Reference Bundle, AD&D Adventure Bundle 1, AD&D Adventure Bundle 2
Documentation for AD&D 2E ruleset.
Custom Maps (I2, S4, T1-4, Barrowmaze,Lost City of Barakus)
Note: Please do not message me directly on this site, post in the forums or ping me in FG's discord.
-
December 28th, 2019, 22:07 #10If there is something that you would like to see in Fantasy Grounds that isn't currently part of the software or if there is something you think would improve a ruleset then add your idea here https://www.fantasygrounds.com/featu...rerequests.php
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks