From Asgard
Jump to: navigation, search

Data Members

-battle: Battle

  • A link to the Battle. Set by constructor.

-view: ConsoleView

  • A link to ConsoleView. Set by constructor.

-debug: boolean

  • Are we in debug mode. This prints out extra information during program execution.


-ConsoleController(...:., b: Battle, v: ConsoleView)

  • Sets the links for Battle and ConsoleView so that each of them can access ConsoleController and themselves. It sets the mode of gameplay, normal or debug. Afterwards, the game loop starts.
  • This function does not automatically load nor save binary data!
  • Additionally, it uses self.loadStaticData() to load EventTypes and non-playable Fighters.

+getBattleCommand(enemy: Party, f: Fighter): [e: Fighter, type: string]

  • Prints out an event selection menu and collects a choice from the user. It returns the enemy selected for attack and the type of attack. Should use pygame's event driven input functionallity.

+getMenuCommand(): int

  • Prints out the startup menu, via ConsoleController.printStartupMenu() then obtains user input. Returns result.

-gameLoop(): void

Show dummy menu. Get user choices. Then:
  • If New Game selected, call self.createNewSave(..)
  • If Load Game selected, call self.load(..)
  • If Save Game selected, call (show only if game loaded), show menu again.
  • If Random Battle selected:
    1. Create a random battle. (self.createRandomBattle(..)).
    2. Print out the state of affairs before the battle begins. Executes Battle.nextTurn() once. The experience passed to giveExp should be the sum of the defeated party's experience.
    3. After battle, show dummy menu again.
  • If Quit selected, end program.

+load(file: string): void

+save(file: string): void

  • Calls Party.getBinaryString() for hero Party.
  • Calls Fighter.getBinaryString() for all playable Fighter.
  • Concatenates binary string and writes to save file.

+createRandomBattle(): void

  • Randomly selects some number (1 to 6) of monsters, and randomly determines which monsters they are.
  • Copies each monster to populate an enemy party.

+loadStaticData(newGame: bool): void

  • Loads EventTypes and non-playable/initial playable Fighters. (at some point, other things too)
  • Utilizes the Fighter xml constructor.
  • By default it loads fighter objects that are non playable into Battle.monsters, but when newGame is True, it also creates the hero party from the files in ./data/fighter/playable. It does not load playable fighters into Battle.monsters.

+unloadStaticData(): void

  • Unloads EventTypes and non-playable Fighters (ConsoleController.monsters). (at some point, other things too)

+getBattle(): Battle

+getView(): ConsoleView