#retroactive-advantage
1 messages ยท Page 1 of 1 (latest)
It's still janky, but much less janky than I expected. For those interested I'll try to write out the theory
Any chat message with a dice result has a roll instance embedded in its json, accessible with a getter at chatMessage.roll
This module clones that roll instance and manually changes the advantageMode and results according to what I understand they should look like with the new advantageMode.
If necessary, it rolls extra d20s (with DSN support for shinys) and adds those into the roll array.
After that it'll call the following Roll methods _evaluateModifiers, getFormula, _evaluateTotal to "half-way-re-evaluate" the Roll without re-rolling any dice.
From there, it bundles up the new Roll instance and updates the chatMessage with the new roll. (Had to use a GM Proxy for this because of permissions unfortunately)
Overall, it's a medium-risk approach that relies on the Roll class's private methods and fields, but since it's self-contained, if it ever stops working, you can just disable the module on its own and move on without it breaking anything else you're using ๐
Compatibility with Compact Roll Cards? ๐
it does actually work perfectly to my surprise ๐
hey this is pretty slick ๐
I should probably get around to releasing that too lol
(Yes please)
seems like it works pretty well, if im understanding what you wrote up correctly this only works for users with GM permissions?
It uses socketlib to get around that limitation so even players can use it
Just needs a GM online.
AH that'll do it.
right, good call
i was about to say, no way i have your first bug report already LOL
https://discord.com/channels/170995199584108546/952435722852397076
for more context on that technical hurdle
good stuff!
with that said, this is still pretty early and hasn't been battle tested very thoroughly, so by all means hit me with your bug reports and incompatibilities
ill definitely be giving it a run, but a cursory "click the buttons a lot and see what happens" yields good results
so... what if I wanted to do this to any chat roll that has a d20?
I'm gonna dig through the code and see if I can just scrape what I need to create a hook that adds buttons and then modify the roll
heck, you take this: out of the retroactive-advantage-5e.js and this bit out of the hook and it works fine except the formula doesn't change
those rolls being made with inline rolls
but you are relying heavily on the d20roll class to do a lot of stuff. I'm going to have to fiddle with the roll object
as in, the d20s you just roll with /r 1d20?
I'm a little confused about the use case, ngl
macros?
in a sense yes, my group plays with macros I made that make everything inline rolls
gooootchya. Hmmmmmm. Make me a GH issue if you please with whatever info you find out, if you manage to make it work, i'm interested in a PR.
else I'll see if I can throw some time at converting this to stop using D20Roll so much, and use a normal Roll instance maybe
You don't need to do that, d20Roll has a lot of 5e specific stuff you probably actually want. I will probably just fork it for my silly specific use case
I'm not sure how much I'm actually using of the 5e roll tbh. It was dizzying to try to grasp how all these roll classes interact... I wouldn't be surprised if this is low level enough to get away with ditching it.
... Which... Hmmm. I wonder if this could end up system agnostic ish
the only place it is really being used is to clone the roll while retaining the references, which is very important,
mmm there's system specific handling for stuff like min10 being interpreted as 'reliable talent' during _evaluateModifiers I think
never mind me then. I made all the inline roll macros to keep my foundry games feeling like dice games. I don't use automation, so it is just as easy to have them roll twice if they forget and take the relevant roll
appreciate your feedback! still interested in what you come up with for your fork if you wanna go through the trouble of pushing so I can take a look ๐
honestly, got stuck where you copy the roll. Like I said earlier, it actually works if you just remove the checks as to whether it is a d20Roll object. It just does not update the formula.