diff --git a/src/monster.cpp b/src/monster.cpp index 77fc67eb381bf..e65d114f0b443 100644 --- a/src/monster.cpp +++ b/src/monster.cpp @@ -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( 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( dHP ) ) > 0 && one_in( 2 ) ) { add_msg_if_player_sees( *this, m_warning, _( "The %s uses the darkness to regenerate." ), name() ); } }