diff options
author | Benoît LUBRANO DI SBARAGLIONE | 2014-06-05 15:37:35 +0200 |
---|---|---|
committer | Benoît LUBRANO DI SBARAGLIONE | 2014-06-05 15:37:35 +0200 |
commit | 728e80ade4d37659fb09ab4ea7db826a58311398 (patch) | |
tree | 20c3699dd6b81b7d362d9e9a10c1fc1119ae8ab0 /src | |
parent | ed17087e33c72794eb8590404c7f82e6bd2aa287 (diff) | |
download | esieequest-728e80ade4d37659fb09ab4ea7db826a58311398.tar.gz |
Add Kill Command !
Diffstat (limited to 'src')
-rw-r--r-- | src/esieequest/engine/GameEngine.java | 2 | ||||
-rw-r--r-- | src/esieequest/engine/commands/Command.java | 1 | ||||
-rw-r--r-- | src/esieequest/engine/commands/KillCommand.java | 23 | ||||
-rw-r--r-- | src/esieequest/game/Text.java | 1 |
4 files changed, 26 insertions, 1 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..bcc0021 --- /dev/null +++ b/src/esieequest/engine/commands/KillCommand.java | |||
@@ -0,0 +1,23 @@ | |||
1 | package esieequest.engine.commands; | ||
2 | |||
3 | import esieequest.game.Game; | ||
4 | import esieequest.game.Text; | ||
5 | import esieequest.ui.View; | ||
6 | |||
7 | public class KillCommand implements Executable { | ||
8 | |||
9 | @Override | ||
10 | public void execute(final String argument, final Game game, final View view) { | ||
11 | |||
12 | if (!argument.isEmpty()) { | ||
13 | view.echo(Text.TOO_MANY_ARGUMENTS.toString()); | ||
14 | return; | ||
15 | } | ||
16 | |||
17 | view.echo(Text.KILL.toString()); | ||
18 | view.disableInput(); | ||
19 | view.stopMusic(); | ||
20 | |||
21 | } | ||
22 | |||
23 | } | ||
diff --git a/src/esieequest/game/Text.java b/src/esieequest/game/Text.java index 7f74e58..b4ad037 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."), |