00001
00002
00003
00004
00005
00006
00007
00008 #ifndef SPL_BOOK_H
00009 #define SPL_BOOK_H
00010
00011 #include "externs.h"
00012
00013 #define SPELLBOOK_SIZE 8
00014
00015 class formatted_string;
00016
00017 enum read_book_action_type
00018 {
00019 RBOOK_USE_STAFF,
00020 RBOOK_READ_SPELL,
00021 };
00022
00023 int book_rarity(uint8_t which_book);
00024 int spell_rarity(spell_type which_spell);
00025 void init_spell_rarities();
00026
00027 bool is_valid_spell_in_book(const item_def &book, int spell);
00028 bool is_valid_spell_in_book(int splbook, int spell);
00029
00030 void mark_had_book(const item_def &book);
00031 void mark_had_book(int booktype);
00032 void inscribe_book_highlevel(item_def &book);
00033
00034 int read_book(item_def &item, read_book_action_type action);
00035
00036 bool player_can_memorise(const item_def &book);
00037 bool can_learn_spell(bool silent = false);
00038 int player_spell_skills();
00039 bool learn_spell();
00040 bool learn_spell(spell_type spell, int book = NUM_BOOKS,
00041 bool is_safest_book = true);
00042 bool forget_spell_from_book(spell_type spell, const item_def* book);
00043
00044 std::string desc_cannot_memorise_reason(bool undead);
00045 bool player_can_memorise_from_spellbook(const item_def &book);
00046
00047 spell_type which_spell_in_book(const item_def &book, int spl);
00048 spell_type which_spell_in_book(int sbook_type, int spl);
00049
00050
00051 int staff_spell(int zap_device_2);
00052 bool is_memorised(spell_type spell);
00053
00054 bool you_cannot_memorise(spell_type spell);
00055 bool you_cannot_memorise(spell_type spell, bool &undead);
00056 bool has_spells_to_memorise(bool silent = true,
00057 int current_spell = SPELL_NO_SPELL);
00058 std::vector<spell_type> get_mem_spell_list(std::vector<int> &books);
00059
00060 int spellbook_contents(item_def &book, read_book_action_type action,
00061 formatted_string *fs = NULL);
00062
00063 int count_staff_spells(const item_def &item, bool need_id);
00064
00065 bool make_book_level_randart(item_def &book, int level = -1,
00066 int num_spells = -1, std::string owner = "");
00067 bool make_book_theme_randart(item_def &book,
00068 int disc1 = 0, int disc2 = 0,
00069 int num_spells = -1, int max_levels = -1,
00070 spell_type incl_spell = SPELL_NO_SPELL,
00071 std::string owner = "");
00072 void make_book_Roxanne_special(item_def *book);
00073
00074 bool book_has_title(const item_def &book);
00075
00076 bool is_dangerous_spellbook(const item_def &book);
00077 bool is_dangerous_spellbook(const int book_type);
00078
00079 void destroy_spellbook(const item_def &book);
00080 #endif