48 lines
813 B
C++
48 lines
813 B
C++
#pragma once
|
|
#include <string>
|
|
#include <vector>
|
|
#include "point.h"
|
|
|
|
enum class NPCState {
|
|
Friendly,
|
|
Hostile
|
|
};
|
|
|
|
enum class DialogResultType {
|
|
GiveItem,
|
|
BecomeHostile,
|
|
OpenLocation,
|
|
Fight,
|
|
Nothing
|
|
};
|
|
|
|
struct DialogOption {
|
|
std::string text;
|
|
DialogResultType result = DialogResultType::Nothing;
|
|
int value = 0;
|
|
std::string message;
|
|
};
|
|
|
|
class NPC {
|
|
public:
|
|
int id = 0;
|
|
std::string name;
|
|
|
|
NPCState state = NPCState::Friendly;
|
|
|
|
int hp = 100;
|
|
int damage = 10;
|
|
|
|
Point position;
|
|
|
|
std::string dialogText;
|
|
std::vector<DialogOption> options;
|
|
|
|
bool defeated = false;
|
|
|
|
bool loadFromFile(const std::string& path);
|
|
|
|
private:
|
|
NPCState parseState(const std::string& value);
|
|
DialogResultType parseDialogResult(const std::string& value);
|
|
}; |