From 9048012f07dd5c68f164e6bb213d8d5471fbaa14 Mon Sep 17 00:00:00 2001 From: haranp Date: Thu, 29 Nov 2007 15:49:47 +0000 Subject: Added Spark card. Added more pain effects. Breaks Nemelexite saves. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2933 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/spells4.cc | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) (limited to 'crawl-ref/source/spells4.cc') diff --git a/crawl-ref/source/spells4.cc b/crawl-ref/source/spells4.cc index 9e361bc07e..f5fd7c9271 100644 --- a/crawl-ref/source/spells4.cc +++ b/crawl-ref/source/spells4.cc @@ -693,25 +693,30 @@ void cast_conjure_ball_lightning( int pow ) static int sleep_monsters(int x, int y, int pow, int garbage) { UNUSED( garbage ); - int mnstr = mgrd[x][y]; + const int mnstr = mgrd[x][y]; - if (mnstr == NON_MONSTER) return 0; - if (mons_holiness(&menv[mnstr]) != MH_NATURAL) return 0; - if (check_mons_resist_magic( &menv[mnstr], pow )) return 0; + if (mnstr == NON_MONSTER) + return 0; + + monsters& mon = menv[mnstr]; + + if (mons_holiness(&mon) != MH_NATURAL) + return 0; + if (check_mons_resist_magic( &mon, pow )) + return 0; - // Why shouldn't we be able to sleep friendly monsters? -- bwr - // if (mons_friendly( &menv[mnstr] )) return 0; + // works on friendlies too, so no check for that //jmf: now that sleep == hibernation: - if (mons_res_cold( &menv[mnstr] ) > 0 && coinflip()) + if (mons_res_cold( &mon ) > 0 && coinflip()) return 0; - if (menv[mnstr].has_ench(ENCH_SLEEP_WARY)) + if (mon.has_ench(ENCH_SLEEP_WARY)) return 0; - menv[mnstr].put_to_sleep(); + mon.put_to_sleep(); - if (mons_class_flag( menv[mnstr].type, M_COLD_BLOOD ) && coinflip()) - menv[mnstr].add_ench(ENCH_SLOW); + if (mons_class_flag( mon.type, M_COLD_BLOOD ) && coinflip()) + mon.add_ench(ENCH_SLOW); return 1; } // end sleep_monsters() -- cgit v1.2.3-54-g00ecf