Atrinik Server 2.5
Defines | Functions | Variables
types/potion.c File Reference
#include <global.h>

Go to the source code of this file.

Defines

#define POTION_IMPROVE_STATS   3
#define POTION_IMPROVE_HP   0
#define POTION_IMPROVE_SP   1
#define POTION_IMPROVE_GRACE   2

Functions

static int potion_improve_apply (object *op, object *tmp)
static int potion_special_apply (object *op, object *tmp)
static int potion_restoration_apply (object *op, object *tmp)
int apply_potion (object *op, object *tmp)

Variables

static const size_t potion_improve_stat_offsets [POTION_IMPROVE_STATS]
static const char *const potion_improve_stat_names [POTION_IMPROVE_STATS]

Detailed Description

Handles potion related code.

Definition in file potion.c.


Function Documentation

int apply_potion ( object op,
object tmp 
)

Apply a potion.

Parameters:
opObject applying the potion.
tmpThe potion.
Returns:
1 if the potion was successfully applied, 0 otherwise.

Definition at line 347 of file potion.c.

static int potion_improve_apply ( object op,
object tmp 
) [static]

Handle applying an improvement potion.

Parameters:
opPlayer applying the potion.
tmpThe potion.
Returns:
1.

Definition at line 68 of file potion.c.

static int potion_restoration_apply ( object op,
object tmp 
) [static]

Apply a potion of minor restoration; cures depleted stats. If the potion is cursed or damned, stats are depleted instead.

Parameters:
opPlayer applying the potion.
tmpThe potion.
Returns:
1 on success, 0 on failure.

Definition at line 286 of file potion.c.

static int potion_special_apply ( object op,
object tmp 
) [static]

Apply a potion that gives player temporary effects (resists, stat increases, etc).

Parameters:
opPlayer applying the potion.
tmpThe potion.
Returns:
1 on success, 0 on failure.

Definition at line 173 of file potion.c.


Variable Documentation

const char* const potion_improve_stat_names[POTION_IMPROVE_STATS] [static]
Initial value:
{
    "health", "mana", "grace"
}

String representations of the stats improvement potions can improve. These are used in potion_improve_apply() to inform a player which stat has increased (or decreased, in case of cursed potions).

Definition at line 58 of file potion.c.

const size_t potion_improve_stat_offsets[POTION_IMPROVE_STATS] [static]
Initial value:
{
    offsetof(player, levhp), offsetof(player, levsp), offsetof(player, levgrace)
}

Offsets of the levxxx arrays in the player structure. These are used in potion_improve_apply() for dynamic access.

Definition at line 49 of file potion.c.