Skip to content

Commit

Permalink
excempt stairs&ramps from vision check
Browse files Browse the repository at this point in the history
  • Loading branch information
Jamuro-g committed Mar 12, 2021
1 parent da7c760 commit 152980e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 4 additions & 1 deletion src/monmove.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1482,7 +1482,10 @@ bool monster::attack_at( const tripoint &p )
}

Character &player_character = get_player_character();
if( p == player_character.pos() && sees( player_character ) ) {
map &here = get_map();
if( p == player_character.pos() && ( sees( player_character ) ||
here.has_flag( TFLAG_RAMP_UP, p ) || here.has_flag( TFLAG_RAMP_DOWN, p ) ||
here.has_flag( TFLAG_GOES_UP, p ) || here.has_flag( TFLAG_GOES_DOWN, p ) ) ) {
return melee_attack( player_character );
}

Expand Down
6 changes: 4 additions & 2 deletions src/monster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1502,8 +1502,10 @@ bool monster::melee_attack( Creature &target, float accuracy )
if( /*This happens sometimes*/ this == &target || !is_adjacent( &target, true ) ) {
return false;
}

if( posz() != target.posz() && !sees( target ) ) {
map &here = get_map();
if( !sees( target ) && !here.has_flag( TFLAG_RAMP_UP, target.pos() ) &&
!here.has_flag( TFLAG_RAMP_DOWN, target.pos() ) && !here.has_flag( TFLAG_GOES_UP, target.pos() ) &&
!here.has_flag( TFLAG_GOES_DOWN, target.pos() ) ) {
debugmsg( "Z-Level view violation: %s tried to attack %s.", disp_name(), target.disp_name() );
}

Expand Down

0 comments on commit 152980e

Please sign in to comment.