Crossfire Server, Trunk
|
#include <global.h>
#include <ob_methods.h>
#include <ob_types.h>
#include <sproto.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
Go to the source code of this file.
Macros | |
#define | LEVELS 7 |
Functions | |
static void | add_capacity (const object *op, StringBuffer *buf, int previous_sp) |
static int | crystal_level (const object *op, int sp) |
void | init_type_power_crystal (void) |
static void | power_crystal_describe (const object *op, const object *observer, int use_media_tags, char *buf, size_t size) |
static method_ret | power_crystal_type_apply (object *op, object *applier, int aflags) |
Variables | |
static const char * | crystal_levels [LEVELS] |
The implementation of a Power Crystal. A Power Crystal can store mana from a player, and give it back when needed.
Definition in file power_crystal.c.
#define LEVELS 7 |
Definition at line 37 of file power_crystal.c.
|
static |
Add the capacity of the crystal to the buffer. Sentence will be dot-terminated.
op | crystal to add the capacity of. |
buf | where to put the capacity. |
previous_sp | if -1 then ignored, else previous sp of the crystal to add 'still ' or 'now ' to the message to signal level changes. |
Definition at line 81 of file power_crystal.c.
References buf, crystal_level(), crystal_levels, replace::current, LEVELS, give::op, say::previous, and stringbuffer_append_string().
Referenced by power_crystal_describe(), and power_crystal_type_apply().
|
static |
Return the level, [0..LEVELS[, of charge of the item.
op | crystal to get the level of, only for the maxsp. |
sp | sp value to get the level for. |
Definition at line 56 of file power_crystal.c.
References if(), and give::op.
Referenced by add_capacity().
void init_type_power_crystal | ( | void | ) |
Initializer for the POWER_CRYSTAL object type.
Definition at line 134 of file power_crystal.c.
References POWER_CRYSTAL, power_crystal_describe(), power_crystal_type_apply(), register_apply(), and register_describe().
Referenced by register_all_ob_types().
|
static |
Definition at line 99 of file power_crystal.c.
References add_capacity(), buf, give::op, query_name(), stringbuffer_append_printf(), stringbuffer_append_string(), stringbuffer_finish(), stringbuffer_new(), and nlohmann::detail::void().
Referenced by init_type_power_crystal().
|
static |
This function handles the application of power crystals. Power crystals, when applied, either suck power from the applier, if he's at full spellpoints, or gives him power, if it's got spellpoins stored.
op | The power crystal to apply |
applier | The object applying the crystal |
aflags | Special flags (always apply/unapply) |
Definition at line 149 of file power_crystal.c.
References add_capacity(), draw_ext_info(), esrv_update_item(), MAX_BUF, liv::maxsp, diamondslots::message, METHOD_OK, MIN, MSG_TYPE_APPLY, MSG_TYPE_APPLY_SUCCESS, give::name, NDI_UNIQUE, object_update_speed(), give::op, PLAYER, query_name(), liv::sp, obj::stats, stringbuffer_append_printf(), stringbuffer_append_string(), stringbuffer_finish(), stringbuffer_new(), obj::type, UPD_ANIMSPEED, and nlohmann::detail::void().
Referenced by init_type_power_crystal().
|
static |
Existing levels, dot-terminated.
Definition at line 40 of file power_crystal.c.
Referenced by add_capacity().