Добавлена система NPC, а также боевая система.

This commit is contained in:
DeLiss
2026-06-11 12:45:30 +05:00
parent 5d4940f754
commit f0a928938b
19 changed files with 427 additions and 19 deletions

View File

@@ -64,7 +64,23 @@ bool Location::loadFromFile(const std::string& path) {
if (tile == 'C') {
Chest chest;
chest.pos = { x, y };
chest.itemIds = { 101, 102 };
if (id == 1) {
chest.itemIds = { 101, 101 };
}
else if (id == 2) {
chest.itemIds = { 101, 201 };
}
else if (id == 3) {
chest.itemIds = { 102 };
}
else if (id == 4) {
chest.itemIds = { 102, 202 };
}
else if (id == 5) {
chest.itemIds = { 101, 102, 202 };
}
chests.push_back(chest);
}
else if (tile == 'E') {
@@ -76,9 +92,26 @@ bool Location::loadFromFile(const std::string& path) {
}
else if (tile == 'N') {
NPC npc;
npc.pos = { x, y };
npc.name = "Stranger";
npcs.push_back(npc);
std::string npcPath;
if (id == 1) {
npcPath = "data/npcs/npc_1.txt";
}
else if (id == 2) {
npcPath = "data/npcs/npc_2.txt";
}
else if (id == 3) {
npcPath = "data/npcs/npc_3.txt";
}
else {
npcPath = "data/npcs/npc_1.txt";
}
if (npc.loadFromFile(npcPath)) {
npc.position = { x, y };
npcs.push_back(npc);
}
}
}
}