00001
00002
00003
00004
00005
00006
00007 #ifndef SPL_MISCAST_H
00008 #define SPL_MISCAST_H
00009
00010 #include "enum.h"
00011
00012 #include "beam.h"
00013 #include "monster.h"
00014 #include "mpr.h"
00015 #include "spl-util.h"
00016
00017 enum nothing_happens_when_type
00018 {
00019 NH_DEFAULT,
00020 NH_NEVER,
00021 NH_ALWAYS,
00022 };
00023
00024 class actor;
00025
00026 class MiscastEffect
00027 {
00028 public:
00029 MiscastEffect(actor* _target, int _source, spell_type _spell, int _pow,
00030 int _fail, std::string _cause = "",
00031 nothing_happens_when_type _nothing_happens = NH_DEFAULT,
00032 int _lethality_margin = 0,
00033 std::string _hand_str = "", bool _can_plural_hand = true);
00034 MiscastEffect(actor* _target, int _source, spschool_flag_type _school,
00035 int _level, std::string _cause,
00036 nothing_happens_when_type _nothing_happens = NH_DEFAULT,
00037 int _lethality_margin = 0,
00038 std::string _hand_str = "", bool _can_plural_hand = true);
00039 MiscastEffect(actor* _target, int _source, spschool_flag_type _school,
00040 int _pow, int _fail, std::string _cause,
00041 nothing_happens_when_type _nothing_happens = NH_DEFAULT,
00042 int _lethality_margin = 0,
00043 std::string _hand_str = "", bool _can_plural_hand = true);
00044
00045
00046 ~MiscastEffect();
00047
00048 void do_miscast();
00049
00050 private:
00051 actor* target;
00052 int source;
00053
00054 std::string cause;
00055
00056 spell_type spell;
00057 spschool_flag_type school;
00058
00059 int pow;
00060 int fail;
00061 int level;
00062
00063 private:
00064 kill_category kc;
00065 killer_type kt;
00066
00067 nothing_happens_when_type nothing_happens_when;
00068
00069 int lethality_margin;
00070
00071 std::string hand_str;
00072 bool can_plural_hand;
00073
00074 int kill_source;
00075 actor* act_source;
00076 actor* guilty;
00077
00078 bool source_known;
00079 bool target_known;
00080
00081 bolt beam;
00082
00083 std::string all_msg;
00084 std::string you_msg;
00085 std::string mon_msg;
00086 std::string mon_msg_seen;
00087 std::string mon_msg_unseen;
00088
00089 msg_channel_type msg_ch;
00090
00091 int sound_loudness;
00092
00093 int recursion_depth;
00094 bool did_msg;
00095
00096 private:
00097 void init();
00098 std::string get_default_cause(bool attribute_to_user) const;
00099
00100 monster* target_as_monster()
00101 {
00102 return dynamic_cast<monster* >(target);
00103 }
00104
00105 monster* source_as_monster()
00106 {
00107 return dynamic_cast<monster* >(act_source);
00108 }
00109
00110 bool neither_end_silenced();
00111
00112 void do_msg(bool suppress_nothing_happens = false);
00113 bool _ouch(int dam, beam_type flavour = BEAM_NONE);
00114 bool _explosion();
00115 bool _big_cloud(cloud_type cl_type, int cloud_pow, int size,
00116 int spread_rate = -1);
00117 bool _lose_stat(stat_type which_stat, int8_t stat_loss);
00118 void _potion_effect(potion_type pot_eff, int pot_pow);
00119 bool _create_monster(monster_type what, int abj_deg, bool alert = false);
00120 void send_abyss();
00121 void _do_poison(int amount);
00122
00123 bool avoid_lethal(int dam);
00124
00125 void _conjuration(int severity);
00126 void _enchantment(int severity);
00127 void _translocation(int severity);
00128 void _summoning(int severity);
00129 void _divination_you(int severity);
00130 void _divination_mon(int severity);
00131 void _necromancy(int severity);
00132 void _transmutation(int severity);
00133 void _fire(int severity);
00134 void _ice(int severity);
00135 void _earth(int severity);
00136 void _air(int severity);
00137 void _poison(int severity);
00138 };
00139
00140 #endif