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...
struct magic_realmclass_magic_realms (const struct player_class *c, int *count)
 Make a list of the spell realms the player's class has books from. More...
const struct class_bookobject_kind_to_book (const struct object_kind *kind)
 Get the spellbook structure from any object which is a book. More...
const struct class_bookplayer_object_to_book (struct player *p, 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

◆ cast_spell()

bool cast_spell ( int  tval,
int  index,
int  dir 

◆ class_magic_realms()

struct magic_realm* class_magic_realms ( const struct player_class c,
int count 

◆ get_spell_info()

void get_spell_info ( int  index,
char *  buf,
size_t  len 

◆ object_kind_to_book()

const struct class_book* object_kind_to_book ( const struct object_kind kind)

Get the spellbook structure from any object which is a book.

References classes, i, object_kind::sval, and object_kind::tval.

Referenced by parse_always().

◆ player_object_to_book()

const struct class_book* player_object_to_book ( struct player p,
const struct object obj 

◆ player_spells_free()

void player_spells_free ( struct player p)

Free player spells.

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

Referenced by player_cleanup_members().

◆ player_spells_init()

void player_spells_init ( struct player p)

◆ spell_book_count_spells()

int spell_book_count_spells ( const struct object obj,
bool(*)(int spell_index)  tester 

◆ spell_by_index()

const struct class_spell* spell_by_index ( int  index)

◆ spell_cast()

bool spell_cast ( int  spell_index,
int  dir 

◆ spell_chance()

s16b spell_chance ( int  spell_index)

◆ spell_collect_from_book()

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, player_object_to_book(), class_spell::sidx, and class_book::spells.

Referenced by spell_menu_new().

◆ spell_learn()

void spell_learn ( int  spell_index)

◆ spell_needs_aim()

bool spell_needs_aim ( int  spell_index)

◆ spell_okay_list()

bool spell_okay_list ( bool(*)(int spell_index)  spell_test,
const int  spells[],
int  n_spells 

◆ spell_okay_to_browse()

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().

◆ spell_okay_to_cast()

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().

◆ spell_okay_to_study()

bool spell_okay_to_study ( int  spell_index)

◆ spell_value_base_by_name()

expression_base_value_f spell_value_base_by_name ( const char *  name)