00001
00002
00003
00004
00005
00006
00007
00008 #ifndef SPL_CAST_H
00009 #define SPL_CAST_H
00010
00011 #include "enum.h"
00012
00013 enum spflag_type
00014 {
00015 SPFLAG_NONE = 0x000000,
00016 SPFLAG_DIR_OR_TARGET = 0x000001,
00017 SPFLAG_TARGET = 0x000002,
00018 SPFLAG_GRID = 0x000004,
00019 SPFLAG_DIR = 0x000008,
00020 SPFLAG_TARG_OBJ = 0x000010,
00021 SPFLAG_TARGETING_MASK = 0x00001f,
00022 SPFLAG_HELPFUL = 0x000020,
00023 SPFLAG_NEUTRAL = 0x000040,
00024 SPFLAG_NOT_SELF = 0x000080,
00025 SPFLAG_UNHOLY = 0x000100,
00026 SPFLAG_UNCLEAN = 0x000200,
00027 SPFLAG_CHAOTIC = 0x000400,
00028 SPFLAG_HASTY = 0x000800,
00029 SPFLAG_MAPPING = 0x001000,
00030 SPFLAG_ESCAPE = 0x002000,
00031 SPFLAG_RECOVERY = 0x004000,
00032 SPFLAG_AREA = 0x008000,
00033 SPFLAG_BATTLE = 0x010000,
00034
00035 SPFLAG_CARD = 0x020000,
00036 SPFLAG_MONSTER = 0x040000,
00037 SPFLAG_INNATE = 0x080000,
00038
00039 SPFLAG_NOISY = 0x100000,
00040 SPFLAG_TESTING = 0x200000,
00041 SPFLAG_CORPSE_VIOLATING = 0x400000,
00042 SPFLAG_ALLOW_SELF = 0x800000,
00043
00044 };
00045
00046 enum spret_type
00047 {
00048 SPRET_ABORT = 0,
00049 SPRET_FAIL,
00050 SPRET_SUCCESS,
00051 SPRET_NONE,
00052 };
00053
00054 typedef bool (*spell_selector)(spell_type spell);
00055
00056 int list_spells(bool toggle_with_I = true, bool viewing = false,
00057 int minRange = -1, spell_selector selector = NULL);
00058 int spell_fail(spell_type spell);
00059 int calc_spell_power(spell_type spell, bool apply_intel,
00060 bool fail_rate_chk = false, bool cap_power = true,
00061 bool rod = false);
00062 int calc_spell_range(spell_type spell, int power = 0,
00063 bool real_cast = false, bool rod = false);
00064 int spell_enhancement(unsigned int typeflags);
00065
00066 bool cast_a_spell(bool check_range, spell_type spell = SPELL_NO_SPELL);
00067
00068 void maybe_identify_staff(item_def &item);
00069
00070 void inspect_spells();
00071 void do_cast_spell_cmd(bool force);
00072
00073 spret_type your_spells(spell_type spell, int powc = 0, bool allow_fail = true,
00074 bool check_range = true, int range_power = 0);
00075
00076 const char* failure_rate_to_string(int fail);
00077
00078 int spell_power_colour(spell_type spell);
00079 int spell_power_bars(spell_type spell, bool rod);
00080 std::string spell_power_string(spell_type spell, bool rod = false);
00081 std::string spell_range_string(spell_type spell, bool rod = false);
00082 std::string spell_schools_string(spell_type spell);
00083 const char* spell_hunger_string(spell_type spell, bool rod = false);
00084 std::string spell_noise_string(spell_type spell);
00085
00086 bool is_prevented_teleport(spell_type spell);
00087
00088 bool spell_is_uncastable(spell_type spell, std::string &message);
00089
00090 #endif