new Simulator(game, hg [, msg])
        Manages HG day simulation.
    
    
    
    
    
    
        Parameters:
| Name | Type | Argument | Description | 
|---|---|---|---|
| game | HungryGames~GuildGame | The GuildGame to simulate. | |
| hg | HungryGames | Parent game manager for logging and SubModule references. | |
| msg | Discord~Message | <optional> | Message to reply to if necessary. | 
- Source:
Classes
Members
- 
    <private, static, constant> _littleDeathRate :number
- 
    
    If a lower percentage of people die in one day than this value, then show a relevant message.Type:- number
 - Default Value:
- 
		- 0.15
 
- Source:
 
- 
    <private, static, constant> _lotsOfDeathRate :number
- 
    
    If a larger percentage of people die in one day than this value, then show a relevant message.Type:- number
 - Default Value:
- 
		- 0.75
 
- Source:
 
- 
    <private, static, constant> _multiEventUserDistribution :object.<number>
- 
    
    Probability of each amount of people being chosen for an event. Must total to 1.0.Type:- object.<number>
 - Default Value:
- 
		- {"undefined":0.0005}
 
- Source:
 
- 
    <private, static, constant> _workerPath :string
- 
    
    Relative path from CWD where the simulation worker is located.Type:- string
 - Default Value:
- 
		- ./src/hg/simulator/worker.js
 
- Source:
 
Methods
- 
    <private, static> _applyOutcome(game, a, k [, w], outcome)
- 
    
    Apply the given outcome to a player in the given guild game.Parameters:Name Type Argument Description gameHungryGames~GuildGame Current GuildGame being affected. aHungryGames~Player The player to affect. knumber The number of kills the player gets in this action. wObject <optional> 
 The weapon being used if any. outcomestring The outcome to apply. - Source:
 Returns:True if valid outcome was successfully applied, false otherwise. ('nothing' is considered not valid, but outcome will still be applied).- Type
- boolean
 
- 
    <private, static> _effectUser(game, affected, kills [, weapon])
- 
    
    Base of all actions to perform on a player.Parameters:Name Type Argument Description gameHungryGames~GuildGame Current GuildGame being affected. affectedHungryGames~Player The player to affect. killsnumber The number of kills the player gets in this action. weaponObject <optional> 
 The weapon being used if any. - Source:
 
- 
    <private, static> _killUser(game, a, k [, w])
- 
    
    Kill the given player in the given guild game.Parameters:Name Type Argument Description gameHungryGames~GuildGame Current GuildGame being affected. aHungryGames~Player The player to affect. knumber The number of kills the player gets in this action. wObject <optional> 
 The weapon being used if any. - Source:
 
- 
    <private, static> _parseConsumeCount(consumeString, numVictim, numAttacker)
- 
    
    Parse the number of items consumed from the given consumed value, and number of victims and attackers.Parameters:Name Type Description consumeStringstring The consumes value for the event. numVictimnumber The number of victims in the event. numAttackernumber The number of attackers in the event. - Source:
 Returns:The number of consumed items.- Type
- number
 
- 
    <private, static> _pickAffectedPlayers(evt, options, userPool, deadPool, teams, weaponWielder)
- 
    
    Pick the players to put into an event.Parameters:Name Type Argument Description evtHungryGames~NormalEvent The event data to pick players for. optionsobject Options for this game. userPoolArray.<HungryGames~Player> Pool of all remaining players to put into an event. deadPoolArray.<HungryGames~Player> Pool of all dead players that can be revived. teamsArray.<HungryGames~Team> All teams in this game. weaponWielderPlayer <nullable> 
 A player that is using a weapon in this event, or null if no player is using a weapon. - Source:
 Returns:Array of all players that will be affected by this event.- Type
- Array.<HungryGames~Player>
 
- 
    <private, static> _pickEvent(userPool, eventPool, options, numAlive, numTotal, teams, probOpts, weaponWielder, weaponId)
- 
    
    Pick event that satisfies all requirements and settings.Parameters:Name Type Argument Description userPoolArray.<HungryGames~Player> Pool of players left to chose from in this day. eventPoolArray.<HungryGames~NormalEvent> Pool of all events available to choose at this time. optionsobject The options set in the current game. numAlivenumber Number of players in the game still alive. numTotalnumber Number of players in the game total. teamsArray.<HungryGames~Team> Array of teams in this game. probOptsHungryGames~OutcomeProbabilities Death rate weights. weaponWielderPlayer <nullable> 
 A player that is using a weapon in this event, or null if no player is using a weapon. weaponIdstring ID of the weapon the player is trying to use. - Source:
 Returns:The chosen event that satisfies all requirements, or null if something went wrong.
- 
    <private, static> _pickWeightedOutcome(probabilityOpts)
- 
    
    Pick an outcome given the probability options.Parameters:Name Type Description probabilityOptsObject The probabilities of each type of event being used. - Source:
 Returns:The outcome. One of "dies", "revived", "thrives", "wounded", or "nothing".- Type
- string
 
- 
    <private, static> _probabilityEvent(eventPool, probabilityOpts [, customWeight] [, recurse])
- 
    
    Produce a random event that using probabilities set in options.Parameters:Name Type Argument Default Description eventPoolArray.<HungryGames~NormalEvent> The pool of all events to consider. probabilityOptsObject The probabilities of each type of event being used. customWeightnumber <optional> 
 1 The weight of custom events. recursenumber <optional> 
 0 The current recursive depth. - Source:
 Returns:The index of the event that was chosen.- Type
- number
 
- 
    <private, static> _restoreUser(game, a, k [, w])
- 
    
    Heal the given player in the given guild game.Parameters:Name Type Argument Description gameHungryGames~GuildGame Current GuildGame being affected. aHungryGames~Player The player to affect. knumber The number of kills the player gets in this action. wObject <optional> 
 The weapon being used if any. - Source:
 
