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/command.cc | 1 - crawl-ref/source/direct.cc | 5 ++--- crawl-ref/source/fight.cc | 44 +++++++++++++++++++++++++++++++++++++++----- crawl-ref/source/misc.cc | 4 ++-- 4 files changed, 43 insertions(+), 11 deletions(-) (limited to 'crawl-ref') diff --git a/crawl-ref/source/command.cc b/crawl-ref/source/command.cc index f5b01ada60..00432ead51 100644 --- a/crawl-ref/source/command.cc +++ b/crawl-ref/source/command.cc @@ -892,7 +892,6 @@ static void recap_feat_keys(std::vector &keys) keys[i] = feature_description(type, NUM_TRAPS, false, DESC_CAP_A, false); } - //fprintf(stderr, "%s\n", keys[i].c_str()); } } diff --git a/crawl-ref/source/direct.cc b/crawl-ref/source/direct.cc index 35354cad74..39b76fb566 100644 --- a/crawl-ref/source/direct.cc +++ b/crawl-ref/source/direct.cc @@ -1625,10 +1625,9 @@ std::string raw_feature_description(dungeon_feature_type grid, return ("translucent unnaturally hard rock wall"); case DNGN_ORCISH_IDOL: if (you.species == SP_HILL_ORC) - { return ("idol of Beogh"); - } - return ("orcish idol"); + else + return ("orcish idol"); case DNGN_WAX_WALL: return ("wall of solid wax"); case DNGN_GRANITE_STATUE: 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))) diff --git a/crawl-ref/source/misc.cc b/crawl-ref/source/misc.cc index 8afbe57dc6..dadab0955a 100644 --- a/crawl-ref/source/misc.cc +++ b/crawl-ref/source/misc.cc @@ -345,8 +345,8 @@ static void maybe_bloodify_square(int x, int y, int amount, bool spatter = false if (spatter) { // smaller chance of spattering surrounding squares - for (int i=-1;i<=1;i++) - for (int j=-1;j<=1;j++) + for (int i = -1; i <= 1; i++) + for (int j = -1; j <= 1; j++) { if (i == 0 && j == 0) // current square continue; -- cgit v1.2.3-54-g00ecf