Angband
Macros | Enumerations | Functions
mon-spell.h File Reference

structures and functions for monster spells More...

#include "monster.h"

Go to the source code of this file.

Macros

#define MIN_NONINNATE_SPELL   (FLAG_START + 26)
#define rsf_has(f, flag)   flag_has_dbg(f, RSF_SIZE, flag, #f, #flag)
 Macros.
#define rsf_next(f, flag)   flag_next(f, RSF_SIZE, flag)
#define rsf_is_empty(f)   flag_is_empty(f, RSF_SIZE)
#define rsf_is_full(f)   flag_is_full(f, RSF_SIZE)
#define rsf_is_inter(f1, f2)   flag_is_inter(f1, f2, RSF_SIZE)
#define rsf_is_subset(f1, f2)   flag_is_subset(f1, f2, RSF_SIZE)
#define rsf_is_equal(f1, f2)   flag_is_equal(f1, f2, RSF_SIZE)
#define rsf_on(f, flag)   flag_on_dbg(f, RSF_SIZE, flag, #f, #flag)
#define rsf_off(f, flag)   flag_off(f, RSF_SIZE, flag)
#define rsf_wipe(f)   flag_wipe(f, RSF_SIZE)
#define rsf_setall(f)   flag_setall(f, RSF_SIZE)
#define rsf_negate(f)   flag_negate(f, RSF_SIZE)
#define rsf_copy(f1, f2)   flag_copy(f1, f2, RSF_SIZE)
#define rsf_union(f1, f2)   flag_union(f1, f2, RSF_SIZE)
#define rsf_comp_union(f1, f2)   flag_comp_union(f1, f2, RSF_SIZE)
#define rsf_inter(f1, f2)   flag_inter(f1, f2, RSF_SIZE)
#define rsf_diff(f1, f2)   flag_diff(f1, f2, RSF_SIZE)
#define RSF_BREATH_MASK
 Breath attacks.

Enumerations

enum  mon_spell_type {
  RST_BOLT = 0x001, RST_BALL = 0x002, RST_BREATH = 0x004, RST_ATTACK = 0x008,
  RST_ANNOY = 0x010, RST_HASTE = 0x020, RST_HEAL = 0x040, RST_TACTIC = 0x080,
  RST_ESCAPE = 0x100, RST_SUMMON = 0x200
}
 Variables. More...

Functions

int breath_dam (int element, int hp)
 Functions.
void do_mon_spell (int index, struct monster *m_ptr, bool seen)
 Process a monster spell.
bool test_spells (bitflag *f, int types)
 Test a spell bitflag for a type of spell.
void set_spells (bitflag *f, int types)
 Set a spell bitflag to allow only a specific set of spell types.
int best_spell_power (const monster_race *r_ptr, int resist)
 Calculate a monster's maximum spell power.
void unset_spells (bitflag *spells, bitflag *flags, bitflag *pflags, struct element_info *el, const monster_race *r_ptr)
 Turn off spells with a side effect or a gf_type that is resisted by something in flags, subject to intelligence and chance.
const char * mon_spell_lore_description (int index)
int mon_spell_lore_damage (int index, const monster_race *race, bool know_hp)

Detailed Description

structures and functions for monster spells

Copyright (c) 2011 Chris Carr

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.

Macro Definition Documentation

#define MIN_NONINNATE_SPELL   (FLAG_START + 26)

Referenced by make_attack_spell().

#define RSF_BREATH_MASK
Value:
RSF_BR_ACID, RSF_BR_ELEC, RSF_BR_FIRE, RSF_BR_COLD, \
RSF_BR_POIS, RSF_BR_PLAS, RSF_BR_LIGHT, RSF_BR_DARK, \
RSF_BR_SOUN, RSF_BR_SHAR, RSF_BR_INER, RSF_BR_GRAV, \
RSF_BR_WALL, RSF_BR_NEXU, RSF_BR_NETH, RSF_BR_CHAO, \
RSF_BR_DISE, RSF_BR_TIME, RSF_BR_MANA

Breath attacks.

Referenced by find_range().

#define rsf_comp_union (   f1,
  f2 
)    flag_comp_union(f1, f2, RSF_SIZE)
#define rsf_copy (   f1,
  f2 
)    flag_copy(f1, f2, RSF_SIZE)
#define rsf_diff (   f1,
  f2 
)    flag_diff(f1, f2, RSF_SIZE)
#define rsf_has (   f,
  flag 
)    flag_has_dbg(f, RSF_SIZE, flag, #f, #flag)
#define rsf_inter (   f1,
  f2 
)    flag_inter(f1, f2, RSF_SIZE)
#define rsf_is_empty (   f)    flag_is_empty(f, RSF_SIZE)

