Skip to content

Commit

Permalink
Hallucinations: Misc NPC fixes
Browse files Browse the repository at this point in the history
- Prevent hallucinations from opening doors
- Prevent player from stealing from hallucinations
  • Loading branch information
dseguin committed Jan 11, 2022
1 parent 41b85d5 commit 1342cfa
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/melee.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) );
Expand Down
3 changes: 2 additions & 1 deletion src/npcmove.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1342cfa

Please sign in to comment.