Class CommandProcessor

java.lang.Object
com.bdtripp.hauntedhouse.engine.CommandProcessor

public class CommandProcessor extends Object
Interprets player commands and applies their effects to the game world. The CommandProcessor translates parsed commands into actions, invokes the GameEngine to update the game state, and returns messages describing the results of those actions.
Author:
Brian Tripp
  • Constructor Details

    • CommandProcessor

      public CommandProcessor(World world, GameEngine gameEngine)
      Creates a CommandProcessor that operates on the given game world.
      Parameters:
      world - the game world whose state will be manipulated by commands.
      gameEngine - the engine that modifies the game's state
  • Method Details

    • processCommand

      public String processCommand(Command command)
      Given a command, process (that is: execute) the command.
      Parameters:
      command - the command to be processed.
      Returns:
      a message to display
    • talk

      public String talk(Command command)
      Makes a play talk to a character
      Parameters:
      command - the command that was entered
      Returns:
      a message to display
    • give

      public String give(Command command)
      Makes the player give an item to a character
      Parameters:
      command - the command that was entered
      Returns:
      a message to display