diff options
author | zelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-07-29 22:59:35 +0000 |
---|---|---|
committer | zelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-07-29 22:59:35 +0000 |
commit | 63036c9e5ed0103475fea0c6710317f15e8cdb24 (patch) | |
tree | c6e731b631741fc069a6baeb80bf15c58458e9e0 /crawl-ref/source/spells4.cc | |
parent | e744cede0540585248737db8e27a8320e5476955 (diff) | |
download | crawl-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/spells4.cc')
-rw-r--r-- | crawl-ref/source/spells4.cc | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/crawl-ref/source/spells4.cc b/crawl-ref/source/spells4.cc index 3cd219f7ff..4c7cdf143f 100644 --- a/crawl-ref/source/spells4.cc +++ b/crawl-ref/source/spells4.cc @@ -51,7 +51,7 @@ #include "skills.h" #include "spells1.h" #include "spells4.h" -#include "spl-cast.h" +#include "spl-mis.h" #include "spl-util.h" #include "stuff.h" #include "terrain.h" @@ -887,13 +887,13 @@ static int _distortion_monsters(coord_def where, int pow, int message) { if (you.skills[SK_TRANSLOCATIONS] < random2(8)) { - miscast_effect( SPTYP_TRANSLOCATION, pow / 9 + 1, pow, 100, - "cast bend on self" ); + MiscastEffect( &you, NON_MONSTER, SPTYP_TRANSLOCATION, + pow / 9 + 1, pow, "cast bend on self" ); } else { - miscast_effect( SPTYP_TRANSLOCATION, 1, 1, 100, - "cast bend on self" ); + MiscastEffect( &you, NON_MONSTER, SPTYP_TRANSLOCATION, 1, 1, + "cast bend on self" ); } return 1; @@ -1079,11 +1079,15 @@ static int _make_a_rot_cloud(const coord_def& where, int pow, cloud_type ctype) } int make_a_normal_cloud(int x, int y, int pow, int spread_rate, - cloud_type ctype, kill_category whose) + cloud_type ctype, kill_category whose, + killer_type killer) { + if (killer == KILL_NONE) + killer = cloud_struct::whose_to_killer(whose); + place_cloud( ctype, coord_def(x, y), (3 + random2(pow / 4) + random2(pow / 4) + random2(pow / 4)), - whose, spread_rate ); + whose, killer, spread_rate ); return 1; } @@ -1681,7 +1685,7 @@ void do_monster_rot(int mon) if (mons_holiness(&menv[mon]) == MH_UNDEAD && !one_chance_in(5)) { apply_area_cloud(make_a_normal_cloud, menv[mon].x, menv[mon].y, - 10, 1, CLOUD_MIASMA, KC_YOU); + 10, 1, CLOUD_MIASMA, KC_YOU, KILL_YOU_MISSILE); } player_hurt_monster( mon, damage ); |