summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/fight.cc
diff options
context:
space:
mode:
authorzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2008-05-26 03:16:36 +0000
committerzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2008-05-26 03:16:36 +0000
commit14752e5f2cfddc5b99a104afe1c8d42a74aff22b (patch)
tree2130bf2a7e0dbf113651cc57a4ec9c455b67b253 /crawl-ref/source/fight.cc
parent091176830cb955eb4de98b900b7c6fa74e987309 (diff)
downloadcrawl-ref-14752e5f2cfddc5b99a104afe1c8d42a74aff22b.tar.gz
crawl-ref-14752e5f2cfddc5b99a104afe1c8d42a74aff22b.zip
monsters::lose_energy() now takes optional paramaters to multiply and/or
divide (rounded up) the amount of energy lost. When a monster's attack is warded off the energy consumed is half that of what the attack would normally have taken, a change from it not taking any energy at all. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5249 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/fight.cc')
-rw-r--r--crawl-ref/source/fight.cc3
1 files changed, 3 insertions, 0 deletions
diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc
index 8a26e078f8..7228295e86 100644
--- a/crawl-ref/source/fight.cc
+++ b/crawl-ref/source/fight.cc
@@ -3888,6 +3888,9 @@ bool melee_attack::mons_perform_attack()
if (attacker != defender && mons_attack_warded_off())
{
+ // A warded-off attack takes half the normal energy.
+ attacker->lose_energy(EUT_ATTACK, 2);
+
perceived_attack = true;
return (false);
}