PHP Class Slackwolf\Game\Game

Afficher le fichier Open project: chrisgillis/slackwolf Class Usage Examples

Méthodes publiques

Свойство Type Description
$dayEnded
$hunterNeedsToShoot
$nightEnded
$seerSeen
$state
$witchHealed
$witchPoisoned
$wolvesVoted

Méthodes publiques

Méthode Description
__construct ( $id, array $users, Slackwolf\Game\RoleStrategy\RoleStrategyInterface $roleStrategy )
addLobbyPlayer ( User $user ) : boolean If the lobby is open, adds a user to it.
assignRoles ( ) Assigns each user in the game to a role.
changeState ( $state )
clearPlayerVote ( $voterId )
clearVotes ( )
getDeadPlayers ( ) : User[] An array containing all the users that have been killed.
getGuardedUserId ( ) : mixed
getId ( ) : string
getLastGuardedUserId ( ) : mixed
getLivingPlayers ( ) : User[] An array containing all users that are still alive.
getLobbyPlayers ( ) : User[]
getNumRole ( $roleType ) : integer
getOriginalNumRole ( $roleType ) : integer
getOriginalPlayers ( ) : User[]
getOriginalPlayersOfRole ( $roleType ) : User[]
getPlayerById ( $id ) : User | boolean
getPlayersOfRole ( $roleType ) : User[]
getRoleStrategy ( ) : Slackwolf\Game\RoleStrategy\RoleStrategyInterface
getState ( ) : integer
getVillageTeam ( ) : User[]
getVotes ( ) : array
getWerewolves ( ) : User[]
getWitchHealed ( ) : mixed
getWitchHealedUserId ( ) : mixed
getWitchHealingPotion ( ) : integer
getWitchPoisonPotion ( ) : integer
getWitchPoisoned ( ) : mixed
getWitchPoisonedUserId ( ) : mixed
getWolvesVoted ( ) : mixed
hasPlayerVoted ( $voterId ) : boolean
isOver ( ) : boolean
isPlayerAlive ( $playerId ) : boolean Whether or not the player is alive.
killPlayer ( $player_id ) Kills the specified player.
removeLobbyPlayer ( $player_id ) : boolean Removes a user from the game lobby.
seerSeen ( ) : mixed
setDayEnded ( boolean $val )
setGuardedUserId ( $id )
setHunterNeedsToShoot ( boolean $val )
setLastGuardedUserId ( $id )
setNightEnded ( boolean $val )
setSeerSeen ( $seen )
setWitchHealed ( $healed )
setWitchHealedUserId ( $id )
setWitchHealingPotion ( $val )
setWitchPoisonPotion ( $val )
setWitchPoisoned ( $poisoned )
setWitchPoisonedUserId ( $id )
setWolvesVoted ( mixed $wolvesVoted )
vote ( $voterId, $voteForId )
votingFinished ( ) : boolean
whoWon ( ) : mixed

Method Details

__construct() public méthode

public __construct ( $id, array $users, Slackwolf\Game\RoleStrategy\RoleStrategyInterface $roleStrategy )
$id
$users array
$roleStrategy Slackwolf\Game\RoleStrategy\RoleStrategyInterface

addLobbyPlayer() public méthode

If the lobby is open, adds a user to it.
public addLobbyPlayer ( User $user ) : boolean
$user Slack\User The user to add to the lobby.
Résultat boolean If successful, returns TRUE, otherwise, FALSE.

assignRoles() public méthode

Assigns each user in the game to a role.
public assignRoles ( )

changeState() public méthode

public changeState ( $state )
$state

clearPlayerVote() public méthode

public clearPlayerVote ( $voterId )
$voterId

clearVotes() public méthode

public clearVotes ( )

getDeadPlayers() public méthode

An array containing all the users that have been killed.
public getDeadPlayers ( ) : User[]
Résultat Slack\User[] Users who have been killed.

getGuardedUserId() public méthode

public getGuardedUserId ( ) : mixed
Résultat mixed

getId() public méthode

public getId ( ) : string
Résultat string The game's ID, matches the channel ID.

getLastGuardedUserId() public méthode

public getLastGuardedUserId ( ) : mixed
Résultat mixed

getLivingPlayers() public méthode

An array containing all users that are still alive.
public getLivingPlayers ( ) : User[]
Résultat Slack\User[] Users who are currently alive.

getLobbyPlayers() public méthode

public getLobbyPlayers ( ) : User[]
Résultat Slack\User[] An array of the lobby members.

getNumRole() public méthode

public getNumRole ( $roleType ) : integer
Résultat integer

getOriginalNumRole() public méthode

public getOriginalNumRole ( $roleType ) : integer
Résultat integer

