Files
Text-Adventure/Engine/headers/creature.h
T

52 lines
917 B
C++
Raw Normal View History

2026-08-07 13:10:07 -05:00
#pragma once
#include <iomanip>
2026-08-20 08:10:07 -05:00
#include <iostream>
2026-08-07 13:10:07 -05:00
#include <math.h>
#include <string>
#include <vector>
2026-08-20 08:10:07 -05:00
enum DmgType { SINGLE, MULTI };
2026-08-07 13:10:07 -05:00
2026-08-20 08:10:07 -05:00
struct Stat {
int statID;
float stat;
2026-08-07 13:10:07 -05:00
};
2026-08-20 08:10:07 -05:00
struct Stats {
float hp;
float speed;
float magic;
float defense;
};
2026-08-07 13:10:07 -05:00
2026-08-20 08:10:07 -05:00
struct RoomInfo {
int roomID;
int x, y;
};
2026-08-07 13:10:07 -05:00
2026-08-20 08:10:07 -05:00
class Creature {
protected:
int id = -1;
int level = 0;
Stats stats = {};
// std::map<std::string, Stat> stats;
std::string name;
std::string description;
2026-08-07 13:10:07 -05:00
2026-08-20 08:10:07 -05:00
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.c_str()); }
void PrintName() { printf("%s\n", name.c_str()); }
virtual ~Creature() = default;
2026-08-07 13:10:07 -05:00
};