The map classes diagram shows the class hierarchy for the game's map system. The ClassicMap class extends the GameMap interface, which defines methods for creating a map and getting territories.
The Continent and Territory interfaces both contain methods for defining and manipulating territories and continents. The Continent interface implements the ContinentType interface and the Territory interface implements the TerritoryType interface. These interfaces define methods for adding and checking territories and neighbors.
In addition to these interfaces, the diagram also shows several classes that implement them. For example, the DefaultWorldMap class implements the GameMap interface and defines the game's default map. The Continent and Territory classes implement the ContinentType and TerritoryType interfaces, respectively, and contain additional methods for managing territories and their neighbors.
%%{init: {"theme": "default"}%%
classDiagram
direction TB
ClassicMap --> GameMap : extends
ClassicMap --> Continent : defines
Continent ..> ContinentType : implements
ClassicMap --> Territory : defines
Territory ..> TerritoryType :implements
class ClassicMap {
+ ClassicMap()
- String description
- String name
+ createMap() void
String name
String description
}
class Continent {
<<enumeration>>
- Continent()
- String name
- List~TerritoryType~ territories
+ addTerritory(TerritoryType) void
+ hasTerritory(TerritoryType) boolean
+ valueOf(String) Continent
+ values() Continent[]
String name
List~TerritoryType~ territories
}
class ContinentType {
<<interface>>
+ hasTerritory(TerritoryType) boolean
+ addTerritory(TerritoryType) void
String name
List~TerritoryType~ territories
}
class GameMap {
+ GameMap()
- List~ContinentType~ continents
- List~TerritoryType~ territories
+ createContinents(ContinentType[]) void
+ createMap() void
+ createTerritories(TerritoryType[]) void
String name
String description
List~ContinentType~ continents
List~TerritoryType~ territories
}
class Territory {
<<enumeration>>
- Territory(Continent, Territory[])
- Continent continent
- List~TerritoryType~ neighbors
- String name
+ values() Territory[]
+ addNeighbor(TerritoryType) void
+ valueOf(String) Territory
+ hasNeighbor(TerritoryType) boolean
String name
List~TerritoryType~ neighbors
Continent continent
}
class TerritoryType {
<<interface>>
+ addNeighbor(TerritoryType) void
+ hasNeighbor(TerritoryType) boolean
ContinentType continent
String name
List~TerritoryType~ neighbors
}
%%{init: {"theme": "default"}%%
classDiagram
direction LR
MapState o--> ContinentState : contains
MapState o--> TerritoryState : contains
class MapState {
+ createFromMap(GameMap) MapState?
}
class ContinentState
class TerritoryState {
- boolean playable
- Player owner
- int armies
+ canStartAttack() boolean
+ addArmies(int) void
+ removeArmies(int) void
+ togglePlayable() void
+ canStartFortify() boolean
ColorType color
boolean conquered
Player owner
boolean playable
int armies
}