Skip to content

Commit fe27e2a

Browse files
committed
Use breathability to measure protection against liquid ammo
1 parent 29b8726 commit fe27e2a

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

src/creature.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1296,6 +1296,19 @@ void Creature::deal_projectile_attack( Creature *source, dealt_projectile_attack
12961296
}
12971297
}
12981298

1299+
if( attack.proj.proj_effects.count( "LIQUID" ) > 0 ) {
1300+
if( Character *char_target = as_character() ) {
1301+
// clothing_wetness_mult returns the effective permeability of the armor on bp_hit
1302+
// as a float between 0 and 1
1303+
// 0 permeability means no liquid touches the skin and the damage is negated
1304+
// 1 permeability means all liquid touches the skin and no damage is negated
1305+
float permeability = char_target->worn.clothing_wetness_mult( hit_selection.bp_hit );
1306+
permeability = std::clamp( permeability, 0.0f, 1.0f );
1307+
1308+
impact.mult_damage( permeability );
1309+
}
1310+
}
1311+
12991312
dealt_dam = deal_damage( source, hit_selection.bp_hit, impact, wp_attack_copy );
13001313
// Force damage instance to match the selected body point
13011314
dealt_dam.bp_hit = hit_selection.bp_hit;

src/ranged.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2098,6 +2098,10 @@ static projectile make_gun_projectile( const item &gun )
20982098
proj.range = gun.gun_range();
20992099
proj.proj_effects = gun.ammo_effects();
21002100

2101+
if( gun.ammo_data()->phase == phase_id::LIQUID ) {
2102+
proj.proj_effects.insert( "LIQUID" );
2103+
}
2104+
21012105
auto &fx = proj.proj_effects;
21022106

21032107
if( ( gun.ammo_data() && gun.ammo_data()->phase == phase_id::LIQUID ) ||

0 commit comments

Comments
 (0)