Class Dungeon

java.lang.Object
Dungeon

public class Dungeon
extends java.lang.Object
Driver file for Heroes and Monsters project. This class is the driver file for the Heroes and Monsters project. It will do the following: 1. Allow the user to choose a hero 2. Randomly select a monster 3. Allow the hero to battle the monster Once a battle concludes, the user has the option of repeating the above.
  • Field Summary

    Fields
    Modifier and Type Field Description
    private static CharacterFactory characterFactory  
    private static java.util.Random randomInt  
  • Constructor Summary

    Constructors
    Constructor Description
    Dungeon()  
  • Method Summary

    Modifier and Type Method Description
    static void battle​(DungeonCharacter theHero, DungeonCharacter theMonster)
    Perform the combat portion of the game.
    static DungeonCharacter chooseHero()
    Allows the user to select a hero, creates that hero, and returns it.
    static DungeonCharacter generateMonster()
    Randomly selects a Monster and returns it.
    static void main​(java.lang.String[] args)
    Main method.
    static boolean playAgain()
    Get the user's answer of whether or not to play another game.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • randomInt

      private static final java.util.Random randomInt
    • characterFactory

      private static final CharacterFactory characterFactory
  • Constructor Details

    • Dungeon

      public Dungeon()
  • Method Details

    • main

      public static void main​(java.lang.String[] args)
      Main method.
    • chooseHero

      public static DungeonCharacter chooseHero()
      Allows the user to select a hero, creates that hero, and returns it.
      Returns:
      Return the specified hero [class].
    • generateMonster

      public static DungeonCharacter generateMonster()
      Randomly selects a Monster and returns it.
      Returns:
      Return a random monster [class].
    • playAgain

      public static boolean playAgain()
      Get the user's answer of whether or not to play another game.
      Returns:
      Returns true if the user chooses to continue, false otherwise.
    • battle

      public static void battle​(DungeonCharacter theHero, DungeonCharacter theMonster)
      Perform the combat portion of the game. Battles occur in rounds. The Hero goes first, then the Monster. At the conclusion of each round, the user has the option of quitting.
      Parameters:
      theHero - The Hero that will fight the monster.
      theMonster - The monster to be fought.