player-spell.h File Reference

Spell and prayer casting/praying. More...

Go to the source code of this file.


void player_spells_init (struct player *p)
 Initialise player spells. More...
void player_spells_free (struct player *p)
 Free player spells. More...
const struct class_bookobject_to_book (const struct object *obj)
 Get the spellbook structure from an object which is a book the player can cast from. More...
const struct class_spellspell_by_index (int index)
int spell_collect_from_book (const struct object *obj, int **spells)
 Collect spells from a book into the spells[] array, allocating appropriate memory. More...
int spell_book_count_spells (const struct object *obj, bool(*tester)(int spell_index))
bool spell_okay_list (bool(*spell_test)(int spell_index), const int spells[], int n_spells)
bool spell_okay_to_cast (int spell_index)
 True if the spell is castable. More...
bool spell_okay_to_study (int spell_index)
 True if the spell can be studied. More...
bool spell_okay_to_browse (int spell_index)
 True if the spell is browsable. More...
s16b spell_chance (int spell_index)
 Returns chance of failure for a spell. More...
void spell_learn (int spell_index)
 Learn the specified spell. More...
bool spell_cast (int spell_index, int dir)
 Cast the specified spell. More...
void get_spell_info (int index, char *buf, size_t len)
bool cast_spell (int tval, int index, int dir)
bool spell_needs_aim (int spell_index)
expression_base_value_f spell_value_base_by_name (const char *name)

Detailed Description

Spell and prayer casting/praying.

Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke

This work is free software; you can redistribute it and/or modify it under the terms of either:

a) the GNU General Public License as published by the Free Software Foundation, version 2, or

b) the "Angband licence": This software may be copied and distributed for educational, research, and not for profit purposes provided that this copyright and statement are included in all such copies. Other copyrights may also apply.

Function Documentation

bool cast_spell ( int  tval,
int  index,
int  dir 
void get_spell_info ( int  index,
char *  buf,
size_t  len 

References spell_append_value_info().

Referenced by spell_menu_display().

const struct class_book* object_to_book ( const struct object obj)
void player_spells_free ( struct player p)

Free player spells.

References mem_free(), player::spell_flags, and player::spell_order.

Referenced by cleanup_player().

void player_spells_init ( struct player p)
int spell_book_count_spells ( const struct object obj,
bool(*)(int spell_index)  tester 
const struct class_spell* spell_by_index ( int  index)
bool spell_cast ( int  spell_index,
int  dir 
s16b spell_chance ( int  spell_index)
int spell_collect_from_book ( const struct object obj,
int **  spells 

Collect spells from a book into the spells[] array, allocating appropriate memory.

References i, mem_zalloc(), class_book::num_spells, object_to_book(), class_spell::sidx, and class_book::spells.

Referenced by spell_menu_new().

void spell_learn ( int  spell_index)
bool spell_needs_aim ( int  spell_index)
bool spell_okay_list ( bool(*)(int spell_index)  spell_test,
const int  spells[],
int  n_spells 
bool spell_okay_to_browse ( int  spell_index)

True if the spell is browsable.

References class_spell::slevel, and spell_by_index().

Referenced by textui_book_browse().

bool spell_okay_to_cast ( int  spell_index)

True if the spell is castable.

References PY_SPELL_LEARNED, and player::spell_flags.

Referenced by do_cmd_cast(), and obj_can_cast_from().

bool spell_okay_to_study ( int  spell_index)
expression_base_value_f spell_value_base_by_name ( const char *  name)