Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

105 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Alter Core Dice Configuration

Latest Version Foundry Core Compatible Version Foundry Core Compatible Version

Total Download Count Latest Release Download Count Forge Installs

A system-agnostic module to quickly toggle between manual and automatic Foundry core dice configuration!

If a user has a role with permission to make manual rolls in the first place, a button (icon R) will be added to the client's Token Controls sidebar.

  • Click on it to toggle between automatic and manual dice rolling, or automatic and smart routing if smart routing options are enabled*.
  • SHIFT + Click to open the Foundry Configure Dice settings menu and set specific dice to manual.

Added functionality by providing a hotkey (default B) to avoid clicking on the Token Controls ACDC button.

  • CTRL + B toggles between automatic and manual dice rolling, or automatic and smart routing if smart routing options are enabled*.
  • SHIFT + B opens the Foundry Configure Dice settings menu.

* Smart routing is a new feature in ACDC v14.364.1+ that allows systems and modules to register roll types for ACDC to automatically route to the manual resolver.


If you like what I do, consider supporting this lonely bugbear 🐾

Every shiny gold coin helps keep the ideas flowing and the goblins at bay.



You can also join the Bugbear’s Den to hang out, get help, or check what I might be working on!


How to use!

Usage.webm

Smart Routing API Example (v14.364.1+)

ACDC currently ships smart routing choices for the dnd5e system. Other systems and modules can register their own roll types as needed.

Systems or modules can register roll types for ACDC smart routing during acdcRegisterSmartRollTypes.

Hooks.on('acdcRegisterSmartRollTypes', (api) => {
	if (game.system.id !== 'dnd4e') return;

	api.registerSmartRollType({
		id: 'attack',
		label: 'ACDC.Settings.RollTypes.attack',
		test: (roll) => roll.data?.isAttackRoll === true,
	});

	api.registerSmartRollType({
		id: 'initiative',
		label: 'ACDC.Settings.RollTypes.initiative',
		test: (roll) => roll.options?.flags?.dnd4e?.roll?.type === 'init',
	});

	api.registerSmartRollType({
		id: 'damage',
		label: 'ACDC.Settings.RollTypes.damage',
		test: (roll) => roll.options?.hitTypeDamage === true || ['normal', 'crit', 'miss'].includes(roll.options?.hitType),
	});

	api.registerSmartRollType({
		id: 'healing',
		label: 'ACDC.Settings.RollTypes.healing',
		test: (roll) => roll.options?.hitTypeHealing === true || roll.options?.hitType === 'heal',
	});

	api.registerSmartRollType({
		id: 'save',
		label: 'ACDC.Settings.RollTypes.save',
		test: (roll) => roll.options?.flags?.dnd4e?.roll?.type === 'save',
	});

	api.registerSmartRollType({
		id: 'deathSave',
		label: 'ACDC.Settings.RollTypes.deathSave',
		test: (roll) => roll.options?.flags?.dnd4e?.roll?.type === 'save' && String(roll.options?.flavor ?? '').includes(game.i18n.localize('DND4E.RollDeathSave')),
	});
});

The test function receives the Roll and the current dice term. Return true when the roll or dice term belongs to that smart routing type.

Smart route d20adv

We could also register a smart routing type for d20Advantage like:

api.registerSmartRollType({
	id: 'd20Advantage',
	label: 'd20 advantage',
	test: (_roll, term) => term.denomination === 'd20' && term.modifiers?.includes('adv'),
});

About

A small module to set Foundry core dice configuration

Resources

Stars

Watchers

Forks

Releases

Sponsor this project

Packages

Contributors

Languages