Defines | Functions | Variables

spell.c File Reference

#include "hack.h"
Include dependency graph for spell.c:

Defines

#define SPELLMENU_CAST   (-2)
#define SPELLMENU_VIEW   (-1)
#define KEEN   20000
#define MAX_SPELL_STUDY   3
#define incrnknow(spell)   spl_book[spell].sp_know = KEEN
#define spellev(spell)   spl_book[spell].sp_lev
#define spellname(spell)   OBJ_NAME(objects[spellid(spell)])
#define spellet(spell)   ((char)((spell < 26) ? ('a' + spell) : ('A' + spell - 26)))
#define uarmhbon   4
#define uarmgbon   6
#define uarmfbon   2

Functions

STATIC_DCL int FDECL (spell_let_to_idx,(CHAR_P))
STATIC_DCL boolean FDECL (cursed_book,(struct obj *bp))
STATIC_DCL boolean FDECL (confused_book,(struct obj *))
STATIC_DCL void FDECL (deadbook,(struct obj *))
STATIC_PTR int NDECL (learn)
STATIC_DCL boolean FDECL (getspell,(int *))
STATIC_DCL boolean FDECL (dospellmenu,(const char *, int, int *))
STATIC_DCL int FDECL (percent_success,(int))
STATIC_DCL int NDECL (throwspell)
STATIC_DCL void NDECL (cast_protection)
STATIC_DCL void FDECL (spell_backfire,(int))
STATIC_DCL const char * FDECL (spelltypemnemonic,(int))
STATIC_DCL int FDECL (isqrt,(int))
STATIC_OVL int spell_let_to_idx (char ilet)
STATIC_OVL boolean cursed_book (struct obj *bp)
STATIC_OVL boolean confused_book (struct obj *spellbook)
STATIC_OVL void deadbook (struct obj *book2)
STATIC_PTR int learn ()
int study_book (struct obj *spellbook)
void book_disappears (struct obj *obj)
void book_substitution (struct obj *old_obj, struct obj *new_obj)
void age_spells ()
STATIC_OVL boolean getspell (int *spell_no)
int docast ()
STATIC_OVL const char * spelltypemnemonic (int skill)
int spell_skilltype (int booktype)
STATIC_OVL void cast_protection ()
STATIC_OVL void spell_backfire (int spell)
int spelleffects (int spell, boolean atme)
STATIC_OVL int throwspell ()
void losespells ()
int dovspell ()
STATIC_OVL boolean dospellmenu (char *prompt, int splaction, int *spell_no) const
void dump_spells ()
STATIC_OVL int isqrt (int val)
STATIC_OVL int percent_success (int spell)
void initialspell (struct obj *obj)

Variables

static NEARDATA schar delay
static NEARDATA struct objbook
static const char explodes [] = "radiates explosive energy"

Define Documentation

#define incrnknow (   spell )    spl_book[spell].sp_know = KEEN

Referenced by initialspell(), and learn().

#define KEEN   20000
#define MAX_SPELL_STUDY   3

Referenced by learn().

#define spellet (   spell )    ((char)((spell < 26) ? ('a' + spell) : ('A' + spell - 26)))

Referenced by dospellmenu(), dovspell(), and dump_spells().

#define spellev (   spell )    spl_book[spell].sp_lev
#define SPELLMENU_CAST   (-2)

Referenced by getspell().

#define SPELLMENU_VIEW   (-1)

Referenced by dospellmenu(), and dovspell().

#define spellname (   spell )    OBJ_NAME(objects[spellid(spell)])

Referenced by dospellmenu(), and dump_spells().

#define uarmfbon   2

Referenced by percent_success().

#define uarmgbon   6

Referenced by percent_success().

#define uarmhbon   4

Referenced by percent_success().


Function Documentation

void age_spells (  )

References decrnknow, MAXSPELL, NO_SPELL, spellid, and spellknow.

Referenced by moveloop().

Here is the caller graph for this function:

void book_disappears ( struct obj obj )

Referenced by obfree(), and saveobjchn().

Here is the caller graph for this function:

void book_substitution ( struct obj old_obj,
struct obj new_obj 
)

Referenced by realloc_obj().

Here is the caller graph for this function:

STATIC_OVL void cast_protection (  )

