为基于文本的D& D广告系列编写一些代码,我正在尝试让方法Weapon()
回想起在开始时选择的字符并让用户选择他们的武器。我在switch语句中写了一个switch语句,允许所选字符的情况询问所需武器的情况。计划是在每个战斗序列之前使用它。
为什么告诉我EBERK
是孤儿?
public static String Weapon() {
String weapon = "Unarmed";
switch (chooseCharacter()) {
case TORDEK:
System.out.println("Choose Weapon: ");
System.out.println("1. War Axe \n2. Bow \n3. Unarmed");
System.out.print("Weapon Selection (1-3): ");
int menuChoice = KBD.nextInt();
System.out.println();
System.out.print("Press Enter...");
System.out.println();
KBD.nextLine();
System.out.println();
while (menuChoice > 3 || menuChoice < 1) {
System.out.print("Please enter 1 through 3: ");
menuChoice = KBD.nextInt();
System.out.println();
KBD.nextLine();
}
switch (menuChoice) {
case 1:
weapon = "War Axe";
break;
case 2:
weapon = "Bow";
break;
default:
weapon = "Unarmed";
break;
}
return weapon;
break;
case EBERK:
System.out.println("Choose Weapon: ");
System.out.println("1. Warhammer \n2. Crossbow \n3. Unarmed");
System.out.print("Weapon Selection (1-3): ");
int menuChoice = KBD.nextInt();
System.out.println();
System.out.print("Press Enter...");
System.out.println();
KBD.nextLine();
System.out.println();
while (menuChoice > 3 || menuChoice < 1) {
System.out.print("Please enter 1 through 3: ");
menuChoice = KBD.nextInt();
System.out.println();
KBD.nextLine();
switch (menuChoice) {
case 1:
weapon = "Warhammer";
break;
case 2:
weapon = "Crossbow";
break;
default:
weapon = "Unarmed";
break;
}
break;
// case JOZAN: etc....