-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathReadme
More file actions
179 lines (123 loc) · 8.46 KB
/
Readme
File metadata and controls
179 lines (123 loc) · 8.46 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
//////////////////////////////////////////////////////////////////////////////
// //
// Object-oriented Programming //
// Academic year: 2020 - 2021 //
// //
/////////////////////////////////////////////////////////////////////////////
Team members:
Ιωάννα Οικονόμου sdi1900137
Δημήτρης Ράμμος sdi1900161
Compilation and running command:
In the directory "program" where the MakeFile is located run the following command
-make run
or
g++ -Wall -no-pie -fPIE -g -I../include -c -o ../modules/Living_Being.o ../modules/Living_Being.cpp
g++ Role_Playing_Game.o ../modules/Living_Being.o ../modules/Grid.o ../modules/Spell.o ../modules/Item.o -o Role_Playing_Game
./Role_Playing_Game
In the files of the project there is a Makefile included.
According to our implementation of the game, the heroes (3 at most) move thoughout the grid as a team and not independently.
The monsters that have died in a war, revive after the end of the war to be ready for the next war.
The heroes always fight against monsters of the same level.
///////////////////////////////////////////////////////////////////
In the header file "information.h" you can find a number of constant variables that remain unchanged throughout the game.
Also, the input is taken from 8 txt files, examples of which you can find in the folder "files".
These files are opened from the main function of the program.
///////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////
// //
// FILES //
// //
////////////////////////////////////////////////////////////////////
The file formats are explained thoroughly below:
-armors.txt:
name_of_armor price requires_level reduse_of_damage
-firespells.txt:
name_of_firespell price level low_damage high_damage energy reduce_of_defense rounds
-heroes.txt:
name_of_hero strength dexterity agility
-icespells.txt:
name_of_icespell price level low_damage high_damage energy new_low_damage rounds
-lightingspells.txt:
name_of_lightingspell price level low_damage high_damage energy defense_probability_reduce rounds
-monsters.txt:
name_of_monster low_damage high_damage defense probability_of_escaping
-potions.txt:
name_of_potion price level characteristic increase
-weapons.txt:
name_of_weapon price level required_number_of_hands damage
///////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////
// //
// Role_Playing_Game //
// //
////////////////////////////////////////////////////////////////////
About Role_Playing_Game.cpp:
This file includes the main of the program. It takes the input from the files includes in the folder named "files", creates vectors and then it passes these
vectors to the grid. The player must choose 1-3 heroes(Warrior, Paladin and/or Sorcerer). The player can change their heroes after they start the game from a Market square.
Then, the monsters are randomly placed on the grid(from files monsters.txt).
Then, the game starts and the program continues to run from the function "StartGame"(in Grid.cpp).
If the player gives "quitGame" as input ,then the Game is over.
///////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////
// //
// LIVING BEING //
// //
////////////////////////////////////////////////////////////////////
About Living_Being.cpp and Living_Being.h:
The file Living_Being.h includes the definitions of monster and hero.
There is one SuperClass, the Living_Being, with constructor Living Being(name , level).
Tha Subclasses Hero and Monster are Classes that inherit from Basic Class Living_Being. The Subclasses Warrior, Sorcerer and Paladin(properties of Hero)
are Classes that inherit from Class Hero. The Subclasses Dragon, Exoskeleton and Spirit(properties of monster) are Classes that inherit from class Monster.
About level_up and constructor:
Every monster or hero that is created or that moves to the next level, has some favored characteristics (better that the rest of the characteristics).
For the Hero to level up, it must have specific experience, which increases by participating in wars(Monster vs Heroes). The monsters move to the next level when all of the heroes
are on the higher level, and the heroes enter a common square.
About Hero:
Every hero has a vector with weapons, armors and potions that he has bought. Every hero has one Weapon and Armor that he uses at a certain time.
////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////
// //
// GRID //
// //
////////////////////////////////////////////////////////////////////
About Grid.cpp and Grid.h:
The Class Grid represents the grid of the game with deminsions x and y, that the player chooses. The grid has squares every one of which is one Square(class Square).
the Square can be Common, Market or nonAccessible which are Subclasses that inherit from SuperClass Square.
About StartGame:
The game starts. The heroes are placed in a Market square to buy Items and Spells. For every hero the player must buy at least one weapon for the war otherwise he loses the game.
Then, the hero moves from this square and Move function is called which prints the grid and asks the player where he wants to move.
If the square is a Market, if he wants, he can buy or sell items and Spells. If the square is Common a war probably starts(may or may not happen).
The game ends when all the heroes have LEVEL_MAX(from information.h) or the player decides to quit the game.
If player gives "quitGame" for input , then the Game is Over.
About buy_sell_and_equip:
When the player buys or sells an item, he can change the item he is holding.
About displayMap:
Prints the grid with UTF-8 characters.
H - is for Hero
M - is for Monster
B - is for both Hero and monster
S - is for Market
X - is for nonAccessible
H S - is for heroes in a Market
////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////
// //
// ITEM //
// //
////////////////////////////////////////////////////////////////////
About Item.cpp and Item.h:
Every item is defined by its name, price and required level to be used. There are three subcategories of an item
(Weapon, Armor and Potion). Each of the categories has different properties. In our implementation there is a main class (Item)
and three subclasses (the subcategories).
////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////
// //
// SPELL //
// //
////////////////////////////////////////////////////////////////////
About Spell.cpp and Spell.h:
Every spell is defined by its name, price, required level, energy that it needs to spend and a range of damage,
which is defined by an lower and an upper bound of damage. There are three subcategories of a spell
(IceSpell, FireSpell and LightingSpell). Each of the categories has different properties. In our implementation there is a main class (Spell)
and three subclasses (the subcategories).
////////////////////////////////////////////////////////////////////