From 30712a6f0906f3127c49989219c1077a81336c6c Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Fri, 28 Mar 2008 12:18:36 +0000 Subject: Implement FR 1911470: DVORP type influences chance of spattering blood This is currently purely cosmetical, but there are a lot of ideas out there how to make blood have an effect. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3910 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/fight.cc | 44 +++++++++++++++++++++++++++++++++++++++----- 1 file changed, 39 insertions(+), 5 deletions(-) (limited to 'crawl-ref/source/fight.cc') diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc index 11dffcecb7..62a4c9f76b 100644 --- a/crawl-ref/source/fight.cc +++ b/crawl-ref/source/fight.cc @@ -562,6 +562,38 @@ bool melee_attack::attack() mons_attack_mons() ); } +static int _modify_blood_amount(const int damage, const int dam_type) +{ + int factor = 0; // DVORP_NONE + + switch (dam_type) + { + case DVORP_CRUSHING: // flails, also unarmed + factor = 2; + break; + case DVORP_SLASHING: // whips + factor = 4; + break; + case DVORP_PIERCING: // pole-arms + factor = 5; + break; + case DVORP_STABBING: // knives, daggers + factor = 8; + break; + case DVORP_SLICING: // other short/long blades, also blade hands + factor = 10; + break; + case DVORP_CHOPPING: // axes + factor = 17; + break; + case DVORP_CLAWING: // unarmed, claws + factor = 24; + break; + } + + return (damage * factor / 10); +} + static bool _vamp_wants_blood_from_monster(const monsters *mon) { if (you.species != SP_VAMPIRE) @@ -688,7 +720,8 @@ bool melee_attack::player_attack() if (damage_done > 0) { - int blood = damage_done; + int blood + = _modify_blood_amount(damage_done, attacker->damage_type()); if (blood > defender->stat_hp()) blood = defender->stat_hp(); @@ -3688,11 +3721,12 @@ void melee_attack::mons_perform_attack_rounds() if (defender->atype() == ACT_MONSTER) type = defender->id(); - int damage = damage_done; - if (damage > defender->stat_hp()) - damage = defender->stat_hp(); + int blood + = _modify_blood_amount(damage_done, attacker->damage_type()); + if (blood > defender->stat_hp()) + blood = defender->stat_hp(); - bleed_onto_floor(pos.x, pos.y, type, damage, true); + bleed_onto_floor(pos.x, pos.y, type, blood, true); if (decapitate_hydra(damage_done, attacker->damage_type(attack_number))) -- cgit v1.2.3-54-g00ecf