nw::SpellBook
-
struct SpellBook
Abstracts a characters Spell Book
Note
Spell slots are trimmed on instantiation, when deserializing whatever is in the GFF or JSON is taken as correct.
Public Functions
-
SpellBook()
-
SpellBook(nw::MemoryResource *allocator)
-
bool from_json(const nlohmann::json &archive)
-
nlohmann::json to_json() const
-
bool add_memorized_spell(size_t level, SpellEntry entry)
Adds a memorized spell at level.
-
size_t all_known_spell_count() const noexcept
Counts all known spells.
-
size_t all_memorized_spell_count() const noexcept
Counts all memorized spells.
-
int available_slots(size_t level) const noexcept
Gets available slots.
-
void clear_memorized_spell(size_t level, Spell spell)
Clears all memorized slots matching
spell, regardless of metamagic or flags.
-
void clear_memorized_spell_slot(size_t level, int slot)
Clears all memorized slots matching
spell, regardless of metamagic or flags.
-
size_t get_known_spell_count(size_t level) const
Gets the number of known at a given level.
-
size_t get_memorized_spell_count(size_t level) const
Gets the number of memorized at a given level.
-
SpellEntry get_memorized_spell(size_t level, int slot) const
Gets a memorized spell entry.
-
int has_memorized_spell(Spell spell, MetaMagicFlag meta = metamagic_none) const
Gets the number of times spell is memorized.
-
bool knows_spell(Spell spell, int spell_level) const
Determines if spell is known, note that NPC wizards do not ‘know’ any spells.
-
int find_memorized_slot(size_t level, Spell spell, MetaMagicFlag meta = metamagic_none) const
Finds a spell slot.
-
int first_empty_slot(size_t level) const noexcept
Finds first empty slot, else -1.
-
void set_available_slots(size_t level, size_t slots)
Sets the available number of memorized slots.
-
SpellBook()