-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.txt
386 lines (300 loc) · 10.2 KB
/
README.txt
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
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
## Files
---------------------------------------------------------------------------
<A brief description of each file and what it does>
- OOD:
[Use Factory Pattern]
Weapon --implements--> Item
Armor --implements--> Item
Spell --implements--> Item
Potion --implements--> Item
CharacterCatalog --implements--> Catalog
ItemCatalog --implements--> Catalog
Hero --implements--> Character
Monster --implements--> Character
IceSpell --extends--> Spell
FireSpell --extends--> Spell
LightningSpell --extends--> Spell
Warrior --extends--> Hero
Paladin --extends--> Hero
Sorcerer --extends--> Hero
Dragon --extends--> Monster
Exoskeleton --extends--> Monster
Spirit --extends--> Monster
- File list:
data // a directory file contains all kinds of info used in the game(provided by prof)
Armor.java //class for armor.
Battle.java //class for battle, create a Battle object in every battle.
Catalog.java //[Interface].
Character.java //[Interface].
CharacterCatalog.java //Implements of Catalog, is a catalog of all heroes and monsters in this game.
GameController.java //Main logic of this game.
GameInfo.java //class for game information
Hero.java //Implements of Character, a class for hero info(extended by class 'Warrior', class 'Paladin' and class 'Sorcerer').
Inventory.java //class for hero's inventory
Item.java //[Interface].
ItemCatalog.java //Implements of Catalog, is a catalog of all items (including weapons, armors, potions and so on) in this game.
Main.java //Just a gate of this program.
Market.java //Class for market.
Monster.java //Implements of Character, a class for monster info(extended by class 'Dragon', class 'Exoskeleton' and class 'Spirit').
PartyOfHeroes.java //Class for player's party of heroes.
Potion.java //Implements of Item, a class for potion.
Spell.java //Implements of Character, a class for spell (extended by class 'IceSpell', class 'FireSpell' and class'LightningSpell').
Weapon.java //Implements of Item, a class for weapon.
WorldMap.java //Class for the map of this game.
## Notes
---------------------------------------------------------------------------
<Bonus Done>
- Use factory pattern as design pattern (Very neat and professional structure)
- Achieve all example rules in the document(including rules of different price of selling and buying same stuff, hero level up,
attack dodge and so on.)
- Reading data files to get all info of items, heroes and monsters, which allows to modify the game very easily.
- Allow player to quit the game when not in a battle.
- When comes to a battle, player can see battle info at any time; At the end of each round,
player can see whether heroes or monsters are alive or not.
- Player can equip armor or weapon for heroes during a battle.
- Inaccessible space detect
- Show latest game info after player quit the game.
<Notes to grader>
## How to compile and run
---------------------------------------------------------------------------
1. Navigate to the directory "hw3" after unzipping the files
2. Run the following instructions:
javac -d bin src/*.java
java -cp bin Main
## Input/Output Example
---------------------------------------------------------------------------
<Place here an example of how the program runs. Include both its
outputs and correctly formatted inputs. Please clearly mark the inputs.>
Output:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
{ LEGENDS:MONSTERS AND HEROES }
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
________________________
[Instructions]
|W/w: move up
|A/a: move left
|S/s: move down
|D/d: move right
|Q/q: quit game
|I/i: show information
|M/m: enter market
________________________
[Warriors]
Name /Level /Exp /HP /MP /Strength /Dexterity /Agility /Gold
Sehanine_Monnbow 0 800 8 600 700 500 800 2500
Flandal_Steelskin 0 700 7 200 750 700 650 2500
Eunoia_Cyn 0 600 6 400 700 600 800 2500
Gaerdal_Ironhand 0 700 7 100 700 600 500 1354
Muamman_Duathall 0 600 6 300 900 750 500 2546
Undefeated_Yoj 0 700 7 400 800 700 400 2500
[Paladins]
Name /Level /Exp /HP /MP /Strength /Dexterity /Agility /Gold
Sehanine_Moonbow 0 700 7 300 750 700 700 2500
Garl_Glittergold 0 500 5 100 600 400 500 2500
Skoraeus_Stonebones 0 400 4 250 650 350 600 2500
Caliber_Heist 0 800 8 400 400 400 400 2500
Parzival 0 700 7 300 750 700 650 2500
Amaryllis_Astra 0 500 5 500 500 500 500 2500
[Sorcerers]
Name /Level /Exp /HP /MP /Strength /Dexterity /Agility /Gold
Kalabar 0 600 6 800 850 600 400 2500
Skye_Soar 0 500 5 1000 700 500 400 2500
Rillifane_Rallathil 0 900 9 1300 750 500 450 2500
Segojan_Earthcaller 0 500 5 900 800 650 500 2500
Reign_Havoc 0 800 8 800 800 800 800 2500
Reverie_Ashels 0 700 7 900 800 400 700 2500
How many heroes do you want to choose?(1~3)
Input: 2
Output:
What is you pick?(Enter complete name of a hero)
Input: Kalarbar
Output:
Kalabar has joined in you party!
What is you pick?(Enter complete name of a hero)
Input: Parzival
Output:
Parzival has joined in you party!
# # # # # # # #
# P $ #
# $ $ # # # #
# # # $ #
# # # # #
# # # #
# $ #
# # # # # # # #
Enter command:
Input: w
Output:
Not accessible space!
# # # # # # # #
# P $ #
# $ $ # # # #
# # # $ #
# # # # #
# # # #
# $ #
# # # # # # # #
Enter command:
Input: s
Output:
# # # # # # # #
# $ #
# P $ # # # #
# # # $ #
# # # # #
# # # #
# $ #
# # # # # # # #
Enter command:
Input: m
Output:
Welcome to mystery market.
___________________________
[Weapon]
0. Weapon{name='Bow', cost=300, requiredLevel=2, damage=500, requiredHands=2}
[Armor]
0. Armor{name='Breastplate', cost=350, requiredLevel=3, damageReduction=600}
[Potion]
0. Potion{name='Healing_Potion', cost=250, requiredLevel=1, attriIncrease=100, attrAffect='Health', availNum=1}
[IceSpell]
0. Spell{name='Frost_Blizzard', cost=750, requiredLevel=5, damage=850, manaCost=350, availNum=1}
[FireSpell]
0. Spell{name='Heat_Wave', cost=450, requiredLevel=2, damage=600, manaCost=150, availNum=1}
[LightningSpell]
0. Spell{name='Electric_Arrows', cost=550, requiredLevel=5, damage=650, manaCost=200, availNum=1}
Enter [B/b] to buy, [S/s] to sell or [Q/q] to quit:
Input: b
Output:
Who(Hero) wants to buy stuff?(Enter complete name):
.
.
.
Enter [B/b] to buy, [S/s] to sell or [Q/q] to quit:
Input: s
Output:
Who(Hero) wants to sell stuff?(Enter complete name)
Kalabar
Inventory
___________________________
[Weapon]
0. Weapon{name='Bow', cost=300, requiredLevel=2, damage=500, requiredHands=2}
[Armor]
[Potion]
[IceSpell]
[FireSpell]
[LightningSpell]
What type of goods do you want to sell?(Enter complete type name)(Enter [Q/q] to quit)
Input: weapon
.
.
.
Output:
Enter [B/b] to buy, [S/s] to sell or [Q/q] to quit:
Input: q
Output:
# # # # # # # #
# $ #
# P $ # # # #
# # # $ #
# # # # #
# # # #
# $ #
# # # # # # # #
Enter command:
Input: i
Output:
[Info Begin] Your party of heroes:
Name /Level /Exp /HP /MP /Strength /Dexterity /Agility /Gold
Kalabar 6 0 600 800 850 600 400 2200
Parzival 7 0 700 300 750 700 650 2500
[Info End]
# # # # # # # #
# $ #
# P $ # # # #
# # # $ #
# # # # #
# # # #
# $ #
# # # # # # # #
Enter command:
Input: d
Output:
>>>>>>>>>>>Battle Starts!
[Monster]
0. name='Rakkshasass', level=7, HP=700, damage=550, defense=600, dodge=35}
1. name='Chronepsish', level=7, HP=700, damage=650, defense=750, dodge=60}
V.S
[Heroes]
[Info Begin] Your party of heroes:
Name /Level /Exp /HP /MP /Strength /Dexterity /Agility /Gold
Kalabar 6 0 600 800 850 600 400 2200
Parzival 7 0 700 300 750 700 650 2500
[Info End]
[Heroes' turn]
Kalabar is ready.
Enter [A/a] for basic attack, [I/i] for battle info, [K/k] for using stuff in inventory:
Input: a
Output:
Choose a target(Enter sequence number of a monster):0
Parzival is ready.
Enter [A/a] for basic attack, [I/i] for battle info, [K/k] for using stuff in inventory:
Input: a
Output:
Choose a target(Enter sequence number of a monster):
Input: 0
Output:
Rakkshasass successfully dodge the attack!
---
Kalabar[Died]
Parzival[Alive]
Rakkshasass[Died]
Chronepsish[Alive]
---
.
.
.
Output:
---
Kalabar[Died]
Parzival[Alive]
Rakkshasass[Died]
Chronepsish[Died]
---
<<<<<<<<<<<<<<<<<Battle Ends
Heroes win the battle!!!
# # # # # # # #
# $ #
# $ P $ # # # #
# # # $ #
# # # # #
# # # #
# $ #
# # # # # # # #
Enter command:
Input: i
Output:[Exp++ & Gold++]
[Info Begin] Your party of heroes:
Name /Level /Exp /HP /MP /Strength /Dexterity /Agility /Gold
Kalabar 6 4 600 800 850 600 400 2900
Parzival 7 4 700 300 750 700 650 3200
[Info End]
# # # # # # # #
# $ #
# $ P $ # # # #
# # # $ #
# # # # #
# # # #
# $ #
# # # # # # # #
Enter command:
.
.
.
Input: q
You quit the game! Here are the latest game info:
[Info Begin] Your party of heroes:
Name /Level /Exp /HP /MP /Strength /Dexterity /Agility /Gold
Kalabar 6 4 600 800 850 600 400 2900
Parzival 7 4 700 300 750 700 650 3200
[Info End]
leon@LeondeMacBook-Air hw3 %