References an(), Blind, you::dx, you::dy, find_ac(), hcolor(), IS_STWALL, Is_waterlevel, levl, mbodypart(), min, NH_GOLDEN, P_EXPERT, P_SKILL, SPE_PROTECTION, spell_skilltype(), STOMACH, u, you::uac, you::ulevel, Underwater, you::uspellprot, you::uspmtime, you::usptime, you::ustuck, and you::uz.

Referenced by spelleffects().

Here is the call graph for this function:

Here is the caller graph for this function:

STATIC_OVL boolean confused_book ( struct obj spellbook )

References display_nhwindow, docall(), FALSE, objects, objclass::oc_uname, pline(), rn2(), SPE_BOOK_OF_THE_DEAD, TRUE, useup(), and WIN_MESSAGE.

Referenced by learn(), and study_book().

Here is the call graph for this function:

Here is the caller graph for this function:

STATIC_OVL boolean cursed_book ( struct obj bp )
STATIC_OVL void deadbook ( struct obj book2 )
int docast (  )

References FALSE, getspell(), and spelleffects().

Here is the call graph for this function:

STATIC_OVL boolean dospellmenu ( char *  prompt,
int  splaction,
int *  spell_no 
) const
int dovspell (  )

References dospellmenu(), NO_SPELL, QBUFSZ, spellet, spellid, SPELLMENU_VIEW, spl_book, and Sprintf.

Here is the call graph for this function:

void dump_spells (  )

Dump the currently known spells.

References BUFSZ, dump(), dump_html(), dump_text(), dump_title(), MAXSPELL, NO_SPELL, percent_success(), spell_skilltype(), spellet, spellev, spellid, spellknow, spellname, spelltypemnemonic(), and Sprintf.

Referenced by disclose().

Here is the call graph for this function:

Here is the caller graph for this function:

