I've found a couple new issues with my mod which may or may not be Modworked specific:
1) The Barbarian's weapon masteries aren't working right. I changed them to add a damage bonus that is multiplicative with Melee Mastery (a new skill I gave to all classes, which is essentially a weapon mastery for the 'mele' item type) as well as an attack rating bonus, but once I actually took the mastery after already taking Melee Mastery, the damage bonus of the new mastery didn't work, and the attack rating bonus was less than expected (the formula I used for the AR bonus is 10*lvl, I put 2 points in the mastery, and I had a +1 skill bonus, but I only got a 20% bonus). I'm guessing either masteries can't stack (the mastery I tested uses the 'swor' item type, which is within the 'mele' item type), or moving item types somehow breaks the mastery (I applied the changes of Modworked 14+ that enabled mercs to equip other items by moving the 'swor' item type to row 914 of ItemTypes.txt). The attack rating bonus working on hard points while the damage bonus doesn't work is confusing, so I'll post the relevant formulas, though I'm not convinced it's a formula problem.
2) This is more an FYI to anyone who reads this, but if a property has 21 as its func1 in Properties.txt (this is used for pseudostats) and another stat with 17 in its func (which corresponds to the param value when entered on items), the param is apparently set to the min/max even if the param field itself is empty. I discovered this when trying to boost unarmed damage when no shield is equipped, but the game was treating every item classified as light, medium, or heavy armor as a shield (I'm using the 'shieid' stat to mark shields, but I made it a parameter to the property that marks an item as light, medium, or heavy armor). I've created a separate property for shields and removed the 'shieid' stat from the original light/medium/heavy armor properties, and it works.
Now for the formulas related to weapon masteries:
- First of all, I'm using the superstates to implement masteries, which means they update in real time. The problem was discovered with Sword Mastery, but whatever fixes that should fix the other masteries as well, so I'll just use Sword Mastery here.
- Sword Mastery uses superoskill15 with passiveitype 'swor', while Melee Mastery uses superoskill21 with passiveitype 'mele'. In both cases, the AR bonus is in pst1, while the damage bonus is in pst2. Melee Mastery also has a critical strike that's working properly, while Sword Mastery doesn't.
- Sword Mastery's attack rating bonus is given as skill('sword mastery'.pst1)*(100+skill('[melee]'.len))/100, while its damage bonus is given as skill('sword mastery'.pst2)*(100+skill('[melee]'.len))*skill('physb'.ast3)/10000. Both pst1 and pst2 of Sword Mastery are 10*lvl. I just noticed that refs to Sword Mastery here are in lowercase, while the actual Sword Mastery skill is in uppercase, so perhaps there's a case sensitive issue here.
- Melee Mastery's attack rating bonus is given as skill('[melee]'.len), while its damage bonus is given as skill('[melee]'.rng). I just noticed that the skill('[melee]'.len) part of Sword Mastery's damage bonus should be skill('[melee]'.rng), and making that change would remove the need for skill('physb'.ast3), since [melee].rng already takes strength into account (in my mod, skill-based bonuses to weapon damage are multiplicative with stat-based bonuses to weapon damage).
- [melee] is a ref skill used to unify all the Melee Mastery skills since each class needs its own Melee Mastery skill for all classes to be able to put points in it. The mod refs [melee].len for the attack rating bonus, [melee].rng for the damage bonus (which is equal to the attack rating bonus but multiplicative with stat-based damage bonus), and [melee].clc4 for the crit chance.
Edit: I just realized that attack rating bonus of Sword Mastery was written to be multiplicative with Melee Mastery's attack rating bonus. This makes the problem even weirder, as the AR bonus as applied is an additive 20% when it's supposed to be a
multiplicative 30%.
Edit 2: After checking, it turns out the old formula for weapon mastery damage is right, as [melee].rng only applies the stat-based damage bonus to [melee].len and not the specific weapon mastery. I've tacked on +skill('[melee]'.rng) at the end per the reply given by Cypress.