-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathItem.cpp
35 lines (32 loc) · 850 Bytes
/
Item.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
#include "Item.h"
Item::Item():Object(){}
Item::Item(string name,int health,int attack,int defense):Object(name,"Item"){
this->health = health;
this->attack = attack;
this->defense = defense;
}
int Item::getHealth(){
return this->health;
}
int Item::getAttack(){
return this->attack;
}
int Item::getDefense(){
return this->defense;
}
void Item::setHealth(int health){
this->health = health;
}
void Item::setAttack(int attack){
this->attack = attack;
}
void Item::setDefense(int defense){
this->defense = defense;
}
void Item::triggerEvent(Object* player,Object* sword){
cout << "You got the sword" << endl;
Player* playerr = dynamic_cast<Player*>(player);
Item* swordd = dynamic_cast<Item*>(sword);
playerr->increaseStates(0,30,0);
playerr->addItem(*swordd);
}