diff options
author | dolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-01-19 08:30:12 +0000 |
---|---|---|
committer | dolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-01-19 08:30:12 +0000 |
commit | 2e7a87cbd1a89c7025d80d847fef33816aed842d (patch) | |
tree | cbcc3b80d8dedc2108274e0ac55ae97b697d7a1c /crawl-ref/source | |
parent | 5343fcdfc6412ab198569a831cd06f5c808a19e3 (diff) | |
download | crawl-ref-2e7a87cbd1a89c7025d80d847fef33816aed842d.tar.gz crawl-ref-2e7a87cbd1a89c7025d80d847fef33816aed842d.zip |
Go back to using the special damage message for draining monsters in
melee attacks, as the previous way could result in out-of-sequence
messages. Keep the other message for draining beams and miscasts,
though.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8585 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source')
-rw-r--r-- | crawl-ref/source/externs.h | 6 | ||||
-rw-r--r-- | crawl-ref/source/fight.cc | 11 | ||||
-rw-r--r-- | crawl-ref/source/mon-util.cc | 6 | ||||
-rw-r--r-- | crawl-ref/source/player.cc | 2 |
4 files changed, 17 insertions, 8 deletions
diff --git a/crawl-ref/source/externs.h b/crawl-ref/source/externs.h index 52d570fec8..bc0bcbca8d 100644 --- a/crawl-ref/source/externs.h +++ b/crawl-ref/source/externs.h @@ -335,7 +335,7 @@ public: virtual bool can_safely_mutate() const = 0; virtual bool can_bleed() const = 0; virtual bool mutate() = 0; - virtual bool drain_exp(actor *agent) = 0; + virtual bool drain_exp(actor *agent, bool quiet = false) = 0; virtual void rot(actor *agent, int amount, int immediate = 0) = 0; virtual int hurt(const actor *attacker, int amount, beam_type flavour = BEAM_MISSILE, @@ -1075,7 +1075,7 @@ public: void slow_down(actor *, int str); void confuse(actor *, int strength); void heal(int amount, bool max_too = false); - bool drain_exp(actor *); + bool drain_exp(actor *, bool quiet = false); void rot(actor *, int amount, int immediate = 0); int hurt(const actor *attacker, int amount, beam_type flavour = BEAM_MISSILE, @@ -1507,7 +1507,7 @@ public: void petrify(actor *, int str); void slow_down(actor *, int str); void confuse(actor *, int strength); - bool drain_exp(actor *); + bool drain_exp(actor *, bool quiet = false); void rot(actor *, int amount, int immediate = 0); int hurt(const actor *attacker, int amount, beam_type flavour = BEAM_MISSILE, diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc index 662a51f259..adb65edeff 100644 --- a/crawl-ref/source/fight.cc +++ b/crawl-ref/source/fight.cc @@ -2056,10 +2056,19 @@ void melee_attack::drain_defender() special_damage = 1 + random2(damage_done) / (2 + defender->res_negative_energy()); - if (defender->drain_exp(attacker)) + if (defender->drain_exp(attacker, true)) { if (defender->atype() == ACT_PLAYER) obvious_effect = true; + else if (defender_visible) + { + special_damage_message = + make_stringf( + "%s %s %s!", + atk_name(DESC_CAP_THE).c_str(), + attacker->conj_verb("drain").c_str(), + def_name(DESC_NOCAP_THE).c_str()); + } attacker->god_conduct(DID_NECROMANCY, 2); } diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc index 302a186bd5..9ece9a4b53 100644 --- a/crawl-ref/source/mon-util.cc +++ b/crawl-ref/source/mon-util.cc @@ -5893,12 +5893,12 @@ god_type monsters::deity() const return (god); } -bool monsters::drain_exp(actor *agent) +bool monsters::drain_exp(actor *agent, bool quiet) { if (x_chance_in_y(res_negative_energy(), 3)) return (false); - if (mons_near(this) && player_monster_visible(this)) + if (!quiet && mons_near(this) && player_monster_visible(this)) mprf("%s is drained!", name(DESC_CAP_THE).c_str()); hurt(agent, 2 + random2(3), BEAM_NEG); @@ -6354,7 +6354,7 @@ void monsters::add_enchantment_effect(const mon_enchant &ench, bool quiet) case ENCH_SUBMERGED: // XXX: What if the monster was invisible before submerging? - if (mons_near(this) && !quiet) + if (!quiet && mons_near(this)) { if (type == MONS_AIR_ELEMENTAL) { diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc index eebf92f4e6..a5c1eaff1a 100644 --- a/crawl-ref/source/player.cc +++ b/crawl-ref/source/player.cc @@ -7007,7 +7007,7 @@ void player::rot(actor *who, int amount, int immediate) disease_player(50 + random2(100)); } -bool player::drain_exp(actor *who) +bool player::drain_exp(actor *who, bool quiet) { return (::drain_exp()); } |