-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWolf.cpp
More file actions
51 lines (43 loc) · 993 Bytes
/
Wolf.cpp
File metadata and controls
51 lines (43 loc) · 993 Bytes
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
#include "Wolf.h"
#include "Field.h"
Wolf::Wolf() {
this->strength = 9;
this->initiative = 5;
this->age = 0;
}
Wolf::Wolf(World* world, coords xy) {
this->strength = 9;
this->initiative = 5;
this->age = 0;
this->world = world;
this->xy = xy;
}
Wolf::Wolf(World* world, coords xy, int strength, int age) {
this->strength = strength;
this->initiative = 5;
this->age = age;
this->world = world;
this->xy = xy;
}
void Wolf::birth(int x1, int y1) {
if (dynamic_cast<Field*>(this->world->board[this->xy.x + x1][this->xy.y + y1])) {
string comment = "";
comment += "New birth: ";
comment += this->getName();
comment += "(";
comment += to_string(this->xy.x + x1 + 1);
comment += ",";
comment += to_string(this->xy.y + y1 + 1);
comment += ")";
this->world->log(comment);
this->world->addOrganism(new Wolf(this->world, { this->xy.x + x1, this->xy.y + y1 }));
}
}
void Wolf::print() {
cout << 'W';
}
string Wolf::getName() {
return "Wolf";
}
Wolf::~Wolf() {
}