ProtoPlanet
extends PlanetType
in package
Defines intrinsic properties of planet types.
Table of Contents
Constants
- PLANET_TYPES = [self::TYPE_TERRAN => \Smr\PlanetTypes\TerranPlanet::class, self::TYPE_ARID => \Smr\PlanetTypes\AridPlanet::class, self::TYPE_DWARF => \Smr\PlanetTypes\DwarfPlanet::class, self::TYPE_DEFENSE => \Smr\PlanetTypes\DefenseWorld::class, self::TYPE_PROTO => \Smr\PlanetTypes\ProtoPlanet::class]
- Associates the planet_type_id with the planet class.
- STRUCTURES = [PLANET_GENERATOR => ['max_amount' => 5, 'base_time' => 10800, 'credit_cost' => 100000, 'exp_gain' => 90], PLANET_HANGAR => ['max_amount' => 50, 'base_time' => 21600, 'credit_cost' => 100000, 'exp_gain' => 180], PLANET_BUNKER => ['max_amount' => 15, 'base_time' => 10800, 'credit_cost' => 50000, 'exp_gain' => 90], PLANET_WEAPON_MOUNT => ['max_amount' => 20, 'base_time' => 32400, 'credit_cost' => 300000, 'exp_gain' => 270], PLANET_RADAR => ['max_amount' => 10, 'base_time' => 64800, 'credit_cost' => 1000000, 'exp_gain' => 540]]
- TYPE_ARID = 2
- TYPE_DEFENSE = 4
- TYPE_DWARF = 3
- TYPE_PROTO = 5
- TYPE_TERRAN = 1
- 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
= [self::TYPE_TERRAN => \Smr\PlanetTypes\TerranPlanet::class, self::TYPE_ARID => \Smr\PlanetTypes\AridPlanet::class, self::TYPE_DWARF => \Smr\PlanetTypes\DwarfPlanet::class, self::TYPE_DEFENSE => \Smr\PlanetTypes\DefenseWorld::class, self::TYPE_PROTO => \Smr\PlanetTypes\ProtoPlanet::class]
These indices must not be changed!
STRUCTURES
public
mixed
STRUCTURES
= [PLANET_GENERATOR => ['max_amount' => 5, 'base_time' => 10800, 'credit_cost' => 100000, 'exp_gain' => 90], PLANET_HANGAR => ['max_amount' => 50, 'base_time' => 21600, 'credit_cost' => 100000, 'exp_gain' => 180], PLANET_BUNKER => ['max_amount' => 15, 'base_time' => 10800, 'credit_cost' => 50000, 'exp_gain' => 90], PLANET_WEAPON_MOUNT => ['max_amount' => 20, 'base_time' => 32400, 'credit_cost' => 300000, 'exp_gain' => 270], PLANET_RADAR => ['max_amount' => 10, 'base_time' => 64800, 'credit_cost' => 1000000, 'exp_gain' => 540]]
TYPE_ARID
public
mixed
TYPE_ARID
= 2
TYPE_DEFENSE
public
mixed
TYPE_DEFENSE
= 4
TYPE_DWARF
public
mixed
TYPE_DWARF
= 3
TYPE_PROTO
public
mixed
TYPE_PROTO
= 5
TYPE_TERRAN
public
mixed
TYPE_TERRAN
= 1
MAX_LANDED_UNLIMITED
protected
mixed
MAX_LANDED_UNLIMITED
= 0
Properties
$structures
private
array<int, PlanetStructureType>
$structures
Methods
description()
public
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
imageLink() : string
Return values
stringmaxAttackers()
public
maxAttackers() : int
Return values
intmaxLanded()
public
maxLanded() : int
Return values
intmenuOptions()
public
menuOptions() : array<string|int, PlanetMenuOption>
Return values
array<string|int, PlanetMenuOption>name()
public
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
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).