#ifndef CREATURELIB_LEARNABLEATTACKS_HPP #define CREATURELIB_LEARNABLEATTACKS_HPP #include #include #include #include "../Attacks/AttackData.hpp" namespace CreatureLib::Library { /// @brief Data class for holding the different attacks a creature can learn. class LearnableAttacks { private: struct impl; std::unique_ptr _impl; public: /// @brief Initialise the class using the maximum level a creature can reach. /// @param levelAttackCapacity The maximum level a creature can reach explicit LearnableAttacks(level_int_t levelAttackCapacity); virtual ~LearnableAttacks(); /// @brief Add an attack that can be learned at a certain level. /// @param level The level the attack can be learned at. /// @param attack A pointer to the attack data that can be learned/ void AddLevelAttack(level_int_t level, ArbUt::BorrowedPtr attack); /// @brief Returns whether or not a specific level has learnable attacks. /// @param level The level to check for. /// @return Whether or not a specific level has learnable attacks. bool HasAttacksForLevel(level_int_t level) const noexcept; /// @brief Returns a list of the attacks that can be learned at a specific level. /// @param level The level to get the attacks from. /// @return A list of the attacks that can be learned at a specific level. /// @warning Note that this will throw if the level has no learnable attacks. Use HasAttacksForLevel first. const ArbUt::List>& GetAttacksForLevel(level_int_t level) const; /// @brief Returns a list of distinct attacks that can be learned through levelling up. /// @return A list of distinct attacks that can be learned through levelling up. const ArbUt::List>& GetDistinctLevelAttacks() const noexcept; /// @brief Returns a random attack that can be learned. /// @param rand A random number generator. /// @return A random attack that can be learned. virtual std::optional> GetRandomAttack(ArbUt::Random& rand) const; }; } #endif // CREATURELIB_LEARNABLEATTACKS_HPP