Guest User

Untitled

a guest
Jun 24th, 2018
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. {
  2. if (player.Inventory() == null){System.out.println("There is nothing to use.");}
  3. else{
  4. if(!command.hasSecondWord())
  5. {
  6. // if there is no second word, we don't know where to go...
  7. System.out.println("Use what?");
  8. return;
  9. }
  10. else
  11. {
  12. String useItem = command.getSecondWord();
  13. if (player.getItem(useItem) == null){System.out.println("No item called that in your inventory!");}
  14. else{
  15.  
  16. if (!player.getItem(useItem).equals("stick") && !player.getItem(useItem).equals("sword")){System.out.println("Used " + useItem); player.removeItem(player.getItem(useItem));}
  17.  
  18. else if (player.getItem(useItem).equals("stick") || player.getItem(useItem).equals("sword") && currentRoom.listEnemys() != null)
  19. {System.out.println("Attttttaaaaack! With a " + player.getItem(useItem));}
  20.  
  21. else {System.out.println("Nothing to attack.");}
  22.  
  23. }
  24. }
  25. }
  26.  
  27. }
Add Comment
Please, Sign In to add comment