games.strategy.triplea
Class TripleAPlayer

java.lang.Object
  extended by games.strategy.common.player.AbstractBasePlayer
      extended by games.strategy.common.player.AbstractHumanPlayer<TripleAFrame>
          extended by games.strategy.triplea.TripleAPlayer
All Implemented Interfaces:
IGamePlayer, IRemote, ITripleaPlayer

public class TripleAPlayer
extends AbstractHumanPlayer<TripleAFrame>
implements IGamePlayer, ITripleaPlayer

Version:
1.0
Author:
Sean Bridges

Field Summary
 
Fields inherited from class games.strategy.common.player.AbstractHumanPlayer
m_ui
 
Fields inherited from class games.strategy.common.player.AbstractBasePlayer
m_bridge, m_id, m_name
 
Constructor Summary
TripleAPlayer(java.lang.String name)
          Creates new TripleAPlayer
 
Method Summary
 void confirmEnemyCasualties(GUID battleId, java.lang.String message, PlayerID hitPlayer)
          Allows the user to pause and confirm enemy casualties
 boolean confirmMoveHariKari()
          The attempted move will kill some units
 boolean confirmMoveInFaceOfAA(java.util.Collection<Territory> aaFiringTerritories)
          The attempted move will incur aa fire, confirm that you still want to move
 boolean confirmMoveKamikaze()
          The attempted move will kill some air units
 void confirmOwnCasualties(GUID battleId, java.lang.String message)
           
 java.util.Collection<Unit> getNumberOfFightersToMoveToNewCarrier(java.util.Collection<Unit> fightersThatCanBeMoved, Territory from)
          get the fighters to move to a newly produced carrier
 boolean isSBRAffectsUnitProduction(GameData data)
           
 void reportError(java.lang.String error)
          Report an error to the user.
 void reportMessage(java.lang.String message)
          report a message to the user
 Territory retreatQuery(GUID battleID, boolean submerge, java.util.Collection<Territory> possibleTerritories, java.lang.String message)
          Ask the player if he wishes to retreat.
 boolean selectAttackSubs(Territory unitTerritory)
          Ask if the player wants to attack lone subs
 boolean selectAttackTransports(Territory unitTerritory)
          Ask if the player wants to attack lone transports
 boolean selectAttackUnits(Territory unitTerritory)
          Ask if the player wants to attack units
 Territory selectBombardingTerritory(Unit unit, Territory unitTerritory, java.util.Collection<Territory> territories, boolean noneAvailable)
          Select the territory to bombard with the bombarding capable unit (eg battleship)
 CasualtyDetails selectCasualties(java.util.Collection<Unit> selectFrom, java.util.Map<Unit,java.util.Collection<Unit>> dependents, int count, java.lang.String message, DiceRoll dice, PlayerID hit, java.util.List<Unit> defaultCasualties, GUID battleID)
          Select casualties
 int[] selectFixedDice(int numDice, int hitAt, boolean hitOnlyIfEquals, java.lang.String title)
          Select a fixed dice roll
 boolean selectShoreBombard(Territory unitTerritory)
          Ask if the player wants to shore bombard
 Territory selectTerritoryForAirToLand(java.util.Collection<Territory> candidates)
          Some carriers were lost while defending.
 boolean shouldBomberBomb(Territory territory)
          One or more bombers have just moved into a territory where a strategic bombing raid can be conducted, should the bomber bomb?
 void start(java.lang.String name)
          The given phase has started.
 Territory whereShouldRocketsAttack(java.util.Collection<Territory> candidates, Territory from)
          Choose where my rockets should fire
 
Methods inherited from class games.strategy.common.player.AbstractHumanPlayer
setFrame
 
Methods inherited from class games.strategy.common.player.AbstractBasePlayer
getGameData, getID, getName, getPlayerBridge, initialize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface games.strategy.engine.gamePlayer.IGamePlayer
getID, getName, initialize
 
