46 lines
2.3 KiB
C++
46 lines
2.3 KiB
C++
#ifndef CREATURELIB_LEARNABLEATTACKS_HPP
|
|
#define CREATURELIB_LEARNABLEATTACKS_HPP
|
|
|
|
#include <Arbutils/Memory/Memory.hpp>
|
|
#include <Arbutils/Random.hpp>
|
|
#include <optional>
|
|
#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> _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<const AttackData> 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<ArbUt::BorrowedPtr<const AttackData>>& 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<ArbUt::BorrowedPtr<const AttackData>>& 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<ArbUt::BorrowedPtr<const AttackData>> GetRandomAttack(ArbUt::Random& rand) const;
|
|
};
|
|
}
|
|
|
|
#endif // CREATURELIB_LEARNABLEATTACKS_HPP
|