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 rsf_has(f, flag)   flag_has_dbg(f, RSF_SIZE, flag, #f, #flag)
 Macros. More...
 
#define rsf_next(f, flag)   flag_next(f, RSF_SIZE, flag)
 
#define rsf_count(f)   flag_count(f, RSF_SIZE)
 
#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_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. More...
 

Enumerations

enum  mon_spell_type {
  RST_NONE = 0x000, 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, RST_INNATE = 0x400
}
 Variables. More...
 

Functions

int breath_dam (int element, int hp)
 Functions. More...
 
const struct monster_spellmonster_spell_by_index (int index)
 
void do_mon_spell (int index, struct monster *mon, bool seen)
 Process a monster spell. More...
 
bool test_spells (bitflag *f, int types)
 Test a spell bitflag for a type of spell. More...
 
void ignore_spells (bitflag *f, int types)
 Set a spell bitflag to ignore a specific set of spell types. More...
 
int best_spell_power (const struct monster_race *race, int resist)
 Calculate a monster's maximum spell power. More...
 
void unset_spells (bitflag *spells, bitflag *flags, bitflag *pflags, struct element_info *el, const struct monster_race *race)
 Turn off spells with a side effect or a proj_type that is resisted by something in flags, subject to intelligence and chance. More...
 
bool mon_spell_is_innate (int index)
 
void create_mon_spell_mask (bitflag *f,...)
 Create a mask of monster spell flags of a specific type. More...
 
const char * mon_spell_lore_description (int index)
 
int mon_spell_lore_damage (int index, const struct 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 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_copy (   f1,
  f2 
)    flag_copy(f1, f2, RSF_SIZE)
#define rsf_count (   f)    flag_count(f, RSF_SIZE)
#define rsf_diff (   f1,
  f2 
)    flag_diff(f1, f2, RSF_SIZE)

Referenced by lore_append_spells().

#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)
#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)

Referenced by create_mon_spell_mask().

Enumeration Type Documentation

Variables.

Constants

Enumerator
RST_NONE 
RST_BOLT 
RST_BALL 
RST_BREATH 
RST_ATTACK 
RST_ANNOY 
RST_HASTE 
RST_HEAL 
RST_TACTIC 
RST_ESCAPE 
RST_SUMMON 
RST_INNATE 

Function Documentation

int best_spell_power ( const struct monster_race race,
int  resist 
)

Calculate a monster's maximum spell power.

Parameters
raceis 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, MAX, MAXIMISE, mon_hp(), mon_spell_dam(), mon_spell_types, monster_spell_by_index(), monster_spell_is_projectable(), effect::params, monster_spell::power, rsf_has, monster_spell::save_message, random::sides, and monster_race::spell_flags.

int breath_dam ( int  type,
int  hp 
)

Functions.

Functions.

Parameters
typeis the attack element type
hpis the monster's hp

References projection::damage_cap, projection::divisor, projections, and type.

Referenced by effect_handler_BREATH(), and mon_spell_dam().

void create_mon_spell_mask ( bitflag f,
  ... 
)

Create a mask of monster spell flags of a specific type.

Parameters
fis the flag array we're filling
...is the list of flags we're looking for

N.B. RST_NONE must be the last item in the ... list

References args, i, mon_spell_info::index, mon_spell_types, rsf_on, rsf_wipe, RST_NONE, and mon_spell_info::type.

Referenced by lore_append_spells().

void do_mon_spell ( int  index,
struct monster mon,
bool  seen 
)

Process a monster spell.

Parameters
indexis the monster spell flag (RSF_FOO)
monis the attacking monster
seenis whether the player can see the monster at this moment

References check_hit(), CONF_HIT_REDUCTION, disturb(), monster_spell::effect, effect_do(), monster_spell::hit, monster_race::level, monster::m_timed, MAX, monster::midx, monster_spell_by_index(), msg, NULL, monster::race, randint0, monster_spell::save_message, SKILL_SAVE, player_state::skills, source_monster(), spell_message(), and player::state.

Referenced by make_attack_spell().

void ignore_spells ( bitflag f,
int  types 
)

Set a spell bitflag to ignore a specific set of spell types.

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

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

Referenced by make_attack_spell().

bool mon_spell_is_innate ( int  index)
int mon_spell_lore_damage ( int  index,
const struct monster_race race,
bool  know_hp 
)
const char* mon_spell_lore_description ( int  index)
const struct monster_spell* monster_spell_by_index ( int  index)
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 mon_spell_info::index, mon_spell_types, rsf_has, and mon_spell_info::type.

Referenced by make_attack_spell().

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

Turn off spells with a side effect or a proj_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
raceis the monster type we're operating on

References monster_spell::effect, timed_effect_data::fail, monster_race::flags, effect::index, mon_spell_info::index, mon_spell_types, 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_effects, and mon_spell_info::type.

Referenced by remove_bad_spells().