diff --git a/src/monmove.cpp b/src/monmove.cpp index 9378ba46d9e20..fb4e705e1c006 100644 --- a/src/monmove.cpp +++ b/src/monmove.cpp @@ -900,6 +900,7 @@ void monster::move() } tripoint next_step; + const bool can_open_doors = has_flag( MF_CAN_OPEN_DOORS ); const bool staggers = has_flag( MF_STUMBLES ); if( moved ) { // Implement both avoiding obstacles and staggering. @@ -982,6 +983,14 @@ void monster::move() bad_choice = true; } + // is there an openable door? + if( can_open_doors && + here.open_door( candidate, !here.is_outside( pos() ), true ) ) { + moved = true; + next_step = candidate_abs; + continue; + } + // Try to shove vehicle out of the way shove_vehicle( destination, candidate ); // Bail out if we can't move there and we can't bash. @@ -989,6 +998,10 @@ void monster::move() if( !can_bash ) { continue; } + // Don't bash if we're just tracking a noise. + if( wander() && destination == wander_pos ) { + continue; + } const int estimate = here.bash_rating( bash_estimate(), candidate ); if( estimate <= 0 ) { continue; @@ -1017,7 +1030,6 @@ void monster::move() } } } - const bool can_open_doors = has_flag( MF_CAN_OPEN_DOORS ); // Finished logic section. By this point, we should have chosen a square to // move to (moved = true). if( moved ) { // Actual effects of moving to the square we've chosen