1 /** 2 * \file mon-spell.h 3 * \brief structures and functions for monster spells 4 * 5 * Copyright (c) 2011 Chris Carr 6 * 7 * This work is free software; you can redistribute it and/or modify it 8 * under the terms of either: 9 * 10 * a) the GNU General Public License as published by the Free Software 11 * Foundation, version 2, or 12 * 13 * b) the "Angband licence": 14 * This software may be copied and distributed for educational, research, 15 * and not for profit purposes provided that this copyright and statement 16 * are included in all such copies. Other copyrights may also apply. 17 */ 18 19 #ifndef MONSTER_SPELL_H 20 #define MONSTER_SPELL_H 21 22 #include "monster.h" 23 24 /** Variables **/ 25 /* none so far */ 26 27 /** Constants **/ 28 29 /* Spell type bitflags */ 30 enum mon_spell_type { 31 RST_NONE = 0x0000, 32 RST_BOLT = 0x0001, 33 RST_BALL = 0x0002, /* Ball spells, but also beams */ 34 RST_BREATH = 0x0004, 35 RST_DIRECT = 0x0008, /* Direct (non-projectable) attacks */ 36 RST_ANNOY = 0x0010, /* Irritant spells, usually non-fatal */ 37 RST_HASTE = 0x0020, /* Relative speed advantage */ 38 RST_HEAL = 0x0040, 39 RST_HEAL_OTHER = 0x0080, 40 RST_TACTIC = 0x0100, /* Get a better position */ 41 RST_ESCAPE = 0x0200, 42 RST_SUMMON = 0x0400, 43 RST_INNATE = 0x0800, 44 RST_ARCHERY = 0x1000 45 }; 46 47 #define RST_DAMAGE (RST_BOLT | RST_BALL | RST_BREATH | RST_DIRECT) 48 49 /** Macros **/ 50 #define rsf_has(f, flag) flag_has_dbg(f, RSF_SIZE, flag, #f, #flag) 51 #define rsf_next(f, flag) flag_next(f, RSF_SIZE, flag) 52 #define rsf_count(f) flag_count(f, RSF_SIZE) 53 #define rsf_is_empty(f) flag_is_empty(f, RSF_SIZE) 54 #define rsf_is_full(f) flag_is_full(f, RSF_SIZE) 55 #define rsf_is_inter(f1, f2) flag_is_inter(f1, f2, RSF_SIZE) 56 #define rsf_is_subset(f1, f2) flag_is_subset(f1, f2, RSF_SIZE) 57 #define rsf_is_equal(f1, f2) flag_is_equal(f1, f2, RSF_SIZE) 58 #define rsf_on(f, flag) flag_on_dbg(f, RSF_SIZE, flag, #f, #flag) 59 #define rsf_off(f, flag) flag_off(f, RSF_SIZE, flag) 60 #define rsf_wipe(f) flag_wipe(f, RSF_SIZE) 61 #define rsf_setall(f) flag_setall(f, RSF_SIZE) 62 #define rsf_negate(f) flag_negate(f, RSF_SIZE) 63 #define rsf_copy(f1, f2) flag_copy(f1, f2, RSF_SIZE) 64 #define rsf_union(f1, f2) flag_union(f1, f2, RSF_SIZE) 65 #define rsf_inter(f1, f2) flag_inter(f1, f2, RSF_SIZE) 66 #define rsf_diff(f1, f2) flag_diff(f1, f2, RSF_SIZE) 67 68 69 /** Functions **/ 70 int breath_dam(int element, int hp); 71 const struct monster_spell *monster_spell_by_index(int index); 72 void do_mon_spell(int index, struct monster *mon, bool seen); 73 bool test_spells(bitflag *f, int types); 74 void ignore_spells(bitflag *f, int types); 75 void unset_spells(bitflag *spells, bitflag *flags, bitflag *pflags, 76 struct element_info *el, const struct monster *mon); 77 bool mon_spell_is_innate(int index); 78 void create_mon_spell_mask(bitflag *f, ...); 79 const char *mon_spell_lore_description(int index, 80 const struct monster_race *race); 81 int mon_spell_lore_damage(int index, const struct monster_race *race, 82 bool know_hp); 83 84 #endif /* MONSTER_SPELL_H */ 85