se.chalmers.dat255.risk.model
IGame.GameMode
Constructor and Description |
---|
Game()
Creates a new Game.
|
Modifier and Type | Method and Description |
---|---|
void |
addListener(java.beans.PropertyChangeListener listener)
Adds a listener to receive events
|
void |
battle(int nbrOfDice)
Tells the game to do battle with two provinces
|
void |
flushProvinces()
Inactivates any saved provinces
|
IPlayer |
getActivePlayer()
Fetches the player who has the current turn.
|
int |
getBonusUnitsLeft()
Method for retrieving the number of units the player has left to place.
|
TurnAndPhaseManager.Phase |
getCurrentPhase()
Fetches the phase the game is in
|
IGame.GameMode |
getGameMode()
retrieves current gameMode
|
java.util.List<IProvince> |
getGameProvinces()
Retrieves all provinces
|
java.lang.String |
getMissionText(IPlayer currentPlayer)
Returns a String that discribes your mission.
|
int |
getOwner(java.lang.String provinceName)
Method for finding the owner of an province
|
java.util.List<IPlayer> |
getPlayers()
Fetches all players
|
void |
handleCardEvent(ICard card)
Determines what should be done with the chosen card
|
void |
handlePhaseEvent()
Determines if the game should change phase
|
void |
handleProvinceEvent(IProvince newProvince)
Determines what should be done with the chosen province
|
void |
moveToProvince(int nrOfUnits)
Moves the requested number of units from one active province to another
|
void |
setGameMode(IGame.GameMode gameMode)
Sets the game type.
|
void |
setupGame(java.util.List<java.lang.String> playersId,
java.lang.String neighboursFile,
java.lang.String continentsFile,
java.lang.String missionFile)
Sets up a new Game
|
void |
surrender(boolean confirm)
Called when the current player gives up
|
public void setupGame(java.util.List<java.lang.String> playersId, java.lang.String neighboursFile, java.lang.String continentsFile, java.lang.String missionFile)
IGame
public void setGameMode(IGame.GameMode gameMode)
IGame
setGameMode
in interface IGame
gameMode
- what type of winning condition the game will havepublic IPlayer getActivePlayer()
IGame
getActivePlayer
in interface IGame
public int getBonusUnitsLeft()
IGame
getBonusUnitsLeft
in interface IGame
public TurnAndPhaseManager.Phase getCurrentPhase()
IGame
getCurrentPhase
in interface IGame
public java.util.List<IPlayer> getPlayers()
IGame
getPlayers
in interface IGame
public java.util.List<IProvince> getGameProvinces()
IGame
getGameProvinces
in interface IGame
public void handleProvinceEvent(IProvince newProvince)
IGame
handleProvinceEvent
in interface IGame
newProvince
- province to be handledpublic void flushProvinces()
IGame
flushProvinces
in interface IGame
public void moveToProvince(int nrOfUnits)
IGame
moveToProvince
in interface IGame
nrOfUnits
- number of units to be movedpublic void battle(int nbrOfDice)
IGame
public void handleCardEvent(ICard card)
IGame
handleCardEvent
in interface IGame
card
- card to be handledpublic void surrender(boolean confirm)
IGame
public void handlePhaseEvent()
IGame
handlePhaseEvent
in interface IGame
public int getOwner(java.lang.String provinceName)
IGame
public void addListener(java.beans.PropertyChangeListener listener)
IGame
addListener
in interface IGame
listener
- listener for eventspublic java.lang.String getMissionText(IPlayer currentPlayer)
IGame
getMissionText
in interface IGame
public IGame.GameMode getGameMode()
IGame
getGameMode
in interface IGame