-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPainting.cpp
More file actions
65 lines (55 loc) · 1.28 KB
/
Copy pathPainting.cpp
File metadata and controls
65 lines (55 loc) · 1.28 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
#include <string>
#include <iostream>
#include <string>
#include <map>
#include "User.h"
#include "InteractObject.h"
#include "Key.h"
#include "Painting.h"
using namespace std;
Painting::Painting(string d, string l, InteractObject *k):InteractObject(false,false,d,l,"painting")
{
hasKey = true;
heldKey = dynamic_cast<Key*>(k);
}
void Painting::beCalled(string v, User& b)
{
if(sameLoc(b))
{
if(v == "use"||v == "get"||v== "drop")
beUsed();
else if(v == "look")
beLooked();
else if(v == "burn")
beBurned();
else
cout<<"I can't do that."<<endl;
}
else
cout<<"I don't see a key."<<endl;
}
void Painting::beCalled2(string v, User& b, InteractObject* p)
{
cout<<"I can't do that."<<endl;
};
void Painting::beUsed()
{
cout<<"As you move the painting, a key falls from behind it onto the ground."<<endl;
heldKey->fall();
}
void Painting::bePickedUp(User& b)
{
beUsed();
}
void Painting::beDropped(User& b)
{
beUsed();
}
void Painting::beLooked()
{
cout<<getDescription()<<endl;
}
void Painting::beBurned()
{
cout<<"You monster! Why would you want to burn a painting? \"What else do you do with "<<endl<<"a painting whose eyes follow you around the room?\" You don't burn it thats for sure!"<<endl;
}