STATIC_DCL int FDECL ( isqrt  ,
(int)   
)
STATIC_DCL boolean FDECL ( cursed_book  ,
(struct obj *bp  
)
STATIC_DCL int FDECL ( percent_success  ,
(int)   
)
STATIC_DCL void FDECL ( deadbook  ,
(struct obj *)   
)
STATIC_DCL void FDECL ( spell_backfire  ,
(int)   
)
STATIC_DCL boolean FDECL ( getspell  ,
(int *)   
)
STATIC_DCL const char* FDECL ( spelltypemnemonic  ,
(int)   
)
STATIC_DCL int FDECL ( spell_let_to_idx  ,
(CHAR_P)   
)
STATIC_DCL boolean FDECL ( confused_book  ,
(struct obj *)   
)
STATIC_DCL boolean FDECL ( dospellmenu  ,
(const char *, int, int *)   
)
STATIC_OVL boolean getspell ( int *  spell_no )

References BUFSZ, dospellmenu(), FALSE, flags, index, MAXSPELL, flag::menu_style, MENU_TRADITIONAL, NO_SPELL, QBUFSZ, quitchars, spell_let_to_idx(), spellid, SPELLMENU_CAST, Sprintf, Strcpy, TRUE, and yn_function().

Referenced by docast().

Here is the call graph for this function:

Here is the caller graph for this function:

void initialspell ( struct obj obj )

References incrnknow, MAXSPELL, NO_SPELL, OBJ_NAME, objects, pline(), spell::sp_id, spell::sp_lev, spellid, and spl_book.

Referenced by ini_inv().

Here is the call graph for this function:

Here is the caller graph for this function:

STATIC_OVL int isqrt ( int  val )

Integer square root function without using floating point.

Referenced by percent_success().

Here is the caller graph for this function:

STATIC_PTR int learn (  )
void losespells (  )

References A_WIS, Confusion, exercise(), FALSE, MAXSPELL, NO_SPELL, rnd(), and spellid.

Referenced by forget().

Here is the call graph for this function:

Here is the caller graph for this function:

STATIC_DCL void NDECL ( cast_protection   )
STATIC_DCL int NDECL ( throwspell   )
STATIC_PTR int NDECL ( learn   )
STATIC_OVL int percent_success ( int  spell )
STATIC_OVL void spell_backfire ( int  spell )

References FALSE, make_confused(), make_stunned(), rn2(), and spellev.

Referenced by spelleffects().

Here is the call graph for this function:

Here is the caller graph for this function:

STATIC_OVL int spell_let_to_idx ( char  ilet )

Referenced by getspell().

Here is the caller graph for this function:

int spell_skilltype ( int  booktype )

References objects, and oc_skill.

Referenced by cast_protection(), dospellmenu(), dump_spells(), percent_success(), pleased(), restricted_spell_discipline(), spell_hit_bonus(), and spelleffects().

Here is the caller graph for this function:

int spelleffects ( int  spell,
boolean  atme 
)

References A_INT, A_STR, A_WIS, acurr(), ACURR, BClairvoyant, body_part(), flag::botl, BUFSZ, cansee, cast_protection(), check_capacity(), Confusion, CORNUTHAUM, do_vicinity_map(), you::dx, you::dy, you::dz, exercise(), EXPL_FIERY, EXPL_FROSTY, explode(), FALSE, flags, freehand(), getdir(), HEAD, healup(), IS_STWALL, isok(), jump(), levl, losehp(), make_familiar(), max, mksobj(), morehungry(), NO_KILLER_PREFIX, NODIR, nothing_happens, obfree(), objects, obj::otyp, P_SKILL, P_SKILLED, peffects(), percent_success(), pline(), PM_WIZARD, obj::quan, rnd(), Role_if, seffects(), Sick, Slimed, SPE_CANCELLATION, SPE_CAUSE_FEAR, SPE_CHARM_MONSTER, SPE_CLAIRVOYANCE, SPE_CONE_OF_COLD, SPE_CONFUSE_MONSTER, SPE_CREATE_FAMILIAR, SPE_CREATE_MONSTER, SPE_CURE_BLINDNESS, SPE_CURE_SICKNESS, SPE_DETECT_FOOD, SPE_DETECT_MONSTERS, SPE_DETECT_TREASURE, SPE_DETECT_UNSEEN, SPE_DIG, SPE_DRAIN_LIFE, SPE_EXTRA_HEALING, SPE_FINGER_OF_DEATH, SPE_FIREBALL, SPE_FORCE_BOLT, SPE_HASTE_SELF, SPE_HEALING, SPE_IDENTIFY, SPE_INVISIBILITY, SPE_JUMPING, SPE_KNOCK, SPE_LEVITATION, SPE_LIGHT, SPE_MAGIC_MAPPING, SPE_MAGIC_MISSILE, SPE_POLYMORPH, SPE_PROTECTION, SPE_REMOVE_CURSE, SPE_RESTORE_ABILITY, SPE_SLEEP, SPE_SLOW_MONSTER, SPE_STONE_TO_FLESH, SPE_TELEPORT_AWAY, SPE_TURN_UNDEAD, SPE_WIZARD_LOCK, spell_backfire(), spell_damage_bonus(), spell_skilltype(), spellev, spellid, spellknow, Sprintf, throwspell(), TINFOIL_HAT, TRUE, u, uarmh, you::uen, you::uhave, uhim, you::uhunger, you::ulevel, update_inventory, use_skill(), you::ux, you::uy, weffects(), nhcoord::x, nhcoord::y, and zapyourself().

Referenced by docast(), dotele(), and doturn().

Here is the call graph for this function:

Here is the caller graph for this function:

STATIC_OVL const char* spelltypemnemonic ( int  skill )

References P_ATTACK_SPELL, P_CLERIC_SPELL, P_DIVINATION_SPELL, P_ENCHANTMENT_SPELL, P_ESCAPE_SPELL, P_HEALING_SPELL, and P_MATTER_SPELL.

Referenced by dospellmenu(), and dump_spells().

Here is the caller graph for this function:

int study_book ( struct obj spellbook )
STATIC_OVL int throwspell (  )

References A_WIS, cansee, distmin(), you::dx, you::dy, exercise(), FALSE, getpos(), IS_STWALL, Is_waterlevel, levl, pline(), TRUE, u, you::ux, you::uy, you::uz, nhcoord::x, and nhcoord::y.

Referenced by spelleffects().

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

NEARDATA struct obj* book [static]
NEARDATA schar delay [static]

Referenced by armoroff(), dowear(), learn(), and study_book().

const char explodes[] = "radiates explosive energy" [static]