Documentation

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

Methods

description()

public abstract description() : string
Return values
string

getTypeInfo()

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
self
public abstract imageLink() : string
Return values
string

maxAttackers()

public abstract maxAttackers() : int
Return values
int

maxLanded()

public abstract maxLanded() : int
Return values
int

name()

public abstract name() : string
Return values
string

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).

Return values
array<int, array<string, int>>

        
On this page

Search results