Character
in package
implements
CharacterInterface, CreateableInterface, GameAwareInterface, ExtendableModelInterface
Uses
Creator, SoftDeletable, PropertyManager, GameAware, ExtendableModel
Model for a character.
Tags
Interfaces, Classes and Traits
- CharacterInterface
- Interface for the character model and all objects that mimick such a model.
- CreateableInterface
- Interface for createable models.
- GameAwareInterface
- Interface for classes that are aware of the game.
- ExtendableModelInterface
Table of Contents
- $buffList : BuffList|null
- $buffs : Collection|null
- $deletedAt : mixed
- $displayName : string
- $fillable : array<string|int, mixed>
- $game : Game
- $health : int
- $id : UuidInterface
- $level : int
- $maxHealth : int
- $messageThreads : Collection|null
- $name : string
- $properties : Collection|null
- $propertyClass : string
- $propertyStorage : mixed
- $viewpoint : Viewpoint|null
- __call() : mixed
- __construct() : mixed
- Construct an empty character.
- __toString() : string
- addBuff() : mixed
- Adds a buff to the buffList.
- create() : CreateableInterface
- Creates and returns an entity instance and fills values.
- createAtFullHealth() : self
- Creates a character at full health.
- damage() : mixed
- Does damage to the entity.
- delete() : mixed
- Deletes the entity.
- getAttack() : int
- Returns the character's virtual attribute "attack".
- getBuffs() : BuffList
- Returns a list of buffs.
- getDefense() : int
- Returns the character's virtual attribute "defense".
- getDeletedAt() : DateTime
- Returns when the entry got deleted.
- getDisplayName() : string
- Returns displayName, a combination of title, name and suffix, mixed with colour codes.
- getGame() : Game
- getHealth() : int
- Returns current health.
- getId() : int
- Returns the entity's id.
- getLevel() : int
- Returns the character's level.
- getMaxHealth() : int
- Returns the maximum health.
- getMessageThreads() : Collection
- Returns a list of message threads this user has created.
- getName() : string
- Returns the character's name.
- getProperty() : mixed
- Returns a property with its stored type.
- getViewpoint() : Viewpoint|null
- Returns the current character viewpoint or null if one is not set.
- heal() : mixed
- Heals the enemy.
- isAlive() : bool
- Returns true if the character is alive.
- isDeleted() : bool
- Returns true if this entity is soft deleted.
- loadProperties() : void
- Loads properties.
- restore() : mixed
- Restores an entity back.
- setDeletedAt() : mixed
- Sets deletedAt to a specific date.
- setGame() : mixed
- setHealth() : mixed
- Sets current health.
- setLevel() : mixed
- Sets the character's level.
- setMaxHealth() : mixed
- Sets the maximum health of a character to a given value. It also sets the health if none has been set yet.
- setName() : mixed
- Sets the character's name and generates the display name.
- setProperty() : void
- Sets a property to a given value.
- setViewpoint() : mixed
- Sets the current character viewpoint.
- unsetProperty() : void
- Deletes a property.
- generateDisplayName() : mixed
- Generates the display name which is a composition of title and name.
Properties
$buffList
private
BuffList|null
$buffList
$buffs
private
Collection|null
$buffs
Tags
$deletedAt
private
mixed
$deletedAt
Tags
$displayName
private
string
$displayName
= ""
Tags
$fillable
private
static array<string|int, mixed>
$fillable
= ["name", "maxHealth", "level"]
$game
private
Game
$game
$health
private
int
$health
= 10
Tags
$id
private
UuidInterface
$id
Tags
$level
private
int
$level
= 1
Tags
$maxHealth
private
int
$maxHealth
= 10
Tags
$messageThreads
private
Collection|null
$messageThreads
Tags
$name
private
string
$name
= ""
Tags
$properties
private
Collection|null
$properties
Tags
$propertyClass
private
string
$propertyClass
= LotGDCoreModelsCharacterProperty::class
$propertyStorage
private
mixed
$propertyStorage
= null
$viewpoint
private
Viewpoint|null
$viewpoint
= null
Tags
Methods
__call()
public
__call(mixed $method, mixed $arguments) : mixed
Parameters
- $method : mixed
- $arguments : mixed
Return values
mixed —__construct()
Construct an empty character.
public
__construct() : mixed
Return values
mixed —__toString()
public
__toString() : string
Return values
string —addBuff()
Adds a buff to the buffList.
public
addBuff(Buff $buff[, bool $override = false ]) : mixed
Parameters
- $buff : Buff
- $override : bool = false
Return values
mixed —create()
Creates and returns an entity instance and fills values.
public
static create(array<string|int, mixed> $arguments) : CreateableInterface
Parameters
- $arguments : array<string|int, mixed>
-
The values the instance should get
Tags
Return values
CreateableInterface —The created Entity
createAtFullHealth()
Creates a character at full health.
public
static createAtFullHealth(array<string|int, mixed> $arguments) : self
Parameters
- $arguments : array<string|int, mixed>
Return values
self —damage()
Does damage to the entity.
public
damage(int $damage) : mixed
Parameters
- $damage : int
Return values
mixed —delete()
Deletes the entity.
public
delete(EntityManagerInterface $em) : mixed
Parameters
- $em : EntityManagerInterface
Return values
mixed —getAttack()
Returns the character's virtual attribute "attack".
public
getAttack([bool $ignoreBuffs = false ]) : int
Parameters
- $ignoreBuffs : bool = false
Return values
int —getBuffs()
Returns a list of buffs.
public
getBuffs() : BuffList
Return values
BuffList —getDefense()
Returns the character's virtual attribute "defense".
public
getDefense([bool $ignoreBuffs = false ]) : int
Parameters
- $ignoreBuffs : bool = false
Return values
int —getDeletedAt()
Returns when the entry got deleted.
public
getDeletedAt() : DateTime
Return values
DateTime —getDisplayName()
Returns displayName, a combination of title, name and suffix, mixed with colour codes.
public
getDisplayName() : string
Return values
string —The displayName
getGame()
public
getGame() : Game
Return values
Game —getHealth()
Returns current health.
public
getHealth() : int
Return values
int —getId()
Returns the entity's id.
public
getId() : int
Return values
int —The id
getLevel()
Returns the character's level.
public
getLevel() : int
Return values
int —getMaxHealth()
Returns the maximum health.
public
getMaxHealth() : int
Return values
int —getMessageThreads()
Returns a list of message threads this user has created.
public
getMessageThreads() : Collection
Return values
Collection —getName()
Returns the character's name.
public
getName() : string
Return values
string —The name
getProperty()
Returns a property with its stored type.
public
getProperty(string $name[, mixed $default = null ]) : mixed
Parameters
- $name : string
- $default : mixed = null
Return values
mixed —getViewpoint()
Returns the current character viewpoint or null if one is not set.
public
getViewpoint() : Viewpoint|null
Return values
Viewpoint|null —heal()
Heals the enemy.
public
heal(int $heal[, bool $overheal = false ]) : mixed
Parameters
- $heal : int
- $overheal : bool = false
-
True if healing bigger than maxHealth is desired.
Return values
mixed —isAlive()
Returns true if the character is alive.
public
isAlive() : bool
Return values
bool —isDeleted()
Returns true if this entity is soft deleted.
public
isDeleted() : bool
Return values
bool —loadProperties()
Loads properties.
public
loadProperties() : void
Return values
void —restore()
Restores an entity back.
public
restore(EntityManagerInterface $em) : mixed
Parameters
- $em : EntityManagerInterface
Return values
mixed —setDeletedAt()
Sets deletedAt to a specific date.
public
setDeletedAt([DateTime|null $deletedAt = null ]) : mixed
Parameters
- $deletedAt : DateTime|null = null
Return values
mixed —setGame()
public
setGame(Game $game) : mixed
Parameters
- $game : Game
Return values
mixed —setHealth()
Sets current health.
public
setHealth(int $health) : mixed
Parameters
- $health : int
Return values
mixed —setLevel()
Sets the character's level.
public
setLevel(int $level) : mixed
Parameters
- $level : int
Return values
mixed —setMaxHealth()
Sets the maximum health of a character to a given value. It also sets the health if none has been set yet.
public
setMaxHealth(int $maxHealth) : mixed
Parameters
- $maxHealth : int
Return values
mixed —setName()
Sets the character's name and generates the display name.
public
setName(string $name) : mixed
Parameters
- $name : string
-
The name to set
Return values
mixed —setProperty()
Sets a property to a given value.
public
setProperty(string $name, mixed $value) : void
Parameters
- $name : string
- $value : mixed
Return values
void —setViewpoint()
Sets the current character viewpoint.
public
setViewpoint(Viewpoint|null $v) : mixed
Parameters
- $v : Viewpoint|null
Return values
mixed —unsetProperty()
Deletes a property.
public
unsetProperty(string $name) : void
Parameters
- $name : string
Return values
void —generateDisplayName()
Generates the display name which is a composition of title and name.
protected
generateDisplayName() : mixed