summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/beam.cc
diff options
context:
space:
mode:
authorStefan O'Rear <stefanor@cox.net>2009-11-08 03:54:06 -0800
committerStefan O'Rear <stefanor@cox.net>2009-11-08 03:54:06 -0800
commit4c4e2fa2602e51e4180086845ff9d28885f3e7ac (patch)
treeeee1262ebefb384fa8f05c5ae625d0cca925d360 /crawl-ref/source/beam.cc
parent53585ee588425a47f6536bd0fc051f33ff6485b1 (diff)
downloadcrawl-ref-4c4e2fa2602e51e4180086845ff9d28885f3e7ac.tar.gz
crawl-ref-4c4e2fa2602e51e4180086845ff9d28885f3e7ac.zip
Fix message order when training shields on a miss
Diffstat (limited to 'crawl-ref/source/beam.cc')
-rw-r--r--crawl-ref/source/beam.cc18
1 files changed, 12 insertions, 6 deletions
diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc
index 8700f19f9f..e8b4cdceb8 100644
--- a/crawl-ref/source/beam.cc
+++ b/crawl-ref/source/beam.cc
@@ -3630,6 +3630,8 @@ bool bolt::misses_player()
if (!is_beam && !is_blockable())
return (false);
+ bool train_shields_more = false;
+
if (is_blockable()
&& you.shield()
&& !aimed_at_feet
@@ -3665,19 +3667,18 @@ bool bolt::misses_player()
}
// Some training just for the "attempt".
- if (coinflip())
- exercise(SK_SHIELDS, one_chance_in(3) ? 1 : 0);
+ train_shields_more = true;
}
if (player_light_armour(true) && !aimed_at_feet && coinflip())
exercise(SK_DODGING, 1);
defer_rand r;
+ bool miss = true;
if (!_test_beam_hit(real_tohit, dodge, is_beam, false, false, r))
{
mprf("The %s misses you.", name.c_str());
- return (true);
}
else if ((you.duration[DUR_REPEL_MISSILES]
|| player_mutation_level(MUT_REPULSION_FIELD) == 3
@@ -3685,17 +3686,22 @@ bool bolt::misses_player()
&& !_test_beam_hit(real_tohit, dodge, is_beam, false, true, r))
{
mprf("The %s is repelled.", name.c_str());
- return (true);
}
else if (you.duration[DUR_DEFLECT_MISSILES]
&& !_test_beam_hit(real_tohit, dodge, is_beam, true, true, r))
{
// active voice to imply stronger effect
mprf("You deflect the %s!", name.c_str());
- return (true);
+ }
+ else
+ {
+ miss = false;
}
- return (false);
+ if (coinflip() && train_shields_more)
+ exercise(SK_SHIELDS, one_chance_in(3) ? 1 : 0);
+
+ return (miss);
}
void bolt::affect_player_enchantment()