Crossfire Server, Branch 1.12
R12190
|
The implementation of the Food class of objects. More...
#include <global.h>
#include <ob_methods.h>
#include <ob_types.h>
#include <sounds.h>
#include <sproto.h>
#include <math.h>
Go to the source code of this file.
Functions | |
static int | dragon_eat_flesh (object *op, object *meal) |
A dragon is eating some flesh. | |
static void | eat_special_food (object *who, object *food) |
Handles player eating food that temporarily changes status (resistances, stats). | |
static method_ret | food_type_apply (ob_methods *context, object *food, object *applier, int aflags) |
Handles applying food. | |
void | init_type_food (void) |
Initializer for the food object type. |
The implementation of the Food class of objects.
Definition in file food.c.
static int dragon_eat_flesh | ( | object * | op, |
object * | meal | ||
) | [static] |
A dragon is eating some flesh.
If the flesh contains resistances, there is a chance for the dragon's skin to get improved.
op | object (dragon player) eating the flesh. |
meal | flesh item, getting chewed in dragon's mouth. |
Definition at line 237 of file food.c.
References atnr_is_dragon_enabled(), change_resist_msg, draw_ext_info(), draw_ext_info_format(), fix_object(), FLESH, FORCE, is_dragon_pl(), MAX_BUF, Settings::max_level, MIN, MSG_TYPE_APPLY, MSG_TYPE_APPLY_SUCCESS, MSG_TYPE_ATTRIBUTE, MSG_TYPE_ATTRIBUTE_PROTECTION_GAIN, MSG_TYPE_ATTRIBUTE_RACE, NDI_RED, NDI_UNIQUE, NROFATTACKS, settings, and snprintf().
Referenced by food_type_apply().
static void eat_special_food | ( | object * | who, |
object * | food | ||
) | [static] |
Handles player eating food that temporarily changes status (resistances, stats).
This used to call cast_change_attr(), but that doesn't work with the new spell code. Since we know what the food changes, just grab a force and use that instead.
who | living eating food. |
food | eaten food. |
Definition at line 155 of file food.c.
References AT_POISON, change_abil(), create_archetype(), draw_ext_info(), fix_object(), FLAG_APPLIED, FLAG_CURSED, FLAG_IS_USED_UP, FORCE_NAME, free_object(), get_attr_value(), hit_player(), insert_ob_in_ob(), is_wraith_pl(), MSG_TYPE_APPLY, MSG_TYPE_APPLY_CURSED, MSG_TYPE_APPLY_SUCCESS, NDI_UNIQUE, NROFATTACKS, NUM_STATS, QUERY_FLAG, set_attr_value(), SET_FLAG, and update_ob_speed().
Referenced by food_type_apply().
static method_ret food_type_apply | ( | ob_methods * | context, |
object * | food, | ||
object * | applier, | ||
int | aflags | ||
) | [static] |
Handles applying food.
If player is applying, takes care of messages and dragon special food.
context | The method context |
food | The food to apply |
applier | The object attempting to apply the food |
aflags | Special flags (always apply/unapply) |
Definition at line 55 of file food.c.
References decrease_ob, dragon_eat_flesh(), draw_ext_info(), draw_ext_info_format(), DRINK, eat_special_food(), FLAG_CAN_USE_SKILL, FLAG_CURSED, FLAG_NO_PICK, FLESH, FOOD, give_skill_by_name(), handle_apply_yield(), is_dragon_pl(), is_old_wraith_pl(), is_wraith_pl(), link_player_skills(), llevError, LOG(), MAX_BUF, METHOD_OK, MSG_TYPE_APPLY, MSG_TYPE_APPLY_FAILURE, MSG_TYPE_APPLY_SUCCESS, NDI_UNIQUE, PLAYER, QUERY_FLAG, SET_FLAG, and snprintf().
Referenced by init_type_food().
void init_type_food | ( | void | ) |
Initializer for the food object type.
Definition at line 40 of file food.c.
References DRINK, FLESH, FOOD, food_type_apply(), and register_apply().
Referenced by register_all_ob_types().