pwatson100 / symbaroum

GNU General Public License v3.0
13 stars 18 forks source link

prepareRollAttribute resolves when roll completes #609

Closed MiddleTwin closed 1 year ago

MiddleTwin commented 1 year ago

Cherrypicked the commit from #608 to RT-V10 as requested.

MiddleTwin commented 1 year ago

Note that I haven't tested on this branch, I can do that in a few hours.

MiddleTwin commented 1 year ago

Alright, since the function is way too complicated to do a thorough branch test on I'll just try and test each line I changed- i.e. each terminal state. I also found another one that I missed initially (resist rolls).

Tests will be run with the following script macro:

let actor = game.actor.get(<id>)
actor.doThing().then(val => ChatMessage.create({content: JSON.stringify(val)}))

I will be testing the following behavior: 1) Chat message does not appear until after the roll 2) Chat message contains useful data about the roll 3) If roll doesn't happen chat message should not appear

The current system fails all three tests for all the listed cases AFAICT. Results will be posted soon.

MiddleTwin commented 1 year ago

RESULTS: (S: succeed, F: fail, blank: N/A)

Case Test 1 Test 2 Test 3
Standard Attribute Roll S S
Roll Dialog Cancelled S
PC attack (using actor.rollWeapon) F F
PC armor roll (using actor.rollArmor) S S
NPC Weapon attack, no resist roll F F
NPC Weapon attack, resist roll F F
Invalid damage modifier <Couldn't trigger>

Overall: does not work on attacks. I will try to push a commit to fix that, at least for the no-resist-roll case

(attacks Still work when enhanced combat is not enabled)

MiddleTwin commented 1 year ago

Take 2: Attacks were in a separate function for enhanced combat. I edited that as well.

Case Test 1 Test 2 Test 3
Standard Attribute Roll S S
Roll Dialog Cancelled S
PC attack (using actor.rollWeapon) S S
PC armor roll (using actor.rollArmor) S S
NPC Weapon attack, no resist roll S S
NPC Weapon attack, resist roll S S

Note that although the NPC attack was fine with resist rolls I'm pretty sure it shouldn't have worked-probably tested resist rolls wrong. Still, good enough for me to be happy.