aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPacien TRAN-GIRARD2014-04-17 10:07:19 +0000
committerPacien TRAN-GIRARD2014-04-17 10:07:19 +0000
commit006daa5c112fd9a5e3bdc38d760ba22b2558651c (patch)
tree638d75e1dd07e29df248143960794265041bbae0 /src
parent12acc853fff55c463f10509e5e79fee72cd9127e (diff)
parentabc30b45754e82c00d7c06ff83c74dff9401da11 (diff)
downloadesieequest-006daa5c112fd9a5e3bdc38d760ba22b2558651c.tar.gz
Merge branch 'zuul-extended' into 'master'
Zuul Extended
Diffstat (limited to 'src')
-rwxr-xr-xsrc/esieequest/Main.java4
-rw-r--r--src/esieequest/controller/Interpreter.java31
-rw-r--r--src/esieequest/controller/Parser.java2
-rw-r--r--src/esieequest/controller/Performer.java151
-rw-r--r--src/esieequest/model/Game.java115
-rw-r--r--src/esieequest/model/commands/CommandWord.java2
-rw-r--r--src/esieequest/model/entities/Character.java25
-rw-r--r--src/esieequest/model/entities/MovingCharacter.java33
-rw-r--r--src/esieequest/model/entities/Player.java56
-rw-r--r--src/esieequest/model/entities/Sumobot.java32
-rw-r--r--src/esieequest/model/events/Quest.java5
-rw-r--r--src/esieequest/model/items/Beamer.java45
-rw-r--r--src/esieequest/model/items/Inventory.java37
-rw-r--r--src/esieequest/model/items/Item.java17
-rw-r--r--src/esieequest/model/items/KeyCard.java20
-rw-r--r--src/esieequest/model/map/Door.java41
-rw-r--r--src/esieequest/model/map/HiddenDoor.java20
-rw-r--r--src/esieequest/model/map/LockedDoor.java55
-rw-r--r--src/esieequest/model/map/Room.java51
-rw-r--r--src/esieequest/model/map/TransporterDoor.java36
-rw-r--r--src/esieequest/model/map/TrapDoor.java21
21 files changed, 723 insertions, 76 deletions
diff --git a/src/esieequest/Main.java b/src/esieequest/Main.java
index 59ac568..362af9c 100755
--- a/src/esieequest/Main.java
+++ b/src/esieequest/Main.java
@@ -62,6 +62,10 @@ public class Main extends JApplet {
62 view = new Window(); 62 view = new Window();
63 } 63 }
64 64
65 if (arguments.contains("--challenge")) {
66 game.getPlayer().setMaxNbSteps(50);
67 }
68
65 new GameEngine(game, view); 69 new GameEngine(game, view);
66 } 70 }
67 71
diff --git a/src/esieequest/controller/Interpreter.java b/src/esieequest/controller/Interpreter.java
index 32adeda..1895099 100644
--- a/src/esieequest/controller/Interpreter.java
+++ b/src/esieequest/controller/Interpreter.java
@@ -48,6 +48,8 @@ class Interpreter {
48 public void dispatch(final Command command) { 48 public void dispatch(final Command command) {
49 if (command.getAction() != null) { 49 if (command.getAction() != null) {
50 switch (command.getAction()) { 50 switch (command.getAction()) {
51
52 // game related:
51 case NEW: 53 case NEW:
52 this.performer.newGame(); 54 this.performer.newGame();
53 return; 55 return;
@@ -57,9 +59,17 @@ class Interpreter {
57 case SAVE: 59 case SAVE:
58 this.performer.saveGame(); 60 this.performer.saveGame();
59 return; 61 return;
62 case QUIT:
63 this.performer.quitGame();
64 return;
60 case SOUND: 65 case SOUND:
61 this.performer.toggleSound(); 66 this.performer.toggleSound();
62 return; 67 return;
68 case HELP:
69 this.performer.showHelp();
70 return;
71
72 // map related:
63 case GO: 73 case GO:
64 this.performer.goTo(command.getOption()); 74 this.performer.goTo(command.getOption());
65 return; 75 return;
@@ -69,25 +79,32 @@ class Interpreter {
69 case LOOK: 79 case LOOK:
70 this.performer.look(); 80 this.performer.look();
71 return; 81 return;
82 case ALEA:
83 this.performer.forceAlea(command.getOption());
84 return;
85
86 // items related:
72 case INVENTORY: 87 case INVENTORY:
73 this.performer.listItems(); 88 this.performer.listItems();
74 return; 89 return;
75 case TAKE: 90 case TAKE:
76 this.performer.take(command.getOption()); 91 this.performer.takeItem(command.getOption());
77 return; 92 return;
78 case DROP: 93 case DROP:
79 this.performer.drop(command.getOption()); 94 this.performer.dropItem(command.getOption());
80 return; 95 return;
81 case HELP: 96 case USE:
82 this.performer.showHelp(); 97 this.performer.useItem(command.getOption());
83 return; 98 return;
84 case QUIT: 99
85 this.performer.quitGame(); 100 // characters related
101 case TALK:
102 this.performer.talk(command.getOption());
86 return; 103 return;
104
87 } 105 }
88 } 106 }
89 this.performer.echo("Unknown command."); 107 this.performer.echo("Unknown command.");
90 return; 108 return;
91 } 109 }
92
93} 110}
diff --git a/src/esieequest/controller/Parser.java b/src/esieequest/controller/Parser.java
index 7b07efb..d13f940 100644
--- a/src/esieequest/controller/Parser.java
+++ b/src/esieequest/controller/Parser.java
@@ -25,7 +25,7 @@ class Parser {
25 * @return the command 25 * @return the command
26 */ 26 */
27 public Command getCommand(final String commandString) { 27 public Command getCommand(final String commandString) {
28 final String[] elements = commandString.split(" "); 28 final String[] elements = commandString.split(" ", 2);
29 29
30 CommandWord action = null; 30 CommandWord action = null;
31 String option = null; 31 String option = null;
diff --git a/src/esieequest/controller/Performer.java b/src/esieequest/controller/Performer.java
index 7ba8c94..6526ef7 100644
--- a/src/esieequest/controller/Performer.java
+++ b/src/esieequest/controller/Performer.java
@@ -1,12 +1,23 @@
1package esieequest.controller; 1package esieequest.controller;
2 2
3import java.util.Collection;
4import java.util.HashMap;
3import java.util.HashSet; 5import java.util.HashSet;
6import java.util.Random;
4import java.util.Set; 7import java.util.Set;
5 8
6import esieequest.model.Game; 9import esieequest.model.Game;
7import esieequest.model.commands.CommandWord; 10import esieequest.model.commands.CommandWord;
11import esieequest.model.entities.Character;
12import esieequest.model.entities.MovingCharacter;
13import esieequest.model.items.Beamer;
8import esieequest.model.items.Inventory; 14import esieequest.model.items.Inventory;
15import esieequest.model.items.Item;
16import esieequest.model.map.Door;
17import esieequest.model.map.LockedDoor;
9import esieequest.model.map.Room; 18import esieequest.model.map.Room;
19import esieequest.model.map.TransporterDoor;
20import esieequest.model.map.TrapDoor;
10import esieequest.view.View; 21import esieequest.view.View;
11 22
12/** 23/**
@@ -55,6 +66,7 @@ class Performer {
55 */ 66 */
56 public void newGame() { 67 public void newGame() {
57 // this.loadGame(default game); 68 // this.loadGame(default game);
69 // TODO
58 this.view.enable(); 70 this.view.enable();
59 this.echo(this.game.getWelcomeMessage()); 71 this.echo(this.game.getWelcomeMessage());
60 } 72 }
@@ -63,6 +75,7 @@ class Performer {
63 * Loads a saved game. 75 * Loads a saved game.
64 */ 76 */
65 public void loadGame() { 77 public void loadGame() {
78 // TODO
66 this.notImplemented(); 79 this.notImplemented();
67 } 80 }
68 81
@@ -70,6 +83,7 @@ class Performer {
70 * Saves the current game. 83 * Saves the current game.
71 */ 84 */
72 public void saveGame() { 85 public void saveGame() {
86 // TODO
73 this.notImplemented(); 87 this.notImplemented();
74 } 88 }
75 89
@@ -77,6 +91,7 @@ class Performer {
77 * Toggles the sound. 91 * Toggles the sound.
78 */ 92 */
79 public void toggleSound() { 93 public void toggleSound() {
94 // TODO
80 this.notImplemented(); 95 this.notImplemented();
81 } 96 }
82 97
@@ -106,12 +121,25 @@ class Performer {
106 * the direction of the new room 121 * the direction of the new room
107 */ 122 */