-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSpell.js
35 lines (31 loc) · 1.14 KB
/
Spell.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
const spellUuid = ""; // UUID of the spell from the Actor inventory
const actor = canvas.tokens.controlled[0].actor;
const item = await fromUuid(spellUuid);
const speaker = ChatMessage.getSpeaker({ actor: actor});
const rollMode = game.settings.get('core', 'rollMode');
const label = `[${item.type}] ${item.name}`;
ChatMessage.create({
speaker: speaker,
rollMode: rollMode,
flavor: label,
content: item.system.description ?? '',
});
// Remove automatically the power of the Actor, edit this if your system have a differente Power configuration
if(item.system.power) {
const power = actor.system.power.value;
const cost = item.system.power;
const newpower = power - cost;
actor.update({'system.power.value': newpower})
}
// You can add a sequencer effect here
/* EXEMPLE
new Sequence()
.effect()
.file("modules/JB2A_DnD5e/Library/Generic/UI/Critical_03_Red_200x200.webm")
.atLocation(canvas.tokens.controlled[0])
.scaleToObject(3)
.fadeIn(1500, {ease: "easeOutCubic", delay: 0})
.scaleIn(2, 2500, {ease: "easeInOutCubic"})
.scaleOut(0, 1500, {ease: "easeInCubic"})
.play()
*/