MafiaEngine.Player (mafia_engine v0.1.1)
This module defines the player type and functions to handle it.
Examples
iex> abed = MafiaEngine.Player.new("Abed")
%MafiaEngine.Player{alive: true, name: "Abed", role: :unknown}
iex> abed = MafiaEngine.Player.set_role(abed, :townie)
%MafiaEngine.Player{alive: true, name: "Abed", role: :townie}
iex> abed = MafiaEngine.Player.kill(abed)
%MafiaEngine.Player{alive: false, name: "Abed", role: :townie}
iex> abed.alive
false
Link to this section Summary
Functions
Sets the player
alive field to false
.
Creates a new player with the given name
.
Changes the player
role the given role
.
Link to this section Types
Specs
t() :: %MafiaEngine.Player{ alive: boolean(), name: String.t(), role: MafiaEngine.Role.t() }
Type that represents a player in the game.
Link to this section Functions
Link to this function
kill(player)
Specs
Sets the player
alive field to false
.
Link to this function
new(name)
Specs
Creates a new player with the given name
.
Link to this function
set_role(player, role)
Specs
set_role(t(), MafiaEngine.Role.t()) :: t()
Changes the player
role the given role
.