summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/effects.cc
diff options
context:
space:
mode:
authordolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2009-01-26 10:54:40 +0000
committerdolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2009-01-26 10:54:40 +0000
commit7b6825cd2b530bb4d28df477160a2a81098dd3ac (patch)
tree0109ca3a403e20a0740d138af96f1bb9b189b887 /crawl-ref/source/effects.cc
parente3e36ce2ea5b8ed3082a9941efba79eab480d4f2 (diff)
downloadcrawl-ref-7b6825cd2b530bb4d28df477160a2a81098dd3ac.tar.gz
crawl-ref-7b6825cd2b530bb4d28df477160a2a81098dd3ac.zip
Clean up direct_effect().
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8786 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/effects.cc')
-rw-r--r--crawl-ref/source/effects.cc25
1 files changed, 13 insertions, 12 deletions
diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc
index 34f0cf3e3e..b228cbe87a 100644
--- a/crawl-ref/source/effects.cc
+++ b/crawl-ref/source/effects.cc
@@ -731,25 +731,26 @@ bool lose_stat(unsigned char which_stat, unsigned char stat_loss,
void direct_effect(monsters *source, spell_type spell,
bolt &pbolt, actor *defender)
{
- const bool mons_defender = defender->atype() == ACT_MONSTER;
- monsters *mdef = mons_defender? dynamic_cast<monsters*>(defender) : NULL;
+ monsters *def =
+ (defender->atype() == ACT_MONSTER) ? dynamic_cast<monsters*>(defender)
+ : NULL;
- if (mdef)
+ if (def)
{
// annoy the target
- behaviour_event(mdef, ME_ANNOY, monster_index(source));
+ behaviour_event(def, ME_ANNOY, monster_index(source));
}
-
int damage_taken = 0;
+
switch (spell)
{
case SPELL_SMITING:
- if (mons_defender)
- simple_monster_message(dynamic_cast<monsters*>(defender),
- " is smitten.");
+ if (def)
+ simple_monster_message(def, " is smitten.");
else
- mpr( "Something smites you!" );
+ mpr("Something smites you!");
+
pbolt.name = "smiting";
pbolt.flavour = BEAM_MISSILE;
pbolt.aux_source = "by divine providence";
@@ -757,7 +758,7 @@ void direct_effect(monsters *source, spell_type spell,
break;
case SPELL_BRAIN_FEED:
- if (!mons_defender)
+ if (!def)
{
// lose_stat() must come last {dlb}
if (one_chance_in(3)
@@ -778,8 +779,8 @@ void direct_effect(monsters *source, spell_type spell,
// apply damage and handle death, where appropriate {dlb}
if (damage_taken > 0)
{
- if (mdef)
- mdef->hurt(source, damage_taken);
+ if (def)
+ def->hurt(source, damage_taken);
else
ouch(damage_taken, pbolt.beam_source, KILLED_BY_BEAM,
pbolt.aux_source.c_str());