-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathInspiring Leader.js
49 lines (45 loc) · 1.75 KB
/
Inspiring Leader.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
44
45
46
47
48
49
/*
▓█████▄ ██▀███ ▒█████
▒██▀ ██▌▓██ ▒ ██▒ ▒██▒ ██▒
░██ █▌▓██ ░▄█ ▒ ▒██░ ██▒
░▓█▄ ▌▒██▀▀█▄ ▒██ ██░
░▒████▓ ░██▓ ▒██▒ ██▓ ░ ████▓▒░
▒▒▓ ▒ ░ ▒▓ ░▒▓░ ▒▓▒ ░ ▒░▒░▒░
░ ▒ ▒ ░▒ ░ ▒░ ░▒ ░ ▒ ▒░
░ ░ ░ ░░ ░ ░ ░ ░ ░ ▒
░ ░ ░ ░ ░
░ ░
A macro for the Inspiring Leader feat.
Iterates through the players and their characters
and uses warpgate to add temp hp to them.
Macro must be executed by the player with the feat.
*/
let talker = game.user.character;
// Talker should be "the player with inspiring leader"
// Inspiring leader gives the leaders level plus their charisma modifier
let thp = talker.data.data.details.level + talker.data.data.abilities.cha.mod;
let missed=[];
for (let u of game.users){
if(u.character){
let tks = canvas.tokens.placeables.filter(t=>t.name == u.character.name);
if (tks.length){
if(tks[0].actor.data.data.attributes.hp.temp < thp){
warpgate.mutate(
tks[0].document,
{'actor.data.attributes.hp.temp':thp},
undefined,
{'description':'Update to your temp HP'}
);
}
} else {
missed.push(u.character.name);
}
}
}
if (missed.length){
ChatMessage.create({
user: game.user._id,
speaker: ChatMessage.getSpeaker({token: actor}),
content: "Tried to apply temp HP to all, but could not find tokens for: " + missed
});
}