
Rest and Recovery
Warlocks, and Archers, rejoice!
This is a script to handle recovery of the Resource attributes on the D&D 5th Edition by Roll20 sheet. To use this script, most non-class resources must include a code in their name, separated from the name by a plus sign. You can include standard dice expressions as well. "1d6" is used in all examples, but you can do 2d6+3, 3d20, etc. After it is finished, it will whisper to the person who used the command just which resources were affected and by how much.
This script does not affect Hit Points, Hit Dice or any of the other things that a short or long rest does. The Companion script for the sheet handles those, and I don't want to overlap any functions. This only affects the Resource section.
Here are examples of the commands given and the codes that are affected. All commands affect a selected token that represents a PC sheet.
!r-short
Used for Short Rest
+SR This resource will return to its maximum value
+SR1d6 This resource will add 1d6 to the resource up to its maximum value
!r-long
Used for Long Rest
+LR This resource will return to its maximum value
+LR1d6 This resource will add 1d6 to the resource up to its maximum value
!r-charges
used for restoring charges that are user-controlled, such as "at dawn" or "under a full moon".
+1d6 This resource will add 1d6 to the resource up to its maximum value
!r-ammo
no code is used here. The script looks for common ammo types, specifically: "Crossbow bolts", "Arrows", "Bullets", "Needles", and "Darts". It rolls 1d2 for each piece of ammo expended. If the result is a "2", the ammo is recovered, in accordance with the standard rules for D&D 5e. The max and current values are adjusted to reflect the new total.
!r-help
This will display the basic help syntax in chat.
!r-list
This will list every resource that can be recovered without using a code. Almost everything from an official sourcebook is covered with the exception of ties such as Ravnica or Acquisitions, Inc.
Special Cases
Finally, the following special cases exist. Class Resources that have any of the following names are recognized and handled appropriately:
These are recovered on a Short or Long Rest:
- Spell Slots, Warlock Spell Slots
- Channel Divinity
- Wild Shape
- Superiority Dice
- Ki Points, Ki
These are recovered on a Long Rest.
- Rages
- Lay on Hands
- Sorcery Points
Bardic Inspiration needs a +SR or +LR code, since the recovery rate changes at fifth level
Examples:
This barbarian will regain all of their rages on the command !r-long
The archer will find 1-10 arrows on the command !r-ammo. That will become the new maximum.
This high level warlock will regain all of their spells slots on the command !r-short
This Wand of Fear will regain 1d6+1 charges to a maximum of 7 on the command !r-charges
This boon will gain 1d6 charges on the command !r-short. Since it is already at maximum, it will not change.
This script is now available in One Click install.
Or directly from the Roll20 repo at https://github.com/Roll20/roll20-api-scripts/tree/master/Rest-and-Recovery
I'm sure that it will need some tweaking and patching. I ask patience, since I am not a particularly fast or skilled JavaScript coder. If anyone can think of common class features that I have overlooked, or variant ways to refer to them, please feel free to make suggestions. The same goes for common ammunition types. Remember that special cases can always be handled with an appropriate recovery code, though.