-
Notifications
You must be signed in to change notification settings - Fork 0
/
Creature.cpp
52 lines (43 loc) · 1.05 KB
/
Creature.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
//
// Created by itaik on 28/12/2018.
//
#include "Creature.h"
void Creature::details() {
cout << "Attack level: " << attack << ", Defense level: " << defense << "\n";
}
void Creature::setCost(int newCost) {
if(newCost>=50 && newCost <=200)
cost = newCost;
else{
cout << "Could not update cost, illegal price was given.\n";
return;
}
}
void Creature::setDefense(int newDefense) {
if(newDefense<=10 && newDefense>=1)
defense = newDefense;
else{
cout << "Could not update defense, illegal parameter was given.\n";
return;
}
}
void Creature::setStrength(int newAttack) {
if(newAttack<=10 && newAttack>=1)
attack = newAttack;
else{
cout << "Could not update strengh, illegal parameter was given.\n";
return;
}
}
int Creature::getCost() {
return cost;
}
int Creature::getStrength() {
return attack;
}
int Creature::getDefense() {
return defense;
}
Creature::~Creature() {
//do nothing here
}