Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

5eOGL Grave Cleric Healing Word Macro for Circle of Mortality feature

I wrote this macro because my grave cleric often forgets to use this feature.  The Circle of Mortality feature specifies that heals to creatures at 0hp have maximum effect. This macro checks your target's health.  If it is zero, it uses the max dice roll to determine hp gained.  Otherwise, it uses normal rolls.  Use as a "Token Action" (so the character casting the spell is "selected" when using). @{selected|wtype}&{template:dmg} {{rname=Healing Word}} 0 {{range=60 feet}} {{damage=1}} {{dmg1flag=1}} {{dmg1=[[{@{target|hp},1}kl1*1d4+{((-1*ceil(@{target|hp}/@{target|target|hp|max}))+1),1}kl1*4 + @{selected|wisdom_mod}[WIS]]]}} {{dmg1type=Healing}} 0 {{dmg2=[[0]]}} {{dmg2type=}} 0 {{desc=}} {{hldmg=[[((1*?{Cast at what level?|Level 1,0|Level 2,1|Level 3,2|Level 4,3|Level 5,4|Level 6,5|Level 7,6|Level 8,7|Level 9,8})*([[{@{target|hp},1}kl1]]))d4+{((-1*ceil(@{target|hp}/@{target|target|hp|max}))+1),1}kl1*?{Cast at what level?}*4]]}} {{spelllevel=1}} {{innate=}} {{globaldamage=[[0]]}} {{globaldamagetype=@{selected|global_damage_mod_type}}} ammo= @{selected|charname_output} This macro can be easily be adapted to Cure Wounds, too, by changing the fours to eights in the appropriate spots.
Updated this macro to account for characters with negative hp (Cuz ppl just get used to clicking the hp bubble and subtracting their damage instead of typing in 0 if it's going to go negative).  @{selected|wtype}&{template:dmg} {{rname=Healing Word}} 0 {{range=60 feet}} {{damage=1}} {{dmg1flag=1}} {{dmg1=[[([[({{(@{target|hp})d1,0d1}kh1,1d1}kl1)]])d4[if hp>0]+[[({((-1*ceil(({(@{target|hp})d1,0d1}kh1)/@{target|target|hp|max}))+1),1d1}kl1*4)]][if hp=0]+(@{selected|wisdom_mod}[WIS])]]}} {{dmg1type=Healing}} 0 {{dmg2=[[0]]}} {{dmg2type=}} 0 {{desc=}} {{hldmg=[[([[(1*?{Cast at what level?|Level 1,0|Level 2,1|Level 3,2|Level 4,3|Level 5,4|Level 6,5|Level 7,6|Level 8,7|Level 9,8})*([[{{(@{target|hp})d1,0d1}kh1,1d1}kl1]])]])d4[if hp>0]+[[{((-1*ceil({(@{target|hp})d1,0d1}kh1/@{target|target|hp|max}))+1),1d1}kl1*?{Cast at what level?}]]*4[if hp=0]]]}} {{spelllevel=1}} {{innate=}} {{globaldamage=[[0]]}} {{globaldamagetype=@{selected|global_damage_mod_type}}} ammo= @{selected|charname_output} Also, some explanation of how it works: In broad strokes, this equation produces two results and adds them together.   (1d4 or 0d4) + (0*4 or 1*4).  In each parenthesis, the first number represents what the value should be when hp is positive, the second number represents what the value should be when hp is 0 (or negative).   Getting to those numbers is a nasty bit of macro gymnastics (at least it felt that way). Starting with how to get to the roll 1d4 if health is positive, but 0d4 if it is at 0 or less. @{target|hp} tells us the current hp.  The trick is to convert this number into 1 or 0 to put in front of that d4 roll.  One might be tempted to divide the current hp by itself to get a 1, but if current hp is 0, the macro will fail completely because it can't divide by 0.  Thus, we want to compare the current health to the number 1 and keep the lowest number.  If health is 0, we get our 0d4, if it is 1 or more we get 1d4.  So: {@{target|hp},1}kl1 . gives 1 or 0, so it gets tacked onto the dice roll ({@{target|hp},1}kl1)d4   (put those parens around it so the parser doesn't get confused about that 1 just before the d4). Now the equation so far does not account for hp that is negative; let's say -7 (because someone subtracted damage instead of zero-ing the hp.  The current expression will yield -7d4, which the parser interprets as -(7d4).  So, before the hp comparisons can be made, any negative number must be converted to zero.  So, the hp is first compared to zero, keeping the higher number.  If the number is positive, it remains the same, if negative, it's now 0.  So, now there is a total of two comparisons: hp to zero kh1 followed by hp to 1 kl1.  It looks like so:  ({{@{target|hp},0}kh1,1}kl1) Another problem arises, because this expression yields the error: Cannot mix sum and M rolls in a roll group Not sure why this is, but what seems to make the parser happy is if everything is a die roll. (If there is some other way of doing this and avoiding the added stress to the roll engine, I'd be happy to learn how.) So @{target|hp} will now be @{target|hp}d1, the 0 becomes 0d1, and the 1 become 1d1. The whole expression turns into this: ([[({{(@{target|hp})d1,0d1}kh1,1d1}kl1)]])d4[if hp>0] Note that the label  [if hp>0]  was added onto the end for easier inspection of the result.  Also, an extra pair of [[ ]] were put around the comparisons to make the result look nicer (instead of seeing all the kh1 and kl1 logic, only the final 0 or 1 is seen). That takes care of the first expression, which gives d4 rolls when they should be used and yields 0 when they should not be used. For the second expression (when health is 0), the result needs to be 1 (to multiply by the constant 4). If health is positive, the result needs to be zero. So, the logic is: (1) Convert any negative numbers to 0, (2) divide by the hp_max for the target character to get a fraction that is less than one, (3) use the ceil() function to round that fraction to 1 or zero, (4) swap 1 and zero around,  and (5) apply to max healing amount.  Note: ceil() function returns a zero when it's input is zero. The logic steps to the point of using the ceil() function cause the expression to look like this:   ceil(({(@{target|hp})d1,0d1}kh1)/@{target|target|hp|max})   The result is either 1 or 0, but the numbers are opposite of how they need to be used (i.e., positive hp yields 1*4, and 0 hp yields 0*4, but the goal is to have 1*4 with 0hp and 0*4 with positive hp).  So, to switch it around, multiply the result by -1, then add 1.  (0*(-1))+1 = 1 (the zero become 1)  (1*(-1))+1=0 (the 1 become 0).  The whole thing now looks like:   ({((-1*ceil(({(@{target|hp})d1,0d1}kh1)/@{target|target|hp|max}))+1),1d1}kl1*4)]][if  hp=0] Now just add the two expressions together to get a result based on the target's current hp :) The rest of the macro is pretty standard stuff with the higher-level cast info being incorporated into the die rolls. Hopefully, this equation is understandable enough to make any tweaks you may wish to add.