From 1342cfab91c15be3317cb90f02d443385cb41948 Mon Sep 17 00:00:00 2001 From: David Seguin Date: Tue, 11 Jan 2022 16:32:02 -0500 Subject: [PATCH] Hallucinations: Misc NPC fixes - Prevent hallucinations from opening doors - Prevent player from stealing from hallucinations --- src/melee.cpp | 2 +- src/npcmove.cpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/melee.cpp b/src/melee.cpp index 2799ff9421517..fed1ea2be8eb4 100644 --- a/src/melee.cpp +++ b/src/melee.cpp @@ -2839,7 +2839,7 @@ void avatar::steal( npc &target ) int their_roll = dice( 5, target.get_per() ); const item *it = loc.get_item(); - if( my_roll >= their_roll ) { + if( my_roll >= their_roll && !target.is_hallucination() ) { add_msg( _( "You sneakily steal %1$s from %2$s!" ), it->tname(), target.get_name() ); i_add( target.i_rem( it ) ); diff --git a/src/npcmove.cpp b/src/npcmove.cpp index fe5af77d66a2c..dd9d0eb8bbb8b 100644 --- a/src/npcmove.cpp +++ b/src/npcmove.cpp @@ -2241,7 +2241,8 @@ bool npc::update_path( const tripoint &p, const bool no_bashing, bool force ) bool npc::can_open_door( const tripoint &p, const bool inside ) const { - return !rules.has_flag( ally_rule::avoid_doors ) && get_map().open_door( p, inside, true ); + return !is_hallucination() && !rules.has_flag( ally_rule::avoid_doors ) && + get_map().open_door( p, inside, true ); } bool npc::can_move_to( const tripoint &p, bool no_bashing ) const