-
Notifications
You must be signed in to change notification settings - Fork 0
/
Game.java
68 lines (52 loc) · 1.74 KB
/
Game.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
public class Game {
// main method
public static void main(String[] args) {
String name = Character.CreateCharacter();
// setting HP for character
int HPMax = (int) (Math.random() * (100) + 50);
int HP = HPMax;
int strength = (int) (Math.random() * (20) + 5);
Character.strengthIndicator(HPMax, strength);
// char creation
Character myChar = new Character(name, HP, HPMax, strength, 0, 1, 20, 1);
// battle simulation
System.out.println("");
System.out.println("Hey, you found an enemy!");
System.out.println("Let's fight!");
System.out.println("");
Character goblin = Character.EnemyGeneration();
Character bossGoblin = Character.BossEnemyGeneration();
Event.Battle(myChar, goblin);
// Re-match
int nextOption;
do {
System.out.println("***********************");
System.out.println("What do you want to do now?");
System.out.println("1. Fight again");
System.out.println("2. Leave the game");
System.out.println("***********************");
nextOption = Event.ChooseOption();
if (nextOption == 1) {
int roll = (int) (Math.random() * 10);
if (roll > 5) {
System.out.println("OH NO!! The boss goblin!!");
System.out.println("Should we attack him?");
System.out.println("1. Yes!!!");
System.out.println("2. Not yet");
nextOption = Event.ChooseOption();
if (nextOption == 1) {
Event.Battle(myChar, bossGoblin);
} else {
System.out.println("A passing goblin decides to attack us");
Event.Battle(myChar, goblin);
nextOption = 0;
}
} else {
nextOption = 0;
Event.Battle(myChar, goblin);
}
}
} while (nextOption != 2);
Event.LeaveGame();
}
}