Skip to content

Commit

Permalink
Merge pull request #62189 from alef/62113
Browse files Browse the repository at this point in the history
Fixes "Bloodless monsters can still get bled by butchery, leave blood splatter on ranged hits"
  • Loading branch information
Rivet-the-Zombie committed Nov 17, 2022
2 parents d1f765d + ecc124c commit 25a0ca0
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
11 changes: 7 additions & 4 deletions src/ballistics.cpp
Expand Up @@ -442,10 +442,13 @@ dealt_projectile_attack projectile_attack( const projectile &proj_arg, const tri
// Critter can still dodge the projectile
// In this case hit_critter won't be set
if( attack.hit_critter != nullptr ) {
const size_t bt_len = blood_trail_len( attack.dealt_dam.total_damage() );
if( bt_len > 0 ) {
const tripoint &dest = move_along_line( tp, trajectory, bt_len );
here.add_splatter_trail( critter->bloodType(), tp, dest );
const field_type_id blood_type = critter->bloodType();
if( blood_type ) {
const size_t bt_len = blood_trail_len( attack.dealt_dam.total_damage() );
if( bt_len > 0 ) {
const tripoint &dest = move_along_line( tp, trajectory, bt_len );
here.add_splatter_trail( blood_type, tp, dest );
}
}
sfx::do_projectile_hit( *attack.hit_critter );
has_momentum = false;
Expand Down
7 changes: 4 additions & 3 deletions src/game.cpp
Expand Up @@ -8747,9 +8747,10 @@ static void butcher_submenu( const std::vector<map_stack::iterator> &corpses, in
corpses[index]->has_flag( flag_FIELD_DRESS_FAILED ) ) ) {
has_organs = true;
}
if( entry.type == harvest_drop_blood && !( corpses[index]->has_flag( flag_QUARTERED ) ||
corpses[index]->has_flag( flag_FIELD_DRESS ) ||
corpses[index]->has_flag( flag_FIELD_DRESS_FAILED ) || corpses[index]->has_flag( flag_BLED ) ) ) {
if( entry.type == harvest_drop_blood && dead_mon->bleed_rate > 0 &&
!( corpses[index]->has_flag( flag_QUARTERED ) ||
corpses[index]->has_flag( flag_FIELD_DRESS ) ||
corpses[index]->has_flag( flag_FIELD_DRESS_FAILED ) || corpses[index]->has_flag( flag_BLED ) ) ) {
has_blood = true;
}
}
Expand Down
8 changes: 5 additions & 3 deletions src/mtype.cpp
Expand Up @@ -153,9 +153,11 @@ std::vector<std::string> mtype::species_descriptions() const

field_type_id mtype::get_bleed_type() const
{
for( const species_id &s : species ) {
if( !s->bleeds.is_empty() ) {
return s->bleeds;
if( bleed_rate > 0 ) {
for( const species_id &s : species ) {
if( !s->bleeds.is_empty() ) {
return s->bleeds;
}
}
}
return fd_null;
Expand Down

0 comments on commit 25a0ca0

Please sign in to comment.