Created
October 20, 2022 20:33
-
-
Save nickelpro/348cedf0f75672b8eae0eecbd505efca to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function applyDivineFury(token, tactor, tokenId, type, origin) { | |
let damage = ` + (1d6 + ${(args[1] / 2) | 0})[${type}]` | |
let duration; | |
if (game.combat) { | |
duration = { | |
startRound: game.combat.round, | |
rounds: 0, | |
turns: 1 | |
} | |
} else { | |
duration = { | |
startTime: game.time.worldTime, | |
seconds: 6 | |
} | |
} | |
let efData = { | |
label: "Divine Fury", | |
icon: "icons/skills/melee/strike-weapons-orange.webp", | |
duration: duration, | |
changes: [ | |
{ | |
key: "macro.itemMacro", | |
mode: 2, | |
value: "", | |
priority: 20 | |
}, | |
{ | |
key: "system.bonuses.mwak.damage", | |
mode: 2, | |
value: damage, | |
priority: 20 | |
} | |
], | |
origin: origin, | |
flags: { | |
dae: { | |
specialDuration: [ | |
"1Hit:mwak" | |
], | |
itemData: { | |
name: "Divine Fury", | |
type: "feat", | |
flags: { | |
itemacro: { | |
macro: { | |
command: "let token = await fromUuid(args[1].tokenUuid); if(args[0] == 'off') { Sequencer.EffectManager.endEffects({name: `df-${args[1].tokenId}`, object: token}); }", | |
scope: "global", | |
sort: 0, | |
type: "script" | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
new Sequence() | |
.effect() | |
.file("modules/jb2a_patreon/Library/Generic/Marker/MarkerRunes_02_Dark_Orange_400x400.webm") | |
.attachTo(token) | |
.scaleToObject(1.6) | |
.fadeIn(500) | |
.fadeOut(500) | |
.persist() | |
.name(`df-${tokenId}`) | |
.play() | |
await tactor.createEmbeddedDocuments("ActiveEffect", [efData]) | |
} | |
async function applyFanaticalFocus(tactor, origin) { | |
let duration = { | |
seconds: 60, | |
type: "seconds", | |
duration: 60, | |
remaining: 60, | |
label: "60 Seconds" | |
} | |
if (game.combat) { | |
duration.startRound = game.combat.round | |
} else { | |
duration.startTime = game.time.worldTime | |
} | |
let efData = { | |
label: "Fanatical Focus", | |
icon: "icons/creatures/eyes/humanoid-single-blind.webp", | |
duration: duration, | |
origin: origin, | |
changes: [ | |
{ | |
key: "flags.midi-qol.optional.fanatic-focus.label", | |
mode: 5, | |
value: "Fanatical Focus", | |
priority: 20 | |
}, | |
{ | |
key: "flags.midi-qol.optional.fanatic-focus.count", | |
mode: 5, | |
value: "1", | |
priority: 20 | |
}, | |
{ | |
key: "flags.midi-qol.optional.fanatic-focus.save.fail", | |
mode: 5, | |
value: "reroll", | |
priority: 20 | |
} | |
], | |
} | |
await tactor.createEmbeddedDocuments("ActiveEffect", [efData]) | |
} | |
let token = await fromUuid(args[2].tokenUuid) | |
let tactor = token.actor | |
let df = tactor.items.getName("Divine Fury") | |
let type = df?.system?.damage?.parts?.[0][1] | |
let hasFocus = tactor.items.getName("Fanatical Focus") | |
if (args[0] == "on") { | |
if (hasFocus) | |
await applyFanaticalFocus(tactor, args[2].origin) | |
if (type) | |
await applyDivineFury(token, tactor, args[2].tokenId, type, args[2].origin) | |
} else if (args[0] == "each") { | |
if (type) | |
await applyDivineFury(token, tactor, args[2].tokenId, type, args[2].origin) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment