Skip to content

Commit

Permalink
Merge pull request #77753 from Night-Pryanik/respirator
Browse files Browse the repository at this point in the history
Several tweaks to Respirator bionic
  • Loading branch information
Maleclypse authored Nov 11, 2024
2 parents 78b68fb + d6bd6af commit 0cbceca
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion data/json/bionics.json
Original file line number Diff line number Diff line change
Expand Up @@ -1022,7 +1022,7 @@
"id": "bio_gills",
"type": "bionic",
"name": { "str": "Respirator" },
"description": "A complex respiration augmentation system. Improves respiration ability in air and allows breathing water. Will automatically turn on when drowning. Turn on to recharge stamina faster, at moderate power cost. Asthmatics may also use it to stop asthma attacks.",
"description": "A complex respiration augmentation system. Improves respiration ability in air and allows breathing water. Will automatically activate when drowning. Turn on to recharge stamina faster, at moderate power cost. Asthmatics may also use it to stop asthma attacks.",
"occupied_bodyparts": [ [ "torso", 8 ], [ "head", 2 ], [ "mouth", 2 ] ],
"flags": [ "BIONIC_TOGGLED" ],
"trigger_cost": "25 kJ"
Expand Down
7 changes: 5 additions & 2 deletions src/bionics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1693,10 +1693,13 @@ void Character::process_bionic( bionic &bio )
mod_power_level( -trigger_cost );
}
} else if( bio.id == bio_gills ) {
if( has_effect( effect_asthma ) ) {
const units::energy trigger_cost = bio.info().power_trigger / 8;
if( has_effect( effect_asthma ) && get_power_level() >= trigger_cost ) {
add_msg_if_player( m_good,
_( "You feel your throat open up and air filling your lungs!" ) );
_( "Your %s activates and you feel your throat open up and air filling your lungs!" ),
bio.info().name );
remove_effect( effect_asthma );
mod_power_level( -trigger_cost );
}
} else if( bio.id == bio_evap ) {
if( is_underwater() ) {
Expand Down
12 changes: 9 additions & 3 deletions src/suffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -317,9 +317,15 @@ void suffer::while_underwater( Character &you )
you.oxygen += 12;
}
if( you.oxygen <= 5 ) {
if( you.has_bionic( bio_gills ) && you.get_power_level() >= bio_gills->power_trigger ) {
you.oxygen += 5;
you.mod_power_level( -bio_gills->power_trigger );
if( you.has_bionic( bio_gills ) ) {
if( you.get_power_level() >= bio_gills->power_trigger ) {
you.oxygen += 5;
you.mod_power_level( -bio_gills->power_trigger );
} else {
you.add_msg_if_player( m_bad,
_( "You don't have enough bionic power for activation of your Respirator, so you're drowning!" ) );
you.apply_damage( nullptr, bodypart_id( "torso" ), rng( 1, 4 ) );
}
} else {
you.add_msg_if_player( m_bad, _( "You're drowning!" ) );
you.apply_damage( nullptr, bodypart_id( "torso" ), rng( 1, 4 ) );
Expand Down

0 comments on commit 0cbceca

Please sign in to comment.