Last active
August 29, 2015 14:11
-
-
Save Chris-plus-alphanumericgibberish/f32af9004032bda2fec2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for(nx = max(1,x-1); nx <= maxx; nx++) | |
for(ny = max(0,y-1); ny <= maxy; ny++) { | |
int dispx, dispy; | |
boolean monseeu = (mon->mcansee && (!Invis || perceives(mdat))); | |
boolean checkobj = OBJ_AT(nx,ny); | |
if(nx == x && ny == y) continue; | |
/* Displacement also displaces the Elbereth/scare monster, | |
* as long as you are visible. | |
*/ | |
if(Displaced && monseeu && (mon->mux==nx) && (mon->muy==ny)) { | |
dispx = u.ux; | |
dispy = u.uy; | |
} else { | |
dispx = nx; | |
dispy = ny; | |
} | |
info[cnt] = 0; | |
if ((checkobj || Displaced) && onscary(dispx, dispy, mon)) { | |
if(!(flag & ALLOW_SSM)) continue; | |
info[cnt] |= ALLOW_SSM; | |
} | |
if((nx == u.ux && ny == u.uy) || | |
(nx == mon->mux && ny == mon->muy)) { | |
if (nx == u.ux && ny == u.uy) { | |
/* If it's right next to you, it found you, | |
* displaced or no. We must set mux and muy | |
* right now, so when we return we can tell | |
* that the ALLOW_U means to attack _you_ and | |
* not the image. | |
*/ | |
mon->mux = u.ux; | |
mon->muy = u.uy; | |
} | |
if(!(flag & ALLOW_U)) continue; | |
info[cnt] |= ALLOW_U; | |
} else if(MON_AT(nx, ny)) { | |
struct monst *mtmp2 = m_at(nx, ny); | |
long mmflag = flag | mm_aggression(mon, mtmp2); | |
if (!(mmflag & ALLOW_M)) continue; | |
info[cnt] |= ALLOW_M; | |
if (mtmp2->mtame) { | |
if (!(mmflag & ALLOW_TM)) continue; | |
info[cnt] |= ALLOW_TM; | |
} | |
} else if(level.flags.has_temple && | |
*in_rooms(nx, ny, TEMPLE) && | |
!*in_rooms(x, y, TEMPLE) && | |
in_your_sanctuary((struct monst *)0, nx, ny)) { | |
/* Note: ALLOW_SANCT only prevents movement, not */ | |
/* attack, into a temple. */ | |
if(!(flag & ALLOW_SANCT)) continue; | |
info[cnt] |= ALLOW_SANCT; | |
} else continue; | |
poss[cnt].x = nx; | |
poss[cnt].y = ny; | |
cnt++; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment