Class: NormalEvent

HungryGames~ NormalEvent

Event that can happen in a game.

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

Creates a HungryGames Normal 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~NormalEvent> <optional>
[] Array of attacks that take place before the event.
Source:

Extends

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:

creator :string

The id of the user that created this event. If not defined, then something is broken. Default global events use SpikeyRobot's ID.
Type:
  • string
Inherited From:
Overrides:
Source:

custom :boolean

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

<constant> id :string

The full unique ID of this event. If not specified, this generates just the 32 bit short hash.
Type:
  • string
Inherited From:
Overrides:
Source:

message :string

The message to show.
Type:
  • string
Inherited From:
Overrides:
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
Inherited From:
Overrides:
Source:

type :string

The type of event this is ('normal', 'arena', 'weapon', or 'battle').
Type:
  • string
Inherited From:
Overrides:
Default Value:
  • normal
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~NormalEvent First event.
e2 HungryGames~NormalEvent 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> from(obj)

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

<static> validate(evt)

Validate that the given data is properly typed and structured to be converted to a NormalEvent. Also coerces values to correct types if possible.
Parameters:
Name Type Description
evt HungryGames~NormalEvent The event data to verify.
Source:
Returns:
Error string, or null if no error.
Type
string

equal(two)

Compare this Event to another to check if they are equivalent.
Parameters:
Name Type Description
two HungryGames~NormalEvent Other NormalEvent to compare against.
Source:
Returns:
If they are equivalent.
Type
boolean

fill(obj)

Fill this instance with data from Event-like object.
Parameters:
Name Type Description
obj object Event-like object to copy.
Inherited From:
Overrides:
Source:
Returns:
Current instance with copied values.
Type
HungryGames~Event

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