Exemplo n.º 1
0
  public void setCommand(String verb, String noun) {
    Command command;
    switch (verb.toLowerCase()) {
      case "activate": // One word Command, Activate
        mySpecialAbility.activate(this);
        break;
      case "buy":
        if (noun.equals("")) {
          System.out.println("Buy what?");
        } else {

        }
        break;
      case "drop":
        if (noun.equals("")) {
          System.out.println("Drop what?");
        } else {

        }
        break;
      case "eat":
        if (noun.equals("")) {
          System.out.println("Eat what?");
        } else {

        }
        break;
      case "equip":
        if (noun.equals("")) {
          System.out.println("Equip what?");
        } else {

        }
        break;
      case "fight":
        if (noun.equals("")) {
          System.out.println("Fight what?");
        } else {

        }
        break;
      case "sell":
        if (noun.equals("")) {
          System.out.println("Sell what?");
        } else {

        }
        break;
      case "take":
        if (noun.equals("")) {
          System.out.println("Take what?");
        } else {

        }
        break;
      case "talk":
        if (noun.equals("")) {
          System.out.println("Talk to whom?");
        } else {

        }
        break;
      case "walk":
        if (noun.equals("")) {
          System.out.println("Walk in which direction?");
        } else {

        }
        break;
      default:
        System.out.println("Invalid command! Please retype!");
    }
  }
Exemplo n.º 2
0
 // Get the behavior of the Player
 public String getBehavior() {
   return mySpecialAbility.getClass().getSimpleName();
 }