Merge pull request 'Allow the Combat tracker to roll intiative using a custom formula' (#24) from feature/combat-tracker-initiative-roll into main

Reviewed-on: #24
This commit is contained in:
Oliver 2026-01-21 23:12:21 +00:00
commit f65bc37dd3
4 changed files with 25 additions and 0 deletions

View file

@ -10,6 +10,10 @@
"name": "Players Can Manage Attributes",
"hint": "This allows players who have edit access to a document to be able to edit what attributes those characters have via the attribute editor"
},
"initiativeFormula": {
"name": "Initiative Formula",
"hint": "The dice formula used for initiative, this can reference attributes on the actor. If the actor doesn't have the attribute it will be interpreted as 0."
},
"sheetDefaultHeight": {
"name": "Default Actor Sheet Height",
"hint": "The height that all actor sheets will open at unless overwridden for that sheet specifically. This setting will not affect already opened sheets."

View file

@ -0,0 +1,9 @@
import { __ID__ } from "../consts.mjs";
const { Combatant } = foundry.documents;
export class TAFCombatant extends Combatant {
_getInitiativeFormula() {
return game.settings.get(__ID__, `initiativeFormula`);
};
};

View file

@ -7,6 +7,7 @@ import { PlayerData } from "../data/Player.mjs";
// Documents
import { TAFActor } from "../documents/Actor.mjs";
import { TAFCombatant } from "../documents/Combatant.mjs";
import { TAFItem } from "../documents/Item.mjs";
import { TAFTokenDocument } from "../documents/Token.mjs";
@ -25,6 +26,7 @@ Hooks.on(`init`, () => {
CONFIG.Token.documentClass = TAFTokenDocument;
CONFIG.Actor.documentClass = TAFActor;
CONFIG.Combatant.documentClass = TAFCombatant;
CONFIG.Actor.dataModels.player = PlayerData;

View file

@ -3,6 +3,16 @@ import { __ID__ } from "../consts.mjs";
const { NumberField, StringField } = foundry.data.fields;
export function registerWorldSettings() {
game.settings.register(__ID__, `initiativeFormula`, {
name: `taf.settings.initiativeFormula.name`,
hint: `taf.settings.initiativeFormula.hint`,
config: true,
type: String,
default: `1d20`,
scope: `world`,
});
game.settings.register(__ID__, `canPlayersManageAttributes`, {
name: `taf.settings.canPlayersManageAttributes.name`,
hint: `taf.settings.canPlayersManageAttributes.hint`,