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.

Macros

#define FOOD_MAX   999
 
#define FOOD_CHANCE_ARTIFACT   4
 
#define FOOD_CHANCE_CURSED   25
 
#define FOOD_CHANCE_CURSE_ATTR   4
 

Functions

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)
 
 OBJECT_TYPE_INIT_DEFINE (food)
 

Detailed Description

Handles code used for food, drinks and flesh.

Definition in file food.c.

Macro Definition Documentation

#define FOOD_CHANCE_ARTIFACT   4

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

Definition at line 46 of file food.c.

#define FOOD_CHANCE_CURSE_ATTR   4

Chance to curse a unique attribute.

Definition at line 56 of file food.c.

#define FOOD_CHANCE_CURSED   25

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 
)
static

Applies an object.

Parameters
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 
)
static

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

Parameters
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 
)
static

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.

Parameters
whoObject eating the food.
foodThe food object.

Definition at line 143 of file food.c.

OBJECT_TYPE_INIT_DEFINE ( food  )

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 
)
static

Process generated treasure.

Parameters
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.
Returns
One of Object method return values.
Warning
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.