-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCharacter Gen
More file actions
311 lines (310 loc) · 16.2 KB
/
Character Gen
File metadata and controls
311 lines (310 loc) · 16.2 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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
package randomCharGen;
import java.util.*;
/**
* @author Connor Solu
* Random Character Generator v1
*/
public class RandomGen {
String gameClass[] = {"Barbarian", "Bard", "Cleric", "Druid", "Fighter", "Monk", "Paladin", "Ranger", "Rogue", "Sorcerer", "Warlock", "Wizard"};
String race[] = {"Dragonborn", "Dwarf", "Elf", "Gnome", "Half-Elf", "Half-Orc", "Halfling", "Human", "Tiefling"};
String name[] = {"Yenward", "Thoice", "Solass", "Brestina", "Unarath", "Zangold", "Elorin", "Oolanys", "Oloward", "Aluuvial", "Daruvial", "Prukahn", "Thokul", "Norgretor"};
String alignment[] = {"Lawful Good", "Neutral Good", "Chaotic Good", "Lawful Neutral", "Neutral", "Chaotic Neutral", "Lawful Evil", "Neutral Evil", "Chaotic Evil"};
String bardCantrips[] = {"Dancing Lights", "Light", "Mage Hand", "Mending", "Message", "Minor Illusion", "Prestidigitation", "True Strike", "Vicious Mockery"};
String firstlvlBard[] = {"Animal Friendship", "Bane", "Charm Person", "Comprehend Languages", "Cure Wounds", "Detect Magic", "Disguise Self", "Faerie Fire", "Feather Fall", "Healing Word", "Heroism", "Hideous Laughter", "Identify", "Illusory Script", "Longstrider", "Silent Image", "Sleep", "Speak with Animals", "Thunderwave", "Unseen Servant"};
String secondlvlBard[] = {"Animal Messenger", "Blindness/Deafness", "Calm Emotions", "Detect Thoughts", "Enhance Ability", "Enthrall", "Heat Metal", "Hold Person", "Invisibility", "Knock", "Lesser Restoration", "Locate Animal or Plants", "Locate Object", "Magic Mouth", "See Invisibility", "Shatter", "Silence", "Suggestion", "Zone of Thruth"};
String thirdlvlBard[] = {"Bestow Curse", "Clairvoyance", "Dispel Magic", "Fear", "Glyph of Warding", "Hypnotic Pattern", "Major Image", "Nondetection", "Plant Growth", "Sending", "Speak with Dead", "Speak with Plants", "Stinking Cloud", "Tiny Hut", "Tongues"};
String fourthlvlBard[] = {"Compulsion", "Confusion", "Dimension Door", "Freedom of Movement", "Greater Invisibility", "Hallucinatory Terrain", "Locate Creature", "Polymorph"};
String fifthlvlBard[] = {"Animate Objects", "Awaken", "Dominate Person", "Dream", "Geas", "Greater Restoration", "Hold Monster", "Legend Lore", "Mass Cure Wounds", "Mislead", "Modify Memory", "Planar Binding", "Raise Dead", "Scrying", "Seeming", "Teleportation Circle"};
String sixthlvlBard[] = {"Eyebite", "Find the Path", "Guards and Wards", "Mass Suggestion", "Otto's Irresistible Dance", "Programmed Illusion", "True Seeing"};
String seventhlvlBard[] = {"Etherealness", "Forcecage", "Magnificent Mansion", "Mirage Arcane", "Mordenkainen's Sword", "Project Image", "Regenerate", "Resurrection", "Symbol", "Teleport"};
String eighthlvlBard[] = {"Dominate Monster", "Feeblemind", "Glibness", "Mind Blank", "Power Word Stun"};
String ninthlvlBard[] = {"Foresight", "Power Word Kill", "True Polymorph"};
int str, dex, con, intel, wis, cha, lvl, health, exp, inv;
public RandomGen(int lvl){
this.lvl = lvl;
this.health = 100;
this.exp = 0;
this.inv = 8;
}
public void loseHealth(int loss){
this.health = health - loss;
if (this.health <= 0) //Checking if character is dead
System.out.println("You Have Died.");
}
public void gainHealth(int gain){
this.health = health + gain;
if (this.health > 100) //Limiting health to 100
this.health = 100;
}
public void gainExp(int gain){
this.exp = exp + gain;
if (this.exp >= 100){ //Checking if a level up is in order
this.exp = exp - 100;
this.lvl++;
}
}
public void useInvSlot(){
this.inv = inv - 1;
if (inv == 0)
System.out.println("Inventory is full.");
}
public int getStrength(){
int rnd;
if (lvl == 15)
rnd = new Random().nextInt(11) + 10;
else if (lvl == 10)
rnd = new Random().nextInt(14) + 7;
else
rnd = new Random().nextInt(16) + 5;
return rnd;
}
public int getDexterity(){
int rnd;
if (lvl == 15)
rnd = new Random().nextInt(11) + 10;
else if (lvl == 10)
rnd = new Random().nextInt(14) + 7;
else
rnd = new Random().nextInt(16) + 5;
return rnd;
}
public int getConstitution(){
int rnd;
if (lvl == 15)
rnd = new Random().nextInt(11) + 10;
else if (lvl == 10)
rnd = new Random().nextInt(14) + 7;
else
rnd = new Random().nextInt(16) + 5;
return rnd;
}
public int getIntelligence(){
int rnd;
if (lvl == 15)
rnd = new Random().nextInt(11) + 10;
else if (lvl == 10)
rnd = new Random().nextInt(14) + 7;
else
rnd = new Random().nextInt(16) + 5;
return rnd;
}
public int getWisdom(){
int rnd;
if (lvl == 15)
rnd = new Random().nextInt(11) + 10;
else if (lvl == 10)
rnd = new Random().nextInt(14) + 7;
else
rnd = new Random().nextInt(16) + 5;
return rnd;
}
public int getCharisma(){
int rnd;
if (lvl == 15)
rnd = new Random().nextInt(11) + 10;
else if (lvl == 10)
rnd = new Random().nextInt(14) + 7;
else
rnd = new Random().nextInt(16) + 5;
return rnd;
}
public String getRace(){
int rnd = new Random().nextInt(this.race.length);
return race[rnd];
}
public int[] raceBonus(String r){
int[] rb = {0, 0, 0, 0, 0, 0};
switch (r){ //Adding race bonuses through switch statement Array order = {str, dex, con, intel, wis, cha}
case "Dragonborn":
rb[0] += 2;
rb[5] += 1;
return rb;
case "Dwarf":
rb[2] += 2;
return rb;
case "Elf":
rb[1] +=2;
return rb;
case "Gnome":
rb[3] += 2;
return rb;
case "Half-Elf":
rb[5] += 2;
rb[4] += 1;
rb[3] += 1;
return rb;
case "Halfling":
rb[1] += 2;
return rb;
case "Half-Orc":
rb[0] += 2;
rb[2] += 1;
return rb;
case "Human":
rb[0] += 1;
rb[1] += 1;
rb[2] += 1;
rb[3] += 1;
rb[4] += 1;
rb[5] += 1;
return rb;
case "Tiefling":
rb[5] += 2;
rb[3] += 1;
return rb;
}
return rb;
}
public String getGameClass(){
int rnd = new Random().nextInt(this.gameClass.length);
return gameClass[rnd];
}
public String getName(){
int rnd = new Random().nextInt(this.name.length);
return name[rnd];
}
public String getAlignment(){
int rnd = new Random().nextInt(this.alignment.length);
return alignment[rnd];
}
public String[] getBardCantrips(){
int rnd1lvl1, rnd2lvl1, rnd1lvl5, rnd2lvl5, rnd3lvl5, rnd1lvl15, rnd2lvl15, rnd3lvl15, rnd4lvl15;
switch (lvl){
case 1:
rnd1lvl1 = new Random().nextInt(this.bardCantrips.length);
do{
rnd2lvl1 = new Random().nextInt(this.bardCantrips.length);
}while (rnd1lvl1 == rnd2lvl1);
return new String[] {bardCantrips[rnd1lvl1], bardCantrips[rnd2lvl1]};
case 5:
rnd1lvl5 = new Random().nextInt(this.bardCantrips.length);
do{
rnd2lvl5 = new Random().nextInt(this.bardCantrips.length);
}while (rnd1lvl5 == rnd2lvl5);
do{
rnd3lvl5 = new Random().nextInt(this.bardCantrips.length);
}while (rnd3lvl5 == rnd1lvl5 || rnd3lvl5 == rnd2lvl5);
return new String[] {bardCantrips[rnd1lvl5], bardCantrips[rnd2lvl5], bardCantrips[rnd3lvl5]};
case 10: case 15:
rnd1lvl15 = new Random().nextInt(this.bardCantrips.length);
do{
rnd2lvl15 = new Random().nextInt(this.bardCantrips.length);
}while (rnd1lvl15 == rnd2lvl15);
do{
rnd3lvl15 = new Random().nextInt(this.bardCantrips.length);
}while (rnd3lvl15 == rnd1lvl15 || rnd3lvl15 == rnd2lvl15);
do{
rnd4lvl15 = new Random().nextInt(this.bardCantrips.length);
}while (rnd4lvl15 == rnd1lvl15 || rnd4lvl15 == rnd2lvl15 || rnd4lvl15 == rnd3lvl15);
return new String[] {bardCantrips[rnd1lvl15], bardCantrips[rnd2lvl15], bardCantrips[rnd3lvl15], bardCantrips[rnd4lvl15]};
}
return new String[] {"Error"};
}
public String[] getBardSpells(){
int rnd1lvl1, rnd2lvl1, rnd1lvl5, rnd2lvl5, rnd3lvl5, rnd4lvl5, rnd5lvl5, rnd6lvl5, rnd7lvl5, rnd8lvl5, rnd1lvl10, rnd2lvl10, rnd3lvl10, rnd4lvl10, rnd5lvl10, rnd6lvl10, rnd7lvl10, rnd8lvl10, rnd9lvl10, rnd10lvl10, rnd11lvl10, rnd12lvl10, rnd13lvl10, rnd14lvl10, rnd1lvl15, rnd2lvl15, rnd3lvl15, rnd4lvl15, rnd5lvl15, rnd6lvl15, rnd7lvl15, rnd8lvl15, rnd9lvl15, rnd10lvl15, rnd11lvl15, rnd12lvl15, rnd13lvl15, rnd14lvl15, rnd15lvl15, rnd16lvl15, rnd17lvl15, rnd18lvl15, rnd19lvl15;
switch (lvl){
case 1:
rnd1lvl1 = new Random().nextInt(this.firstlvlBard.length);
do{
rnd2lvl1 = new Random().nextInt(this.firstlvlBard.length);
}while (rnd1lvl1 == rnd2lvl1);
return new String[] {firstlvlBard[rnd1lvl1], firstlvlBard[rnd2lvl1]};
case 5:
rnd1lvl5 = new Random().nextInt(this.firstlvlBard.length);
do{
rnd2lvl5 = new Random().nextInt(this.firstlvlBard.length);
}while (rnd1lvl5 == rnd2lvl5);
do{
rnd3lvl5 = new Random().nextInt(this.firstlvlBard.length);
}while (rnd3lvl5 == rnd1lvl5 || rnd3lvl5 == rnd2lvl5);
do{
rnd4lvl5 = new Random().nextInt(this.firstlvlBard.length);
}while (rnd4lvl5 == rnd1lvl5 || rnd4lvl5 == rnd2lvl5 || rnd4lvl5 == rnd3lvl5);
rnd5lvl5 = new Random().nextInt(this.secondlvlBard.length);
do{
rnd6lvl5 = new Random().nextInt(this.secondlvlBard.length);
}while (rnd6lvl5 == rnd5lvl5);
do{
rnd7lvl5 = new Random().nextInt(this.secondlvlBard.length);
}while (rnd7lvl5 == rnd5lvl5 || rnd7lvl5 == rnd6lvl5);
rnd8lvl5 = new Random().nextInt(this.thirdlvlBard.length);
return new String[] {firstlvlBard[rnd1lvl5], firstlvlBard[rnd2lvl5], firstlvlBard[rnd3lvl5], firstlvlBard[rnd4lvl5], secondlvlBard[rnd5lvl5], secondlvlBard[rnd6lvl5], secondlvlBard[rnd7lvl5], thirdlvlBard[rnd8lvl5]};
case 10:
rnd1lvl10 = new Random().nextInt(this.firstlvlBard.length);
do{
rnd2lvl10 = new Random().nextInt(this.firstlvlBard.length);
}while (rnd1lvl10 == rnd2lvl10);
do{
rnd3lvl10 = new Random().nextInt(this.firstlvlBard.length);
}while (rnd3lvl10 == rnd1lvl10 || rnd3lvl10 == rnd2lvl10);
do{
rnd4lvl10 = new Random().nextInt(this.firstlvlBard.length);
}while (rnd4lvl10 == rnd1lvl10 || rnd4lvl10 == rnd2lvl10 || rnd4lvl10 == rnd3lvl10);
rnd5lvl10 = new Random().nextInt(this.secondlvlBard.length);
do{
rnd6lvl10 = new Random().nextInt(this.secondlvlBard.length);
}while (rnd6lvl10 == rnd5lvl10);
do{
rnd7lvl10 = new Random().nextInt(this.secondlvlBard.length);
}while (rnd7lvl10 == rnd5lvl10 || rnd7lvl10 == rnd6lvl10);
rnd8lvl10 = new Random().nextInt(this.thirdlvlBard.length);
do{
rnd9lvl10 = new Random().nextInt(this.thirdlvlBard.length);
}while (rnd9lvl10 == rnd8lvl10);
do{
rnd10lvl10 = new Random().nextInt(this.thirdlvlBard.length);
}while (rnd10lvl10 == rnd8lvl10 || rnd10lvl10 == rnd9lvl10);
rnd11lvl10 = new Random().nextInt(this.fourthlvlBard.length);
do{
rnd12lvl10 = new Random().nextInt(this.fourthlvlBard.length);
}while (rnd12lvl10 == rnd11lvl10);
do{
rnd13lvl10 = new Random().nextInt(this.fourthlvlBard.length);
}while (rnd13lvl10 == rnd11lvl10 || rnd13lvl10 == rnd12lvl10);
rnd14lvl10 = new Random().nextInt(this.fifthlvlBard.length);
return new String[] {firstlvlBard[rnd1lvl10], firstlvlBard[rnd2lvl10], firstlvlBard[rnd3lvl10], firstlvlBard[rnd4lvl10], secondlvlBard[rnd5lvl10], secondlvlBard[rnd6lvl10], secondlvlBard[rnd7lvl10], thirdlvlBard[rnd8lvl10], thirdlvlBard[rnd9lvl10], thirdlvlBard[rnd10lvl10], fourthlvlBard[rnd11lvl10], fourthlvlBard[rnd12lvl10], fourthlvlBard[rnd13lvl10], fifthlvlBard[rnd14lvl10]};
case 15:
rnd1lvl15 = new Random().nextInt(this.firstlvlBard.length);
do{
rnd2lvl15 = new Random().nextInt(this.firstlvlBard.length);
}while (rnd1lvl15 == rnd2lvl15);
do{
rnd3lvl15 = new Random().nextInt(this.firstlvlBard.length);
}while (rnd3lvl15 == rnd1lvl15 || rnd3lvl15 == rnd2lvl15);
do{
rnd4lvl15 = new Random().nextInt(this.firstlvlBard.length);
}while (rnd4lvl15 == rnd1lvl15 || rnd4lvl15 == rnd2lvl15 || rnd4lvl15 == rnd3lvl15);
rnd5lvl15 = new Random().nextInt(this.secondlvlBard.length);
do{
rnd6lvl15 = new Random().nextInt(this.secondlvlBard.length);
}while (rnd6lvl15 == rnd5lvl15);
do{
rnd7lvl15 = new Random().nextInt(this.secondlvlBard.length);
}while (rnd7lvl15 == rnd5lvl15 || rnd7lvl15 == rnd6lvl15);
rnd8lvl15 = new Random().nextInt(this.thirdlvlBard.length);
do{
rnd9lvl15 = new Random().nextInt(this.thirdlvlBard.length);
}while (rnd9lvl15 == rnd8lvl15);
do{
rnd10lvl15 = new Random().nextInt(this.thirdlvlBard.length);
}while (rnd10lvl15 == rnd8lvl15 || rnd10lvl15 == rnd9lvl15);
rnd11lvl15 = new Random().nextInt(this.fourthlvlBard.length);
do{
rnd12lvl15 = new Random().nextInt(this.fourthlvlBard.length);
}while (rnd12lvl15 == rnd11lvl15);
do{
rnd13lvl15 = new Random().nextInt(this.fourthlvlBard.length);
}while (rnd13lvl15 == rnd11lvl15 || rnd13lvl15 == rnd12lvl15);
rnd14lvl15 = new Random().nextInt(this.fifthlvlBard.length);
do{
rnd15lvl15 = new Random().nextInt(this.fifthlvlBard.length);
}while (rnd15lvl15 == rnd14lvl15);
rnd16lvl15 = new Random().nextInt(this.sixthlvlBard.length);
rnd17lvl15 = new Random().nextInt(this.seventhlvlBard.length);
rnd18lvl15 = new Random().nextInt(this.eighthlvlBard.length);
rnd19lvl15 = new Random().nextInt(this.ninthlvlBard.length);
return new String[] {firstlvlBard[rnd1lvl15], firstlvlBard[rnd2lvl15], firstlvlBard[rnd3lvl15], firstlvlBard[rnd4lvl15], secondlvlBard[rnd5lvl15], secondlvlBard[rnd6lvl15], secondlvlBard[rnd7lvl15], thirdlvlBard[rnd8lvl15], thirdlvlBard[rnd9lvl15], thirdlvlBard[rnd10lvl15], fourthlvlBard[rnd11lvl15], fourthlvlBard[rnd12lvl15], fourthlvlBard[rnd13lvl15], fifthlvlBard[rnd14lvl15], fifthlvlBard[rnd15lvl15], sixthlvlBard[rnd16lvl15], seventhlvlBard[rnd17lvl15], eighthlvlBard[rnd18lvl15], ninthlvlBard[rnd19lvl15]};
}
return new String[] {"Error"};
}
}