Class: Event

HungryGames~ Event

Event that can happen in a game.

new Event(message [, numVictim] [, numAttacker] [, victimOutcome] [, attackerOutcome] [, victimKiller] [, attackerKiller] [, battle] [, state] [, attacks])

Creates a HungryGames Event.
Parameters:
Name Type Argument Default Description
message string The message to show.
numVictim number <optional>
0 The number of victims in this event.
numAttacker number <optional>
0 The number of attackers in this event.
victimOutcome string <optional>
nothing The outcome of the victims from this event.
attackerOutcome string <optional>
nothing The outcome of the attackers from this event.
victimKiller boolean <optional>
false Do the victims kill anyone in this event. Used for calculating kill count.
attackerKiller boolean <optional>
false Do the attackers kill anyone in this event. Used for calculating kill count.
battle boolean <optional>
false Is this event a battle?
state number <optional>
0 State of event if there are multiple attacks before the event.
attacks Array.<HungryGames~Event> <optional>
[] Array of attacks that take place before the event.
Source:

Members


<nullable> action :string

The action to format into a message if this is a weapon event.
Type:
  • string
Source:

attacker :object

Information about the attackers in this event.
Type:
  • object
Properties:
Name Type Argument Description
count number Number of attackers. Negative means "at least" the magnitude.
outcome string The outcome of the attackers.
killer boolean Do the attackers kill the victims.
weapon Object <nullable>
The weapon information to give to the player.
Source:

attacks :Array.<HungryGames~Event>

The attacks in a battle to show before the message.
Type:
Default Value:
  • []
Source:

battle :boolean

Is this event a battle event.
Type:
  • boolean
Default Value:
  • false
Source:

consumes :number|string

Amount of consumables used if this is a weapon event.
Type:
  • number | string
Source:

custom :boolean

If the event is created by the user.
Type:
  • boolean
Default Value:
  • true
Source:

message :string

The message to show.
Type:
  • string
Source:

state :number

The current state of printing the battle messages.
Type:
  • number
Default Value:
  • 0
Source:

subMessage :string

Additional message text to send.
Type:
  • string
Source:

victim :object

Information about the victims in this event.
Type:
  • object
Properties:
Name Type Argument Description
count number Number of victims. Negative means "at least" the magnitude.
outcome string The outcome of the victims.
killer boolean Do the victims kill the attackers.
weapon Object <nullable>
The weapon information to give to the player.
Source:

Methods


<static> equal(e1, e2)

Compare two events to check if they are equivalent.
Parameters:
Name Type Description
e1 HungryGames~Event First event.
e2 HungryGames~Event Second event to compare.
Source:
Returns:
If the two given events are equivalent.
Type
boolean

<static> finalize(message, affectedUsers, numVictim, numAttacker, victimOutcome, attackerOutcome, game)

Format an event string based on specified users.
Parameters:
Name Type Description
message string The message to show.
affectedUsers Array.<HungryGames~Player> An array of all users affected by this event.
numVictim number Number of victims in this event.
numAttacker number Number of attackers in this event.
victimOutcome string The outcome of the victims from this event.
attackerOutcome string The outcome of the attackers from this event.
game HungryGames~GuildGame The GuildGame to make this event for. Used for settings and fetching other players not affected by this event if necessary.
Source:
Returns:
The final event that was created and formatted ready for display.
Type
HungryGames~FinalEvent

<static> finalizeSimple(message [, game])

Make an event that doesn't affect any players and is just a plain message.
Parameters:
Name Type Argument Description
message string The message to show.
game HungryGames~GuildGame <optional>
The GuildGame to make this event for. This is to check options and fetch players that may be necessary.
Source:
Returns:
The event that was created.
Type
HungryGames~FinalEvent
Example
Event.finalizeSimple('Something happens!', game);

<static> from(obj)

Create a new Event object from a Event-like object. Similar to copy-constructor.
Parameters:
Name Type Description
obj object Event-like object to copy.
Source:
Returns:
Copy of event.
Type
HungryGames~Event

equal(two)

Compare this Event to another to check if they are equivalent.
Parameters:
Name Type Description
two HungryGames~Event Other Event to compare against.
Source:
Returns:
If they are equivalent.
Type
boolean
Example
console.log(firstEvent.equal(otherEvent));

finalize(game, affected)

Finalize this instance.
Parameters:
Name Type Description
game HungryGames~GuildGame Game context.
affected Array.<HungryGames~Player> An array of all players affected by this event.
Source:
Returns:
The finalized event.
Type
HungryGames~FinalEvent