PlanetType
in package
AbstractYes
Defines intrinsic properties of planet types.
Table of Contents
Constants
- PLANET_TYPES = [1 => \Smr\PlanetTypes\TerranPlanet::class, 2 => \Smr\PlanetTypes\AridPlanet::class, 3 => \Smr\PlanetTypes\DwarfPlanet::class, 4 => \Smr\PlanetTypes\DefenseWorld::class, 5 => \Smr\PlanetTypes\ProtoPlanet::class]
- Associates the planet_type_id with the planet class.
- MAX_LANDED_UNLIMITED = 0
Properties
- $structures : array<int, PlanetStructureType>
Methods
- description() : string
- getTypeInfo() : self
- Returns an instance of the planet type from the given $typeID.
- imageLink() : string
- maxAttackers() : int
- maxLanded() : int
- menuOptions() : array<string|int, PlanetMenuOption>
- name() : string
- structureTypes() : PlanetStructureType|array<int, PlanetStructureType>
- Access properties of structures that this planet type can build.
- getStructureData() : array<int, array<string, int>>
- Returns the properties of all the structures this planet type can build.
Constants
PLANET_TYPES
Associates the planet_type_id with the planet class.
public
mixed
PLANET_TYPES
= [1 => \Smr\PlanetTypes\TerranPlanet::class, 2 => \Smr\PlanetTypes\AridPlanet::class, 3 => \Smr\PlanetTypes\DwarfPlanet::class, 4 => \Smr\PlanetTypes\DefenseWorld::class, 5 => \Smr\PlanetTypes\ProtoPlanet::class]
These indices must not be changed!
MAX_LANDED_UNLIMITED
protected
mixed
MAX_LANDED_UNLIMITED
= 0
Properties
$structures
private
array<int, PlanetStructureType>
$structures
Methods
description()
public
abstract description() : string
Return values
stringgetTypeInfo()
Returns an instance of the planet type from the given $typeID.
public
static getTypeInfo(int $typeID) : self
This is the intended method to construct a PlanetType child class.
Parameters
- $typeID : int
Return values
selfimageLink()
public
abstract imageLink() : string
Return values
stringmaxAttackers()
public
abstract maxAttackers() : int
Return values
intmaxLanded()
public
abstract maxLanded() : int
Return values
intmenuOptions()
public
abstract menuOptions() : array<string|int, PlanetMenuOption>
Return values
array<string|int, PlanetMenuOption>name()
public
abstract name() : string
Return values
stringstructureTypes()
Access properties of structures that this planet type can build.
public
structureTypes([int|null $structureID = null ]) : PlanetStructureType|array<int, PlanetStructureType>
Parameters
- $structureID : int|null = null
Return values
PlanetStructureType|array<int, PlanetStructureType>getStructureData()
Returns the properties of all the structures this planet type can build.
protected
abstract getStructureData() : array<int, array<string, int>>
We could access static::STRUCTURES directly (late static binding), but that confuses static analyzers, since there is no STRUCTURES const in the base class (nor should there be).