Referenced by make_attack_spell().

#define rsf_is_equal (   f1,
  f2 
)    flag_is_equal(f1, f2, RSF_SIZE)
#define rsf_is_full (   f)    flag_is_full(f, RSF_SIZE)
#define rsf_is_inter (   f1,
  f2 
)    flag_is_inter(f1, f2, RSF_SIZE)

Referenced by mon_pit_hook().

#define rsf_is_subset (   f1,
  f2 
)    flag_is_subset(f1, f2, RSF_SIZE)

Referenced by mon_pit_hook().

#define rsf_negate (   f)    flag_negate(f, RSF_SIZE)
#define rsf_next (   f,
  flag 
)    flag_next(f, RSF_SIZE, flag)
#define rsf_off (   f,
  flag 
)    flag_off(f, RSF_SIZE, flag)
#define rsf_on (   f,
  flag 
)    flag_on_dbg(f, RSF_SIZE, flag, #f, #flag)
#define rsf_setall (   f)    flag_setall(f, RSF_SIZE)
#define rsf_union (   f1,
  f2 
)    flag_union(f1, f2, RSF_SIZE)
#define rsf_wipe (   f)    flag_wipe(f, RSF_SIZE)

Enumeration Type Documentation

Variables.

Constants

Enumerator:
RST_BOLT 
RST_BALL 
RST_BREATH 
RST_ATTACK 
RST_ANNOY 
RST_HASTE 
RST_HEAL 
RST_TACTIC 
RST_ESCAPE 
RST_SUMMON 

Function Documentation

int best_spell_power ( const monster_race r_ptr,
int  resist 
)

Calculate a monster's maximum spell power.

Parameters
r_ptris the monster we're studying
resistis the degree of resistance we're assuming to any attack type (-1 = vulnerable ... 3 = immune)

References adjust_dam(), random::base, random::dice, monster_spell::effect, mon_spell_info::index, monster_race::level, random::m_bonus, MAXIMISE, mon_hp(), mon_spell_dam(), mon_spell_info_table, monster_spell_by_index(), monster_spell_is_projectable(), effect::params, monster_spell::power, rsf_has, mon_spell_info::save, random::sides, and monster_race::spell_flags.

Referenced by eval_max_dam().

int breath_dam ( int  element,
int  hp 
)

Functions.

Functions.

Parameters
elementis the attack element
hpis the monster's hp

References breath, breath_damage::cap, and breath_damage::divisor.

Referenced by effect_handler_BREATH(), and mon_spell_dam().

void do_mon_spell ( int  index,
struct monster mon,
bool  seen 
)
int mon_spell_lore_damage ( int  index,
const monster_race race,
bool  know_hp 
)
const char* mon_spell_lore_description ( int  index)
void set_spells ( bitflag f,
int  types 
)

Set a spell bitflag to allow only a specific set of spell types.

Parameters
fis the set of spell flags we're pruning
typesis the spell type(s) we're allowing

References mon_spell_info::index, mon_spell_info_table, rsf_has, rsf_off, and mon_spell_info::type.

Referenced by make_attack_spell().

bool test_spells ( bitflag f,
int  types 
)

Test a spell bitflag for a type of spell.

Returns TRUE if any desired type is among the flagset

Parameters
fis the set of spell flags we're testing
typesis the spell type(s) we're looking for

References FALSE, mon_spell_info::index, mon_spell_info_table, rsf_has, TRUE, and mon_spell_info::type.

Referenced by make_attack_spell().

void unset_spells ( bitflag spells,
bitflag flags,
bitflag pflags,
struct element_info el,
const monster_race r_ptr 
)

Turn off spells with a side effect or a gf_type that is resisted by something in flags, subject to intelligence and chance.

Parameters
spellsis the set of spells we're pruning
flagsis the set of object flags we're testing
pflagsis the set of player flags we're testing
elis what we know about the monster's elemental resists
r_ptris the monster type we're operating on

References effect, monster_spell::effect, monster_race::flags, effect::index, mon_spell_info::index, mon_spell_info_table, monster_spell_by_index(), effect::next, of_has, one_in_, effect::params, pf_has, randint0, element_info::res_level, rf_has, rsf_has, rsf_off, RST_BALL, RST_BOLT, RST_BREATH, timed_protect_flag(), and mon_spell_info::type.

Referenced by remove_bad_spells().