Skip to content

Commit

Permalink
Merge pull request #74042 from Procyonae/Backport70799And72684
Browse files Browse the repository at this point in the history
Backport #70799 and #72684
  • Loading branch information
kevingranade authored May 26, 2024
2 parents 7b67074 + 120fde4 commit ed84c16
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/monster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3167,10 +3167,11 @@ void monster::process_effects()
add_msg_if_player_sees( *this, m_warning, healing_format_string, name() );
}

if( type->regenerates_in_dark ) {
if( type->regenerates_in_dark && !g->is_in_sunlight( pos() ) ) {
const float light = get_map().ambient_light_at( pos() );
// Magic number 10000 was chosen so that a floodlight prevents regeneration in a range of 20 tiles
if( heal( static_cast<int>( 50.0 * std::exp( - light * light / 10000 ) ) > 0 && one_in( 2 ) ) ) {
const float dHP = 50.0 * std::exp( - light * light / 10000 );
if( heal( static_cast<int>( dHP ) ) > 0 && one_in( 2 ) ) {
add_msg_if_player_sees( *this, m_warning, _( "The %s uses the darkness to regenerate." ), name() );
}
}
Expand Down

0 comments on commit ed84c16

Please sign in to comment.