forked from Kekilla0/Personal-Macros
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Second Wind.js
27 lines (27 loc) · 954 Bytes
/
Second Wind.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
(async () => {
const charData = game.user.character;
const fighterLvl = charData.items.find(i=>i.name==="Fighter").data.data.levels;
game.dnd5e.rollItemMacro("Second Wind").then(() =>{
const SWroll = new Roll(`1d10+${fighterLvl}`);
SWroll.roll();
SWroll.toMessage({
user : game.user._id,
speaker : speaker,
flavor : "Second Wind Dice"
});
const actorUpdate ={
data :{
attributes:{
hp :{
value : Math.clamped(
charData.data.data.attributes.hp.value + SWroll.total,
charData.data.data.attributes.hp.min,
charData.data.data.attributes.hp.max
)
},
},
},
};
charData.update(actorUpdate);
});
})();