Calc
This module handles calculator functionality
Calc
Static Members
Sets the User's characters in Medical dropdown and fields
Parameters
user (object)
A Firebase auth user
Returns
undefined
:
Modifies the DOM
Sets the User's characters in Calculator dropdown and fields
Parameters
user (object)
A Firebase auth user
Returns
undefined
:
Modifies the DOM
Calculates and displays the Effective Accuracy Level
Returns
undefined
:
Modifies the DOM
▸
displayChanceToHit(weapon, eal)
Displays the correct chance-to-hit
Parameters
weapon (object)
A phoenix-functions weapon object
eal (object)
Effective Accuracy Level
Returns
undefined
:
Modifies the DOM
▸
burstHandler(weapon, eal, accuracy, chance)
Handles gathering info for the fireBurst function
Parameters
weapon (object)
A phoenix-functions weapon object
eal (object)
Effective Accuracy Level
accuracy (number)
Unused parameter
chance (number)
Percent chance of hitting
Returns
undefined
:
Modifies the DOM
▸
singleShotHandler(weapon, eal, accuracy, chance)
Handles gathering info for the fireSingleShot function
Parameters
weapon (object)
A phoenix-functions weapon object
eal (object)
Effective Accuracy Level
accuracy (number)
Unused parameter
chance (number)
Percent chance of hitting
Returns
undefined
:
Modifies the DOM
▸
shotgunHandler(weapon, eal, accuracy, chance)
Handles gathering info for the fireShotgun function
Parameters
weapon (object)
A phoenix-functions weapon object
eal (object)
Effective Accuracy Level
accuracy (number)
Effective Accuracy Level result
chance (number)
Percent chance of hitting
Returns
undefined
:
Modifies the DOM
▸
explosiveHandler(weapon, eal, accuracy, chance)
Handles gathering info for the fireExplosive function
Parameters
weapon (object)
A phoenix-functions weapon object
eal (object)
Effective Accuracy Level
accuracy (number)
Effective Accuracy Level result
chance (number)
Percent chance of hitting
Returns
undefined
:
Modifies the DOM
▸
fireBurst(weapon, numberOfTargets, arc, chance, range)
Fires a burst weapon at targets
Parameters
weapon (object)
A phoenix-functions weapon object
numberOfTargets (number)
Number of targets being fired at
arc (number)
Arc of weapon sweep
chance (number)
Percent chance of hitting
range (number)
Number of hexes away from the target
Returns
undefined
:
Modifies the DOM and database
▸
fireSingleShot(weapon, chance, range)
Fires a single shot weapon at a target
Parameters
weapon (object)
A phoenix-functions weapon object
chance (number)
Percent chance of hitting
range (number)
Number of hexes away from the target
Returns
undefined
:
Modifies the DOM and database
▸
fireShotgun(ammoType, range, weapon, chance)
Fires a shotgun weapon at targets
Parameters
ammoType (string)
Type of ammo
range (number)
Number of hexes away from the target
weapon (object)
A phoenix-functions weapon object
chance (number)
Percent chance of hitting
Returns
undefined
:
Modifies the DOM and database
▸
fireExplosive(weapon, range, chance, accuracy)
Fires a burst weapon at targets
Parameters
weapon (object)
A phoenix-functions weapon object
range (number)
Number of hexes away from the target
chance (number)
Percent chance of hitting
accuracy (number)
Shot accuracy for shot scatter
Returns
undefined
:
Modifies the DOM and database
▸
getMinimumArc(weapon, range)
Gets the minimum arc for a wapon at range
Parameters
weapon (object)
A phoenix-functions weapon object
range (number)
Number of hexes away from target
Returns
number
:
The weapon's minimum arc
▸
displayTargets(targetList, weapon, ammoType)
Displays target hit results and damage calculation button
Parameters
targetList (array)
A list of target results
weapon (weapon)
A phoenix-command weapon object
ammoType (string)
Type of ammo used
Returns
undefined
:
Modifies the DOM
▸
displayExplosionTargets(targetList, weapon, ammoType, location)
Displays explostion target hit results and damage calculation button
Parameters
targetList (array)
A list of target results
weapon (weapon)
A phoenix-command weapon object
ammoType (string)
Type of ammo used
location (string)
Location of the hit
Returns
undefined
:
Modifies the DOM
▸
calculateDamage(targets, weapon, ammoType)
Calculates total damage for hits on target
Parameters
targets (object)
A hit results object
weapon (weapon)
A phoenix-command weapon object
ammoType (string)
Type of ammo used
Returns
undefined
:
Modifies the DOM
▸
calculateExplosionDamage(targets, weapon, ammoType)
Calculates total explosion damage for hits on target
Parameters
targets (object)
A hit results object
weapon (weapon)
A phoenix-command weapon object
ammoType (string)
Type of ammo used
Returns
undefined
:
Modifies the DOM
Displays damage calculation
Parameters
targets (object)
A hit results object
Returns
undefined
:
Modifies the DOM
▸
displayExplosionDamage(targets)
Displays explosion damage calculation
Parameters
targets (object)
A hit results object
Returns
undefined
:
Modifies the DOM
Character
This module handles character functionality
Character
Static Members
▸
displayCharacterSheet(characterName)
Displays all properties of a character
Parameters
characterName (string)
A character's name property
Returns
undefined
:
Modifies the DOM and database
▸
displayCharacterCreation()
Displays equipment and weapon checkboxes
Returns
undefined
:
Modifies the DOM
Displays all equipment for a character
Parameters
character (object)
A character
Returns
undefined
:
Modifies the DOM and database
▸
displayWeapons(character)
Displays all weapons for a character
Parameters
character (object)
A character
Returns
undefined
:
Modifies the DOM and database
Collects data from character creation form and runs Game.addCharacter
Returns
undefined
:
runs Game.addCharacter
Database
This module handles various database functionality
Database
Static Members
async. Gets a user by Firebase user id, either passed in or from localstorage
Parameters
userId (string)
A Firebase user id
Returns
object
:
Firebase user object
async. Gets a game by Firebase user id, either passed in or from localstorage
Parameters
userId (string)
A Firebase user id
Returns
object
:
Firebase game object
▸
actionList(gameId, userId)
async. Gets a game's actionList and game time by Firebase game id
Parameters
userId (string)
A Firebase user id
Returns
object
:
Firebase actionList object with game time attached
▸
currentCharacter(characterPath)
async. Gets a user's currently selected character
Parameters
characterPath (string)
Path to the character in the format of "users/{userid}/games/{gameid}/content/characters/{characterid}"
Returns
object
:
Firebase character object
Gets a database reference
Parameters
path (string)
Path to the resource
Returns
object
:
Firebase database reference
Sets a database reference
Parameters
path (string)
Path to the resource
Returns
undefined
:
Modifies the database
Pushes a value to a database location
Parameters
path (string)
Path to the resource
Returns
undefined
:
Modifies the database
Deletes a value in the database
Parameters
path (string)
Path to the resource
key (string)
Key of the resource
Returns
undefined
:
Modifies the database
Gets a reference to Firebase auth
Returns
object
:
Firebase auth object
Game
This module handles main game logic
Game
Static Members
Displays the game interface
Parameters
user (object)
A Firebase auth user
Returns
undefined
:
Modifies the DOM
Advances the game time by one impuse
Returns
undefined
:
Modifies the database
Builds a user's game navigation
Parameters
user (object)
A Firebase auth user
Returns
undefined
:
Modifies the DOM
▸
addPlayers(user, gameId, players, gameName)
Joins other players to a game
Parameters
user (object)
A Firebase auth user who owns the game
gameId (string)
A game object id
players (array)
A list of user ids to add as players
gameName (string)
A game object's name property
Returns
undefined
:
Modifies the database
▸
addCharacter(character)
Adds a character to the current game
Parameters
character (object)
A game's character object
Returns
undefined
:
Modifies the database
▸
createNew(user, gameName, players)
Creates a new game in the database
Parameters
user (object)
A Firebase auth user who owns the game
gameName (string)
A game object's name property
players (array)
A list of user ids to add as players
Returns
undefined
:
Modifies the database
▸
setCurrent(uid, gameId)
Makes a game the current game
Parameters
uid (string)
A Firebase id of a user
gameId (string)
A Firebase id of a game
Returns
undefined
:
Modifies the database
Selects a game
Parameters
uid (string)
A Firebase id of a user
gameId (string)
A Firebase id of a game
Returns
undefined
:
Modifies the window location and runs setCurrent
Handler for new game submit
Returns
undefined
:
runs createNew
Index
This module is the application entry point
Index
Static Members
Runs the entry point function based on html file
Parameters
user (object)
A Firebase auth user
Returns
undefined
:
Runs the appropriate function
Listeners
This module handles jQuery and Firebase event listeners
Listeners
Static Members
Listens for timer update in database then changes time display
Returns
undefined
:
Modifies the DOM
Listens for randomize-character button click then runs Utils.randomize
randomize-character
Listens for dropdown-eal click then adds result to dropdown
dropdown-eal
Listens for game-dropdown click then runs Game.select
game-dropdown
Listens for calc-character-name click then updates character sheet
calc-character-name
Listens for timer-character-name click then updates capi on timer page
timer-character-name
Medical
This module handles calculator functionality
Medical
Timer
This module handles timer functionality
Timer
Static Members
Sets the User's characters in Timer dropdowns
Parameters
user (object)
A Firebase auth user
Returns
undefined
:
Modifies the DOM
Runs any action in the actionList for the current game time
Parameters
gameId (string)
A game id in the format "{user.uid}/games/{games object id}"
Returns
undefined
:
Modifies the database
Adds an action object to a game's actionList
Parameters
action (object)
A Phoenix Command action object
Returns
undefined
:
Modifies the database
An action object template with pre-filled values for userId and currentCharacter
Returns
object
:
An empty Phoenix Command action object
Allows the user to arbitrarily set the game clock
Parameters
user (object)
A Firebase auth user
Returns
undefined
:
Modifies the DOM and database
User
This module handles user functionality
User
Static Members
Adds a new user to the database and sets localStorage 'phoenix-command-user-id'
Parameters
user (object)
A Firebase auth user
Returns
undefined
:
Modifies the database and localstorage
▸
getUserCharacters(game)
Gets a list of all character objects belonging to a user
Parameters
game (object)
An entire game object
Returns
array
:
A list of user's characters
▸
getCharacterSheet(game, characterName)
Gets a character object by name
Parameters
game (object)
An entire game object
characterName (string)
The character's game name
Returns
object
:
A character object
▸
getCharacterId(game, characterName)
Gets a character object ID
Parameters
game (object)
An entire game object
characterName (string)
The character's game name
Returns
string
:
ID for a character object
Utils
This module handles various utility functionality
Utils
Static Members
▸
selectedCheckboxes(boxes)
Finds all selected checkboxes
Parameters
boxes (array)
A list of input checkboxes
Returns
array
:
List of all checkboxes that are selected
Rolls 3d6
Returns
number
:
The result of rolling 3d6
Adds a message to the game's log
Parameters
msg (string)
A text message to be logged
Returns
undefined
:
Modifies the database
Displays the contents of a game's log
Parameters
user (object)
A Firebase auth user
Returns
undefined
:
Modifies the DOM
▸
displaySetActions(user)
Displays the action list
Parameters
user (object)
A Firebase auth user
Returns
undefined
:
Modifies the DOM and database
Creates display text for a phoenix-functions hit result object
Parameters
result (object)
A phoenix-functions hit result object
Returns
string
:
Properly parsed and formatted text for hit result
Generates random attributes for a character
Returns
undefined
:
Modifies the DOM
Toggles sign out/sign in display based on auth state of user
Parameters
user (object)
A Firebase auth user
Returns
undefined
:
Modifies the DOM
Changes the shot type dropdown based on the weapon
Parameters
gun (object)
A phoenix-functions gun object
Returns
undefined
:
Modifies the DOM
Displays the generated mission name for the game
Returns
undefined
:
Modifies the DOM
Displays a user's account information
Parameters
user (object)
A Firebase auth user
Returns
undefined
:
Modifies the DOM
Displays default text for empty user
Returns
undefined
:
Modifies the DOM
Gets the game path from localstorage in the format of "users/{user.uid}/games/{games object id}
Returns
string
:
The game path
Displays a modal with custom title and message
Parameters
title (string)
Text for the title area
msg (string)
Text for the content
Returns
undefined
:
Modifies the DOM
▸
deleteModal(title, msg, path, key)
Displays a confirmation modal for database deletion
Parameters
title (string)
Text for the title area
msg (string)
Text for the content
path (string)
Path to the database resource
key (string)
ID of object to delete
Returns
undefined
:
Modifies the DOM and database
▸
deleteGameModal(title, msg, path, key)
Displays a confirmation modal for game object and nav reference deletion
Parameters
title (string)
Text for the title area
msg (string)
Text for the content
path (string)
Path to the database resource
key (string)
ID of object to delete
Returns
undefined
:
Modifies the DOM and database