protected Room followHearing() { // if alive player in room, stay and fight // if (GameEngine.instance.hasPlayer(fRoom)) // return fRoom; Room room = fRoom.getHearCandidate(this.getHearing()); if (room != null) { if (fTargetRoom == null) { fTargetRoom = room.getRandomPassage(fRoom); if (fTargetRoom == fRoom) { fTargetRoom = room; } } Utility.Trace(this.getMonsterDescription() + " is following hearing from room " + fRoom.getRoomNumber() + " to " + room.getRoomNumber()); // if alive player in room, stay and fight, unless there is fighting to be had in another room, in which // case the monster has a hard time deciding... if (GameEngine.instance.hasPlayer(fRoom)) { if (GameEngine.rand.range(0, 1) == 0) { return(fRoom); } } } // unless there is another player in the next room! // if (GameEngine.instance.hasPlayer(fRoom)) // { // if (room != null && !GameEngine.instance.hasPlayer(room)) // { // return fRoom; // } // } fHunting = true; if (room == null && fTargetRoom != null) { Room[] path = GameEngine.instance.fMaze.findRoute(fRoom, fTargetRoom, null, Maze.USE_OPEN_DOORS); if (path.Length > 0) { room = path[0]; } } else if (room != null) { if (!fRoom.isPassable(room)) { room = fRoom.getRandomPassage(fLastRoom); } } if (room == null) { fHunting = false; } else { fStationary = false; } if (fHunting) { // Utility.Trace(this.getMonsterDescription() + " follows hearing and makes noise"); // this.makeNoise(Player.kFightNoise); } return(room); }