pwatson100 / symbaroum

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

prepareRollAttribute resolves when roll completes #608

Closed MiddleTwin closed 1 year ago

MiddleTwin commented 1 year ago

it's enough to get the following script to work:

let player = game.actors.get('<id>');

player.rollAttribute("quick").then((roll) => {
 ChatMessage.create({content: roll.margin >= 0? "Throw Successful": "Throw failed"})
})

Useful for when e.g. a player has wrestling as adept or advanced and wants to roll it instead of defend, then automatically chain into defend or damage and then an optional free attack into an optional hammer ram, etc. Basically makes a lot of scripts that weren't previously possible both possible and fairly easy.

Since Symbaroum gameplay can involve a lot of conditional rolls the ability to automate them is extremely helpful.

prepareRollAttribute is complicated enough that I'm sure I missed at least one or two terminal branches, but basically we just want to add either a resolve() or reject() right after the roll is either made or cancelled.

Since the current promise returned by prepareRollAttribute isn't useful, no one should be using it and so we should have full backwards compatibility.

bithir commented 1 year ago

Can you please rework these change in to our RT-VT10 branch and redo the PR?

pwatson100 commented 1 year ago

I have edited it to push to RT-V10.

pwatson100 commented 1 year ago

Bithr spotted that the git history seems to be trying to merge old changes. Would you be able to pull the TR-10 branch and make the changes there and issue a new pull request please?

MiddleTwin commented 1 year ago

Opened a new PR for RT-V10. Closing this one.