51 "Eck!...that was poisonous!");
55 "You begin to feel better.");
58 "Eck!...that was poisonous!");
65 "You are drained of mana!");
72 "You feel a rush of magical energy!");
75 "You are drained of mana!");
86 if (capacity_remaining < food->stats.food)
87 applier->
stats.
hp += capacity_remaining / 50;
94 const int wasted_food = food->
stats.
food - capacity_remaining;
95 if (wasted_food > 0) {
98 if (wasted_food > thresh) {
105 snprintf(buf,
sizeof(buf),
106 "%s the %s makes you %s full. You feel yourself moving %s " 109 wasted_food > thresh ?
"very" :
"rather",
110 wasted_food > thresh ?
"much" :
"somewhat");
153 snprintf(buf,
sizeof(buf),
"You have been dead for too long to taste %s, ", food->
name);
157 "and seem to have obtained a taste for living flesh.");
162 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");
171 snprintf(buf,
sizeof(buf),
"Ahhh...that %s tasted good.", food->
name);
173 snprintf(buf,
sizeof(buf),
"The %s tasted %s", food->
name, food->
type ==
FLESH ?
"terrible!" :
"good.");
176 snprintf(buf,
sizeof(buf),
"The %s tasted terrible!", food->
name);
225 if (food->
resist[i] > 0) {
368 double totalchance = 1;
388 if (skin == NULL || abil == NULL)
413 chance = (chance < -12) ? 0. : 1./pow(2., -chance);
416 chance *= ((double)(
MIN(meal->
resist[i], 50)))/50.;
420 chance =
MIN(100., chance*2.);
423 if (
RANDOM()%10000 < (
unsigned int)(chance*100)) {
424 atnr_winner[winners] = i;
429 totalchance *= 1-chance/100;
436 totalchance = 100-totalchance*100;
438 if (totalchance > 50.)
439 snprintf(buf,
sizeof(buf),
"Hmm! The %s tasted delicious!", meal->
name);
440 else if (totalchance > 10.)
441 snprintf(buf,
sizeof(buf),
"The %s tasted very good.", meal->
name);
442 else if (totalchance > 1.)
443 snprintf(buf,
sizeof(buf),
"The %s tasted good.", meal->
name);
444 else if (totalchance > 0.1)
445 snprintf(buf,
sizeof(buf),
"The %s tasted bland.", meal->
name);
446 else if (totalchance >= 0.01)
447 snprintf(buf,
sizeof(buf),
"The %s had a boring taste.", meal->
name);
449 snprintf(buf,
sizeof(buf),
"The %s tasted strange.", meal->
name);
451 snprintf(buf,
sizeof(buf),
"The %s had no taste.", meal->
name);
458 i = atnr_winner[
RANDOM()%winners];
460 if (i >= 0 && i < NROFATTACKS && skin->resist[i] < 95) {
466 "Your skin is now more resistant to %s!",
480 "Your metabolism prepares to focus on %s!",
483 "The change will happen at level %d",
487 "Your metabolism will continue to focus on %s.",
const char *const change_resist_msg[NROFATTACKS]
These are the descriptions of the resistances displayed when a player puts on/takes off an item...
int slow_living_by(object *op, const int speed_penalty)
#define FLAG_SEE_IN_DARK
if set ob not effected by darkness
void LOG(LogLevel logLevel, const char *format,...)
Logs a message to stderr, or to file.
static method_ret food_type_apply(object *food, object *applier, int aflags)
Handles applying food.
#define MSG_TYPE_APPLY_FAILURE
Apply OK, but no/bad result.
void apply_handle_yield(object *tmp)
This checks whether the object has a "on_use_yield" field, and if so generated and drops matching ite...
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 fix_object(object *op)
Updates all abilities given by applied objects in the inventory of the given object.
int16_t maxgrace
Maximum grace.
int16_t max_level
This is read out of exp_table.
int8_t luck
Affects thaco and ac from time to time.
#define FLAG_BLIND
If set, object cannot see (visually)
void link_player_skills(object *op)
This function goes through the player inventory and sets up the last_skills[] array in the player obj...
#define FLAG_STEALTH
Will wake monsters with less range.
int16_t y
Position in the map for this object.
int is_dragon_pl(const object *op)
Checks if player is a dragon.
static const float MOVE_PER_SECOND
Speed of an object that gives it one move per second, real time.
int16_t duration
Number of moves (see 'speed') spell lasts.
uint32_t path_repelled
Paths the object is repelled from.
animal 'body parts' -b.t.
Global type definitions and header inclusions.
struct player * contr
Pointer to the player which control this object.
void draw_ext_info(int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *message)
Sends message to player(s).
#define MSG_TYPE_APPLY
Applying objects.
static int dragon_eat_flesh(object *op, object *meal)
A dragon is eating some flesh.
void set_attr_value(living *stats, int attr, int8_t value)
Sets Str/Dex/con/Wis/Cha/Int/Pow in stats to value, depending on what attr is (STR to POW)...
bool chance(int a, int b)
Return true with a probability of a/b.
#define FLAG_IS_USED_UP
When (–food<0) the object will exit.
char method_ret
Define some standard return values for callbacks which don't need to return any other results...
#define FLAG_UNDEAD
Monster is undead.
int change_abil(object *op, object *tmp)
Permanently alters an object's stats/flags based on another object.
int16_t level
Level of creature or object.
int is_old_wraith_pl(object *op)
Checks if player is a wraith without the 'wraith feed' skill.
object * object_find_by_type_and_arch_name(const object *who, int type, const char *name)
Find object in inventory by type and archetype name.
static void check_heal_and_mana(object *who, object *food)
int16_t resist[NROFATTACKS]
Resistance adjustments for attacks.
#define FLAG_REFL_SPELL
Spells (some) will reflect from object.
#define INS_ON_TOP
Always put object on top.
#define MSG_TYPE_ATTRIBUTE_PROTECTION_GAIN
Protections in this.
float speed
Frequency of object 'moves' relative to server tick rate.
object * arch_to_object(archetype *at)
Creates and returns a new object which is a copy of the given archetype.
#define FLAG_CAN_USE_SKILL
The monster can use skills.
object * create_archetype(const char *name)
Finds which archetype matches the given name, and returns a new object containing a copy of the arche...
#define QUERY_FLAG(xyz, p)
#define MSG_TYPE_ATTRIBUTE
Changes to attributes (stats, resistances, etc)
void object_free_drop_inventory(object *ob)
Frees everything allocated by an object, removes it from the list of used objects, and puts it on the list of free objects.
int atnr_is_dragon_enabled(int attacknr)
Determine if the attacktype represented by the specified attack-number is enabled for dragon players...
char killer[BIG_NAME]
Who killed this player.
struct Settings settings
Global settings.
#define FLAG_XRAYS
X-ray vision.
uint32_t path_denied
Paths the object is denied access to.
living stats
Str, Con, Dex, etc.
#define MAX_BUF
Used for all kinds of things.
static void eat_special_food(object *who, object *food)
Handles player eating food that temporarily changes status (resistances, stats).
struct mapstruct * map
Pointer to the map in which this object is present.
#define FLAG_CURSED
The object is cursed.
struct archetype * other_arch
Pointer used for various things - mostly used for what this objects turns into or what this object cr...
#define AT_POISON
Some damage each turn thereafter (1024)
void init_type_food(void)
Initializer for the food object type.
#define object_decrease_nrof_by_one(xyz)
MoveType move_type
Type of movement this object uses.
sstring name
The name of the object, obviously...
int8_t get_attr_value(const living *stats, int attr)
Gets the value of a stat.
sstring title
Of foo, etc.
uint8_t type
PLAYER, BULLET, etc.
int8_t ac
Armor Class, lower AC increases probability of not getting hit.
#define FLAG_APPLIED
Object is ready for use by living.
#define FLAG_LIFESAVE
Saves a players' life once, then destr.
void object_update_speed(object *op)
Updates the speed of an object.
#define MSG_TYPE_APPLY_SUCCESS
Was able to apply object.
#define FLAG_MAKE_INVIS
(Item) gives invisibility when applied
#define MSG_TYPE_APPLY_CURSED
Applied a cursed object (BAD)
static const int32_t MAX_FOOD
int16_t maxsp
Max spell points.
uint32_t attacktype
Bitmask of attacks this object does.
object * give_skill_by_name(object *op, const char *skill_name)
Given the skill name skill_name, we find the skill archetype/object, set appropriate values...
#define NDI_UNIQUE
Print immediately, don't buffer.
int is_wraith_pl(object *op)
Tests if a player is a wraith.
void play_sound_map(int8_t sound_type, object *emitter, int dir, const char *action)
Plays a sound on a map.
int32_t food
How much food in stomach.
#define MSG_TYPE_ATTRIBUTE_RACE
Race-related changes.
int16_t maxhp
Max hit points.
object * object_insert_in_ob(object *op, object *where)
This function inserts the object op in the linked list inside the object environment.
object * object_insert_in_map_at(object *op, mapstruct *m, object *originator, int flag, int x, int y)
Same as object_insert_in_map() except it handle separate coordinates and do a clean job preparing mul...
int8_t wc
Weapon Class, lower WC increases probability of hitting.
#define FLAG_NO_PICK
Object can't be picked up.
int hit_player(object *op, int dam, object *hitter, uint32_t type, int full_hit)
Object is attacked by something.
Object type functions and variables.
#define FLAG_REFL_MISSILE
Arrows will reflect from object.
bool is_wraith
Whether this player is a wraith or not, initialized at load time.
#define MSG_TYPE_ATTRIBUTE_BAD_EFFECT_START
Start of a bad effect to the player.
static void eat_common(object *applier, object *food)
uint32_t path_attuned
Paths the object is attuned to.
int32_t last_eat
How long since we last ate.
void register_apply(int ob_type, apply_func method)
Registers the apply method for the given type.