| BeamRoom.java |
1 /*
2 * CVS: $Id: BeamRoom.java,v 1.5 2004/07/25 19:07:20 marcus Exp $
3 *
4 * This file is part of JZuul.
5 *
6 * JZuul is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * JZuul is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with Zuul; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 *
20 * Copyrigth 2004 by marcus, leh
21 *
22 */
23
24package org.jzuul.engine.rooms;
25
26import org.jzuul.engine.Engine;
27import org.jzuul.engine.Event;
28import org.jzuul.engine.Messages;
29
30/**
31 * Ein BeamRoom ist ein Raum der den Player beim betreten in einen
32 * zufälligen anderen Raum befördert
33 *
34 *
35 * @version $Revision: 1.5 $
36 */
37public class BeamRoom extends Room {
38
39 /**
40 * Erstellt ein neues BeamRoom Objekt
41 *
42 * @param name der Name des Raumes
43 * @param beschreibung die Beschreibung des Raumes
44 */
45 public BeamRoom(String name, String beschreibung) {
46 super(name, beschreibung);
47 }
48
49 /**
50 * Der defaultHandler für BeamRoom Objekte.
51 * Das Event.PLAYERENTER wird benutzt um den Spieler in einen anderen Raum
52 * zu bewegen.
53 *
54 * @param eventId eine eventId
55 * @see org.jzuul.engine.Event
56 */
57 protected void defaultHandler(int eventId) {
58 if (eventId == Event.PLAYERENTER) {
59
60 this.printBeschreibung();
61 Engine.player.resetLastRoom();
62 Room nextRoom = Engine.map.getRandomRoom();
63
64 for (int i = 0; i < 5; i++) {
65 Engine.gui.print("."); //$NON-NLS-1$
66 Engine.delay(1000);
67 }
68 Engine.gui.println();
69 Engine.gui.println(Messages.getString("BEAMROOM_MESSAGE")); //$NON-NLS-1$
70 Engine.player.setCurrentRoom(nextRoom);
71 }
72 }
73
74}
75