-
Notifications
You must be signed in to change notification settings - Fork 6
/
MainGame.java
112 lines (109 loc) · 2.74 KB
/
MainGame.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
import java.util.Scanner;
public class MainGame {
public static void main(String[] args) {
Status playerData = new Status();
playerData.showData();
showCommand();
System.out.println("Input Command!");
Scanner sc = new Scanner(System.in);
int line = 0;
while (sc.hasNext()) {
String tmp = sc.nextLine();
if (tmp.matches("[+-]?\\d*(\\.\\d+)?")) {
line = Integer.parseInt(tmp);
} else {
line = 0;
}
switch (line) {
case 1: {
AddLV addlv = new AddLV();
playerData.lv = addlv.addLv(playerData.lv);
}
break;
case 2: {
SubLV sublv = new SubLV();
playerData.lv = sublv.sublv(playerData.lv);
}
break;
case 3: {
AddAtk addatk = new AddAtk();
playerData.atk = addatk.addatk(playerData.atk);
}
break;
case 4: {
SubAtk subatk = new SubAtk();
playerData.atk = subatk.subatk(playerData.atk);
}
break;
case 5: {
AddDef adddef = new AddDef();
playerData.def = adddef.adddef(playerData.def);
}
break;
case 6: {
SubDef subdef = new SubDef();
playerData.def = subdef.subdef(playerData.def);
}
break;
case 7: {
AddHP addhp = new AddHP();
playerData.hp = addhp.addhp(playerData.hp);
}
break;
case 8: {
SubHP subhp = new SubHP();
playerData.hp = subhp.subhp(playerData.hp);
}
break;
case 9: {
AddMP addmp = new AddMP();
playerData.hp = addmp.addmp(playerData.mp);
}
break;
case 10: {
SubMP submp = new SubMP();
playerData.mp = submp.submp(playerData.mp);
}
break;
case 11: {
AddLuk addluk = new AddLuk();
playerData.luk = addluk.addLuk(playerData.luk);
}
break;
case 12: {
SubLuk subluk = new SubLuk();
playerData.luk = subluk.subLuk(playerData.luk);
}
break;
case 13: { // add kogure
System.out.println("No operation");
}
default: {
System.exit(0);
}
break;
}
playerData.showData();
showCommand();
}
sc.close();
}
public static void showCommand() {
System.out.println("---Command List---");
System.out.println("1: Add Lv");
System.out.println("2: Sub Lv");
System.out.println("3: Add atk");
System.out.println("4: Sub atk");
System.out.println("5: Add def");
System.out.println("6: Sub def");
System.out.println("7: Add HP");
System.out.println("8: Sub HP");
System.out.println("9: Add MP");
System.out.println("10: Sub MP");
System.out.println("11: Add LUK");
System.out.println("12: Sub LUK");
System.out.println("13: No OP");
System.out.println("other: close program");
System.out.println("------------------");
}
}