Skip to content

Fix some issues with magic missile

Firstly, thanks a ton for the macros in this repository, they're awesome! Especially as a reference while trying to learn the foundry api and all that can be done with it.

One of my players started to use magic missile more regularly during sessions and noticed the default one was not automated very well. I found this macro and tried it out, but had some issues.

  1. The missiles were only applying to one target, and damage applications only happened once
  2. The card in the chat was missing the images
  3. Dice rolls reported in chat would be off by one from what was visually rolled using dice3d (and from what must've been rolled based on damage calculated)

This MR attempts to fix each of these issues. I've split the fixes into separate commits so that they can be reviewed and accepted/rejected individually if you like.

I've also included a filename fix to remove a trailing space that was making the windows filesystem very upset.

Test Evidence

I put the macro as the item macro on a spell item in foundry and gave it to a random bandit token. Then cast the spell on some test monsters I had set up. Screenshots are from the canvas with the token and also the chat window to display the images and dice roll results. When casting the spell I chose 1, 2, 0 missile to go to the targets respectively from left to right and the monsters started with full health.

I'm currently using:

  • Foundry Build 314, Version 11 Stable
  • DnD5e module version 2.4.0
  • MidiQOL version 11.2.4
  • Dice So Nice! version 4.6.8
  • A bunch of other stuff that I don't think is super likely to be impacting this (although the weird 100ms delay helping might be somehow related to other modules)

Before:
image image

Notice:

  • Damage is only applied to one of the targets. There is 10 hp missing, but the leftmost token is unaffected by the spell
  • Token art is broken on the chat card
  • The d4 symbol reporting the roll in the chat card shows 5 (the total result with the +1 added, not the actual result of the die roll)

After: image image

Merge request reports

Loading