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
Aaron Sturtevant
cptr142_group_project
Commits
86e1f43f
Commit
86e1f43f
authored
Mar 19, 2018
by
Aaron Sturtevant
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
commiting
parent
23b3e678
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
14 deletions
+33
-14
Dungeon.cpp
Dungeon.cpp
+22
-6
Dungeon.h
Dungeon.h
+6
-2
main.cpp
main.cpp
+5
-6
No files found.
Dungeon.cpp
View file @
86e1f43f
#include <iomanip>
#include <iostream>
#include <string>
#include "Player.h"
#include "Boss.h"
#include "Inventory.h"
#include "Monster.h"
using
namespace
std
;
int
Dungeon
::
rollRoom
()
{
...
...
@@ -12,14 +16,26 @@ using namespace std;
Monster
.
summon
(
encounterNum
);
}
void
Dungeon
::
monsterResponse
(
int
encounterNum
,
string
response
)
{
Monster
.
monsterResponse
(
encounterNum
,
response
);
void
Dungeon
::
monsterResponse
(
int
encounterNum
,
bool
playerWon
)
{
Monster
.
monsterResponse
(
encounterNum
,
playerWon
);
}
void
Dungeon
::
getBoss
(
int
floorNum
)
{
Monster
.
summonBoss
(
floorNum
);
Boss
.
summonBoss
(
floorNum
);
}
void
Dungeon
::
bossResponse
(
int
floorNum
,
string
response
)
{
Monster
.
bossResponse
(
floorNum
,
respose
);
void
Dungeon
::
bossResponse
(
int
floorNum
,
bool
playerWon
)
{
Boss
.
bossResponse
(
floorNum
,
response
);
}
void
giveItems
(
int
floorNum
,
Inventory
inventory
)
{
Boss
.
giveItems
(
floorNum
,
inventory
);
}
void
giveBossItems
(
int
encounterNum
,
Inventory
inventory
)
{
Boss
.
giveItems
(
floorNum
,
inventory
);
}
void
giveMonsterItems
(
int
encounterNum
,
Inventory
inventory
)
{
Boss
.
giveItems
(
encounterNum
,
inventory
);
}
Dungeon.h
View file @
86e1f43f
...
...
@@ -2,6 +2,10 @@
#include <iomanip>
#include <iostream>
#include <stdlib.h>
#include "Player.h"
#include "Boss.h"
#include "Inventory.h"
#include "Monster.h"
using
namespace
std
;
class
Dungeon
{
...
...
@@ -16,7 +20,7 @@ class Dungeon {
void
monsterResponse
(
int
encounterNum
,
string
response
);
void
getBoss
(
int
floorNum
);
void
bossResponse
(
int
floorNum
,
string
response
);
void
giveBossItems
(
int
floorNum
,
Inventory
inventory
);
void
giveMonsterItems
(
int
encounterNum
,
Inventory
inventory
);
};
main.cpp
View file @
86e1f43f
...
...
@@ -50,11 +50,11 @@ int main() {
cout
<<
"How do you respond? (Fight, Talk, Or Flee): "
;
cin
>>
response
;
if
((
response
==
'
Fight
'
)
||
(
response
==
'
Talk
'
)
{
if
(
dungeon
.
compareStats
(
playerPtr
,
dungeon
.
floorNum
))
{
if
(
dungeon
.
compareStats
(
playerPtr
,
dungeon
.
floorNum
,
response
))
{
dungeonPtr
.
bossResponse
(
dungeonPtr
.
floorNum
,
playerWon
);
playerWon
=
true
;
dungeonPtr
.
floorNum
++
;
monsterPtr
.
giveItems
(
dungeonPtr
.
floorNum
,
inventoryPtr
);
monsterPtr
.
give
Boss
Items
(
dungeonPtr
.
floorNum
,
inventoryPtr
);
}
else
{
dungeonPtr
.
bossResponse
(
dungeonPtr
.
floorNum
,
playerWon
);
}
...
...
@@ -77,10 +77,10 @@ int main() {
cout
<<
"How do you respond? (Fight, Talk, Or Flee): "
;
cin
>>
response
;
if
((
response
==
'
Fight
'
)
||
(
response
==
'
Talk
'
)
{
if
(
dungeon
.
compareStats
(
playerPtr
,
monsterPtr
,
dungeon
.
roomEncounter
))
{
if
(
dungeon
.
compareStats
(
playerPtr
,
monsterPtr
,
dungeon
.
roomEncounter
,
response
))
{
dungeonPtr
.
monsterResponse
(
dungeonPtr
.
encounterNum
,
playerWon
);
playerWon
=
true
;
monsterPtr
.
giveItems
(
dungeonPtr
.
encounterNum
,
inventoryPtr
);
monsterPtr
.
give
Monster
Items
(
dungeonPtr
.
encounterNum
,
inventoryPtr
);
}
else
{
dungeonPtr
.
bossResponse
(
dungeonPtr
.
encounterNum
,
playerWon
);
}
...
...
@@ -110,12 +110,11 @@ int main() {
cout
<<
"How do you respond? (Fight, Talk, Or Flee): "
;
cin
>>
response
;
if
((
response
==
'
Fight
'
)
||
(
response
==
'
Talk
'
)
{
if
(
dungeon
.
compareStats
(
playerPtr
,
dungeon
.
floorNum
))
{
if
(
dungeon
.
compareStats
(
playerPtr
,
dungeon
.
floorNum
,
response
))
{
dungeonPtr
.
bossResponse
(
dungeonPtr
.
floorNum
,
playerWon
);
playerWon
=
true
;
playerVictory
=
true
;
dungeonPtr
.
floorNum
++
;
monsterPtr
.
giveItems
(
dungeonPtr
.
floorNum
,
inventoryPtr
);
}
else
{
dungeonPtr
.
bossResponse
(
dungeonPtr
.
floorNum
,
playerWon
);
}
...
...
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