-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMirror.cpp
More file actions
86 lines (74 loc) · 1.59 KB
/
Copy pathMirror.cpp
File metadata and controls
86 lines (74 loc) · 1.59 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
#include <iostream>
#include <string>
#include <map>
#include "User.h"
#include "InteractObject.h"
#include "Sword.h"
#include "Mirror.h"
using namespace std;
Mirror::Mirror(string d,string l):InteractObject(false,false,d,l,"mirror")
{
isOpen = false;
};
void Mirror::beCalled(string v, User& b)
{
if(sameLoc(b))
{
if(v == "use")
{
beUsed();
}
else if(v=="break")
{
cout<<"You smash your hand against the mirror, but it only seems to hurt your hand."<<endl;//bad practice to not make it a function, but for this, its ok, I guess.
}
else if(v == "look")
beLooked();
else
cout<<"I can't do that."<<endl;
}
else
cout<<"I don't see a mirror."<<endl;
}
void Mirror::beCalled2(string v, User& b, InteractObject* p)//if an indirect object is included
{
if(p->getName() == "sword"&&p->getInventoryState())
{
beBroken(b);
}
else
{
cout<<"I can't do that."<<endl;
}
}
void Mirror::beBroken(User& b)
{
if(!isOpen)
{
cout<<"The mirror smashes into a million shimmering pieces. A large\nopening to a ledge can now be seen where the mirror once was"<<endl;
isOpen = true;
string s = "";
b.unlock("The Ledge");
setDescription("The remnants of the mirror lie on the floor.");
}
else
{
cout<<"The mirror is already broken."<<endl;
}
}
void Mirror::beUsed()
{
cout<<"You look into the mirror and see a horrible, hideous monst... oh, that's just \nyour reflection."<<endl;
}
void Mirror::bePickedUp(User& b)
{
cout<<"I can't do that"<<endl;
}
void Mirror::beDropped(User& b)
{
cout<<"I cant do that."<<endl;
}
void Mirror::beLooked()
{
cout<<getDescription()<<endl;
}