MafiaAction

sockMafia Action class

Author: Accalia
License: MIT

MafiaAction~MafiaAction

MafiaAction class

Kind: inner class of MafiaAction

new MafiaAction(data, game)

Mafia Action constructor. Creates a new MafiaAction instance

Param Type Description
data object Persisted action data
game MafiaGame MafiaGame this action is a part of

mafiaAction.postId ⇒ number

Get the postId this action was created for

Kind: instance property of MafiaAction
Returns: number - Post Id

mafiaAction.actor ⇒ MafiaUser

Get the MafiaUser who created this action

Kind: instance property of MafiaAction
Returns: MafiaUser - Actor user.

mafiaAction.target ⇒ MafiaUser

Get the MafiaUser who created this action. May be null if action is targetless

Kind: instance property of MafiaAction
Returns: MafiaUser - Target User or null if action is targetless

mafiaAction.action ⇒ string

Get the action type of this MafiaAction.

Default type is 'vote'

Kind: instance property of MafiaAction
Returns: string - Action type

mafiaAction.token ⇒ string

Get the action token for this MafiaAction.

The default token is 'vote'

Kind: instance property of MafiaAction
Returns: string - Action token

mafiaAction.isCurrent ⇒ boolean

Is this Action current?

Returns true if action is current, false if cancelled or overridden by a later action

Kind: instance property of MafiaAction
Returns: boolean - True if action is current, false otherwise

mafiaAction.revokedId ⇒ number

Get the post Id this action was revoked in, or undefined if this action has not been revoked

Kind: instance property of MafiaAction
Returns: number - Post Id this MafiaAction was revoked in.

mafiaAction.day ⇒ number

Get the day this MafiaAction was created in

Kind: instance property of MafiaAction
Returns: number - The Day this MafiaAction was created in

mafiaAction.revoke(postId) ⇒ Promise.<MafiaAction>

Revoke this MafiaAction as of a particular post.

Kind: instance method of MafiaAction
Returns: Promise.<MafiaAction> - Resolves to the revoked action on success.

Param Type Description
postId number The Id of the post that revoked the action

mafiaAction.toJSON() ⇒ object

Create a serializeable representation of the DAO object.

Kind: instance method of MafiaAction
Returns: object - A serializeable clone of this action's internal data store.