forked from Kekilla0/Personal-Macros
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathShillelagh.js
24 lines (24 loc) · 1.1 KB
/
Shillelagh.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
//check for all error message needs
if(!game.modules.get("about-time").active) return ui.notifications.error(`About Time isn't Loaded`);
//instantiate variables (macro, quarterstaff)
const macro = game.macros.entities.find(m=>m.name==="Call");
const quarterstaff = game.user.character.data.items.find(i=>i.name==="Quarterstaff");
const copy_quarterstaff = duplicate(quarterstaff);
//cast spell
game.dnd5e.rollItemMacro("Shillelagh").then(()=> {
//call macro, set condition + time
macro.execute(game.user.character.name,"Shillelagh",1,"");
//get old information
let qOld_ability = quarterstaff.data.ability;
let qOld_damage = quarterstaff.data.damage.parts[0][0];
//update weapon
copy_quarterstaff.data.ability= "wis";
copy_quarterstaff.data.damage.parts[0][0] = "1d8+@mod";
game.user.character.updateEmbeddedEntity("OwnedItem",copy_quarterstaff);
//revert weapon
game.Gametime.doIn({minutes:1},() => {
copy_quarterstaff.data.ability = qOld_ability;
copy_quarterstaff.data.damage.parts[0][0] = qOld_damage;
game.user.character.updateEmbeddedEntity("OwnedItem",copy_quarterstaff);
});
});