Skip to content

Commit

Permalink
Hallucinations: Misc monster fixes
Browse files Browse the repository at this point in the history
- Prevents hallucinations from attacking non-hallucinations
- Prevents hallucinations from opening doors
- Prevents hallucinations from shoving vehicles
  • Loading branch information
dseguin committed Jan 12, 2022
1 parent 2057907 commit 5ec8f25
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/monmove.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -916,7 +916,7 @@ void monster::move()
}

tripoint_abs_ms next_step;
const bool can_open_doors = has_flag( MF_CAN_OPEN_DOORS );
const bool can_open_doors = has_flag( MF_CAN_OPEN_DOORS ) && !is_hallucination();
const bool staggers = has_flag( MF_STUMBLES );
if( moved ) {
// Implement both avoiding obstacles and staggering.
Expand Down Expand Up @@ -981,6 +981,10 @@ void monster::move()

const Creature *target = creatures.creature_at( candidate, is_hallucination() );
if( target != nullptr ) {
if( is_hallucination() != target->is_hallucination() && !target->is_avatar() ) {
// Hallucinations should only be capable of targetting the player or other hallucinations.
continue;
}
const Attitude att = attitude_to( *target );
if( att == Attitude::HOSTILE ) {
// When attacking an adjacent enemy, we're direct.
Expand Down Expand Up @@ -2106,7 +2110,7 @@ void monster::shove_vehicle( const tripoint &remote_destination,
const tripoint &nearby_destination )
{
map &here = get_map();
if( this->has_flag( MF_PUSH_VEH ) ) {
if( this->has_flag( MF_PUSH_VEH ) && !is_hallucination() ) {
optional_vpart_position vp = here.veh_at( nearby_destination );
if( vp ) {
vehicle &veh = vp->vehicle();
Expand Down

0 comments on commit 5ec8f25

Please sign in to comment.