42 lines
715 B
C++
42 lines
715 B
C++
#pragma once
|
|||
|
|
|
||
|
|
#include <iostream>
|
||
|
|
#include <iomanip>
|
||
|
|
#include <math.h>
|
||
|
|
#include <string>
|
||
|
|
#include <vector>
|
||
|
|
|
||
|
|
enum DmgType {SINGLE, MULTI};
|
||
|
|
|
||
|
|
struct Stat
|
||
|
|
{
|
||
|
|
int statID;
|
||
|
|
std::string statName;
|
||
|
|
float stat;
|
||
|
|
};
|
||
|
|
|
||
|
|
class Creature
|
||
|
|
{
|
||
|
|
protected:
|
||
|
|
int id;
|
||
|
|
int level;
|
||
|
|
std::vector<Stat> stats;
|
||
|
|
std::string name;
|
||
|
|
std::string description;
|
||
|
|
|
||
|
|
public:
|
||
|
|
virtual void Init() = 0;
|
||
|
|
virtual void LevelUp() = 0;
|
||
|
|
virtual void Die() = 0;
|
||
|
|
virtual void TakeDamage(int damageType, float damage) = 0;
|
||
|
|
virtual float GetHealth() = 0;
|
||
|
|
|
||
|
|
|
||
|
|
bool IsAlive() { return GetHealth() > 0; }
|
||
|
|
|
||
|
|
void PrintDescription() { printf("%s\n", description); }
|
||
|
|
void PrintName() { printf("%s\n", name); }
|
||
|
|
|
||
|
|
virtual ~Creature() = default;
|
||
|
|
};
|