Methods inherited from interface games.strategy.triplea.player.ITripleaPlayer
getID
 

Constructor Detail

TripleAPlayer

public TripleAPlayer(java.lang.String name)
Creates new TripleAPlayer

Method Detail

reportError

public void reportError(java.lang.String error)
Description copied from interface: ITripleaPlayer
Report an error to the user.

Specified by:
reportError in interface ITripleaPlayer

reportMessage

public void reportMessage(java.lang.String message)
Description copied from interface: ITripleaPlayer
report a message to the user

Specified by:
reportMessage in interface ITripleaPlayer

start

public void start(java.lang.String name)
Description copied from class: AbstractBasePlayer
The given phase has started. We parse the phase name and call the apropiate method.

Specified by:
start in interface IGamePlayer
Specified by:
start in class AbstractHumanPlayer<TripleAFrame>

selectCasualties

public CasualtyDetails selectCasualties(java.util.Collection<Unit> selectFrom,
                                        java.util.Map<Unit,java.util.Collection<Unit>> dependents,
                                        int count,
                                        java.lang.String message,
                                        DiceRoll dice,
                                        PlayerID hit,
                                        java.util.List<Unit> defaultCasualties,
                                        GUID battleID)
Description copied from interface: ITripleaPlayer
Select casualties

Specified by:
selectCasualties in interface ITripleaPlayer
Parameters:
selectFrom - - the units to select casualties from
dependents - - dependents of the units to select from
count - - the number of casualties to select
message - - ui message to display
dice - - the dice rolled for the casualties
hit - - the player hit
defaultCasualties - - default casualties as selected by the game
battleID - - the battle we are fighting in, may be null if this is an aa casualty selection during a move
Returns:
the selected casualties Added new collection autoKilled to handle killing units prior to casualty selection

selectFixedDice

public int[] selectFixedDice(int numDice,
                             int hitAt,
                             boolean hitOnlyIfEquals,
                             java.lang.String title)
Description copied from interface: ITripleaPlayer
Select a fixed dice roll

Specified by:
selectFixedDice in interface ITripleaPlayer
Parameters:
numDice - - the number of dice rolls
hitAt - - the lowest roll that constitutes a hit (0 for none)
hitOnlyIfEquals - - whether to count rolls greater than hitAt as hits
title - - the title for the DiceChooser
Returns:
the resulting dice array

selectBombardingTerritory

public Territory selectBombardingTerritory(Unit unit,
                                           Territory unitTerritory,
                                           java.util.Collection<Territory> territories,
                                           boolean noneAvailable)
Description copied from interface: ITripleaPlayer
Select the territory to bombard with the bombarding capable unit (eg battleship)

Specified by:
selectBombardingTerritory in interface ITripleaPlayer
Parameters:
unit - - the bombarding unit
unitTerritory - - where the bombarding unit is
territories - - territories where the unit can bombard
Returns:
the Territory to bombard in, null if the unit should not bombard

selectAttackSubs

public boolean selectAttackSubs(Territory unitTerritory)
Description copied from interface: ITripleaPlayer
Ask if the player wants to attack lone subs

Specified by:
selectAttackSubs in interface ITripleaPlayer
Parameters:
unitTerritory - - where the potential battle is

selectAttackTransports

public boolean selectAttackTransports(Territory unitTerritory)
Description copied from interface: ITripleaPlayer
Ask if the player wants to attack lone transports

Specified by:
selectAttackTransports in interface ITripleaPlayer
Parameters:
unitTerritory - - where the potential battle is

selectAttackUnits

public boolean selectAttackUnits(Territory unitTerritory)
Description copied from interface: ITripleaPlayer
Ask if the player wants to attack units

Specified by:
selectAttackUnits in interface ITripleaPlayer
Parameters:
unitTerritory - - where the potential battle is

selectShoreBombard

public boolean selectShoreBombard(Territory unitTerritory)
Description copied from interface: ITripleaPlayer
Ask if the player wants to shore bombard

