Crossfire Server, Branches 1.12  R18729
spellbook.c File Reference
#include <global.h>
#include <ob_methods.h>
#include <ob_types.h>
#include <sounds.h>
#include <sproto.h>
+ Include dependency graph for spellbook.c:

Go to the source code of this file.

Functions

void init_type_spellbook (void)
 
static method_ret spellbook_type_apply (ob_methods *context, object *lighter, object *applier, int aflags)
 

Detailed Description

Implimentation of spellbooks.

Definition in file spellbook.c.

Function Documentation

void init_type_spellbook ( void  )

Initializer for the SPELLBOOK object type.

Definition at line 39 of file spellbook.c.

References register_apply(), SPELLBOOK, and spellbook_type_apply().

Referenced by register_all_ob_types().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static method_ret spellbook_type_apply ( ob_methods context,
object book,
object applier,
int  aflags 
)
static

Applies a spellbook. Checks whether player has knowledge of required skill, doesn't already know the spell, stuff like that. Random learning failure too.

Parameters
contextmethod context.
bookSpellbook to apply.
applierobject attempting to apply the spellbook. Should be a player.
aflagsspecial flags (always apply/unapply).
Returns
METHOD_OK always.
Todo:

handle failure differently for praying/magic.

split into multiple functions

Definition at line 64 of file spellbook.c.

References calc_skill_exp(), change_exp(), check_spell_known(), obj::contr, decrease_ob, die_roll(), do_forget_spell(), do_learn_spell(), draw_ext_info(), draw_ext_info_format(), obj::env, esrv_update_item(), find_skill_by_name(), FLAG_BLESSED, FLAG_BLIND, FLAG_CONFUSED, FLAG_CURSED, FLAG_DAMNED, FLAG_IDENTIFIED, FLAG_STARTEQUIP, FLAG_WIZ, get_levelnumber(), liv::grace, identify(), liv::Int, obj::inv, learn_spell, obj::level, llevError, LOG(), MAX, MAX_BUF, METHOD_OK, MSG_TYPE_APPLY, MSG_TYPE_APPLY_ERROR, MSG_TYPE_APPLY_FAILURE, MSG_TYPE_APPLY_SUCCESS, obj::name, NDI_UNIQUE, play_sound_player_only(), PLAYER, PREFER_LOW, QUERY_FLAG, query_name(), random_roll(), rndm(), scroll_failure(), settings, obj::skill, pl::socket, SOUND_TYPE_SPELL, liv::sp, Settings::spell_failure_effects, obj::stats, TRUE, obj::type, UPD_FLAGS, UPD_NAME, socket_struct::update_look, and liv::Wis.

Referenced by init_type_spellbook().

+ Here is the call graph for this function:

+ Here is the caller graph for this function: