Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
C
cptr142_group_project
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kameron Kinsey
cptr142_group_project
Commits
7dd1ec5e
Commit
7dd1ec5e
authored
Mar 02, 2018
by
Kameron Kinsey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Initialize repository
parent
69517fc0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
18 deletions
+30
-18
Kam_set_stats.cpp
Kam_set_stats.cpp
+30
-18
No files found.
Kam_set_stats.cpp
View file @
7dd1ec5e
// Random Stat Generator and Player Class
#include <cstring>
#include <cstdlib>
#include <cstdlib>
#include <iostream>
using
namespace
std
;
...
...
@@ -13,13 +13,19 @@ class Player {
health
=
100
;
string
playerName
;
public:
// Get Functions
int
getFight
()
{
return
fight
;
}
int
getFlee
()
{
return
flee
;
}
int
getTalk
()
{
return
talk
;
}
int
getHealth
()
{
return
health
;
}
string
getPlayerName
()
{
return
playerName
;
}
void
setStats
();
// Set Functions
void
setStats
(
int
);
int
setFight
(
int
Fight
)
{
fight
=
Fight
;
}
int
setFlee
(
int
Flee
)
{
flee
=
Flee
;
}
int
setTalk
(
int
Talk
)
{
talk
=
Talk
;
}
int
setPlayerName
(
string
name
)
{
playerName
=
name
;
}
};
int
main
()
{
...
...
@@ -30,47 +36,53 @@ int main() {
string
name
=
player
.
getPlayerName
();
// Enter Seed
cin
>>
seed
;
srand
(
seed
);
//cin >> seed;
// Set Stats
player
.
setStats
(
seed
);
// Enter Name
cout
<<
"Enter Player Name: "
;
cin
>>
name
;
player
.
setPlayerName
(
name
);
// Set Stats
player
.
setStats
();
int
health
=
player
.
getHealth
();
int
fight
=
player
.
getFight
();
int
flee
=
player
.
getFlee
();
int
talk
=
player
.
getTalk
();
cout
<<
name
<<
"'s stats"
<<
endl
<<
"========================"
<<
endl
<<
"Health: "
<<
player
.
getHealth
()
<<
endl
<<
"Fight: "
<<
player
.
getFight
()
<<
endl
<<
"Flee: "
<<
player
.
getFlee
()
<<
endl
<<
"Talk: "
<<
player
.
getTalk
()
<<
endl
<<
"Health: "
<<
health
<<
endl
<<
"Fight: "
<<
fight
<<
endl
<<
"Flee: "
<<
flee
<<
endl
<<
"Talk: "
<<
talk
<<
endl
<<
endl
;
// << "Armor: " << armor << endl
// << "Weapon: " << weapon << endl;
return
0
;
}
void
Player
::
setStats
()
{
void
Player
::
setStats
(
int
seed
)
{
cin
>>
seed
;
srand
(
seed
);
// Set Fight Stat and Modifier
int
fight
=
getFight
();
fight
=
rand
()
%
20
+
5
;
setFight
(
fight
);
// Set Flee Stat and Modifier
int
flee
=
getFlee
();
flee
=
rand
()
%
20
+
5
;
setFlee
(
flee
);
// Set Talk Stat and Modifier
int
talk
=
getTalk
();
talk
=
rand
()
%
20
+
5
;
setTalk
(
talk
);
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment