toastygm / HarnMaster-3-FoundryVTT

An unofficial system for playing the HârnMaster 3 game by Columbia Games, Inc., on Foundry VTT.
GNU General Public License v3.0
9 stars 4 forks source link

Temporary modifiers not applied during Automated Combat #365

Closed valcorin closed 1 year ago

valcorin commented 1 year ago

When you enable an Active Effect, such as Melee Attack +5, it shows correctly in the Effects tab and under the hood in the object as system.eph.meleeAMLMod: 5 However, this modifier is not applied during Automated Combat. The only Active Effect I've found which changes the modifier is Combat Skills EML (but it unfortunately boosts Defense as well as Attack).

In module/combat.js, you can see the code gets the existing AML and adds the number you type into the dialog, but it doesn't retrieve any temporary values from Active Effects or the like stored in system.eph Line 225 const effAML = dialogResult.weapon.system.attackMasteryLevel + dialogResult.addlModifier;

It seems like that spot in combat.js would be a good place to check temporary modifiers for AML and DML to address the issue.

P.S. In module/actor/actor.js, there is a commented out line that might have been part of applying temporary modifiers, but I'm only guessing. Line 1149 has a commented out /* applyWeaponActiveEffect(weapon) {

toastygm commented 1 year ago

Honestly, the whole mechanism I put in place for active effects for Items was a huge hack, and I've come to regret it mightily. I suggest not using them for the moment. I will be wholesale replacing the mechanism with a new mechanism in the near future.

valcorin commented 1 year ago

I've hacked plenty of code in my lifetime - I understand and shudder at the thought of some of my spaghetti code.