forked from hermannm/foundry-macros
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlayonhands.js
43 lines (43 loc) · 1.49 KB
/
layonhands.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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
(async () => {
const {
_id: focusID,
data: {
focus: { points: focusPoints, pool: focusPool },
},
} = actor.data.items.find((item) => item.name === "Focus Spells");
if (event.altKey) {
if (focusPoints < focusPool) {
ChatMessage.create({
user: game.user._id,
speaker: ChatMessage.getSpeaker(),
content: actor.name + " refocuses, restoring 1 Focus Point.",
});
await actor.updateEmbeddedEntity("OwnedItem", {
_id: focusID,
data: { focus: { points: focusPoints + 1, pool: focusPool } },
});
} else {
ui.notifications.warn("Focus pool already full.");
}
} else if (focusPoints <= 0) {
ui.notifications.warn("You have no focus points left.");
} else {
await DicePF2e.damageRoll({
event: event,
parts: new Array(
Math.ceil(actor.data.data.details.level.value / 2)
).fill("6"),
actor: actor,
data: actor.data.data,
title: "Lay on Hands - Healing",
speaker: ChatMessage.getSpeaker(),
});
if (!token.data.effects.includes(effect.iconPath)) {
await token.toggleEffect(effect.iconPath);
}
await actor.updateEmbeddedEntity("OwnedItem", {
_id: focusID,
data: { focus: { points: focusPoints - 1, pool: focusPool } },
});
}
})();