-
Notifications
You must be signed in to change notification settings - Fork 0
/
Unit.cpp
57 lines (47 loc) · 1.33 KB
/
Unit.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
#include "Unit.h"
Unit::Unit(const std::string &name, int hitPointsLimit, int atackPower)
{
state = new UnitState();
at = new UnitAtack();
state->setHitPointsLimit(hitPointsLimit);
state->setHitPoints(hitPointsLimit);
state->setAtackPower(atackPower);
state->setName(name);
state->setForm(HUMAN);
}
void Unit::makeDamage(Unit* unit)
{
at->atack(this->at, this->state, unit->at, unit->state);
}
void Unit::bite(Unit *unit)
{
at->bite(this->at, this->state, unit->at, unit->state);
}
void Unit::transformAndAtack(Unit *unit)
{
at->thansformAndAtack(this->at, this->state, unit->at, unit->state);
}
Unit::~Unit()
{
delete at;
delete state;
}
void Unit::heal(Unit *unit, HealingSpellList spell)
{
at->heal(this->at, this->state, unit->at, unit->state, spell);
}
void Unit::makeMagicDamage(Unit *unit, DamageSpellList spell)
{
at->magicAtack(this->at, this->state, unit->at, unit->state, spell);
}
void Unit::show()
{
std::cout << "Name: " << this->state->getName() << std::endl;
std::cout << "AtackPower: " << this->state->getAtackPower() << std::endl;
std::cout << "HitPointsLimit: " << this->state->getHitPointsLimit() << std::endl;
std::cout << "HitPoints: " << this->state->getHitPoints() << std::endl;
}
Unit *Unit::createDeamon()
{
return at->createDemon(this->state);
}