public void foundItem(Thing f) { if (f.show() == "Claws") { claw += 1; f.add_to(gracz); } else if (f.show() == "Piece of ebonite") { ebon += 1; f.add_to(gracz); } else if (f.show() == "Dust") { dust += 1; f.add_to(gracz); } else if (f.show() == "Venom") { venom += 1; f.add_to(gracz); } else f.add_to(gracz); }
/** funkcja dodajaca przedmiot do ekwipunku */ public void found(Thing f) { Scanner sc = new Scanner(System.in); String line; char dec = 'a'; int num = 0; System.out.println("Found something! :"); String info = f.show(); System.out.println("\t" + info + "\n"); if (f.id() == 'i') { foundItem(f); return; } show(); System.out.println("Wanna add? (y/n)"); while (dec != 'y' && dec != 'n') { line = sc.nextLine(); dec = line.charAt(0); if (dec != 'y' && dec != 'n') System.out.println("Only y/n answer Idjit!"); } if (dec == 'n') return; System.out.println("Which position change? (1-8)"); while (num < 1 || num > 8) { num = sc.nextInt(); if (num > 0 && num < 9) things[num - 1] = f; else System.out.println("Wrong number Idjit!"); } System.out.println("Added!"); }