evolution.actions
Class Action

Direct Known Subclasses:
Constructing, Exploring, GeoInvestigation, SimpleAction

public abstract class Action

An action which humans can do.


Method Summary
 protected abstract void_perform(Human human)
          Extra things which should be done when this action's perform method is called.
 protected doublecalculateSquareValue(SquareOfLand sq, Map neededResources, boolean maximizing)
          Calculate the value of the given square of land for this action.
 protected booleancanBePerformedOn(SquareOfLand square)
          Checks whether this action can be performed on the given square of land.
 protected voiddoChecks(Human human)
          Checks if this action can be performed by the human on the selected square of land.
 SquareOfLandfindSquare(SquareOfLand sq, int visionrange)
          Get the square in the range of a certain position where it is the most suitable to perform a given action.
 StringgetName()
          Return the name of this action.
 protected MapgetProducesLandResources()
          Returns a map of the names of landresources that are produced by this action.
 protected MapgetProducesResources()
          Returns a map of the names of resources that are produced by this action.
 protected MapgetUsesLandResources()
          Returns a map of the names of landresources that are used by this action.
 protected MapgetUsesResources()
          Returns a map of the names of resources that are used by this action.
 booleanhasEnoughResources()
          Checks whether this action had enough worldresources to be performed.
 booleanisEnergyBufferAction()
          Checks whether this action is an energybufferaction = nofoodaction in our .prop files)
 protected voidmodifyLandResources(SquareOfLand square, Map resources, double mul, boolean influencedBy)
          Modify the landresources that are mentioned in the given map.
 protected voidmodifyResources(Map resources, double mul, boolean influencedBy)
          Modify the resources that are mentioned in the given map.
 voidperform(Human human)
          Perform the action.
 voidperformEnergyBuffer(SquareOfLand square, Human human)
          A special case of perform

Method Detail

_perform

protected abstract void _perform(Human human)
throws evolution.resources.NotEnoughResourcesException,
IllegalLandTypeException,
evolution.lands.NotEnoughLandResourcesException
Extra things which should be done when this action's perform method is called. Template method.

calculateSquareValue

protected double calculateSquareValue(SquareOfLand sq, Map neededResources, boolean maximizing)
Calculate the value of the given square of land for this action. This method is necessary for the vision of humans.

canBePerformedOn

protected boolean canBePerformedOn(SquareOfLand square)
Checks whether this action can be performed on the given square of land.

doChecks

protected void doChecks(Human human)
throws evolution.resources.NotEnoughResourcesException,
IllegalLandTypeException,
evolution.lands.NotEnoughLandResourcesException
Checks if this action can be performed by the human on the selected square of land. If not, some exception will be thrown.

findSquare

public SquareOfLand findSquare(SquareOfLand sq, int visionrange)
Get the square in the range of a certain position where it is the most suitable to perform a given action.

getName

public String getName()
Return the name of this action.

getProducesLandResources

protected Map getProducesLandResources()
Returns a map of the names of landresources that are produced by this action.

getProducesResources

protected Map getProducesResources()
Returns a map of the names of resources that are produced by this action.

getUsesLandResources

protected Map getUsesLandResources()
Returns a map of the names of landresources that are used by this action.

getUsesResources

protected Map getUsesResources()
Returns a map of the names of resources that are used by this action.

hasEnoughResources

public boolean hasEnoughResources()
Checks whether this action had enough worldresources to be performed.

isEnergyBufferAction

public boolean isEnergyBufferAction()
Checks whether this action is an energybufferaction = nofoodaction in our .prop files)

modifyLandResources

protected void modifyLandResources(SquareOfLand square, Map resources, double mul, boolean influencedBy)
throws evolution.lands.NotEnoughLandResourcesException
Modify the landresources that are mentioned in the given map.

modifyResources

protected void modifyResources(Map resources, double mul, boolean influencedBy)
throws evolution.resources.NotEnoughResourcesException
Modify the resources that are mentioned in the given map. mul has the value 1 when the

perform

public void perform(Human human)
throws evolution.resources.NotEnoughResourcesException,
IllegalLandTypeException,
evolution.lands.NotEnoughLandResourcesException
Perform the action. This is automatically triggered via Evolution.
See Also:
_perform

performEnergyBuffer

public void performEnergyBuffer(SquareOfLand square, Human human)
throws IllegalLandTypeException
A special case of perform

a gvijf production