Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Aaron Sturtevant
cptr142_group_project
Commits
1988d927
Commit
1988d927
authored
Mar 09, 2018
by
Kameron Kinsey
Browse files
Initialize repository
parent
733bfa63
Changes
2
Hide whitespace changes
Inline
Side-by-side
Player.cpp
0 → 100644
View file @
1988d927
/******************************************************************************
*
*
* Random Stat Generator and Player Class
* By: Kameron Kinsey
*
*
*
*
*/
#include
"Player.h"
#include
<cstring>
#include
<cstdlib>
#include
<iostream>
using
namespace
std
;
int
main
()
{
// Declare Character Details
int
seed
;
Player
player
;
string
name
=
player
.
getPlayerName
();
// Set Stats
player
.
setStats
(
seed
);
// Enter Name
cout
<<
"Enter Player Name: "
;
cin
>>
name
;
player
.
setPlayerName
(
name
);
int
health
=
player
.
getHealth
();
int
fight
=
player
.
getFight
();
int
flee
=
player
.
getFlee
();
int
talk
=
player
.
getTalk
();
cout
<<
name
<<
"'s stats"
<<
endl
<<
"========================"
<<
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
(
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
);
}
bool
Player
::
checkVictory
(
bool
win
)
{
if
(
win
==
true
)
{
cout
<<
"Congratulations "
<<
getPlayerName
()
<<
" you have retrieved the Maguffin of Vauge Desirability!"
<<
endl
;
}
}
\ No newline at end of file
Player.h
0 → 100644
View file @
1988d927
// Header File for the Player Class
#include
<cstring>
#include
<iostream>
using
namespace
std
;
class
Player
{
private:
int
fight
=
10
,
flee
=
10
,
talk
=
10
,
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
;
}
// 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
;
}
// Check Victory
bool
checkVictory
(
bool
win
);
};
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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