summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/misc.cc
diff options
context:
space:
mode:
authorharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2009-01-13 15:46:45 +0000
committerharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2009-01-13 15:46:45 +0000
commitc32244f1ca9dfacd55040e1a61c3ff6c5c1ab4d5 (patch)
treead68b92ce822cad4a7ba541282afdeba6b7fd9c4 /crawl-ref/source/misc.cc
parentd436eeaf8f01d5e9b0476254171b6a0bcc2c403d (diff)
downloadcrawl-ref-c32244f1ca9dfacd55040e1a61c3ff6c5c1ab4d5.tar.gz
crawl-ref-c32244f1ca9dfacd55040e1a61c3ff6c5c1ab4d5.zip
Remove atk and def from melee_attack.
Rewrite some code to use actor methods instead of calling things directly. In theory, attacker_as_monster() and defender_as_monster() are hacks; any calls to them that can be replaced by calls to actor methods should be. Fix some inconsistencies with monster bleeding and summoned creatures. (This should probably go into actor::can_bleed().) git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8444 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/misc.cc')
-rw-r--r--crawl-ref/source/misc.cc38
1 files changed, 10 insertions, 28 deletions
diff --git a/crawl-ref/source/misc.cc b/crawl-ref/source/misc.cc
index 65ad96c77b..0befb1a692 100644
--- a/crawl-ref/source/misc.cc
+++ b/crawl-ref/source/misc.cc
@@ -1102,31 +1102,6 @@ void split_potions_into_decay( int obj, int amount, bool need_msg )
dec_inv_item_quantity(obj, amount);
}
-// Checks whether the player or a monster is capable of bleeding.
-bool victim_can_bleed(int montype)
-{
- if (montype == -1) // player
- {
- if (you.is_undead && (you.species != SP_VAMPIRE
- || you.hunger_state <= HS_SATIATED))
- {
- return (false);
- }
-
- int tran = you.attribute[ATTR_TRANSFORMATION];
- if (tran == TRAN_STATUE || tran == TRAN_ICE_BEAST
- || tran == TRAN_AIR || tran == TRAN_LICH
- || tran == TRAN_SPIDER) // Monster spiders don't bleed either.
- {
- return (false);
- }
- return (true);
- }
-
- // Now check monsters.
- return (mons_has_blood(montype));
-}
-
static bool allow_bleeding_on_square(const coord_def& where)
{
// No bleeding onto sanctuary ground, please.
@@ -1197,9 +1172,16 @@ void bleed_onto_floor(const coord_def& where, int montype,
int damage, bool spatter, bool smell_alert)
{
ASSERT(in_bounds(where));
- if (!victim_can_bleed(montype))
+ if (montype == -1 && !you.can_bleed())
return;
-
+ if (montype != -1)
+ {
+ monsters m;
+ m.type = montype;
+ if (!m.can_bleed())
+ return;
+ }
+
_maybe_bloodify_square(where, damage, spatter, smell_alert);
}
@@ -3106,7 +3088,7 @@ bool stop_attack_prompt(const monsters *mon, bool beam_attack,
const bool wontAttack = mons_wont_attack(mon);
const bool isFriendly = mons_friendly(mon);
const bool isNeutral = mons_neutral(mon);
- const bool isUnchivalric = is_unchivalric_attack(&you, mon, mon);
+ const bool isUnchivalric = is_unchivalric_attack(&you, mon);
const bool isHoly = mons_is_holy(mon);
if (isFriendly)