getOriginalPlayers() public méthode

public getOriginalPlayers ( ) : User[]
Résultat Slack\User[]

getOriginalPlayersOfRole() public méthode

public getOriginalPlayersOfRole ( $roleType ) : User[]
Résultat Slack\User[]

getPlayerById() public méthode

public getPlayerById ( $id ) : User | boolean
$id
Résultat Slack\User | boolean

getPlayersOfRole() public méthode

public getPlayersOfRole ( $roleType ) : User[]
Résultat Slack\User[]

getRoleStrategy() public méthode

public getRoleStrategy ( ) : Slackwolf\Game\RoleStrategy\RoleStrategyInterface
Résultat Slackwolf\Game\RoleStrategy\RoleStrategyInterface The game's strategy type.

getState() public méthode

public getState ( ) : integer
Résultat integer The state of the game.

getVillageTeam() public méthode

public getVillageTeam ( ) : User[]
Résultat Slack\User[]

getVotes() public méthode

public getVotes ( ) : array
Résultat array

getWerewolves() public méthode

public getWerewolves ( ) : User[]
Résultat Slack\User[]

getWitchHealed() public méthode

public getWitchHealed ( ) : mixed
Résultat mixed

getWitchHealedUserId() public méthode

public getWitchHealedUserId ( ) : mixed
Résultat mixed

getWitchHealingPotion() public méthode

public getWitchHealingPotion ( ) : integer
Résultat integer

getWitchPoisonPotion() public méthode

public getWitchPoisonPotion ( ) : integer
Résultat integer

getWitchPoisoned() public méthode

public getWitchPoisoned ( ) : mixed
Résultat mixed

getWitchPoisonedUserId() public méthode

public getWitchPoisonedUserId ( ) : mixed
Résultat mixed

getWolvesVoted() public méthode

public getWolvesVoted ( ) : mixed
Résultat mixed

hasPlayerVoted() public méthode

public hasPlayerVoted ( $voterId ) : boolean
$voterId
Résultat boolean

isOver() public méthode

public isOver ( ) : boolean
Résultat boolean

isPlayerAlive() public méthode

Whether or not the player is alive.
public isPlayerAlive ( $playerId ) : boolean
$playerId The Slack user ID.
Résultat boolean TRUE if player is alive and in game, otherwise FALSE.

killPlayer() public méthode

Kills the specified player.
public killPlayer ( $player_id )
$player_id The player to kill.

removeLobbyPlayer() public méthode

Removes a user from the game lobby.
public removeLobbyPlayer ( $player_id ) : boolean
$player_id The user to remove from the lobby.
Résultat boolean If successful, returns TRUE, otherwise, FALSE.

seerSeen() public méthode

public seerSeen ( ) : mixed
Résultat mixed

setDayEnded() public méthode

public setDayEnded ( boolean $val )
$val boolean

setGuardedUserId() public méthode

public setGuardedUserId ( $id )
$id

setHunterNeedsToShoot() public méthode

public setHunterNeedsToShoot ( boolean $val )
$val boolean

setLastGuardedUserId() public méthode

public setLastGuardedUserId ( $id )
$id

setNightEnded() public méthode

public setNightEnded ( boolean $val )
$val boolean

setSeerSeen() public méthode

public setSeerSeen ( $seen )
$seen

setWitchHealed() public méthode

public setWitchHealed ( $healed )
$healed

setWitchHealedUserId() public méthode

public setWitchHealedUserId ( $id )
$id

setWitchHealingPotion() public méthode

public setWitchHealingPotion ( $val )
$val

setWitchPoisonPotion() public méthode

public setWitchPoisonPotion ( $val )
$val

setWitchPoisoned() public méthode

public setWitchPoisoned ( $poisoned )
$poisoned

setWitchPoisonedUserId() public méthode

public setWitchPoisonedUserId ( $id )
$id

setWolvesVoted() public méthode

public setWolvesVoted ( mixed $wolvesVoted )
$wolvesVoted mixed

vote() public méthode

public vote ( $voterId, $voteForId )
$voterId
$voteForId

votingFinished() public méthode

public votingFinished ( ) : boolean
Résultat boolean

whoWon() public méthode

public whoWon ( ) : mixed
Résultat mixed

Property Details

$dayEnded public_oe property

public $dayEnded

$hunterNeedsToShoot public_oe property

public $hunterNeedsToShoot

$nightEnded public_oe property

public $nightEnded

$seerSeen public_oe property

public $seerSeen

$state public_oe property

public $state

$witchHealed public_oe property

public $witchHealed

$witchPoisoned public_oe property

public $witchPoisoned

$wolvesVoted public_oe property

public $wolvesVoted