diff --git a/src/condition.cpp b/src/condition.cpp index a433326188d30..ca74b46d71a22 100644 --- a/src/condition.cpp +++ b/src/condition.cpp @@ -773,17 +773,16 @@ void conditional_t::set_npc_allies( const JsonObject &jo ) template void conditional_t::set_npc_allies_global( const JsonObject &jo ) { - int_or_var iov = get_int_or_var( jo, "npc_allies_global" ); + int_or_var iov = get_int_or_var( jo, "npc_allies_global" ); condition = [iov]( const T & d ) { const auto all_npcs = overmap_buffer.get_overmap_npcs(); const size_t count = std::count_if( all_npcs.begin(), all_npcs.end(), []( const shared_ptr_fast &ptr ) { - // Note: it seems that the is_npc check /is/ necessary to avoid including dead friends - return ptr.get()->is_player_ally() && !ptr.get()->hallucination && ptr.get()->is_npc(); + return ptr.get()->is_player_ally() && !ptr.get()->hallucination && !ptr.get()->is_dead(); } ); - return count >= static_cast( iov.evaluate( d.actor( iov.is_npc() ) ) ); + return count >= static_cast( iov.evaluate( d ) ); }; }