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");
StringBuffer * stringbuffer_new(void)
static void stringbuffer_append_spelldesc(StringBuffer *sb, const object *spell)
#define QUERY_FLAG(xyz, p)
void do_learn_spell(object *op, object *spell, int special_prayer)
int get_learn_spell(int stat)
void init_type_spellbook(void)
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)
#define MSG_TYPE_SPELL_INFO
void common_ob_describe(const object *op, const object *observer, int use_media_tags, char *buf, size_t size)
object * identify(object *op)
void stringbuffer_trim_whitespace(StringBuffer *sb)
#define object_decrease_nrof_by_one(xyz)
const readable_message_type * get_readable_message_type(object *readable)
#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)
void stringbuffer_append_string(StringBuffer *sb, const char *str)
void query_short_name(const object *op, char *buf, size_t size)
char * stringbuffer_finish(StringBuffer *sb)
int rndm(int min, int max)
StringBuffer * describe_spellpath_attenuation(const char *attenuation, int value, StringBuffer *buf)
object * find_skill_by_name(object *who, const char *name)
void register_describe(int ob_type, describe_func method)
int random_roll(int min, int max, const object *op, int goodbad)
uint8_t spell_failure_effects
void register_apply(int ob_type, apply_func method)
static void spellbook_type_describe(const object *book, const object *observer, const int use_media_tags, char *buf, const size_t size)
int die_roll(int num, int size, const object *op, int goodbad)
void LOG(LogLevel logLevel, const char *format,...)
object * check_spell_known(object *op, const char *name)
void esrv_update_item(int flags, object *pl, object *op)
static method_ret spellbook_type_apply(object *book, object *applier, int aflags)
void stringbuffer_append_printf(StringBuffer *sb, const char *format,...)
void change_exp(object *op, int64_t exp, const char *skill_name, int flag)
#define MSG_TYPE_APPLY_FAILURE
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 draw_ext_info_format(int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *format,...)
void safe_strcat(char *dest, const char *orig, size_t *curlen, size_t maxlen)
int is_identified(const object *op)