From 56f8c2bfbc13fa45a7b0b7f3210e16e61227143f Mon Sep 17 00:00:00 2001 From: haranp Date: Sat, 10 Jan 2009 12:51:04 +0000 Subject: Code cleanups again, fix Twist. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8379 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/spells3.cc | 57 +++++++++++++++++++++++---------------------- 1 file changed, 29 insertions(+), 28 deletions(-) (limited to 'crawl-ref/source/spells3.cc') diff --git a/crawl-ref/source/spells3.cc b/crawl-ref/source/spells3.cc index 4af107569f..93cee741c4 100644 --- a/crawl-ref/source/spells3.cc +++ b/crawl-ref/source/spells3.cc @@ -184,43 +184,44 @@ bool detect_curse(bool suppress_msg) return (success); } -int cast_smiting(int power, dist &beam) +bool cast_smiting(int power, const coord_def& where) { - bool success = false; - - if (mgrd(beam.target) == NON_MONSTER || beam.isMe) - canned_msg(MSG_SPELL_FIZZLES); - else + if (invalid_monster_index(mgrd(where))) { - monsters *monster = &menv[mgrd(beam.target)]; + mpr("There's nothing there!"); + // Counts as a real cast, due to victory-dancing and + // invisible/submerged monsters. + return (true); + } - god_conduct_trigger conducts[3]; - disable_attack_conducts(conducts); + monsters& m = menv[mgrd(where)]; - success = !stop_attack_prompt(monster, false, false); + god_conduct_trigger conducts[3]; + disable_attack_conducts(conducts); - if (success) - { - set_attack_conducts(conducts, monster); + const bool success = !stop_attack_prompt(&m, false, false); - mprf("You smite %s!", monster->name(DESC_NOCAP_THE).c_str()); + if (success) + { + set_attack_conducts(conducts, &m); - behaviour_event(monster, ME_ANNOY, MHITYOU); - if (mons_is_mimic(monster->type)) - mimic_alert(monster); - } + mprf("You smite %s!", m.name(DESC_NOCAP_THE).c_str()); - enable_attack_conducts(conducts); + behaviour_event(&m, ME_ANNOY, MHITYOU); + if (mons_is_mimic(m.type)) + mimic_alert(&m); + } - if (success) - { - // Maxes out at around 40 damage at 27 Invocations, which is - // plenty in my book (the old max damage was around 70, - // which seems excessive). - monster->hurt(&you, 7 + (random2(power) * 33 / 191)); - if (monster->alive()) - print_wounds(monster); - } + enable_attack_conducts(conducts); + + if (success) + { + // Maxes out at around 40 damage at 27 Invocations, which is + // plenty in my book (the old max damage was around 70, + // which seems excessive). + m.hurt(&you, 7 + (random2(power) * 33 / 191)); + if (m.alive()) + print_wounds(&m); } return (success); -- cgit v1.2.3-54-g00ecf