Добавлена система NPC, а также боевая система.
This commit is contained in:
48
include/npc.h
Normal file
48
include/npc.h
Normal file
@@ -0,0 +1,48 @@
|
||||
#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);
|
||||
};
|
||||
Reference in New Issue
Block a user