aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPacien TRAN-GIRARD2014-06-09 22:33:56 +0200
committerPacien TRAN-GIRARD2014-06-09 22:33:56 +0200
commit243ae35dce4dd0b7774def30543ef801b93fd8fa (patch)
treef6b11760615454e497c9d9766494d829dfaff6fa /src
parent944ab1b199f4ea4a7823dfaee084c54b03eb8ba1 (diff)
parent95a7af1f4e55db08d9cd19416a7669ce910812e1 (diff)
downloadesieequest-243ae35dce4dd0b7774def30543ef801b93fd8fa.tar.gz
Merge branch 'master' of https://gitlab.pacien.net/pacien/a3p-esieequest
Diffstat (limited to 'src')
-rw-r--r--src/esieequest/engine/GameEngine.java2
-rw-r--r--src/esieequest/engine/commands/Command.java1
-rw-r--r--src/esieequest/engine/commands/KillCommand.java28
-rw-r--r--src/esieequest/game/Text.java1
-rw-r--r--src/esieequest/game/characters/Athanase.java10
-rw-r--r--src/esieequest/game/items/Banana.java9
-rw-r--r--src/esieequest/game/items/PortableConsole.java8
-rw-r--r--src/esieequest/game/states/Quest.java1
8 files changed, 52 insertions, 8 deletions
diff --git a/src/esieequest/engine/GameEngine.java b/src/esieequest/engine/GameEngine.java
index 9211eb0..ebd37b4 100644
--- a/src/esieequest/engine/GameEngine.java
+++ b/src/esieequest/engine/GameEngine.java
@@ -111,7 +111,7 @@ public class GameEngine {
111 return; 111 return;
112 } 112 }
113 }); 113 });
114 this.view.echo("You are trapped. You losed."); 114 this.view.echo("You are trapped. Game Over.");
115 } 115 }
116 116
117 } 117 }
diff --git a/src/esieequest/engine/commands/Command.java b/src/esieequest/engine/commands/Command.java
index 5c44e9b..e73856a 100644
--- a/src/esieequest/engine/commands/Command.java
+++ b/src/esieequest/engine/commands/Command.java
@@ -43,6 +43,7 @@ public enum Command {
43 43
44 // shortcuts 44 // shortcuts
45 DO(new DoCommand()), 45 DO(new DoCommand()),
46 KILL(new KillCommand()),
46 47
47 ; 48 ;
48 49
diff --git a/src/esieequest/engine/commands/KillCommand.java b/src/esieequest/engine/commands/KillCommand.java
new file mode 100644
index 0000000..9f5dc49
--- /dev/null
+++ b/src/esieequest/engine/commands/KillCommand.java
@@ -0,0 +1,28 @@
1package esieequest.engine.commands;
2
3import esieequest.game.Game;
4import esieequest.game.Text;
5import esieequest.ui.View;
6
7/**
8 * Allows the user to commit suicide.
9 *
10 * @author Benoit LUBRANO DI SBARAGLIONE
11 */
12public class KillCommand implements Executable {
13
14 @Override
15 public void execute(final String argument, final Game game, final View view) {
16
17 if (!argument.isEmpty()) {
18 view.echo(Text.TOO_MANY_ARGUMENTS.toString());
19 return;
20 }
21
22 view.echo(Text.KILL.toString());
23 view.disableInput();
24 view.stopMusic();
25
26 }
27
28}
diff --git a/src/esieequest/game/Text.java b/src/esieequest/game/Text.java
index 7f74e58..09317c1 100644
--- a/src/esieequest/game/Text.java
+++ b/src/esieequest/game/Text.java
@@ -55,6 +55,7 @@ public enum Text {
55 WELCOME("Welcome to ESIEEquest! ESIEEquest is a new, amazingly boring adventure game."), 55 WELCOME("Welcome to ESIEEquest! ESIEEquest is a new, amazingly boring adventure game."),
56 CHALLENGE_FAILED("Challenge failed: you died from exhaustion..."), 56 CHALLENGE_FAILED("Challenge failed: you died from exhaustion..."),
57 QUIT("Thanks for wasting your time. Good bye."), 57 QUIT("Thanks for wasting your time. Good bye."),
58 KILL("You killed yourself! Game Over."),
58 59
59 ALEA_OVERRIDE_ENABLED("Alea override enabled."), 60 ALEA_OVERRIDE_ENABLED("Alea override enabled."),
60 ALEA_OVERRIDE_DISABLED("Alea override disabled."), 61 ALEA_OVERRIDE_DISABLED("Alea override disabled."),
diff --git a/src/esieequest/game/characters/Athanase.java b/src/esieequest/game/characters/Athanase.java
index 51fa3c0..442273f 100644
--- a/src/esieequest/game/characters/Athanase.java
+++ b/src/esieequest/game/characters/Athanase.java
@@ -10,6 +10,7 @@ import esieequest.ui.View;
10 * Athanase the mathgorilla. 10 * Athanase the mathgorilla.
11 * 11 *
12 * @author Pacien TRAN-GIRARD 12 * @author Pacien TRAN-GIRARD
13 * @author Benoit LUBRANO DI SBARAGLIONE
13 */ 14 */
14public class Athanase extends SimpleCharacter { 15public class Athanase extends SimpleCharacter {
15 16
@@ -36,7 +37,7 @@ public class Athanase extends SimpleCharacter {
36 if (playersInventory.hasItem(Item.BANANA)) { 37 if (playersInventory.hasItem(Item.BANANA)) {
37 playersInventory.removeItem(Item.BANANA); 38 playersInventory.removeItem(Item.BANANA);
38 view.updateInventory(playersInventory); 39 view.updateInventory(playersInventory);
39 view.echo("Ooooh! You have a banana! *nomz* WAIT!... It tastes like... an EMERGENCY BANANA! That means... Hmmm..." 40 view.echo("Ooooh! You have a banana! *nomz* WAIT!... It tastes like... an EMERGENCY BANANA! That means... Hmmm..."
40 + "\n" 41 + "\n"
41 + "They turned it ON... Their stupid machine... It was not ready. It was a beta... Obviously it crashed... WITH THE ENTIRE UNIVERSE" 42 + "They turned it ON... Their stupid machine... It was not ready. It was a beta... Obviously it crashed... WITH THE ENTIRE UNIVERSE"
42 + "\n" + "I think we have to restart everything..."); 43 + "\n" + "I think we have to restart everything...");
@@ -71,12 +72,15 @@ public class Athanase extends SimpleCharacter {
71 if (playersInventory.hasItem(Item.PORTABLE_CONSOLE)) { 72 if (playersInventory.hasItem(Item.PORTABLE_CONSOLE)) {
72 view.echo("The Universe is far away... Well... Not exactly... Sort of... Complicated. Find an antenna on the outside or something that may act as an amplifier and connect the Portable Console to contact the Universe."); 73 view.echo("The Universe is far away... Well... Not exactly... Sort of... Complicated. Find an antenna on the outside or something that may act as an amplifier and connect the Portable Console to contact the Universe.");
73 } else { 74 } else {
75 view.echo("You should go outside, at the Console instead of talking to me.");
76 }
77 break;
78 case USE_DISK:
79 if (playersInventory.hasItem(Item.DISK)) {
74 view.echo("Well... You have installed the console, right? Have you turned it ON and inserted the disk? Because you should."); 80 view.echo("Well... You have installed the console, right? Have you turned it ON and inserted the disk? Because you should.");
75 } 81 }
76 break; 82 break;
77
78 } 83 }
79 84
80 } 85 }
81
82} 86}
diff --git a/src/esieequest/game/items/Banana.java b/src/esieequest/game/items/Banana.java
index 81f0b45..0c7e7ba 100644
--- a/src/esieequest/game/items/Banana.java
+++ b/src/esieequest/game/items/Banana.java
@@ -1,12 +1,14 @@
1package esieequest.game.items; 1package esieequest.game.items;
2 2
3import esieequest.game.Game; 3import esieequest.game.Game;
4import esieequest.game.states.Quest;
4import esieequest.ui.View; 5import esieequest.ui.View;
5 6
6/** 7/**
7 * A Banana that can be eaten only by Athanase. 8 * A Banana that can be eaten only by Athanase.
8 * 9 *
9 * @author Pacien TRAN-GIRARD 10 * @author Pacien TRAN-GIRARD
11 * @author Benoit LUBRANO DI SBARAGLIONE
10 */ 12 */
11public class Banana extends SimpleItem { 13public class Banana extends SimpleItem {
12 14
@@ -19,7 +21,10 @@ public class Banana extends SimpleItem {
19 21
20 @Override 22 @Override
21 public void use(final Game game, final View view) { 23 public void use(final Game game, final View view) {
22 view.echo("Better keep it for later..."); 24 if (game.getPlayer().getCurrentQuest() == Quest.FEED_ATHANASE) {
25 view.echo("Athanase would eat this!");
26 } else {
27 view.echo("Better keep it for later...");
28 }
23 } 29 }
24
25} 30}
diff --git a/src/esieequest/game/items/PortableConsole.java b/src/esieequest/game/items/PortableConsole.java
index 9c14219..cf63da1 100644
--- a/src/esieequest/game/items/PortableConsole.java
+++ b/src/esieequest/game/items/PortableConsole.java
@@ -3,12 +3,14 @@ package esieequest.game.items;
3import esieequest.game.Game; 3import esieequest.game.Game;
4import esieequest.game.map.Direction; 4import esieequest.game.map.Direction;
5import esieequest.game.map.Room; 5import esieequest.game.map.Room;
6import esieequest.game.states.Quest;
6import esieequest.ui.View; 7import esieequest.ui.View;
7 8
8/** 9/**
9 * The transponder. 10 * The transponder.
10 * 11 *
11 * @author Pacien TRAN-GIRARD 12 * @author Pacien TRAN-GIRARD
13 * @author Benoit LUBRANO DI SBARAGLIONE
12 */ 14 */
13public class PortableConsole extends SimpleItem { 15public class PortableConsole extends SimpleItem {
14 16
@@ -23,11 +25,13 @@ public class PortableConsole extends SimpleItem {
23 public void use(final Game game, final View view) { 25 public void use(final Game game, final View view) {
24 final boolean onRoundabout = game.getPlayer().getCurrentRoom().equals( 26 final boolean onRoundabout = game.getPlayer().getCurrentRoom().equals(
25 Room.ENTRANCE_ROUNDABOUT); 27 Room.ENTRANCE_ROUNDABOUT);
26 final boolean pointingSouth = game.getPlayer().getCurrentDirection().equals(Direction.EAST); 28 final boolean pointingEast = game.getPlayer().getCurrentDirection().equals(Direction.EAST);
27 29
28 if (onRoundabout && pointingSouth) { 30 if (onRoundabout && pointingEast) {
29 game.getPlayer().getInventory().removeItem(Item.PORTABLE_CONSOLE); 31 game.getPlayer().getInventory().removeItem(Item.PORTABLE_CONSOLE);
30 game.getPlayer().getCurrentSide().getInventory().putItem(Item.PORTABLE_CONSOLE); 32 game.getPlayer().getCurrentSide().getInventory().putItem(Item.PORTABLE_CONSOLE);
33 game.getPlayer().setCurrentQuest(Quest.USE_DISK);
34 view.updateQuest(Quest.USE_DISK);
31 35
32 view.updateInventory(game.getPlayer().getInventory()); 36 view.updateInventory(game.getPlayer().getInventory());
33 view.updateLocation(game.getPlayer().getCurrentRoom(), game.getPlayer() 37 view.updateLocation(game.getPlayer().getCurrentRoom(), game.getPlayer()
diff --git a/src/esieequest/game/states/Quest.java b/src/esieequest/game/states/Quest.java
index 2a7c591..a09ea09 100644
--- a/src/esieequest/game/states/Quest.java
+++ b/src/esieequest/game/states/Quest.java
@@ -18,6 +18,7 @@ public enum Quest {
18 FIND_DISK("Find the Disk at Club*Nix"), 18 FIND_DISK("Find the Disk at Club*Nix"),
19 FIND_CONSOLE("Find the Portable Remote Console at ESIEEspace"), 19 FIND_CONSOLE("Find the Portable Remote Console at ESIEEspace"),
20 INSTALL_CONSOLE("Find a place to install the Console"), 20 INSTALL_CONSOLE("Find a place to install the Console"),