PF2E Playlist
  1. #1

    Problems with 5E ActionDamage.onDamage behavior

    I am intercepting the call to ActionDamage.onDamage. One call with sword damage works. One call with fireball damage does not display the dice on the right end of the chat entry. Why?
    onDamage.png

  2. #2
    Here are the chat messages.
    Sword first
    s' onDamage: rMessage:' | {
    s'diemodifier' = #7,
    s'font' = s'systemfont',
    s'dice' =
    { #1 = { s'type' = s'b12', s'result' = #12 }, #2 = { s'type' = s'b12', s'result' = #12 }, #3 = { s'type' = s'b12', s'result' = #7 }, #4 = { s'type' = s'b12', s'result' = #3 }, #5 = { s'type' = s'b12', s'result' = #6 }, #6 = { s'type' = s'b12', s'result' = #12 }, #7 = { s'type' = s'b12', s'result' = #6 }
    },
    s'type' = s'damage',
    s'sender' = s'_GM PC',
    s'text' = s'[DAMAGE (M)] Longsword [x1.5] [TYPE: slashing (65=65)]',
    s'icon' = s'portrait_gm_token',
    s'secret' = bFALSE }

    then fireball
    s' onDamage: rMessage:' | {
    s'diemodifier' = #6, s'font' = s'systemfont',
    s'dice' =
    { #1 = { s'type' = s'b9', s'result' = #7 }, #2 = { s'type' = s'b9', s'result' = #6 }, #3 = { s'type' = s'b9', s'result' = #7 }, #4 = { s'type' = s'b9', s'result' = #6 }, #5 = { s'type' = s'b9', s'result' = #9 }, #6 = { s'type' = s'b9', s'result' = #6 }, #7 = { s'type' = s'b9', s'result' = #1 }, #8 = { s'type' = s'b9', s'result' = #1 }
    },
    s'type' = s'damage',
    s'sender' = s'_GM PC',
    s'text' = s'[DAMAGE] Fireball (150) = [x1.5] [TYPE: fire (49=49)]',
    s'icon' = s'portrait_gm_token',
    s'secret' = bFALSE }

    The difference in behavior appears to be in one of these two lines from onDamage():
    -- Apply damage to the PC or CT entry referenced
    local nTotal = ActionsManager.total(rRoll);
    notifyApplyDamage(rSource, rTarget, rRoll.bTower, rMessage.text, nTotal);

  3. #3
    I suspect I know the answer. Refdoc says: Each die result object is an array with a "type" and a "result" field. The "type" field is a string matching the die type defined in the XML ("d4", "d6", ...). I recommend that in the comm code you substitute the die_general_icon when the number of sides does not match a specific icon. I will try using "bF" for the die type. I don't think it is used in a calculation for the chat message, and "dF" does have a generic 6 sided die icon. That did not work. It would have to be changed in the comm package.
    Last edited by webdove; April 5th, 2021 at 03:04.

  4. #4
    I'm assuming that "b9" is not a valid die asset type defined in the ruleset; so it will be ignored.

    JPG

  5. #5
    Quote Originally Posted by Moon Wizard View Post
    I'm assuming that "b9" is not a valid die asset type defined in the ruleset; so it will be ignored.

    JPG
    I had a feeling that you might say that .

    I wanted to thank you for the delightful experience this past two weeks of learning LUA (I had not coded since the 1990's in Symbolics Lisp and C++) and learning FGU (very cool despite lacking code comments and man pages).

    Now that I understand things better I will refactor 5E DMGX. I won't use Celestian's 2E approach of scaling nmod and diesides.

    I will intercept the ResultHandler for "damage" (ActionsDamage.onDamage()),
    append "[x?]" to rRoll.dDesc,
    temporarily wrap ActionsManager.total() to scale its returned value by the DMGX value
    run the original ActionsDamage.onDamage().
    unwrap ActionsManager.total()
    return

    This will avoid any issues with non-standard die sizes, avoid comingling the scaled mod with unscaled dice in the chat message and quantize more accurately by only scaling the total.

Thread Information

Users Browsing this Thread

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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
DMsGuild

Log in

Log in