56 int capacity_remaining;
80 snprintf(buf,
sizeof(buf),
"You have been dead for too long to taste %s, ", food->
name);
84 "and seem to have obtained a taste for living flesh.", NULL);
91 snprintf(buf,
sizeof(buf),
"You can no longer taste %s, and do not feel less hungry after %s it.", food->
name, food->
type ==
DRINK ?
"drinking" :
"eating");
99 "You feel full, but what a waste of food!", NULL);
102 "Most of the drink goes down your face not your throat!", NULL);
111 snprintf(buf,
sizeof(buf),
"Ahhh...that %s tasted good.", food->
name);
113 snprintf(buf,
sizeof(buf),
"The %s tasted %s", food->
name, food->
type ==
FLESH ?
"terrible!" :
"good.");
116 snprintf(buf,
sizeof(buf),
"The %s tasted terrible!", food->
name);
121 capacity_remaining = 999-applier->
stats.
food;
123 if (capacity_remaining < food->stats.food)
124 applier->
stats.
hp += capacity_remaining/50;
172 if (food->
resist[i] > 0) {
196 "Eck!...that was poisonous!", NULL);
200 "You begin to feel better.", NULL);
203 "Eck!...that was poisonous!", NULL);
210 "You are drained of mana!", NULL);
216 "You feel a rush of magical energy!", NULL);
244 double totalchance = 1;
258 for (tmp = op->
inv; tmp != NULL; tmp = tmp->
below) {
260 if (strcmp(tmp->
arch->
name,
"dragon_skin_force") == 0)
262 else if (strcmp(tmp->
arch->
name,
"dragon_ability_force") == 0)
270 if (skin == NULL || abil == NULL)
305 chance = (chance < -12) ? 0. : 1./pow(2., -chance);
308 chance *= ((double)(
MIN(meal->
resist[i], 50)))/50.;
312 chance =
MIN(100., chance*2.);
315 if (RANDOM()%10000 < (
int)(chance*100)) {
316 atnr_winner[winners] = i;
321 totalchance *= 1-chance/100;
328 totalchance = 100-totalchance*100;
330 if (totalchance > 50.)
331 snprintf(buf,
sizeof(buf),
"Hmm! The %s tasted delicious!", meal->
name);
332 else if (totalchance > 10.)
333 snprintf(buf,
sizeof(buf),
"The %s tasted very good.", meal->
name);
334 else if (totalchance > 1.)
335 snprintf(buf,
sizeof(buf),
"The %s tasted good.", meal->
name);
336 else if (totalchance > 0.1)
337 snprintf(buf,
sizeof(buf),
"The %s tasted bland.", meal->
name);
338 else if (totalchance >= 0.01)
339 snprintf(buf,
sizeof(buf),
"The %s had a boring taste.", meal->
name);
341 snprintf(buf,
sizeof(buf),
"The %s tasted strange.", meal->
name);
343 snprintf(buf,
sizeof(buf),
"The %s had no taste.", meal->
name);
350 i = atnr_winner[RANDOM()%winners];
352 if (i >= 0 && i < NROFATTACKS && skin->resist[i] < 95) {
358 "Your skin is now more resistant to %s!",
359 "Your skin is now more resistant to %s!",
373 "Your metabolism prepares to focus on %s!",
374 "Your metabolism prepares to focus on %s!",
377 "The change will happen at level %d",
378 "The change will happen at level %d",
382 "Your metabolism will continue to focus on %s.",
383 "Your metabolism will continue to focus on %s.",
void init_type_food(void)
#define MSG_TYPE_ATTRIBUTE_PROTECTION_GAIN
#define MSG_TYPE_APPLY_FAILURE
sint8 get_attr_value(const living *stats, int attr)
void draw_ext_info(int flags, int pri, const object *pl, uint8 type, uint8 subtype, const char *message, const char *oldmessage)
void draw_ext_info_format(int flags, int pri, const object *pl, uint8 type, uint8 subtype, const char *new_format, const char *old_format,...)
static method_ret food_type_apply(ob_methods *context, object *food, object *applier, int aflags)
object * give_skill_by_name(object *op, const char *skill_name)
int change_abil(object *op, object *tmp)
void handle_apply_yield(object *tmp)
object * create_archetype(const char *name)
static int dragon_eat_flesh(object *op, object *meal)
int is_wraith_pl(object *op)
#define FLAG_CAN_USE_SKILL
int is_dragon_pl(const object *op)
void set_attr_value(living *stats, int attr, sint8 value)
#define MSG_TYPE_ATTRIBUTE
static void eat_special_food(object *who, object *food)
EXTERN const char *const change_resist_msg[NROFATTACKS]
void register_apply(int ob_type, apply_func method)
#define QUERY_FLAG(xyz, p)
int is_old_wraith_pl(object *op)
object * insert_ob_in_ob(object *op, object *where)
sint16 resist[NROFATTACKS]
#define MSG_TYPE_APPLY_CURSED
#define MSG_TYPE_ATTRIBUTE_RACE
int snprintf(char *dest, int max, const char *format,...)
#define MSG_TYPE_APPLY_SUCCESS
void update_ob_speed(object *op)
void link_player_skills(object *op)
void LOG(LogLevel logLevel, const char *format,...)
void free_object(object *ob)
void fix_object(object *op)
int hit_player(object *op, int dam, object *hitter, uint32 type, int full_hit)
int atnr_is_dragon_enabled(int attacknr)