81 lines
1.9 KiB
C++
81 lines
1.9 KiB
C++
#pragma once
|
|
|
|
#include "core/Common.hpp"
|
|
#include "combat/Enemy.hpp"
|
|
#include <vector>
|
|
#include <memory>
|
|
|
|
namespace dnr {
|
|
|
|
struct DoorData {
|
|
int x;
|
|
int y;
|
|
int securityLevel; // 1 to 3: controls number of pins and skill check speed
|
|
bool unlocked;
|
|
};
|
|
|
|
struct LootData {
|
|
int x;
|
|
int y;
|
|
std::vector<AmmoType> ammoRewards;
|
|
int picksReward;
|
|
bool looted;
|
|
};
|
|
|
|
struct MapEnemy {
|
|
int x;
|
|
int y;
|
|
Enemy enemy;
|
|
bool alive = true;
|
|
};
|
|
|
|
class Dungeon {
|
|
public:
|
|
Dungeon(int width = 21, int height = 21);
|
|
|
|
void clear();
|
|
void resize(int width, int height);
|
|
|
|
int getWidth() const { return m_width; }
|
|
int getHeight() const { return m_height; }
|
|
int getFloor() const { return m_floor; }
|
|
void setFloor(int floor) { m_floor = floor; }
|
|
|
|
TileType getTile(int x, int y) const;
|
|
void setTile(int x, int y, TileType type);
|
|
|
|
bool isWalkable(int x, int y) const;
|
|
bool isDoor(int x, int y) const;
|
|
bool isDoorLocked(int x, int y) const;
|
|
|
|
DoorData* getDoorAt(int x, int y);
|
|
LootData* getLootAt(int x, int y);
|
|
MapEnemy* getEnemyAt(int x, int y);
|
|
|
|
void addDoor(int x, int y, int secLevel);
|
|
void addLoot(int x, int y, const std::vector<AmmoType>& ammo, int picks);
|
|
void addEnemy(int x, int y, EnemyType type, int level);
|
|
|
|
void removeEnemyAt(int x, int y);
|
|
void unlockDoorAt(int x, int y);
|
|
|
|
bool isExplored(int x, int y) const;
|
|
void reveal(int centerX, int centerY, int radius = 3);
|
|
|
|
const std::vector<DoorData>& getDoors() const { return m_doors; }
|
|
const std::vector<LootData>& getLoots() const { return m_loots; }
|
|
std::vector<MapEnemy>& getEnemies() { return m_enemies; }
|
|
|
|
private:
|
|
int m_width;
|
|
int m_height;
|
|
int m_floor = 1;
|
|
std::vector<TileType> m_tiles;
|
|
std::vector<bool> m_explored;
|
|
|
|
std::vector<DoorData> m_doors;
|
|
std::vector<LootData> m_loots;
|
|
std::vector<MapEnemy> m_enemies;
|
|
};
|
|
|
|
} // namespace dnr
|