summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--crawl-ref/source/externs.h4
-rw-r--r--crawl-ref/source/fight.cc3
-rw-r--r--crawl-ref/source/mon-util.cc4
3 files changed, 7 insertions, 4 deletions
diff --git a/crawl-ref/source/externs.h b/crawl-ref/source/externs.h
index ed86c042b7..b6e6e2bf18 100644
--- a/crawl-ref/source/externs.h
+++ b/crawl-ref/source/externs.h
@@ -126,7 +126,7 @@ public:
// Need not be implemented for the player - player action costs
// are explicitly calculated.
- virtual void lose_energy(energy_use_type)
+ virtual void lose_energy(energy_use_type, int div = 1, int mult = 1)
{
}
@@ -1091,7 +1091,7 @@ public:
bool del_ench(enchant_type ench, bool quiet = false, bool effect = true);
bool lose_ench_duration(const mon_enchant &e, int levels);
bool lose_ench_levels(const mon_enchant &e, int lev);
- void lose_energy(energy_use_type et);
+ void lose_energy(energy_use_type et, int div = 1, int mult = 1);
void scale_hp(int num, int den);
bool gain_exp(int exp);
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);
}
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc
index edd906743f..1c1d7fb53b 100644
--- a/crawl-ref/source/mon-util.cc
+++ b/crawl-ref/source/mon-util.cc
@@ -5860,9 +5860,9 @@ int monsters::action_energy(energy_use_type et) const
return 10;
}
-void monsters::lose_energy(energy_use_type et)
+void monsters::lose_energy(energy_use_type et, int div, int mult)
{
- speed_increment -= action_energy(et);
+ speed_increment -= div_round_up(mult * action_energy(et), div);
}
static inline monster_type _royal_jelly_ejectable_monster()