Go to the documentation of this file.
40 const object *book,
const object *observer,
41 const int use_media_tags,
char *
buf,
const size_t size);
104 const object *book,
const object *observer,
105 const int use_media_tags,
char *
buf,
size_t size) {
123 const object *spell = book->
inv;
125 snprintf(
buf+len, size-len,
" (blank)");
157 object *skapplier, *spell, *spell_skill;
164 "You are unable to read while blind.");
170 LOG(
llevError,
"apply_spellbook: Book %s has no spell in it!\n", book->
name);
172 "The spellbook symbols make no sense.");
182 failure = -
rndm(35, 100);
218 "You already know the spell %s.\n", spell->
name);
227 "You lack the skill %s to use this spell",
232 int skill_lev_diff = spell->
level - spell_skill->
level;
233 if (skill_lev_diff > 0) {
234 if (skill_lev_diff < 2)
236 "The spell described in this book is just beyond your skill in %s.", spell->
skill);
237 else if (skill_lev_diff < 3)
239 "The spell described in this book is slightly beyond your skill in %s.", spell->
skill);
240 else if (skill_lev_diff < 5)
242 "The spell described in this book is beyond your skill in %s.", spell->
skill);
243 else if (skill_lev_diff < 8)
245 "The spell described in this book is quite a bit beyond your skill in %s.", spell->
skill);
246 else if (skill_lev_diff < 15)
248 "The spell described in this book is way beyond your skill in %s.", spell->
skill);
251 "The spell described in this book is totally beyond your skill in %s.", spell->
skill);
261 "You can't read! You will need this skill before you can comprehend the ideas written within.");
267 read_level = skapplier->
level;
275 lev_diff = spell->
level - (read_level+10);
279 "You recognise most of the words but this book is just beyond your comprehension.");
280 else if (lev_diff < 3)
282 "You recognise many of the words but this book is slightly beyond your comprehension.");
283 else if (lev_diff < 5)
285 "You recognise some of the words but this book is slightly beyond your comprehension.");
286 else if (lev_diff < 8)
288 "You recognise some of the words but this book is beyond your comprehension.");
289 else if (lev_diff < 15)
291 "You recognise a few of the words but this book is beyond your comprehension.");
294 "You recognise a few of the words but this book is totally beyond your comprehension.");
313 "The spellbook contains %s %s.", spell->
name, desc);
334 "In your confused state you flub the wording of the text!");
341 "You open the %s and start reading.", desc);
342 if (spell->
msg != NULL) {
351 "You succeed in learning the spell!");
360 "You fail to learn the spell.\n");
void LOG(LogLevel logLevel, const char *format,...)
void safe_strcat(char *dest, const char *orig, size_t *curlen, size_t maxlen)
#define QUERY_FLAG(xyz, p)
void do_learn_spell(object *op, object *spell, int special_prayer)
void stringbuffer_append_printf(StringBuffer *sb, const char *format,...)
StringBuffer * stringbuffer_new(void)
void register_apply(int ob_type, apply_func method)
void draw_ext_info_format(int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *format,...) PRINTF_ARGS(6
void play_sound_player_only(player *pl, int8_t sound_type, object *emitter, int dir, const char *action)
void scroll_failure(object *op, int failure, int power)
int rndm(int min, int max)
#define MSG_TYPE_SPELL_INFO
void common_ob_describe(const object *op, const object *observer, int use_media_tags, char *buf, size_t size)
void init_type_spellbook(void)
char * stringbuffer_finish(StringBuffer *sb)
#define object_decrease_nrof_by_one(xyz)
#define MSG_TYPE_APPLY_SUCCESS
void query_name(const object *op, char *buf, size_t size)
int64_t calc_skill_exp(const object *who, const object *op, const object *skill)
StringBuffer * describe_spellpath_attenuation(const char *attenuation, int value, StringBuffer *buf)
void query_short_name(const object *op, char *buf, size_t size)
int is_identified(const object *op)
static void stringbuffer_append_spelldesc(StringBuffer *sb, const object *spell)
void change_exp(object *op, int64_t exp, const char *skill_name, int flag)
void stringbuffer_append_string(StringBuffer *sb, const char *str)
int random_roll(int min, int max, const object *op, int goodbad)
object * find_skill_by_name(object *who, const char *name)
uint8_t spell_failure_effects
int get_learn_spell(int stat)
void stringbuffer_trim_whitespace(StringBuffer *sb)
object * check_spell_known(object *op, const char *name)
static void spellbook_type_describe(const object *book, const object *observer, const int use_media_tags, char *buf, const size_t size)
void esrv_update_item(int flags, object *pl, object *op)
static method_ret spellbook_type_apply(object *book, object *applier, int aflags)
int die_roll(int num, int size, const object *op, int goodbad)
#define MSG_TYPE_APPLY_FAILURE
const readable_message_type * get_readable_message_type(object *readable)
void draw_ext_info(int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *message)
void do_forget_spell(object *op, const char *spell)
#define MSG_TYPE_APPLY_ERROR
void register_describe(int ob_type, describe_func method)
object * identify(object *op)