-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtext_adventure.cpp
66 lines (54 loc) · 1.44 KB
/
text_adventure.cpp
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
#include <iostream>
#include <math.h>
#include <stdlib.h>
#include <vector>
using namespace std;
struct charecter {
int health;
int armour;
int strength;
int inteligence;
int gold;
int difficulty;
string name;
int action;
};
void print_charecter_stats(charecter hero){
cout<<hero.name<<":"<<"\n-health : "<<hero.health<<"\n-armour : "<<hero.armour<<"\n-strength : "<<hero.strength<<"\n-inteligence : "<<hero.inteligence<<"\n-gold : "<<hero.gold<<"\n";
}
struct creature {
int health;
int armour;
int strength;
string name;
};
void print_creature_stats(charecter hero){
cout<<hero.name<<":"<<"\n-health : "<<hero.health<<"\n-armour : "<<hero.armour<<"\n-strength : "<<hero.strength<<"\n";
};
creature create_creature(int difficulty);
creature monster;
monster.health = rand() % (5*difficulty) + (5*difficulty);
monster.armour = rand() % (5*difficulty) + (5*difficulty);
monster.strength = rand() % (5*difficulty) + (5*difficulty);
return monster;
}
charecter create_charecter(){
charecter hero;
hero.health = rand() % 5 + 5;
hero.armour = 0;
hero.strength = rand() % 5 + 5;
hero.inteligence = rand() % 5 + 5;
hero.gold = 20;
hero.difficulty = 1;
cout<<"What is your name?\n";
getline(cin,hero.name);
return hero;
}
int main(){
charecter hero = create_charecter();
print_charecter_stats(hero);
creature monster = create_creature();
monster.name = "Troll";
cout<<"You come across a troll.\n";
print_creature_stats(monster);
}