Atrinik Server  4.0
Macros | Functions
food.c File Reference
#include <global.h>
#include <arch.h>
#include <player.h>
#include <object.h>
#include <object_methods.h>
#include <artifact.h>
#include "common/process_treasure.h"

Go to the source code of this file.


#define FOOD_MAX   999


static void food_create_force (object *who, object *food, object *force)
static void food_eat_special (object *who, object *food)
static int apply_func (object *op, object *applier, int aflags)
static int process_treasure_func (object *op, object **ret, int difficulty, treasure_affinity_t *affinity, int flags)

Detailed Description

Handles code used for food, drinks and flesh.

Definition in file food.c.

Macro Definition Documentation


Chance for generated food to turn into artifacts - 1/x.

Definition at line 46 of file food.c.


Chance to curse a unique attribute.

Definition at line 56 of file food.c.


Chance for generated food to become cursed - 1/x.

Definition at line 51 of file food.c.

#define FOOD_MAX   999

Maximum allowed food value.

Definition at line 41 of file food.c.

Function Documentation

static int apply_func ( object op,
object applier,
int  aflags 

Applies an object.

opThe object to apply.
applierThe object that executes the apply action.
aflagsSpecial (always apply/unapply) flags.

Definition at line 224 of file food.c.

static void food_create_force ( object who,
object food,
object force 

Create a food force to include buff/debuff effects of stats and protections to the player.

whoThe player object.
foodThe food.
forceThe force object.

Definition at line 70 of file food.c.

static void food_eat_special ( object who,
object food 

The food gives specials, like +/- hp or sp, protections and stats.

Food can be good or bad (good effect or bad effect), and cursed or not. If food is "good" (for example, Str +1 and Dex +1), then it puts those effects as force in the player for some time.

If good food is cursed, all positive values are turned to negative values.

If bad food (Str -1, Dex -1) is uncursed, it gives just those values.

If bad food is cursed, all negative values are doubled.

Food effects can stack. For really powerful food, a high food value should be set, so the player can't eat a lot of such food, as his stomach will be full.

whoObject eating the food.
foodThe food object.

Definition at line 143 of file food.c.


Initialize the food type object methods.

Definition at line 372 of file food.c.

static int process_treasure_func ( object op,
object **  ret,
int  difficulty,
treasure_affinity_t *  affinity,
int  flags 

Process generated treasure.

opObject to process.
[out]retIf the function returns OBJECT_METHOD_OK, this variable will contain the processed treasure object, which may be different from 'op' (which may be destroyed). Indeterminate on any other return value.
difficultyDifficulty level.
affinityTreasure affinity.
flagsA combination of GT_xxx flags.
One of Object method return values.
If OBJECT_METHOD_ERROR is returned from this function, it is possible that the original object has been destroyed and thus any further processing should stop.

Definition at line 295 of file food.c.