- 
    <private, static> _reviveUser(game, a, k [, w])
- 
    
    Revive the given player in the given guild game.Parameters:Name Type Argument Description gameHungryGames~GuildGame Current GuildGame being affected. aHungryGames~Player The player to affect. knumber The number of kills the player gets in this action. wObject <optional> 
 The weapon being used if any. - Source:
 
- 
    <private, static> _validateEventNumConstraint(numVictim, numAttacker, userPool, numAlive)
- 
    
    Ensure the number of users in an event is mathematically possible.Parameters:Name Type Description numVictimnumber Number of victims in this event. numAttackernumber Number of attackers in this event. userPoolArray.<HungryGames~Player> Pool of all remaining players to put into an event. numAlivenumber Total number of living players left in the game. - Source:
 Returns:If the event requires a number of players that is valid from the number of players left to choose from.- Type
- boolean
 
- 
    <private, static> _validateEventRequirements(numVictim, numAttacker, userPool, numAlive, teams, options, victimsDie, attackersDie, weaponWielder)
- 
    
    Ensure the event chosen meets all requirements for actually being used in the current game.Parameters:Name Type Argument Description numVictimnumber Number of victims in this event. numAttackernumber Number of attackers in this event. userPoolArray.<HungryGames~Player> Pool of all remaining players to put into an event. numAlivenumber Total number of living players left in the game. teamsArray.<HungryGames~Team> All teams in this game. optionsobject The options set for this game. victimsDieboolean Do the victims die in this event? attackersDieboolean Do the attackers die in this event? weaponWielderPlayer <nullable> 
 A player that is using a weapon in this event, or null if no player is using a weapon. - Source:
 Returns:String of failing constraint check, or null if passes.- Type
- string
 
- 
    <private, static> _validateEventTeamConstraint(numVictim, numAttacker, userPool, teams, options, victimsDie, attackersDie, weaponWielder)
- 
    
    Ensure teammates don't attack each other.Parameters:Name Type Argument Description numVictimnumber The number of victims in the event. numAttackernumber The number of attackers in the event. userPoolArray.<HungryGames~Player> Pool of all remaining players to put into an event. teamsArray.<HungryGames~Team> All teams in this game. optionsobject Options for this game. victimsDieboolean Do the victims die in this event? attackersDieboolean Do the attackers die in this event? weaponWielderPlayer <nullable> 
 A player that is using a weapon in this event, or null if no player is using a weapon. - Source:
 Returns:String describing failing check, or null of pass.- Type
- string
 
- 
    <private, static> _validateEventVictorConstraint(numVictim, numAttacker, numAlive, options, victimsDie, attackersDie)
- 
    
    Ensure the event we choose will not force all players to be dead.Parameters:Name Type Description numVictimnumber Number of victims in this event. numAttackernumber Number of attackers in this event. numAlivenumber Total number of living players left in the game. optionsobject The options set for this game. victimsDieboolean Do the victims die in this event? attackersDieboolean Do the attackers die in this event? - Source:
 Returns:Will this event follow current options set about number of victors required.- Type
- boolean
 
- 
    <private, static> _woundUser(game, a, k [, w])
- 
    
    Wound the given player in the given guild game.Parameters:Name Type Argument Description gameHungryGames~GuildGame Current GuildGame being affected. aHungryGames~Player The player to affect. knumber The number of kills the player gets in this action. wObject <optional> 
 The weapon being used if any. - Source:
 
- 
    <static> formatWeaponCounts(eventTry, affectedUsers, weapons, nameFormat)
- 
    
    Format the text that shows all users' inventories in an event.Parameters:Name Type Description eventTryHungryGames~NormalEvent The event to format inventories for. affectedUsersArray.<HungryGames~Player> Array of all player affected by this event. weaponsobject.<HungryGames~WeaponEvent> The default weapons object injected with custom weapons. nameFormatstring The format for HungryGames~Grammar~formatMultiNames. - Source:
 Returns:The additional text to append.- Type
- string
 
- 
    <static> formatWeaponEvent(eventTry, userWithWeapon, ownerName, firstAttacker, weaponId, weapons [, countOverride])
- 
    
    Format an event message for the given weapon information.Parameters:Name Type Argument Description eventTryHungryGames~NormalEvent The event to format. userWithWeaponHungryGames~Player The player using the weapon. ownerNamestring The formated name to insert fot the weapon owner. firstAttackerboolean Is the weapon owner the first attacker in list of affected users. weaponIdstring The id of the chosen weapon. weaponsobject.<HungryGames~WeaponEvent> The default weapons object injected with custom weapons. countOverridenumber <optional> 
 If specified, this value is used as the final amount the player will end up with, instead of using the calculated value. - Source:
 Returns:Additional subMessage.- Type
- string
 
- 
    <static> weightedUserRand()
- 
    
    Produce a random number that is weighted by multiEventUserDistribution.- Source:
- See:
- 
		- multiEventUserDistribution
 
 Returns:The weighted number outcome.- Type
- number
 
- 
    go(cb)
- 
    
    Simulate a day with the current GuildGame.Parameters:Name Type Description cbfunction Callback that always fires on completion. The only parameter is a possible error string, null if no error. - Source:
 
- 
    setGame(game)
- 
    
    Change the GuildGame to simulate.Parameters:Name Type Description gameHungryGames~GuildGame The new GuildGame. - Source:
 
- 
    setMessage(msg)
- 
    
    Update the message to reply to.Parameters:Name Type Description msgDiscord~Message New message to reference. - Source:
 
- 
    setParent(hg)
- 
    
    Update the reference to the parent HungryGames.Parameters:Name Type Description hgHungryGames New parent reference. - Source: