Name

Cosair::AI::Planet - Cosair AI Planet Superclass


Synopsis

This class provides access to general planet information in the game. It is the superclass for Cosair::AI::OwnPlanet and Cosair::AI::NmePlanet, which provide more specific information and action interfaces.


Description

Information Methods

id()

Returns the unique id number of the planet.

name()

Returns the name of the Planet.

owner_id()

Returns the id of the nation currently owning this planet.

Distance Related Methods

distance_to_planet($)

Returns the distance from this planet to a given planet. The only parameter is the Cosair::AI::Planet object to calculate the distance to. The return value is a numerical value of the euclidian distance on the map, whereas 1 is the unit between 2 directly neighbored squares. If you pass the planet itself, the undef value is returned.

distance_to_nation($)

Returns the distance from this planet to a given nation, i.e. the nearest planet of the nation. The only parameter is the Cosair::AI::Nation object to calculate the distance to. The return value is a numerical value of the euclidian distance on the map, whereas 1 is the unit between 2 directly neighbored squares. If you pass the planet owning nation or an exterminated one, the undef value is returned.

nearest_planet_of_nation($)

Returns the nearest planet of a given nation to this planet. The only parameter is the Cosair::AI::Nation object to search the planet of. The return value is the Cosair::AI::Planet object of the nearest planet. If you pass the planet owning nation or an exterminated nation, the undef value is returned.

own_planets_within_distance($)

Returns a list of own planets within a given distance from this planet. The only parameter is the distance value to decide upon. The return value is a list of Cosair::AI::Planet objects.

nme_planets_within_distance($)

Returns a list of enemy planets within a given distance from this planet. The only parameter is the distance value to decide upon. The return value is a list of Cosair::AI::Planet objects.

planets_of_nation_within_distance($$)

Returns a list of planets of a given nation within a given distance from this planet. The first parameter is the Cosair::AI::Nation object of the nation in question, the second parameter is the distance value to decide upon. The return value is a list of Cosair::AI::Planet objects.

nme_nations_within_distance($)

Returns a list of enemy nations within a given distance from this planet. The only parameter is the distance value to decide upon. The return value is a list of Cosair::AI::Nation objects.

Statistical Methods

colonised()

Returns the event of the colonisation of this planet, or undef if the planet is one of the start planets.

age()

Returns the age in turns since the planet exists in the game.

last_conquest()

Returns the event of the last conquest of this planet, or undef if the planet has never been conquered yet.

age_of_last_conquest()

Returns the age in turns since the planet has been conquered the last time, or undef if it has never been conquered yet.