public bool needsContent(Room room) { if (room.fKeys > 0 && this.fKeys < this.getMaxNumKeys()) { return(true); } if (room.fCoins > 0) { return(true); } if (room.fDragonSwords > 0 && this.fDragonSwords < this.getMaxNumDragonSwords()) { return(true); } if (room.fSerpentShields > 0 && this.fSerpentShields < this.getMaxNumSerpentShields()) { return(true); } if (room.fArmor > this.fArmor && room.fArmor <= this.getMaxArmor()) { return(true); } if (room.fCarpets > 0 && (this.fCarpets == 0)) { return(true); } if (room.hasStaffs() && this.getMaxNumStaffs() > 0) { Staff best = room.fStaffs.getBestStaff(); if (this.wantsStaff(best)) { return(true); } } if (room.fArrows > 0) { return(true); } if (room.fAxes > 0 && this.fAxes < this.getMaxNumAxes()) { return(true); } if (room.fSandals > 0 && (this.fSandals == 0)) { return(true); } if (room.fWater > 0 && this.fWater < this.getMaxWater()) { return(true); } if ((room.fRing | this.fRing) != this.fRing) { return(true); } return(false); }
public String getAdjacentMonsterDescription() { String str = ""; for (int iPassage = 0; iPassage <= this.getNumPassages(); iPassage++) { Room room = null; if (iPassage == 0) { if (!this.hasDoor() || !this.isDoorOpen()) { continue; } room = this.fDoor; } else { room = this.getPassage(iPassage); } Utility.Assert(room != null, "Room.getAdjacentDescription - room != null"); if (room.fPit) { str += "You can feel a draft.\n"; } } for (int iPassage = 0; iPassage <= this.getNumPassages(); iPassage++) { Room room = null; if (iPassage == 0) { if (!this.hasDoor() || !this.isDoorOpen()) { continue; } room = this.fDoor; } else { room = this.getPassage(iPassage); } Utility.Assert(room != null, "Room.getAdjacentDescription - room != null (2)"); if (room.hasMuck()) { // str += "It stinks of serpent-muck.\n"; str += "It stinks in here.\n"; } } for (int iPassage = 0; iPassage <= this.getNumPassages(); iPassage++) { Room room = null; if (iPassage == 0) { if (!this.hasDoor() || !this.isDoorOpen()) { continue; } room = this.fDoor; } else { room = this.getPassage(iPassage); } Utility.Assert(room != null, "Room.getAdjacentDescription - room != null (5)"); if (GameEngine.instance.fMaze.isJanitor(room) && (room.hasMuck() || room.fPit)) { // str += "Someone is cleaning in cavern " + room.getRoomNumber() + ".\n"; str += "Someone is cleaning nearby.\n"; } } for (int iPassage = 0; iPassage <= this.getNumPassages(); iPassage++) { Room room = null; if (iPassage == 0) { if (!this.hasDoor() || !this.isDoorOpen()) { continue; } room = this.fDoor; } else { room = this.getPassage(iPassage); } Utility.Assert(room != null, "Room.getAdjacentDescription - room != null (3)"); if (room.fDragonSwords > 0 || room.fSerpentShields > 0 || room.fSandals > 0 || room.hasStaffs() || room.fRing != 0) { if (Player.fKnowsItems || Player.hasExplored(room)) { // Check if the player really wants the item // bool wants = false; Player player = GameEngine.instance.getCurrentPlayer(); if (room.fDragonSwords > 0 && player.fDragonSwords < player.getMaxNumDragonSwords()) { wants = true; } else if (room.fSerpentShields > 0 && player.fSerpentShields < player.getMaxNumSerpentShields()) { wants = true; } else if (room.fSandals > 0 && (player.fSandals == 0)) { wants = true; } if ((room.fRing | player.fRing) != player.fRing) { wants = true; } else if (room.hasStaffs() && player.getMaxNumStaffs() > 0) { Staff best = room.fStaffs.getBestStaff(); if (player.wantsStaff(best)) { wants = true; } } if (wants) { str += "You feel a potent power from cavern " + room.getRoomNumber() + ".\n"; } } else { str += "You feel a potent power.\n"; } } } for (int iPassage = 0; iPassage <= this.getNumPassages(); iPassage++) { Room room = null; if (iPassage == 0) { if (!this.hasDoor() || !this.isDoorOpen()) { continue; } room = this.fDoor; } else { room = this.getPassage(iPassage); } Utility.Assert(room != null, "Room.getAdjacentDescription - room != null (4)"); } return(str); }