Allow the Combat tracker to roll intiative using a custom formula
This commit is contained in:
parent
deedda7648
commit
116eb216d0
4 changed files with 25 additions and 0 deletions
|
|
@ -10,6 +10,10 @@
|
||||||
"name": "Players Can Manage Attributes",
|
"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"
|
"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": {
|
"sheetDefaultHeight": {
|
||||||
"name": "Default Actor Sheet Height",
|
"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."
|
"hint": "The height that all actor sheets will open at unless overwridden for that sheet specifically. This setting will not affect already opened sheets."
|
||||||
|
|
|
||||||
9
module/documents/Combatant.mjs
Normal file
9
module/documents/Combatant.mjs
Normal 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`);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
@ -7,6 +7,7 @@ import { PlayerData } from "../data/Player.mjs";
|
||||||
|
|
||||||
// Documents
|
// Documents
|
||||||
import { TAFActor } from "../documents/Actor.mjs";
|
import { TAFActor } from "../documents/Actor.mjs";
|
||||||
|
import { TAFCombatant } from "../documents/Combatant.mjs";
|
||||||
import { TAFItem } from "../documents/Item.mjs";
|
import { TAFItem } from "../documents/Item.mjs";
|
||||||
import { TAFTokenDocument } from "../documents/Token.mjs";
|
import { TAFTokenDocument } from "../documents/Token.mjs";
|
||||||
|
|
||||||
|
|
@ -25,6 +26,7 @@ Hooks.on(`init`, () => {
|
||||||
|
|
||||||
CONFIG.Token.documentClass = TAFTokenDocument;
|
CONFIG.Token.documentClass = TAFTokenDocument;
|
||||||
CONFIG.Actor.documentClass = TAFActor;
|
CONFIG.Actor.documentClass = TAFActor;
|
||||||
|
CONFIG.Combatant.documentClass = TAFCombatant;
|
||||||
|
|
||||||
CONFIG.Actor.dataModels.player = PlayerData;
|
CONFIG.Actor.dataModels.player = PlayerData;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,16 @@ import { __ID__ } from "../consts.mjs";
|
||||||
const { NumberField, StringField } = foundry.data.fields;
|
const { NumberField, StringField } = foundry.data.fields;
|
||||||
|
|
||||||
export function registerWorldSettings() {
|
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`, {
|
game.settings.register(__ID__, `canPlayersManageAttributes`, {
|
||||||
name: `taf.settings.canPlayersManageAttributes.name`,
|
name: `taf.settings.canPlayersManageAttributes.name`,
|
||||||
hint: `taf.settings.canPlayersManageAttributes.hint`,
|
hint: `taf.settings.canPlayersManageAttributes.hint`,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue