From 728e80ade4d37659fb09ab4ea7db826a58311398 Mon Sep 17 00:00:00 2001 From: Benoît LUBRANO DI SBARAGLIONE Date: Thu, 5 Jun 2014 15:37:35 +0200 Subject: Add Kill Command ! --- src/esieequest/engine/GameEngine.java | 2 +- src/esieequest/engine/commands/Command.java | 1 + src/esieequest/engine/commands/KillCommand.java | 23 +++++++++++++++++++++++ src/esieequest/game/Text.java | 1 + 4 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 src/esieequest/engine/commands/KillCommand.java (limited to 'src') 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 { return; } }); - this.view.echo("You are trapped. You losed."); + this.view.echo("You are trapped. Game Over."); } } 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 { // shortcuts DO(new DoCommand()), + KILL(new KillCommand()), ; 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 @@ +package esieequest.engine.commands; + +import esieequest.game.Game; +import esieequest.game.Text; +import esieequest.ui.View; + +public class KillCommand implements Executable { + + @Override + public void execute(final String argument, final Game game, final View view) { + + if (!argument.isEmpty()) { + view.echo(Text.TOO_MANY_ARGUMENTS.toString()); + return; + } + + view.echo(Text.KILL.toString()); + view.disableInput(); + view.stopMusic(); + + } + +} 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 { WELCOME("Welcome to ESIEEquest! ESIEEquest is a new, amazingly boring adventure game."), CHALLENGE_FAILED("Challenge failed: you died from exhaustion..."), QUIT("Thanks for wasting your time. Good bye."), + KILL("You killed yourself ! Game Over."), ALEA_OVERRIDE_ENABLED("Alea override enabled."), ALEA_OVERRIDE_DISABLED("Alea override disabled."), -- cgit v1.2.3 From abd34ab61aa8be29730739eabaa21838ac90fe85 Mon Sep 17 00:00:00 2001 From: Benoît LUBRANO DI SBARAGLIONE Date: Thu, 5 Jun 2014 18:42:25 +0200 Subject: Add instructions before end game --- src/esieequest/engine/commands/KillCommand.java | 5 +++++ src/esieequest/game/characters/Athanase.java | 10 +++++++--- src/esieequest/game/items/Banana.java | 1 + src/esieequest/game/items/PortableConsole.java | 8 ++++++-- src/esieequest/game/states/Quest.java | 1 + 5 files changed, 20 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/esieequest/engine/commands/KillCommand.java b/src/esieequest/engine/commands/KillCommand.java index bcc0021..9f5dc49 100644 --- a/src/esieequest/engine/commands/KillCommand.java +++ b/src/esieequest/engine/commands/KillCommand.java @@ -4,6 +4,11 @@ import esieequest.game.Game; import esieequest.game.Text; import esieequest.ui.View; +/** + * Allows the user to commit suicide. + * + * @author Benoit LUBRANO DI SBARAGLIONE + */ public class KillCommand implements Executable { @Override 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; * Athanase the mathgorilla. * * @author Pacien TRAN-GIRARD + * @author Benoit LUBRANO DI SBARAGLIONE */ public class Athanase extends SimpleCharacter { @@ -36,7 +37,7 @@ public class Athanase extends SimpleCharacter { if (playersInventory.hasItem(Item.BANANA)) { playersInventory.removeItem(Item.BANANA); view.updateInventory(playersInventory); - view.echo("Ooooh! You have a banana! *nomz* WAIT!... It tastes like... an EMERGENCY BANANA! That means... Hmmm..." + view.echo("Ooooh! You have a banana! *nomz* WAIT!... It tastes like... an EMERGENCY BANANA! That means... Hmmm..." + "\n" + "They turned it ON... Their stupid machine... It was not ready. It was a beta... Obviously it crashed... WITH THE ENTIRE UNIVERSE" + "\n" + "I think we have to restart everything..."); @@ -71,12 +72,15 @@ public class Athanase extends SimpleCharacter { if (playersInventory.hasItem(Item.PORTABLE_CONSOLE)) { 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."); } else { + view.echo("You should go outside, at the Console instead of talking to me."); + } + break; + case USE_DISK: + if (playersInventory.hasItem(Item.DISK)) { view.echo("Well... You have installed the console, right? Have you turned it ON and inserted the disk? Because you should."); } break; - } } - } diff --git a/src/esieequest/game/items/Banana.java b/src/esieequest/game/items/Banana.java index 81f0b45..4350463 100644 --- a/src/esieequest/game/items/Banana.java +++ b/src/esieequest/game/items/Banana.java @@ -7,6 +7,7 @@ import esieequest.ui.View; * A Banana that can be eaten only by Athanase. * * @author Pacien TRAN-GIRARD + * @author Benoit LUBRANO DI SBARAGLIONE */ public class Banana extends SimpleItem { 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; import esieequest.game.Game; import esieequest.game.map.Direction; import esieequest.game.map.Room; +import esieequest.game.states.Quest; import esieequest.ui.View; /** * The transponder. * * @author Pacien TRAN-GIRARD + * @author Benoit LUBRANO DI SBARAGLIONE */ public class PortableConsole extends SimpleItem { @@ -23,11 +25,13 @@ public class PortableConsole extends SimpleItem { public void use(final Game game, final View view) { final boolean onRoundabout = game.getPlayer().getCurrentRoom().equals( Room.ENTRANCE_ROUNDABOUT); - final boolean pointingSouth = game.getPlayer().getCurrentDirection().equals(Direction.EAST); + final boolean pointingEast = game.getPlayer().getCurrentDirection().equals(Direction.EAST); - if (onRoundabout && pointingSouth) { + if (onRoundabout && pointingEast) { game.getPlayer().getInventory().removeItem(Item.PORTABLE_CONSOLE); game.getPlayer().getCurrentSide().getInventory().putItem(Item.PORTABLE_CONSOLE); + game.getPlayer().setCurrentQuest(Quest.USE_DISK); + view.updateQuest(Quest.USE_DISK); view.updateInventory(game.getPlayer().getInventory()); 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 { FIND_DISK("Find the Disk at Club*Nix"), FIND_CONSOLE("Find the Portable Remote Console at ESIEEspace"), INSTALL_CONSOLE("Find a place to install the Console"), + USE_DISK("Insert the disk into the Console"), ; -- cgit v1.2.3 From 95a7af1f4e55db08d9cd19416a7669ce910812e1 Mon Sep 17 00:00:00 2001 From: Benoît LUBRANO DI SBARAGLIONE Date: Thu, 5 Jun 2014 19:03:06 +0200 Subject: Fix nospace!nospace --- src/esieequest/game/Text.java | 2 +- src/esieequest/game/items/Banana.java | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/esieequest/game/Text.java b/src/esieequest/game/Text.java index b4ad037..09317c1 100644 --- a/src/esieequest/game/Text.java +++ b/src/esieequest/game/Text.java @@ -55,7 +55,7 @@ public enum Text { WELCOME("Welcome to ESIEEquest! ESIEEquest is a new, amazingly boring adventure game."), CHALLENGE_FAILED("Challenge failed: you died from exhaustion..."), QUIT("Thanks for wasting your time. Good bye."), - KILL("You killed yourself ! Game Over."), + KILL("You killed yourself! Game Over."), ALEA_OVERRIDE_ENABLED("Alea override enabled."), ALEA_OVERRIDE_DISABLED("Alea override disabled."), diff --git a/src/esieequest/game/items/Banana.java b/src/esieequest/game/items/Banana.java index 4350463..0c7e7ba 100644 --- a/src/esieequest/game/items/Banana.java +++ b/src/esieequest/game/items/Banana.java @@ -1,6 +1,7 @@ package esieequest.game.items; import esieequest.game.Game; +import esieequest.game.states.Quest; import esieequest.ui.View; /** @@ -20,7 +21,10 @@ public class Banana extends SimpleItem { @Override public void use(final Game game, final View view) { - view.echo("Better keep it for later..."); + if (game.getPlayer().getCurrentQuest() == Quest.FEED_ATHANASE) { + view.echo("Athanase would eat this!"); + } else { + view.echo("Better keep it for later..."); + } } - } -- cgit v1.2.3