summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/spl-mis.h
diff options
context:
space:
mode:
authorzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2008-07-29 22:59:35 +0000
committerzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2008-07-29 22:59:35 +0000
commit63036c9e5ed0103475fea0c6710317f15e8cdb24 (patch)
treec6e731b631741fc069a6baeb80bf15c58458e9e0 /crawl-ref/source/spl-mis.h
parente744cede0540585248737db8e27a8320e5476955 (diff)
downloadcrawl-ref-63036c9e5ed0103475fea0c6710317f15e8cdb24.tar.gz
crawl-ref-63036c9e5ed0103475fea0c6710317f15e8cdb24.zip
Implemented monster spell miscasts. Spell miscasting is now handled
by the MiscastEffect class, which has helper methods to make most of the non-helper code agnostic with respect to whether the miscaster is the player or a monster. Mummy death curses now affect monsters, and Zot traps now directly affect friendly and good-neutral monsters. In wizard mode you can force the player or a monster to miscast by targeting it and pressing 'M'. Todo/issues/notes: * Clouds now have a killer_type in addition to a kill_category. * There aren't any divination monster miscast effects yet. * Many of the harmless message-only miscast effects are missing monster messages. * If a monster actually miscasts a spell (not getting a mummy death curse or setting off a Zot trap) and this kills both the monster and the player then the wrong monster will be listed in hiscore entry. Since monsters can't do true spell miscasts yet, this can wait. * There was old, non-functioning code making Zot traps heal, haste or turn invisible hostile monsters that triggered it. I fixed it and then commented it out. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6723 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/spl-mis.h')
-rw-r--r--crawl-ref/source/spl-mis.h126
1 files changed, 126 insertions, 0 deletions
diff --git a/crawl-ref/source/spl-mis.h b/crawl-ref/source/spl-mis.h
new file mode 100644
index 0000000000..ec6c06ff7e
--- /dev/null
+++ b/crawl-ref/source/spl-mis.h
@@ -0,0 +1,126 @@
+/*
+ * File: spl-mis.h
+ * Summary: Spell miscast class.
+ * Written by: Matthew Cline
+ *
+ * Modified for Crawl Reference by $Author$ on $Date: 2008-06-28 22:
+16:39 -0700 (Sat, 28 Jun 2008) $
+ *
+ * Change History (most recent first):
+ *
+ * <1> -/--/-- LRH Created
+ */
+
+#ifndef SPL_MIS_H
+#define SPL_MIS_H
+
+// last updated 23jul2008 {mpc}
+/* ***********************************************************************
+ * called from: decks - effects - fight - item_use - it_use2 - it_use3 -
+ * item_use - monstuff - religion - spells2 - spells4 -
+ * spl-book - spl-cast - traps - xom
+ * *********************************************************************** */
+
+#include "enum.h"
+
+#include "beam.h"
+#include "mpr.h"
+#include "spl-util.h"
+
+#define ZOT_TRAP_MISCAST (NON_MONSTER + 1)
+#define WIELD_MISCAST (NON_MONSTER + 2)
+#define MELEE_MISCAST (NON_MONSTER + 3)
+#define MISC_KNOWN_MISCAST (NON_MONSTER + 4)
+#define MISC_UNKNOWN_MISCAST (NON_MONSTER + 5)
+
+enum nothing_happens_when_type
+{
+ NH_DEFAULT,
+ NH_NEVER,
+ NH_ALWAYS
+};
+
+class actor;
+
+class MiscastEffect
+{
+public:
+ MiscastEffect(actor* _target, int _source, spell_type _spell, int _pow,
+ int _fail, std::string _cause = "",
+ nothing_happens_when_type _nothing_happens = NH_DEFAULT);
+ MiscastEffect(actor *_target, int _source, spschool_flag_type _school,
+ int _level, std::string _cause,
+ nothing_happens_when_type _nothing_happens = NH_DEFAULT);
+ MiscastEffect(actor *_target, int _source, spschool_flag_type _school,
+ int _pow, int _fail, std::string _cause,
+ nothing_happens_when_type _nothing_happens = NH_DEFAULT);
+
+ void do_miscast();
+
+private:
+ actor* target;
+ int source;
+
+ std::string cause;
+
+ spell_type spell;
+ spschool_flag_type school;
+
+ int pow;
+ int fail;
+ int level;
+
+private:
+ kill_category kc;
+ killer_type kt;
+
+ monsters* mon_target;
+ monsters* mon_source;
+
+ nothing_happens_when_type nothing_happens_when;
+
+ int kill_source;
+ actor* act_source;
+
+ bool source_known;
+ bool target_known;
+
+ bolt beam;
+
+ std::string all_msg;
+ std::string you_msg;
+ std::string mon_msg;
+ std::string mon_msg_seen;
+ std::string mon_msg_unseen;
+
+ msg_channel_type msg_ch;
+
+private:
+ void init();
+ std::string get_default_cause();
+
+ bool neither_end_silenced();
+
+ void do_msg(bool suppress_nothing_happens = false);
+ void _ouch(int dam, beam_type flavour = BEAM_NONE);
+ void _explosion();
+ void _potion_effect(int pot_eff, int pow);
+ bool _create_monster(monster_type what, int abj_deg, bool alert = false);
+ void send_abyss();
+
+ void _conjuration(int severity);
+ void _enchantment(int severity);
+ void _translocation(int severity);
+ void _summoning(int severity);
+ void _divination_you(int severity);
+ void _divination_mon(int severity);
+ void _necromancy(int severity);
+ void _transmigration(int severity);
+ void _fire(int severity);
+ void _ice(int severity);
+ void _earth(int severity);
+ void _air(int severity);
+ void _poison(int severity);
+};
+
+#endif