Specified by:
selectShoreBombard in interface ITripleaPlayer
Parameters:
unitTerritory - - where the potential battle is

shouldBomberBomb

public boolean shouldBomberBomb(Territory territory)
Description copied from interface: ITripleaPlayer
One or more bombers have just moved into a territory where a strategic bombing raid can be conducted, should the bomber bomb?

Specified by:
shouldBomberBomb in interface ITripleaPlayer

whereShouldRocketsAttack

public Territory whereShouldRocketsAttack(java.util.Collection<Territory> candidates,
                                          Territory from)
Description copied from interface: ITripleaPlayer
Choose where my rockets should fire

Specified by:
whereShouldRocketsAttack in interface ITripleaPlayer
Parameters:
candidates - - a collection of Territories, the possible territories to attack
from - - where the rockets are launched from, null for WW2V1 rules
Returns:
the territory to attack, null if no territory should be attacked

getNumberOfFightersToMoveToNewCarrier

public java.util.Collection<Unit> getNumberOfFightersToMoveToNewCarrier(java.util.Collection<Unit> fightersThatCanBeMoved,
                                                                        Territory from)
Description copied from interface: ITripleaPlayer
get the fighters to move to a newly produced carrier

Specified by:
getNumberOfFightersToMoveToNewCarrier in interface ITripleaPlayer
Parameters:
fightersThatCanBeMoved - - the fighters that can be moved
from - - the territory containing the factory
Returns:
- the fighters to move

selectTerritoryForAirToLand

public Territory selectTerritoryForAirToLand(java.util.Collection<Territory> candidates)
Description copied from interface: ITripleaPlayer
Some carriers were lost while defending. We must select where to land some air units.

Specified by:
selectTerritoryForAirToLand in interface ITripleaPlayer
Parameters:
candidates - - a list of territories - these are the places where air units can land
Returns:
- the territory to land the fighters in, must be non null

confirmMoveInFaceOfAA

public boolean confirmMoveInFaceOfAA(java.util.Collection<Territory> aaFiringTerritories)
Description copied from interface: ITripleaPlayer
The attempted move will incur aa fire, confirm that you still want to move

Specified by:
confirmMoveInFaceOfAA in interface ITripleaPlayer
Parameters:
aaFiringTerritories - - the territories where aa will fire

confirmMoveKamikaze

public boolean confirmMoveKamikaze()
Description copied from interface: ITripleaPlayer
The attempted move will kill some air units

Specified by:
confirmMoveKamikaze in interface ITripleaPlayer

confirmMoveHariKari

public boolean confirmMoveHariKari()
Description copied from interface: ITripleaPlayer
The attempted move will kill some units

Specified by:
confirmMoveHariKari in interface ITripleaPlayer

retreatQuery

public Territory retreatQuery(GUID battleID,
                              boolean submerge,
                              java.util.Collection<Territory> possibleTerritories,
                              java.lang.String message)
Description copied from interface: ITripleaPlayer
Ask the player if he wishes to retreat.

Specified by:
retreatQuery in interface ITripleaPlayer
Parameters:
battleID - - the battle
submerge - - is submerging possible
possibleTerritories - - where the player can retreat to
message - - user displayable message
Returns:
the territory to retreat to, or null if the player doesnt wish to retreat

confirmEnemyCasualties

public void confirmEnemyCasualties(GUID battleId,
                                   java.lang.String message,
                                   PlayerID hitPlayer)
Description copied from interface: ITripleaPlayer
Allows the user to pause and confirm enemy casualties

Specified by:
confirmEnemyCasualties in interface ITripleaPlayer

confirmOwnCasualties

public void confirmOwnCasualties(GUID battleId,
                                 java.lang.String message)
Specified by:
confirmOwnCasualties in interface ITripleaPlayer

isSBRAffectsUnitProduction

public final boolean isSBRAffectsUnitProduction(GameData data)