-
Notifications
You must be signed in to change notification settings - Fork 0
/
CfChapter.java
343 lines (321 loc) · 10.7 KB
/
CfChapter.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
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
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
import java.util.Scanner;
//this is the layout of the game by chapter.
//It arranges the roads and areas while checking if the
//player is still alive to reach the next area
public class CfChapter
{
public static int merch = 0, direction = 0;
public static String player;
static Scanner input = new Scanner ( System.in );
static Scanner KeyIn = new Scanner ( System.in );
public static void ch1( )
{
while ( Var.getChapter ( ) == 1 )
{
// chapter 1
// Forest
CfRoads.forest ( );
char roadFork = (char) CfRoads.roadFork ( ); // choose direction
if ( roadFork == 'W' ) // Merchant Road
{
CfRoads.merchantRoad ( );
}
else if ( roadFork == 'E' )
{
CfRoads.swampRoad1 ( ); // swamp road
if ( Var.getHp ( ) > 0 )
{
CfAreas.theLake ( ); // lake
}
if ( Var.getHp ( ) > 0 )
{
CfRoads.swampRoad2 ( );// swamp road 2
}
}
}
}
// chapter 2
public static void ch2( )
{
// direction 1 returns to player to merchant camp
// merchant camp is the central hub for chapter 2
Var.setDirection ( 1 );
while ( Var.getDirection ( ) == 1 )
{
CfAreas.merchantHub ( 5 ); // merchant
// player leaves merchant camp
switch ( Var.getDirection ( ) )
{
// East to the swamp (lake)
case 3:
CfRoads.swampRoad1 ( );
if ( Var.getHp ( ) > 0 )
{
CfAreas.theLake ( ); // the Lake
}
if ( Var.getHp ( ) > 0 )
{
CfRoads.swampRoad2 ( );
}
break;
// South the the City
case 2:
CfSetup.cityIntro ( ); // text intro to go to the city
CfRoads.cityRoad ( ); // road to Crestfall
if ( Var.getHp ( ) > 0 )
{
CfAreas.theCity ( );///// the city of Crestfall/////
}
// direction 1 takes carriage back to merchant
// direction 2 walks back to merchant
// direction 3 goes to chapter 3
if ( Var.getDirection ( ) == 2 && Var.getHp ( ) > 0 )
{
// walk back to the merchant camp
System.out
.println ( "As the gates to the city close behind you, you are filled with determination." );
System.out.println ( "Press Enter to continue" );
KeyIn.nextLine ( );
CfRoads.cityRoad ( );
}
break;
// West to the Mountain
case 4:
CfRoads.mountainRoad1 ( );
if ( Var.getHp ( ) > 0 )
{
CfAreas.mountainTop ( );// the mountain and chaos demon boss battle
}
if ( Var.getHp ( ) > 0 )
{
CfRoads.mountainRoad2 ( );
}
} // End Merchant Fork Switch
} // End Merchant Hub
}// end Chapter 2
// chapter 3. must defeat chaos demon and take carriage from city
public static void ch3( )
{
while ( Var.getChapter ( ) == 3 )
{
String nautical; // passes nautical direction to roads
// initialize direction loop, home hub is central to chapter 3
Var.setDirection ( 1 );
while ( Var.getDirection ( ) == 1 )
{
if ( Var.getHp ( ) > 0 )
{
Var.setHp ( Var.getHpMax ( ) ); // refill health
CfAreas.homeHub ( ); // home hub
}
// hp is > 1, player is dead
else
{
Var.setDirection ( -9 );
Var.setChapter ( -9 );
}
switch ( Var.getDirection ( ) )
{
// go to shimmering valley and white marsh
case 2:
int eastWest = 0;
System.out.println ( "The trees and ferns of Shimmering Valley all perpetually covered in dew\n"
+ "by the mist that rolls in from the distant marsh." );
nautical = "East";
CfRoads.sValleyRoad ( nautical ); // shimmering valley road
if ( Var.getHp ( ) > 0 )
{
CfAreas.sValley ( ); // shimmering valley area
}
if ( Var.getHp ( ) > 0 )
{
System.out.println ( "Head back home or onward to the White Marsh?" );
System.out.println ( "1 - Home\n2 - Marsh" );
do
{
eastWest = input.nextInt ( );
if ( eastWest < 1 || eastWest > 2 )
{
System.out.println ( "You must enter 1 to go Home or 2 for the Marsh" );
}
} while ( eastWest < 1 || eastWest > 2 );
}
// player heads home
if ( eastWest == 1 )
{
nautical = "West";
CfRoads.sValleyRoad ( nautical );
Var.setDirection ( 1 );
}
// player goes to white marsh
else if ( eastWest == 2 )
{
nautical = "East";
CfRoads.wMarshRoad ( nautical ); // white marsh road
if ( Var.getHp ( ) > 0 )
{
CfAreas.whiteMarsh ( ); // white marsh area and necro horde boss fight
}
// when player leaves the marsh, they only take shimmering valley road back home
if ( Var.getHp ( ) > 0 )
{
nautical = "West";
System.out.println ( "You find the trail and head back west but everything looks different.\n "
+ "After what seems like a couple of hours, you realize that you are now\n "
+ "walking amongst the split trails of the shimmering valley...\n" );
CfRoads.sValleyRoad ( nautical );
Var.setDirection ( 1 );
}
}
break;
// go to the Arid Plains and volcano
case 3:
eastWest = 0;
nautical = "North";
System.out.println ( "The Arid Plains are barren, sans short grass and a faint\n"
+ "smell of sulpher wafting from the Volcano that looms on the distant Northern horizon" );
CfRoads.aPlainsRoad ( nautical ); // arid plains road
if ( Var.getHp ( ) > 0 )
{
CfAreas.aridPlains ( ); // arid plains area
}
if ( Var.getHp ( ) > 0 )
{
System.out.println ( "Head back home or onward to the Volcano?\n" );
System.out.println ( "1 - Home\n2 - Volcano" );
do
{
eastWest = input.nextInt ( );
if ( eastWest < 1 || eastWest > 2 )
{
System.out.println ( "You must enter 1 to go Home or 2 for the Volcano" );
}
} while ( eastWest < 1 || eastWest > 2 );
}
// player heads back home
if ( eastWest == 1 )
{
nautical = "South";
CfRoads.aPlainsRoad ( nautical );
Var.setDirection ( 1 );
}
// player continues to the volcano
else if ( eastWest == 2 )
{
nautical = "North";
CfRoads.volcanoRoad ( nautical ); // volcano road
if ( Var.getHp ( ) > 0 )
{
CfAreas.volcano ( ); // volcano area and final boss fight, chaos
}
// if player defeats chaos, the player is transported to the game over scenario.
if ( Var.getChaosLife ( ) < 1 )
{
System.out.println ( "You're abruptly transported home by the rift..." );
Var.setDirection ( 9 ); // breaks home hub loop
Var.setChapter ( 9 ); // breaks chapter loop
Var.setHp ( -300 ); //breaks hp loop
}
// player either ran away or couldn't find the chaos demon and gave up because they didn't
// have the spectacles found in the tomb
else if ( Var.getHp ( ) > 0 )
{
// player must take both roads directly home
nautical = "South";
System.out.println ( "You give up and head back home..." );
CfRoads.volcanoRoad ( nautical );
if ( Var.getHp ( ) > 0 )
{
CfRoads.aPlainsRoad ( nautical );
Var.setDirection ( 1 );
}
}
}
break;
// go to frozen desert and sandstone cliffs
case 4:
eastWest = 0;
nautical = "South";
System.out.println (
"The grass gets crunchy as you reach the southern tundra and the frozen dunes rise on the horizon.\n"
+ "However, you sense no change in the air temperature..." );
CfRoads.fDesertRoad ( nautical ); // frozen desert road
if ( Var.getHp ( ) > 0 )
{
CfAreas.frozenDesert ( );// frozen desert area
}
if ( Var.getHp ( ) > 0 )
{
System.out.println ( "Head back home or onward to the Sandstone Cliffs?" );
System.out.println ( "1 - Home\n2 - Sandstone Cliffs" );
do
{
eastWest = input.nextInt ( );
if ( eastWest < 1 || eastWest > 2 )
{
System.out.println ( "You must enter 1 to go Home or 2 for the Cliffs" );
}
} while ( eastWest < 1 || eastWest > 2 );
}
// player heads back home
if ( eastWest == 1 )
{
nautical = "North";
CfRoads.fDesertRoad ( nautical );
Var.setDirection ( 1 );
}
// player continues to sandstone cliffs
else if ( eastWest == 2 )
{
nautical = "South";
CfRoads.sCliffsRoad ( nautical ); // cliffs road
if ( Var.getHp ( ) > 0 )
{
CfAreas.sandstoneCliffs ( );// sandstone cliffs area and gryphon boss fight
}
// when player leaves and gryphon is dead, they only take the frozen desert road back
if ( Var.getHp ( ) > 0 && Var.getGryphonLife ( ) < 1 )
{
nautical = "North";
System.out.println ( "You decide to open the Icy Locket and a seemingly endless amount of\n"
+ "sand pours from it like a waterfall. You find yourself back in the Frozen Desert...\n" );
CfRoads.fDesertRoad ( nautical );
Var.setDirection ( 1 );
}
// if player retreats from the sandstone cliffs before defeating the gryphon
else if ( Var.getHp ( ) > 0 )
{
System.out.println ( "You decide to retreat" );
nautical = "North";
CfRoads.sCliffsRoad ( nautical ); // back along cliffs road
CfRoads.fDesertRoad ( nautical );// back along frozen desert road
Var.setDirection ( 1 );
}
}
break;
// go to sleeping forest and ancient tomb
case 5:
eastWest = 0;
nautical = "West";
System.out.println ( "You've heard the Sleeping Forest is difficult to navigate\n"
+ "and as you enter the first stand of trees you already feel eyes upon you" );
CfRoads.sForestRoad ( nautical ); // sleeping forest road
if ( Var.getHp ( ) > 0 )
{
System.out.println (
"You come to a clearing with a gargantuan stone door and a small table with a merchant tending it." );
CfAreas.tombEntrance ( ); // outside the doors to the ancient tomb
}
// player must head back through the sleeping forest to get back home
if ( Var.getHp ( ) > 0 )
{
nautical = "East";
System.out.println ( "The only way home is back though the forest..." );
CfRoads.sForestRoad ( nautical );
Var.setDirection ( 1 );
}
}// direction choice
} // back to hub
} // chapter 3
}// end chapter 3
}// end chapter class