toroidwars.interfaces
Interface Country

All Superinterfaces:
java.lang.Comparable

public interface Country
extends java.lang.Comparable

Country interface

Author:
Kent McClymont, Maximillian Dupenois

Method Summary
 AttackResult attack(Direction direction, int numberOfUnits)
          Takes a turn for this country, performing an attack
 void build()
          Takes a turn for this country, performing a build, adds one unit to this countries force
 int canAcceptUnits()
          Checks to how many units this country can accept
 int getIndex()
          This country's index
 int getLastTurnPerformed()
          The last turn that was performed on this country
 java.lang.String getName()
          This country's name
 int getNumberOfUnits()
          Returns the number of units in this country
 boolean isOccupyingForce(Player occupyingForce)
          Checks to see if the passed player is the occupying force in this country
 int leftCanAcceptUnits()
          Checks to see how many units the country to the left can accept, returns 0 if the country is unfriendly
 boolean leftIsFriendly()
          Checks to see if the country to the left is friendly
 int rightCanAcceptUnits()
          Checks to see how many units the country to the right can accept, returns 0 if the country is unfriendly
 boolean rightIsFriendly()
          Checks to see if the country to the right is friendly
 int scout(Direction direction)
          Takes a turn for this country, performing a scout action
 void transfer(Direction direction, int numberOfUnits)
          Takes a turn for this country, performing a transfer
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Method Detail

leftIsFriendly

boolean leftIsFriendly()
Checks to see if the country to the left is friendly

Returns:
returns true if friendly (occupied by you)

rightIsFriendly

boolean rightIsFriendly()
Checks to see if the country to the right is friendly

Returns:
returns true if friendly (occupied by you)

canAcceptUnits

int canAcceptUnits()
Checks to how many units this country can accept

Returns:
returns the number of units the country can accept

leftCanAcceptUnits

int leftCanAcceptUnits()
Checks to see how many units the country to the left can accept, returns 0 if the country is unfriendly

Returns:
returns the number of units the country to the left can accept (0 if the country is unfriendly)

rightCanAcceptUnits

int rightCanAcceptUnits()
Checks to see how many units the country to the right can accept, returns 0 if the country is unfriendly

Returns:
returns the number of units the country to the right can accept (0 if the country is unfriendly)

getNumberOfUnits

int getNumberOfUnits()
Returns the number of units in this country

Returns:
returns the number of units in this country

getLastTurnPerformed

int getLastTurnPerformed()
The last turn that was performed on this country

Returns:
returns the turn number that was last performed on this country

isOccupyingForce

boolean isOccupyingForce(Player occupyingForce)
Checks to see if the passed player is the occupying force in this country

Parameters:
occupyingForce -
Returns:
true if the passed player is the occupying force

getName

java.lang.String getName()
This country's name

Returns:
country's name

getIndex

int getIndex()
This country's index

Returns:
country's index

attack

AttackResult attack(Direction direction,
                    int numberOfUnits)
                    throws AttackActionException,
                           CheatingException,
                           TurnTimedOutException
Takes a turn for this country, performing an attack

Parameters:
direction - Direction to attack in
numberOfUnits - the number of units to attack with
Returns:
the attack result
Throws:
AttackActionException
TurnTimedOutException
CheatingException

build

void build()
           throws BuildActionException,
                  CheatingException,
                  TurnTimedOutException
Takes a turn for this country, performing a build, adds one unit to this countries force

Throws:
BuildActionException
CheatingException
TurnTimedOutException
blindrisk.exceptions.BuildActionException - thrown if there would be too many units in the country.
blindrisk.exceptions.CheatingException - thrown if the country is not yours or if it's already had a turn taken on this go

transfer

void transfer(Direction direction,
              int numberOfUnits)
              throws TransferActionException,
                     CheatingException,
                     TurnTimedOutException
Takes a turn for this country, performing a transfer

Parameters:
direction - the direction to transfer in
numberOfUnits - the number of units to transfer
Throws:
TransferActionException
CheatingException
blindrisk.exceptions.TurnTimedOutException - Thrown if this turn has timed out.
TurnTimedOutException

scout

int scout(Direction direction)
          throws ScoutActionException,
                 CheatingException,
                 TurnTimedOutException
Takes a turn for this country, performing a scout action

Parameters:
direction - the direction to scout in
Returns:
the units found
Throws:
ScoutActionException
blindrisk.exceptions.ScoutActionException - Thrown if your country has attempted to scout itself
CheatingException
TurnTimedOutException
blindrisk.exceptions.CheatingException - thrown if the country is not yours or if it's already had a turn taken on this go
blindrisk.exceptions.TurnTimedOutException - Thrown if this turn has timed out.