@ehsawyer/initiative-tracker
v1.2.1
Published
A lightweight combat tracker for tabletop games
Readme
@ehsawyer/initiative-tracker
A lightweight combat tracker for tabletop games
Installation
Install with
npm i @ehsawyer/initiative-tracker
or
yarn add @ehsawyer/initiative-tracker
Documentation
Table of Contents
- Tracker
Tracker
Class that handles initiative tracking
Parameters
charactersarray The characters in the trackerturnnumber The character position whose turn it isroundnumber The current round
allCharacters
Get the amount of characters in the tracker
Returns string The amount of character in the tracker
characterCount
Get the amount of characters in the tracker
Returns string The amount of character in the tracker
round
Get the current round
Returns string The current round
turn
Get the current turn
Returns string The current turn
progress
Get the amount of characters in the tracker
Returns string The amount of character in the tracker
currentCharacter
Get the current character whose turn it is
Returns string The current character whose turn it is
turnIndex
Set the turn index
Parameters
indexinteger The target index
roundIndex
Set the round index
Parameters
indexinteger The target index
getCharacterOwnerID
Get the target character
Parameters
targetNamenamestring The name of the target character
Returns string The target character
getCharacterIndex
Get the target character's index
Parameters
namestring The name of the target character
Returns string The target character's index
addCharacter
Adds a character to the tracker
Parameters
userIDstring The ID of the user responsible for controlling the characternamestring The name of the character to be addedinitiativestring The character's initiative rolldexteritystring The character's dexterity score
editCharacter
Edits a character in the tracker
Parameters
namestring The name of the character to be addednewnameinitiativestring The character's initiative rolldexteritystring The character's dexterity score
removeCharacter
Removes a character from the tracker
Parameters
namestring The name of the character to be removed
userHasCharacter
Checks if a user already has a character
Parameters
userIDstring The user's ID
listCharacters
Lists characters to console (Debug only)
nextTurn
Progresses to the next turn
startCombat
Starts Combat
sortTracker
Sorts the current turn order by rolled initiative and then the dexterity score of the characters
reset
Resets the tracker
Parameters
wipe(optional, defaulttrue)
