From 63036c9e5ed0103475fea0c6710317f15e8cdb24 Mon Sep 17 00:00:00 2001 From: zelgadis Date: Tue, 29 Jul 2008 22:59:35 +0000 Subject: 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 --- crawl-ref/source/spells1.cc | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'crawl-ref/source/spells1.cc') diff --git a/crawl-ref/source/spells1.cc b/crawl-ref/source/spells1.cc index e7d1d3715b..4164092c1f 100644 --- a/crawl-ref/source/spells1.cc +++ b/crawl-ref/source/spells1.cc @@ -537,7 +537,7 @@ bool conjure_flame(int pow) mpr( "The fire roars with new energy!" ); const int extra_dur = 2 + std::min(random2(pow) / 2, 20); env.cloud[cloud].decay += extra_dur * 5; - env.cloud[cloud].whose = KC_YOU; + env.cloud[cloud].set_whose(KC_YOU); return (true); } @@ -607,9 +607,23 @@ int cast_big_c(int pow, cloud_type cty, kill_category whose, bolt &beam) void big_cloud(cloud_type cl_type, kill_category whose, int cl_x, int cl_y, int pow, int size, int spread_rate) +{ + big_cloud(cl_type, whose, cloud_struct::whose_to_killer(whose), + cl_x, cl_y, pow, size, spread_rate); +} + +void big_cloud(cloud_type cl_type, killer_type killer, + int cl_x, int cl_y, int pow, int size, int spread_rate) +{ + big_cloud(cl_type, cloud_struct::killer_to_whose(killer), killer, + cl_x, cl_y, pow, size, spread_rate); +} + +void big_cloud(cloud_type cl_type, kill_category whose, killer_type killer, + int cl_x, int cl_y, int pow, int size, int spread_rate) { apply_area_cloud(make_a_normal_cloud, cl_x, cl_y, pow, size, - cl_type, whose, spread_rate); + cl_type, whose, killer, spread_rate); } static bool _mons_hostile(const monsters *mon) -- cgit v1.2.3-54-g00ecf