Files
dusklight/src/dusk/randomizer/logic/dungeon.cpp
T
2026-04-08 01:18:35 -07:00

128 lines
3.7 KiB
C++

#include "dungeon.hpp"
#include "area.hpp"
#include "entrance.hpp"
#include "item.hpp"
#include "world.hpp"
#include "../utility/container.hpp"
#include "../utility/log.hpp"
namespace randomizer::logic::dungeon
{
Dungeon::Dungeon(const std::string& name, randomizer::logic::world::World* world): _name(name), _world(world) {}
std::string Dungeon::GetName() const
{
return this->_name;
}
void Dungeon::SetSmallKey(randomizer::logic::item::Item* item)
{
this->_smallKey = item;
LOG_TO_DEBUG("Set \"" + item->GetName() + "\" as small key for dungeon " + this->_name);
}
randomizer::logic::item::Item* Dungeon::GetSmallKey() const
{
return this->_smallKey;
}
void Dungeon::SetBigKey(randomizer::logic::item::Item* item)
{
this->_bigKey = item;
LOG_TO_DEBUG("Set \"" + item->GetName() + "\" as big key for dungeon " + this->_name);
}
randomizer::logic::item::Item* Dungeon::GetBigKey() const
{
return this->_bigKey;
}
void Dungeon::SetCompass(randomizer::logic::item::Item* item)
{
this->_compass = item;
LOG_TO_DEBUG("Set \"" + item->GetName() + "\" as compass for dungeon " + this->_name);
}
randomizer::logic::item::Item* Dungeon::GetCompass() const
{
return this->_compass;
}
void Dungeon::SetDungeonMap(randomizer::logic::item::Item* item)
{
this->_dungeonMap = item;
LOG_TO_DEBUG("Set \"" + item->GetName() + "\" as dungeon map for dungeon " + this->_name);
}
randomizer::logic::item::Item* Dungeon::GetDungeonMap() const
{
return this->_dungeonMap;
}
void Dungeon::SetStartingArea(randomizer::logic::area::Area* startingArea)
{
this->_startingArea = startingArea;
LOG_TO_DEBUG("Set \"" + startingArea->GetName() + "\" as starting area for dungeon " + this->_name)
}
randomizer::logic::area::Area* Dungeon::GetStartingAreas()
{
return this->_startingArea;
}
void Dungeon::AddStartingEntrance(randomizer::logic::entrance::Entrance* startingEntrance)
{
this->_startingEntrances.insert(startingEntrance);
LOG_TO_DEBUG("Added \"" + startingEntrance->GetOriginalName() + "\" as starting entrance for dungeon " + this->_name)
}
std::unordered_set<randomizer::logic::entrance::Entrance*> Dungeon::GetStartingEntrances() const
{
return this->_startingEntrances;
};
void Dungeon::AddLocation(randomizer::logic::location::Location* location)
{
if (!randomizer::utility::container::ElementInContainer(this->_locations, location))
{
this->_locations.push_back(location);
LOG_TO_DEBUG(location->GetName() + " has been assigned to dungeon " + this->_name);
}
}
randomizer::logic::location::LocationPool Dungeon::GetLocations()
{
return this->_locations;
}
void Dungeon::SetGoalLocation(randomizer::logic::location::Location* goalLocation)
{
this->_goalLocation = goalLocation;
LOG_TO_DEBUG(goalLocation->GetName() + " has been assigned as goal location to dungeon " + this->_name);
}
randomizer::logic::location::Location* Dungeon::GetGoalLocation()
{
return this->_goalLocation;
}
void Dungeon::SetRequired(const bool& required)
{
this->_required = required;
LOG_TO_DEBUG(this->_name + " has been set as required.");
}
bool Dungeon::IsRequired() const
{
return this->_required;
}
bool Dungeon::ShouldBeBarren() const
{
return !this->_required && this->_world->Setting("Unrequired Dungeons Are Barren") == "On";
}
} // namespace randomizer::logic::dungeon