Skip to content
This repository has been archived by the owner on Jan 20, 2025. It is now read-only.

Commit

Permalink
Merge pull request #732 from mjording/mmrpg
Browse files Browse the repository at this point in the history
Basic system setup for MMRPG
  • Loading branch information
otigon authored Jan 2, 2025
2 parents db13421 + 5d8ead9 commit 0845771
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 1 deletion.
31 changes: 30 additions & 1 deletion src/gameSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,36 @@ class AAGameSettings extends TJSGameSettingsWithUI {
}
});
break;


case 'marvel-multiverse':
settings.push({
namespace,
key: 'playonAttackCore',
folder: game.system.title || game.system.name,
options: {
name: 'autoanimations.settings.coreonatk_name',
hint: 'autoanimations.settings.coreonatk_hint',
scope: scope.world,
type: Boolean,
default: false,
config: true
}
});
settings.push({
namespace,
key: 'playonDamageCore',
folder: game.system.title || game.system.name,
options: {
name: 'autoanimations.settings.coreondmg_name',
hint: 'autoanimations.settings.coreondmg_hint',
scope: scope.world,
type: Boolean,
default: false,
config: true
}
});
break;

case 'dnd5e':
case 'sw5e':
if (game.modules.get('midi-qol')?.active) {
Expand Down
39 changes: 39 additions & 0 deletions src/system-support/aa-marvel-multiverse.js
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)
}

0 comments on commit 0845771

Please sign in to comment.