From 4c03ff31930606f480107434a32397ceeccf7ecb Mon Sep 17 00:00:00 2001 From: Pacien TRAN-GIRARD Date: Fri, 30 May 2014 20:19:30 +0200 Subject: Fix real directions --- src/esieequest/game/Game.java | 98 +++++++++++++------------- src/esieequest/game/characters/Character.java | 2 +- src/esieequest/game/items/Disk.java | 3 +- src/esieequest/game/items/PortableConsole.java | 3 +- src/esieequest/game/map/Direction.java | 20 +++--- 5 files changed, 62 insertions(+), 64 deletions(-) (limited to 'src') diff --git a/src/esieequest/game/Game.java b/src/esieequest/game/Game.java index 92bc99f..9851607 100644 --- a/src/esieequest/game/Game.java +++ b/src/esieequest/game/Game.java @@ -29,7 +29,7 @@ public class Game implements SerialisableObject { public static final int DEFAULT_INVENTORY_LIMIT = 10; public static final int DEFAULT_STEPS_LIMIT = 0; public static final int CHALLENGE_STEPS_LIMIT = 50; - public static final Direction DEFAULT_DIRECTION = Direction.NORTH; + public static final Direction DEFAULT_DIRECTION = Direction.WEST; public static final Room DEFAULT_ROOM = Room.AMPHITHEATER_SEAT; public static final Quest DEFAULT_QUEST = Quest.WHAT_HAPPENED; @@ -83,52 +83,52 @@ public class Game implements SerialisableObject { * Connects Room-s together using Door-s. */ public void connectRooms() { - this.d(Room.AMPHITHEATER_SEAT, Direction.NORTH, Room.AMPHITHEATER_STAGE); - this.d(Room.AMPHITHEATER_STAGE, Direction.WEST, Room.CAFETERIA); - this.d(Room.CAFETERIA, Direction.NORTH, Room.CAFETERIA_STREET); - this.d(Room.CAFETERIA_STREET, Direction.EAST, Room.ESIEESPACE_STREET); - - this.d(Room.ESIEESPACE_STREET, Direction.SOUTH, Room.ESIEESPACE_FRONT); - this.d(Room.ESIEESPACE_FRONT, Direction.EAST, Room.ESIEESPACE_ENTRANCE); - this.d(Room.ESIEESPACE_ENTRANCE, Direction.NORTH, Room.ESIEESPACE); - - this.d(Room.ESIEESPACE_STREET, Direction.EAST, Room.ENTRANCE_STREET); - this.d(Room.ENTRANCE_STREET, Direction.SOUTH, Room.ENTRANCE_STAIRS); - this.d(Room.ENTRANCE_STAIRS, Direction.SOUTH, Room.ENTRANCE_ROUNDABOUT); - - this.d(Room.ENTRANCE_STREET, Direction.EAST, Room.WING_STREET); - this.d(Room.WING_STREET, Direction.NORTH, Room.WING_FLOOR_ONE); - this.d(Room.WING_FLOOR_ONE, Direction.WEST, Room.WING_STAIRS_ONE); - this.d(Room.WING_STAIRS_ONE, Direction.SOUTH, new Door(Room.WING_STAIRS_TWO)); - this.d(Room.WING_STAIRS_TWO, Direction.SOUTH, new Door(Room.WING_STAIRS_ONE)); + this.d(Room.AMPHITHEATER_SEAT, Direction.WEST, Room.AMPHITHEATER_STAGE); + this.d(Room.AMPHITHEATER_STAGE, Direction.SOUTH, Room.CAFETERIA); + this.d(Room.CAFETERIA, Direction.WEST, Room.CAFETERIA_STREET); + this.d(Room.CAFETERIA_STREET, Direction.NORTH, Room.ESIEESPACE_STREET); + + this.d(Room.ESIEESPACE_STREET, Direction.EAST, Room.ESIEESPACE_FRONT); + this.d(Room.ESIEESPACE_FRONT, Direction.NORTH, Room.ESIEESPACE_ENTRANCE); + this.d(Room.ESIEESPACE_ENTRANCE, Direction.WEST, Room.ESIEESPACE); + + this.d(Room.ESIEESPACE_STREET, Direction.NORTH, Room.ENTRANCE_STREET); + this.d(Room.ENTRANCE_STREET, Direction.EAST, Room.ENTRANCE_STAIRS); + this.d(Room.ENTRANCE_STAIRS, Direction.EAST, Room.ENTRANCE_ROUNDABOUT); + + this.d(Room.ENTRANCE_STREET, Direction.NORTH, Room.WING_STREET); + this.d(Room.WING_STREET, Direction.WEST, Room.WING_FLOOR_ONE); + this.d(Room.WING_FLOOR_ONE, Direction.SOUTH, Room.WING_STAIRS_ONE); + this.d(Room.WING_STAIRS_ONE, Direction.EAST, new Door(Room.WING_STAIRS_TWO)); + this.d(Room.WING_STAIRS_TWO, Direction.EAST, new Door(Room.WING_STAIRS_ONE)); this.d(Room.WING_STAIRS_ONE, Direction.UP, new HiddenDoor(Room.WING_STAIRS_TWO)); this.d(Room.WING_STAIRS_TWO, Direction.DOWN, new HiddenDoor(Room.WING_STAIRS_ONE)); - this.d(Room.WING_STAIRS_TWO, Direction.EAST, Room.WING_FLOOR_TWO); - this.d(Room.WING_FLOOR_TWO, Direction.NORTH, Room.WING_OFFICE_CORRIDOR); - this.d(Room.WING_OFFICE_CORRIDOR, Direction.EAST, Room.WING_OFFICE); - - this.d(Room.WING_STREET, Direction.EAST, Room.CLUBNIX_STREET); - this.d(Room.CLUBNIX_STREET, Direction.SOUTH, Room.CLUBNIX_FRONT); - this.d(Room.CLUBNIX_FRONT, Direction.EAST, Room.CLUBNIX_ENTRANCE); - this.d(Room.CLUBNIX_ENTRANCE, Direction.NORTH, Room.CLUBNIX); - - this.d(Room.WING_FLOOR_ONE, Direction.EAST, new HiddenDoor(Room.SECRET_CORRIDOR_ENTRANCE)); - this.d(Room.SECRET_CORRIDOR_ENTRANCE, Direction.WEST, new Door(Room.WING_FLOOR_ONE)); - this.d(Room.SECRET_CORRIDOR_ENTRANCE, Direction.NORTH, Room.STORAGE_ROOM); - this.d(Room.SECRET_CORRIDOR_ENTRANCE, Direction.SOUTH, Room.SECRET_LAB); - this.d(Room.SECRET_CORRIDOR_ENTRANCE, Direction.EAST, Room.SECRET_CORRIDOR_END); - this.d(Room.SECRET_CORRIDOR_END, Direction.NORTH, new TrapDoor(Room.DEAD_END)); + this.d(Room.WING_STAIRS_TWO, Direction.NORTH, Room.WING_FLOOR_TWO); + this.d(Room.WING_FLOOR_TWO, Direction.WEST, Room.WING_OFFICE_CORRIDOR); + this.d(Room.WING_OFFICE_CORRIDOR, Direction.NORTH, Room.WING_OFFICE); + + this.d(Room.WING_STREET, Direction.NORTH, Room.CLUBNIX_STREET); + this.d(Room.CLUBNIX_STREET, Direction.EAST, Room.CLUBNIX_FRONT); + this.d(Room.CLUBNIX_FRONT, Direction.NORTH, Room.CLUBNIX_ENTRANCE); + this.d(Room.CLUBNIX_ENTRANCE, Direction.WEST, Room.CLUBNIX); + + this.d(Room.WING_FLOOR_ONE, Direction.NORTH, new HiddenDoor(Room.SECRET_CORRIDOR_ENTRANCE)); + this.d(Room.SECRET_CORRIDOR_ENTRANCE, Direction.SOUTH, new Door(Room.WING_FLOOR_ONE)); + this.d(Room.SECRET_CORRIDOR_ENTRANCE, Direction.WEST, Room.STORAGE_ROOM); + this.d(Room.SECRET_CORRIDOR_ENTRANCE, Direction.EAST, Room.SECRET_LAB); + this.d(Room.SECRET_CORRIDOR_ENTRANCE, Direction.NORTH, Room.SECRET_CORRIDOR_END); + this.d(Room.SECRET_CORRIDOR_END, Direction.WEST, new TrapDoor(Room.DEAD_END)); final LockedDoor lockedDoorEnter = new LockedDoor(Room.LOCKED_ROOM); lockedDoorEnter.setKey(Item.KEYCARD); - this.d(Room.SECRET_CORRIDOR_END, Direction.SOUTH, lockedDoorEnter); + this.d(Room.SECRET_CORRIDOR_END, Direction.EAST, lockedDoorEnter); final LockedDoor lockedDoorExit = new LockedDoor(Room.SECRET_CORRIDOR_END); lockedDoorExit.setKey(Item.KEYCARD); - this.d(Room.LOCKED_ROOM, Direction.NORTH, lockedDoorExit); + this.d(Room.LOCKED_ROOM, Direction.WEST, lockedDoorExit); - this.d(Room.SECRET_CORRIDOR_END, Direction.EAST, new Door(Room.TRANSPORTER_ROOM)); - this.d(Room.TRANSPORTER_ROOM, Direction.WEST, new TransporterDoor(Room.values())); + this.d(Room.SECRET_CORRIDOR_END, Direction.NORTH, new Door(Room.TRANSPORTER_ROOM)); + this.d(Room.TRANSPORTER_ROOM, Direction.SOUTH, new TransporterDoor(Room.values())); } /** @@ -166,19 +166,19 @@ public class Game implements SerialisableObject { public void addItems() { // secret corridor - this.i(Room.STORAGE_ROOM, Direction.WEST, Item.STORAGE_CUBE); - this.i(Room.STORAGE_ROOM, Direction.EAST, Item.SAFETY_CUBE); - this.i(Room.STORAGE_ROOM, Direction.NORTH, Item.BLACK_HOLE); + this.i(Room.STORAGE_ROOM, Direction.SOUTH, Item.STORAGE_CUBE); + this.i(Room.STORAGE_ROOM, Direction.NORTH, Item.SAFETY_CUBE); + this.i(Room.STORAGE_ROOM, Direction.WEST, Item.BLACK_HOLE); - this.i(Room.SECRET_LAB, Direction.SOUTH, Item.BEAMER); + this.i(Room.SECRET_LAB, Direction.EAST, Item.BEAMER); - this.i(Room.DEAD_END, Direction.NORTH, Item.KEYCARD); + this.i(Room.DEAD_END, Direction.WEST, Item.KEYCARD); // scenario - this.i(Room.AMPHITHEATER_STAGE, Direction.SOUTH, Item.NOTE); - this.i(Room.CAFETERIA, Direction.WEST, Item.BANANA); - this.i(Room.ESIEESPACE, Direction.NORTH, Item.PORTABLE_CONSOLE); - this.i(Room.CLUBNIX, Direction.NORTH, Item.DISK); + this.i(Room.AMPHITHEATER_STAGE, Direction.EAST, Item.NOTE); + this.i(Room.CAFETERIA, Direction.SOUTH, Item.BANANA); + this.i(Room.ESIEESPACE, Direction.WEST, Item.PORTABLE_CONSOLE); + this.i(Room.CLUBNIX, Direction.WEST, Item.DISK); } @@ -202,10 +202,10 @@ public class Game implements SerialisableObject { public void addCharacters() { // secret corridor - this.c(Room.LOCKED_ROOM, Direction.SOUTH, Character.SUMOBOT); + this.c(Room.LOCKED_ROOM, Direction.EAST, Character.SUMOBOT); // scenario - this.c(Room.WING_OFFICE, Direction.EAST, Character.ATHANASE); + this.c(Room.WING_OFFICE, Direction.NORTH, Character.ATHANASE); } diff --git a/src/esieequest/game/characters/Character.java b/src/esieequest/game/characters/Character.java index 66250fe..b9dbd9b 100644 --- a/src/esieequest/game/characters/Character.java +++ b/src/esieequest/game/characters/Character.java @@ -15,7 +15,7 @@ public enum Character implements SerialisableObject { // @formatter:off // secret corridor - SUMOBOT(new Sumobot(Room.LOCKED_ROOM, Direction.SOUTH)), + SUMOBOT(new Sumobot(Room.LOCKED_ROOM, Direction.EAST)), // scenario ATHANASE(new Athanase()); diff --git a/src/esieequest/game/items/Disk.java b/src/esieequest/game/items/Disk.java index 096aa48..81c1456 100644 --- a/src/esieequest/game/items/Disk.java +++ b/src/esieequest/game/items/Disk.java @@ -22,8 +22,7 @@ public class Disk extends SimpleItem { public void use(final Game game, final Viewable view) { final boolean onRoundabout = game.getPlayer().getCurrentRoom().equals( Room.ENTRANCE_ROUNDABOUT); - final boolean pointingSouth = game.getPlayer().getCurrentDirection() - .equals(Direction.SOUTH); + final boolean pointingSouth = game.getPlayer().getCurrentDirection().equals(Direction.EAST); final boolean deviceInstalled = game.getPlayer().getCurrentSide().getInventory().hasItem( Item.PORTABLE_CONSOLE); diff --git a/src/esieequest/game/items/PortableConsole.java b/src/esieequest/game/items/PortableConsole.java index c3b9b5e..b7883f1 100644 --- a/src/esieequest/game/items/PortableConsole.java +++ b/src/esieequest/game/items/PortableConsole.java @@ -23,8 +23,7 @@ public class PortableConsole extends SimpleItem { public void use(final Game game, final Viewable view) { final boolean onRoundabout = game.getPlayer().getCurrentRoom().equals( Room.ENTRANCE_ROUNDABOUT); - final boolean pointingSouth = game.getPlayer().getCurrentDirection() - .equals(Direction.SOUTH); + final boolean pointingSouth = game.getPlayer().getCurrentDirection().equals(Direction.EAST); if (onRoundabout && pointingSouth) { game.getPlayer().getInventory().removeItem(Item.PORTABLE_CONSOLE); diff --git a/src/esieequest/game/map/Direction.java b/src/esieequest/game/map/Direction.java index 89cc442..95d1b18 100644 --- a/src/esieequest/game/map/Direction.java +++ b/src/esieequest/game/map/Direction.java @@ -9,10 +9,10 @@ public enum Direction { // @formatter:off + WEST, + EAST, NORTH, SOUTH, - EAST, - WEST, UP, DOWN; @@ -23,14 +23,14 @@ public enum Direction { */ public Direction getOpposite() { switch (this) { + case WEST: + return EAST; + case EAST: + return WEST; case NORTH: return SOUTH; case SOUTH: return NORTH; - case EAST: - return WEST; - case WEST: - return EAST; case UP: return DOWN; case DOWN: @@ -53,25 +53,25 @@ public enum Direction { switch (orientation) { case LEFT: switch (this) { - case NORTH: - return WEST; case WEST: return SOUTH; case SOUTH: return EAST; case EAST: return NORTH; + case NORTH: + return WEST; } case RIGHT: switch (this) { + case WEST: + return NORTH; case NORTH: return EAST; case EAST: return SOUTH; case SOUTH: return WEST; - case WEST: - return NORTH; } } return null; -- cgit v1.2.3