Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Adventure_game/monster.h
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
65 lines (51 sloc)
999 Bytes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef MONSTER_H | |
#define MONSTER_H | |
#include "functions.h" | |
#include <iostream> | |
#include <string> | |
#include "Windows.h" // Library for sleep timer | |
#include <iomanip> // Library for setw | |
using namespace std; | |
class Monster{ | |
protected: | |
int hp, hitpow; | |
public: | |
Monster(int HP, int ATK){ | |
hp = HP; | |
hitpow = ATK; | |
} | |
void sethp(int HP){ | |
hp = HP; | |
} | |
int gethp(){ | |
return hp; | |
} | |
void sethitpow(int ATK){ | |
hitpow = ATK; | |
} | |
int gethitpow(){ | |
return hitpow; | |
} | |
//monster got hit | |
void attack(int att){ | |
att = att - hitpow; | |
hit = att; | |
} | |
}; | |
class Monster_A: public Monster{ | |
protected: | |
int armour; | |
public: | |
Monster_A(int HP, int ATK, int DEF): Monster(hp, hitpow){ | |
hp = HP; | |
hitpow = ATK; | |
armour = DEF; | |
} | |
void setdef(int def){ | |
armour = def; | |
} | |
int getdef(){ | |
return armour; | |
} | |
}; | |
#endif |