1 /**
2  * @file
3  * @brief Spellbook contents array and management functions
4 **/
5 
6 #pragma once
7 
8 #include <vector>
9 
10 #define RANDBOOK_SIZE 8
11 #include "item-prop-enum.h"
12 #include "spl-util.h" // spschool
13 
14 using std::vector;
15 
16 #define SPELL_LIST_KEY "spell_list"
17 
18 /// Should the book's name NOT use articles? (Foo's Bar of Baz, not the Foo's)
19 #define BOOK_TITLED_KEY "is_named"
20 
21 class formatted_string;
22 
23 bool book_exists(book_type which_book);
24 #ifdef DEBUG
25 void validate_spellbooks();
26 #endif
27 bool is_player_spell(spell_type which_spell);
28 bool is_player_book_spell(spell_type which_spell);
29 bool is_wand_spell(spell_type spell);
30 
31 bool book_has_title(const item_def &book);
32 
33 bool player_can_memorise(const item_def &book);
34 bool can_learn_spell(bool silent = false);
35 bool player_has_available_spells();
36 bool learn_spell();
37 bool learn_spell(spell_type spell, bool wizard = false, bool interactive = true);
38 
39 bool library_add_spells(vector<spell_type> spells);
40 
41 string desc_cannot_memorise_reason(spell_type spell);
42 
43 spell_type spell_in_wand(wand_type wand);
44 vector<spell_type> spellbook_template(book_type book);
45 vector<spell_type> spells_in_book(const item_def &book);
46 
47 bool you_can_memorise(spell_type spell) PURE;
48 bool has_spells_to_memorise(bool silent = true);
49 vector<spell_type> get_sorted_spell_list(bool silent = false,
50                                          bool memorise_only = true);
51 spret divine_exegesis(bool fail);
52 
53 book_type choose_book_type(int item_level);
54