Skip to content

Commit

Permalink
Merge pull request #49 from nickelpro/aid
Browse files Browse the repository at this point in the history
add(spell): Implement Aid
  • Loading branch information
TheGiddyLimit authored Nov 8, 2022
2 parents 9b48a0c + 0d5ae81 commit 6836385
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
12 changes: 12 additions & 0 deletions macro-item/spell/PHB_aid.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
async function macro (args) {
const tactor = (await fromUuid(args[1].tokenUuid)).actor;

const health = tactor.system.attributes.hp.value;
const healthChange = eval(args[1].efData.changes[0].value); // eslint-disable-line no-eval

if (args[0] === "on") {
tactor.update({ "system.attributes.hp.value": health + healthChange });
} else if (args[0] === "off") {
tactor.update({ "system.attributes.hp.value": Math.max(health - healthChange, 0) });
}
}
29 changes: 29 additions & 0 deletions module/data/spell/__core.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,34 @@
{
"spell": [
{
"name": "Aid",
"source": "PHB",
"data": {
"damage.parts": []
},
"effects": [
{
"changes": [
{
"key": "system.attributes.hp.max",
"mode": "ADD",
"value": "(@item.level - 1) * 5",
"priority": 20
},
{
"key": "macro.itemMacro",
"mode": "CUSTOM",
"value": "",
"priority": 20
}
],
"duration": {
"seconds": 28800
}
}
],
"itemMacro": "PHB_aid.js"
},
{
"name": "Aura of Purity",
"source": "PHB",
Expand Down

0 comments on commit 6836385

Please sign in to comment.