40 const ob_methods *context,
const object *book,
const object *observer,
41 const int use_media_tags,
char *buf,
const size_t size);
53 "zero",
"ten",
"twenty",
"thirty",
"fourty",
"fifty",
"sixty",
"seventy",
59 "zeroth",
"first",
"second",
"third",
"fourth",
"fifth",
"sixth",
"seventh",
60 "eighth",
"ninth",
"tenth",
"eleventh",
"twelfth",
"thirteenth",
61 "fourteenth",
"fifteenth",
"sixteenth",
"seventeenth",
"eighteenth",
62 "nineteenth",
"twentieth" 67 "zeroth",
"tenth",
"twentieth",
"thirtieth",
"fortieth",
"fiftieth",
"sixtieth",
68 "seventieth",
"eightieth",
"ninetieth" 83 if (n > 99 || n < 0) {
87 }
else if (n % 10 == 0) {
151 const ob_methods *context,
const object *book,
const object *observer,
152 const int use_media_tags,
char *buf,
size_t size) {
170 const object *spell = book->
inv;
172 snprintf(buf+len, size-len,
" (blank)");
206 object *skapplier, *spell, *spell_skill;
213 "You are unable to read while blind.");
219 LOG(
llevError,
"apply_spellbook: Book %s has no spell in it!\n", book->
name);
221 "The spellbook symbols make no sense.");
231 failure = -
rndm(35, 100);
267 "You already know the spell %s.\n", spell->
name);
276 "You lack the skill %s to use this spell",
281 int skill_lev_diff = spell->
level - spell_skill->
level;
282 if (skill_lev_diff > 0) {
283 if (skill_lev_diff < 2)
285 "The spell described in this book is just beyond your skill in %s.", spell->
skill);
286 else if (skill_lev_diff < 3)
288 "The spell described in this book is slightly beyond your skill in %s.", spell->
skill);
289 else if (skill_lev_diff < 5)
291 "The spell described in this book is beyond your skill in %s.", spell->
skill);
292 else if (skill_lev_diff < 8)
294 "The spell described in this book is quite a bit beyond your skill in %s.", spell->
skill);
295 else if (skill_lev_diff < 15)
297 "The spell described in this book is way beyond your skill in %s.", spell->
skill);
300 "The spell described in this book is totally beyond your skill in %s.", spell->
skill);
310 "You can't read! You will need this skill before you can comprehend the ideas written within.");
316 read_level = skapplier->
level;
324 lev_diff = spell->
level - (read_level+10);
328 "You recognise most of the words but this book is just beyond your comprehension.");
329 else if (lev_diff < 3)
331 "You recognise many of the words but this book is slightly beyond your comprehension.");
332 else if (lev_diff < 5)
334 "You recognise some of the words but this book is slightly beyond your comprehension.");
335 else if (lev_diff < 8)
337 "You recognise some of the words but this book is beyond your comprehension.");
338 else if (lev_diff < 15)
340 "You recognise a few of the words but this book is beyond your comprehension.");
343 "You recognise a few of the words but this book is totally beyond your comprehension.");
362 "The spellbook contains %s %s.", spell->
name, desc);
383 "In your confused state you flub the wording of the text!");
390 "You open the %s and start reading.", desc);
391 if (spell->
msg != NULL) {
400 "You succeed in learning the spell!");
409 "You fail to learn the spell.\n");
void draw_ext_info_format(int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *format,...)
int64_t calc_skill_exp(const object *who, const object *op, const object *skill)
object * check_spell_known(object *op, const char *name)
void do_forget_spell(object *op, const char *spell)
#define MSG_TYPE_APPLY_FAILURE
void register_describe(int ob_type, describe_func method)
void stringbuffer_trim_whitespace(StringBuffer *sb)
static method_ret spellbook_type_apply(ob_methods *context, object *book, object *applier, int aflags)
StringBuffer * stringbuffer_new(void)
void esrv_update_item(int flags, object *pl, object *op)
#define MSG_TYPE_SPELL_INFO
void draw_ext_info(int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *message)
static const char *const ordinals_10[]
int rndm(int min, int max)
int is_identified(const object *op)
void stringbuffer_append_string(StringBuffer *sb, const char *str)
#define MSG_TYPE_APPLY_ERROR
int die_roll(int num, int size, const object *op, int goodbad)
static const char *const ordinals[]
void do_learn_spell(object *op, object *spell, int special_prayer)
void register_apply(int ob_type, apply_func method)
#define QUERY_FLAG(xyz, p)
static void spellbook_type_describe(const ob_methods *context, const object *book, const object *observer, const int use_media_tags, char *buf, const size_t size)
void change_exp(object *op, int64_t exp, const char *skill_name, int flag)
void common_ob_describe(const ob_methods *context, const object *op, const object *observer, int use_media_tags, char *buf, size_t size)
void safe_strcat(char *dest, const char *orig, size_t *curlen, size_t maxlen)
#define object_decrease_nrof_by_one(xyz)
void play_sound_player_only(player *pl, int8_t sound_type, object *emitter, int dir, const char *action)
void query_short_name(const object *op, char *buf, size_t size)
void scroll_failure(object *op, int failure, int power)
#define MSG_TYPE_APPLY_SUCCESS
object * identify(object *op)
void stringbuffer_append_printf(StringBuffer *sb, const char *format,...)
StringBuffer * describe_spellpath_attenuation(const char *attenuation, int value, StringBuffer *buf)
void stringbuffer_append_ordinal(StringBuffer *sb, const int n)
const readable_message_type * get_readable_message_type(object *readable)
void LOG(LogLevel logLevel, const char *format,...)
int get_learn_spell(int stat)
void query_name(const object *op, char *buf, size_t size)
int random_roll(int min, int max, const object *op, int goodbad)
static void stringbuffer_append_spelldesc(StringBuffer *sb, const object *spell)
uint8_t spell_failure_effects
object * find_skill_by_name(object *who, const char *name)
char * stringbuffer_finish(StringBuffer *sb)
static const char *const numbers_10[]
void init_type_spellbook(void)