5E Character Create Playlist
  1. #1

    Is there a structure that is used when dragging damage from the chat window?

    So I'm thinking about my Improved Critical extension and am trying to possibly streamline some of the code. Currently, to handle dragging damage to a crit immune target correctly, I put a bunch of stuff in the description so that when it is dragged, I can parse the new tags and come up with the proper damage to apply. It works, but I was wondering if there is some built in mechanism I'm missing that I could use instead.

    For example, if I rolled an untargeted crit with a greatsword, and used the default settings, the rolled damage (2d6+2d6+5) might be (3+2)+(4+5)+5 = 19, but the actual damage after my extension would be: (6+6) + (4+5) + 5 = 26.

    Now, if I drag that "26" to a normal target, I want it to do 26 damage, which it does.

    But, if I drag it to a crit immune target, I want it to do 19 damage (which it also does now.)

    But to facilitate this, I keep track of everything I need in the sDesc and it works, but it is also displayed in the chat window in a format that I might do differently if I could track the dragged damage another way, like maybe keep track in a stack or something. But I don't know how the dragged item is retrieved.

    Any clues?

    Thanks!

  2. #2
    You don't mention the ruleset; but in some of them, you can just specify an effect as "IMMUNE: critical" for the combatant to be immune to critical damage.

    To answer your other comments, there is nothing inherent to the drag data; it's all encoded in the text since it needs to be handled as either drag or double-click roll.

    Regards,
    JPG

  3. #3
    Thanks for the confirmation Moon!

    So, another stupid question. I'm trying something new and I'm adding a table to the rRoll structure (rRoll.clausemodifiers) in my wrapper of the modDamage function to keep track of things during the damage calculation. When I dump the rRoll to the console after my wrapper calls the ruleset's modDamage, it looks right...rRoll.clausemodifiers is added and populated as I'd like (rRoll.clausemodifier[1].bDoubleDamage=false, rRoll.clausemodifier[1].bMaxDamage=true), etc.

    However, by the time the onDamageRoll function is called, the table I have added to the rRoll structure has changed to a string and is now empty (rRoll.clausemodifier='' - it's not even a table anymore).

    Am I doing something wrong or is this expected? Do I need to convert it to a string and then convert it back to a table to preserve the values?

    Thanks!

  4. #4
    The rRoll structure data only gets passed one level deep, since that is how the dice roll internal structures work. So, any nested tables will not get passed.

    Regards,
    JPG

  5. #5
    Gotcha. I'll just store it as a string then.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
5E Product Walkthrough Playlist

Log in

Log in