Class GameController
Object
GameController
Central point of communication between GameData, GameView and CombatEngine.
-
Constructor Summary
ConstructorsConstructorDescriptionGameController
(GameData data, GameView view, CombatEngine engine) The GameController needs all major components of the game to work - view, data and combat -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
processCommand
(String command) Setup as a helper method forstart()
}, processes commands the client passes in throughGameView.displayMainMenu()
.void
start()
Starts the game, causing it to run until a client exits.
-
Constructor Details
-
GameController
The GameController needs all major components of the game to work - view, data and combat- Parameters:
data
- GameData - does not care the type (CSV, JSON, etc), just the abstract classview
- GameView - calles the various methods based on feedback from dataengine
- runs combat between an active knight group and MOBs
-
-
Method Details
-
start
public void start()Starts the game, causing it to run until a client exits. Starts with splashScreen, loops as long as processCommand returns true, prints endgame when loop is done.- See Also:
-
processCommand
Setup as a helper method forstart()
}, processes commands the client passes in throughGameView.displayMainMenu()
. The following command combinations are allowed:- exit or bye (contains) - causes processCommand to return false
- ls or list all - list all knights. For example, view.listKnights(data.getKnights())
- list active - list active knights via
GameData.getActiveKnights()
- show (name or id) - if the command starts with show, take the remainder and show the knight card
- set active (name or id) - if command starts with set active, grabs the remainder of the line, and try to add the knight to the active knight list.
- remove (name or id) - if command starts with remove, grabs the remainder of the line, attempts to remove the knight from active status.
- save (filename - optional) - saves the game. If a file name is provided saves the knights to the file. If a file name is left off, saves out to saveData.csv
- explore, adventure or quest - if any three of these words are used, it starts a combat
sequence. For example.
engine.initialize(); engine.runCombat(); engine.clear(); }
- any other input, print the help menu.
- Parameters:
command
- command to process.- Returns:
- true unless exit or bye is used.
-