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?
Text-Based-game/Gustes code/Enemy.h
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
28 lines (23 sloc)
540 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
#pragma once | |
#include <stdlib.h> | |
#include <string> | |
class Enemy | |
{ | |
private: | |
int level; | |
int hp; | |
int hpMax; | |
int damageMin; | |
int damageMax; | |
float dropChance; | |
int defence; | |
int accuracy; | |
public: | |
Enemy(); | |
virtual ~Enemy(); | |
inline bool isAlive() { return this->hp > 0; } | |
std::string getAsString() const; | |
inline void takeDamage(int damage) { this->hp -= damage; }; | |
inline int getGamage() const { return rand() % this->damageMax - this->damageMin; } | |
inline int getExp() const { return level * 100; } | |
}; | |