This repository has been archived by the owner on Jan 20, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #732 from mjording/mmrpg
Basic system setup for MMRPG
- Loading branch information
Showing
2 changed files
with
69 additions
and
1 deletion.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { debug } from "../constants/constants.js"; | ||
import { trafficCop } from "../router/traffic-cop.js"; | ||
import AAHandler from "../system-handlers/workflow-data.js"; | ||
import { getRequiredData } from "./getRequiredData.js"; | ||
|
||
// DnD5e System hooks provided to run animations | ||
export function systemHooks() { | ||
|
||
Hooks.on("marvel-multiverse.rollAttack", async (item, roll) => { | ||
let playonAttack = game.settings.get('autoanimations', 'playonAttackCore') | ||
if (item.attack && playonAttack) { return; } | ||
attack(await getRequiredData({item, actor: item.actor, workflow: item})) | ||
}) | ||
Hooks.on("marvel-multiverse.calcDamage", async (item, roll) => { | ||
let playonDamage = game.settings.get('autoanimations', 'playonDamageCore') | ||
if (item.attack && !playonDamage) { return; } | ||
damage(await getRequiredData({item, actor: item.actor, workflow: item})) | ||
}) | ||
|
||
} | ||
|
||
/** | ||
* | ||
* @param {Boolean} attack // Checks if the item has Attack | ||
* | ||
*/ | ||
|
||
async function attack(input) { | ||
debug("Attack rolled, checking for animations"); | ||
const handler = await AAHandler.make(input) | ||
if (!handler?.item || !handler?.sourceToken) { console.log("Automated Animations: No Item or Source Token", handler); return;} | ||
trafficCop(handler) | ||
} | ||
async function damage(input) { | ||
debug("Damage ready, checking for animations") | ||
const handler = await AAHandler.make(input) | ||
if (!handler?.item || !handler?.sourceToken) { console.log("Automated Animations: No Item or Source Token", handler); return;} | ||
trafficCop(handler) | ||
} |