-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvampire.cpp
66 lines (55 loc) · 1.54 KB
/
vampire.cpp
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
#include "vampire.h"
#include <iostream>
#include <cstdlib>
namespace da_game {
Vampire::Vampire(Environment * current_room, int hp, int strength) {
std::cout << "SHREE! a new vampire is born!" << std::endl;
this->hp = hp;
this->strength = strength;
// TODO: Perhaps we should move this up the inheretance tree?
// might fit better in actor or something
this->current_room = current_room;
}
void Vampire::eat(Actor & actor) {
actor.fight(*this);
}
void Vampire::eat(Food &) {
std::cout << "Bläh" << std::endl;
}
void Vampire::run() {
std::vector<std::string> exit_names = current_room->get_exit_names();
switch (std::rand()%3) {
case 1:
go(exit_names[std::rand()%exit_names.size()]);
break;
default:
break;
}
}
std::string Vampire::get_type() const {
return "Vampire";
}
std::string Vampire::get_name() const {
return "Drakula";
}
/*
* I have no idea how we should implement this
*/
void Vampire::fight(Actor &) {
return;
}
bool Vampire::pick_up(Object *) {
std::cout << "IIIHH" << std::endl;
return false;
}
bool Vampire::drop(Object *) {
std::cout << "IHHHHIIII" << std::endl;
return false;
}
void Vampire::talk_to(Actor &) {
std::cout << "SHREEK!" << std::endl;
}
std::string Vampire::serialize() const {
return "";
}
}