se.chalmers.dat255.risk.model
public interface IGame
Modifier and Type | Interface and Description |
---|---|
static class |
IGame.GameMode |
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
AGAIN |
static java.lang.String |
ATTACK |
static java.lang.String |
CARDS |
static java.lang.String |
CHANGE_TURN |
static java.lang.String |
CONQUER |
static java.lang.String |
MOVEMENT |
static java.lang.String |
SURRENDER |
static java.lang.String |
UNITS |
static java.lang.String |
WIN |
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 province)
Determines what should be done with the chosen card
|
void |
handlePhaseEvent()
Determines if the game should change phase
|
void |
handleProvinceEvent(IProvince province)
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
|
static final java.lang.String MOVEMENT
static final java.lang.String ATTACK
static final java.lang.String CONQUER
static final java.lang.String AGAIN
static final java.lang.String WIN
static final java.lang.String SURRENDER
static final java.lang.String UNITS
static final java.lang.String CARDS
static final java.lang.String CHANGE_TURN
void setupGame(java.util.List<java.lang.String> playersId, java.lang.String neighboursFile, java.lang.String continentsFile, java.lang.String missionFile)
playersId
- id's of all playersneighboursFile
- relations between provincescontinentsFile
- continents and their provincesIPlayer getActivePlayer()
void battle(int nbrOfDice)
nbrOfDice
- the number of dice to attack withint getBonusUnitsLeft()
TurnAndPhaseManager.Phase getCurrentPhase()
java.util.List<IPlayer> getPlayers()
java.util.List<IProvince> getGameProvinces()
void handleProvinceEvent(IProvince province)
province
- province to be handledvoid handleCardEvent(ICard province)
province
- card to be handledvoid handlePhaseEvent()
int getOwner(java.lang.String provinceName)
provinceName
- the name of the provincevoid addListener(java.beans.PropertyChangeListener listener)
listener
- listener for eventsvoid moveToProvince(int nrOfUnits)
nrOfUnits
- number of units to be movedvoid surrender(boolean confirm)
confirm
- true if player has already confirmed their surrender, false
otherwisevoid flushProvinces()
void setGameMode(IGame.GameMode gameMode)
gameMode
- what type of winning condition the game will haveIGame.GameMode getGameMode()
java.lang.String getMissionText(IPlayer currentPlayer)