summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/spells3.cc
diff options
context:
space:
mode:
authorharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2009-01-10 12:51:04 +0000
committerharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2009-01-10 12:51:04 +0000
commit56f8c2bfbc13fa45a7b0b7f3210e16e61227143f (patch)
tree21fc15eb6949022ec5c4032c04a6fe045690d6a2 /crawl-ref/source/spells3.cc
parentdb5b5c9c29fa2e7fd3fb668b01fa96b92cc8d84b (diff)
downloadcrawl-ref-56f8c2bfbc13fa45a7b0b7f3210e16e61227143f.tar.gz
crawl-ref-56f8c2bfbc13fa45a7b0b7f3210e16e61227143f.zip
Code cleanups again, fix Twist.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8379 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/spells3.cc')
-rw-r--r--crawl-ref/source/spells3.cc57
1 files changed, 29 insertions, 28 deletions
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);