int rogue_can_see(int row, int col) { int retval; retval = !blind && (((get_room_number(row, col) == cur_room) && !(rooms[cur_room].is_room & R_MAZE)) || rogue_is_around(row, col)); return(retval); }
int flame_broil(object *monster) { short row, col; if ((!mon_sees(monster, rogue.row, rogue.col)) || coin_toss()) { return 0; } row = rogue.row - monster->row; col = rogue.col - monster->col; if (row < 0) { row = -row; } if (col < 0) { col = -col; } if (((row != 0) && (col != 0) && (row != col)) || ((row > 7) || (col > 7))) { return 0; } if ((!blind) && (!rogue_is_around(monster->row, monster->col))) { row = monster->row; col = monster->col; get_closer(&row, &col, rogue.row, rogue.col); standout(); do { mvaddch_rogue(row, col, '~'); refresh(); get_closer(&row, &col, rogue.row, rogue.col); } while ((row != rogue.row) || (col != rogue.col)); standend(); row = monster->row; col = monster->col; get_closer(&row, &col, rogue.row, rogue.col); do { mvaddch_rogue(row, col, get_dungeon_char(row, col)); refresh(); get_closer(&row, &col, rogue.row, rogue.col); } while ((row != rogue.row) || (col != rogue.col)); } mon_hit(monster, flame_name, 1); return 1; }
void mv_1_monster(object *monster, short row, short col) { short i, n; boolean tried[6]; if (monster->m_flags & ASLEEP) { if (monster->m_flags & NAPPING) { if (--monster->nap_length <= 0) { monster->m_flags &= (~(NAPPING | ASLEEP)); } return; } if ((monster->m_flags & WAKENS) && rogue_is_around(monster->row, monster->col) && rand_percent(((stealthy > 0) ? (WAKE_PERCENT / (STEALTH_FACTOR + stealthy)) : WAKE_PERCENT))) { wake_up(monster); } return; } else if (monster->m_flags & ALREADY_MOVED) { monster->m_flags &= (~ALREADY_MOVED); return; } if ((monster->m_flags & FLITS) && flit(monster)) { return; } if ((monster->m_flags & STATIONARY) && (!mon_can_go(monster, rogue.row, rogue.col))) { return; } if (monster->m_flags & FREEZING_ROGUE) { return; } if ((monster->m_flags & CONFUSES) && m_confuse(monster)) { return; } if (mon_can_go(monster, rogue.row, rogue.col)) { mon_hit(monster); return; } if ((monster->m_flags & FLAMES) && flame_broil(monster)) { return; } if ((monster->m_flags & SEEKS_GOLD) && seek_gold(monster)) { return; } if ((monster->trow == monster->row) && (monster->tcol == monster->col)) { monster->trow = NO_ROOM; } else if (monster->trow != NO_ROOM) { row = monster->trow; col = monster->tcol; } if (monster->row > row) { row = monster->row - 1; } else if (monster->row < row) { row = monster->row + 1; } if ((dungeon[row][monster->col] & DOOR) && mtry(monster, row, monster->col)) { return; } if (monster->col > col) { col = monster->col - 1; } else if (monster->col < col) { col = monster->col + 1; } if ((dungeon[monster->row][col] & DOOR) && mtry(monster, monster->row, col)) { return; } if (mtry(monster, row, col)) { return; } for (i = 0; i <= 5; i++) tried[i] = 0; for (i = 0; i < 6; i++) { NEXT_TRY: n = get_rand(0, 5); switch(n) { case 0: if (!tried[n] && mtry(monster, row, monster->col-1)) { goto O; } break; case 1: if (!tried[n] && mtry(monster, row, monster->col)) { goto O; } break; case 2: if (!tried[n] && mtry(monster, row, monster->col+1)) { goto O; } break; case 3: if (!tried[n] && mtry(monster, monster->row-1, col)) { goto O; } break; case 4: if (!tried[n] && mtry(monster, monster->row, col)) { goto O; } break; case 5: if (!tried[n] && mtry(monster, monster->row+1, col)) { goto O; } break; } if (!tried[n]) { tried[n] = 1; } else { goto NEXT_TRY; } } O: if ((monster->row == monster->o_row) && (monster->col == monster->o_col)) { if (++(monster->o) > 4) { if ((monster->trow == NO_ROOM) && (!mon_sees(monster, rogue.row, rogue.col))) { monster->trow = get_rand(1, (DROWS - 2)); monster->tcol = get_rand(0, (DCOLS - 1)); } else { monster->trow = NO_ROOM; monster->o = 0; } } } else { monster->o_row = monster->row; monster->o_col = monster->col; monster->o = 0; } }