-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCharacterCreation.java
More file actions
134 lines (115 loc) · 3.59 KB
/
CharacterCreation.java
File metadata and controls
134 lines (115 loc) · 3.59 KB
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
import java.util.*;
/**
*@author Tyler Lericos
*@version 1.0
*Interfaces
*Spring Semester/Freshman
*/
public class CharacterCreation extends Stats{
char charChoice;
Random rand = new Random();
Player player;
/*
* ===============================================================================
* WORLD
* ===============================================================================
*/
public CharacterCreation() {
// TODO Auto-generated constructor stub
}
public CharacterCreation(String name) {
player.name = name;
}
/*
* ===============================================================================
* PLAYER RACE
* ===============================================================================
*/
public void SetPlayerRace(Player player, Scanner scan)
{
System.out.println("Now, " + player.getName() + " what race are you?\n");
System.out.println("1. Human\n2. Elf\n3.Dwarf\n4.Orc");
charChoice = scan.next().charAt(0);
switch(charChoice)
{
case '1':
player.setRace(player.race.HUMAN);
break;
case '2':
player.setRace(player.race.ELF);
break;
case '3':
player.setRace(player.race.DWARF);
break;
case '4':
player.setRace(player.race.ORC);
break;
default:
System.out.println("Start over!");
}
}
/*
* ===============================================================================
* PLAYER CLASS
* ===============================================================================
*/
public void SetPlayerClass(Player player, Scanner scan)
{
System.out.println("Ahh, you chose " + player.race +". Interesting. Now for your class:\n");
System.out.println("1. Warrior\n2. Mage\n3. Thief");
charChoice=scan.next().charAt(0);
switch(charChoice)
{
case '1':
player.setClasses(player.classes.WARRIOR);
break;
case '2':
player.setClasses(player.classes.MAGE);
break;
case '3':
player.setClasses(player.classes.THIEF);
break;
default:
System.out.println("Start over!");
}
}
public void SetPlayerStats(Player player, Scanner scan)
{
System.out.println("Hmm, a " +player.classes +". How fitting! Here are your stats,"+player.name+"!\n");
try {
if(player.getClasses()== player.classes.MAGE)
{
player.strength = rand.nextInt(10)+1;
player.intellegence = rand.nextInt(5,10);
player.agility = rand.nextInt(10)+1;
player.wisdom = rand.nextInt(5,10);
}
if(player.getClasses()== player.classes.WARRIOR)
{
player.strength = rand.nextInt(5,10);
player.intellegence = rand.nextInt(10)+1;
player.agility = rand.nextInt(2,8);
player.wisdom = rand.nextInt(5,10);
}
if(player.getClasses()== player.classes.THIEF)
{
player.strength = rand.nextInt(10-1)+1;
player.intellegence = rand.nextInt(10)+1;
player.agility = rand.nextInt(5,10);
player.wisdom = rand.nextInt(10)+1;
}
System.out.println("Strength: " + player.getStrength()+"\nIntellegence: " + player.getIntellegence() + "\nAgility: "
+ player.getAgility() + "\nWisdom:" + player.getWisdom());
}
catch(Exception e)
{
System.out.println("Stats Not Set");
}
}
public void getStats(Player player){
System.out.println("***************STATS***************");
System.out.println(player.getName()+"\n" +player.race+ "\n" + player.getClasses());
System.out.println("Strength: " + player.getStrength()+"\nIntellegence: " + player.getIntellegence() + "\nAgility: "
+ player.getAgility() + "\nWisdom:" + player.getWisdom());
}
}