go-dice-genesys-hooks
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

Go Dice API Genesys Plugin Hooks

This is an addon for the Go Dice API Wrapper and React hooks packages maintained by Zeragamba and myself adding support for Genesys dice types.

Genesys is a generic version of Fantasy Flight's Edge of the Empire game utilizing symbol based dice values:

  • Success
  • Triumph (critical success)
  • Advantage
  • Failure
  • Despair (critical failure)
  • Threat Successes and failures cancel each other out to determine the roll's success, while advantage and threat cancel each other to determine potential side effects separate to the intended roll outcome.

This package contains two hooks:

  • useGenesysDie

This replaces the useDieValue hook, listens for the die's "value" event and returns an array of genesys die face values, e.g. ["success", "advantage"], ["triumph"], ["failure", "threat"].

function useGenesysDie(die: Die): dieFaceValues[]
  • useGenesysResults

This returns an object containing a variety of state and setState functions used to calculate the final result of the dice pool.

function useGenesysResults(die: Die): {
success: number, // represents the net successes of the roll
triumph: number, // represents the net triumphs of the roll
advantage: number, // represents the net advantages of the roll
rolled: boolean, // state that records whether the user had rolled or not
setRolled: (newState: boolean) => void, // sets rolled state
outcome: string, // contains the successfulness of the roll, e.g. "Success" or "Failure"
sideEffects: string, // contains the nature of the side effects, e.g. "Advantage" or "Disadvantage"
crit: string, // contains the nature of the crit, e.g. "Triumphant" or "Despairing"
inputResult: (genesysDieValue: string[]) => void, // takes the array of values returned by useGenesysDie and will increment or decrement the appropriate state for each value.
resetResults: () => void // this function resets all states to 0
};

Package Sidebar

Install

npm i go-dice-genesys-hooks

Weekly Downloads

1

Version

1.0.1

License

ISC

Unpacked Size

38.7 kB

Total Files

9

Last publish

Collaborators

  • carljmcgee