From e12f068572a3f1baefc55186cc97789154e2cf94 Mon Sep 17 00:00:00 2001 From: "profit.samuel" Date: Thu, 15 Mar 2018 10:50:03 -0700 Subject: [PATCH 1/3] Merge branch 'master' of C:\Users\profit.samuel\IdeaProjects\AdventureGalley with conflicts. --- src/com/company/Baseball.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/com/company/Baseball.java b/src/com/company/Baseball.java index 3862c21..af2a12a 100644 --- a/src/com/company/Baseball.java +++ b/src/com/company/Baseball.java @@ -13,4 +13,9 @@ public String handle(String s) { return "derp."; } } + + @Override + public String handle(String s) { + return null; + } } From 6c6b33b1bf39d78e5e9180e32d88349f4a36ee9c Mon Sep 17 00:00:00 2001 From: "profit.samuel" Date: Thu, 15 Mar 2018 10:55:31 -0700 Subject: [PATCH 2/3] I added a new item named baseball and implemented the method throwable into the item class. --- src/com/company/Baseball.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/com/company/Baseball.java b/src/com/company/Baseball.java index af2a12a..9952cf7 100644 --- a/src/com/company/Baseball.java +++ b/src/com/company/Baseball.java @@ -18,4 +18,12 @@ public String handle(String s) { public String handle(String s) { return null; } + @Override + public String handle(String s) { + if (s.equalsIgnoreCase("examine")) { + return this.getDescription(); + } else { + return "derp."; + } + } } From 66c775abcb918ff10eab0eefd2cf19bd9794497a Mon Sep 17 00:00:00 2001 From: "profit.samuel" Date: Mon, 19 Mar 2018 09:19:16 -0700 Subject: [PATCH 3/3] Fixed the changes to the Item class that were breaking things. --- src/com/company/Apple.java | 3 +-- src/com/company/Baseball.java | 13 ----------- src/com/company/Main.java | 3 --- src/com/company/Pencil.java | 41 +++++++++++++++++++++++++++++++++++ 4 files changed, 42 insertions(+), 18 deletions(-) create mode 100644 src/com/company/Pencil.java diff --git a/src/com/company/Apple.java b/src/com/company/Apple.java index 982c9b4..e10e17f 100644 --- a/src/com/company/Apple.java +++ b/src/com/company/Apple.java @@ -1,6 +1,5 @@ package com.company; -import java.time.Duration; import java.util.Date; /** @@ -12,7 +11,7 @@ public class Apple extends Item { private Date bestByDate; public Apple() { - super("apple", "A delicious red apple.", true); + super("Pencil", "An ordinary looking orange pencil", true); birthdate = new Date(); bestByDate = new Date(birthdate.getTime() + 5*60); } diff --git a/src/com/company/Baseball.java b/src/com/company/Baseball.java index 9952cf7..3862c21 100644 --- a/src/com/company/Baseball.java +++ b/src/com/company/Baseball.java @@ -13,17 +13,4 @@ public String handle(String s) { return "derp."; } } - - @Override - public String handle(String s) { - return null; - } - @Override - public String handle(String s) { - if (s.equalsIgnoreCase("examine")) { - return this.getDescription(); - } else { - return "derp."; - } - } } diff --git a/src/com/company/Main.java b/src/com/company/Main.java index 9c453eb..e4297e6 100644 --- a/src/com/company/Main.java +++ b/src/com/company/Main.java @@ -1,7 +1,5 @@ package com.company; -import java.util.Scanner; - public class Main { public static void main(String[] args) { @@ -17,7 +15,6 @@ public static void main(String[] args) { // offer help, since this is the player's first time playing String prompt = input.readLine(curRoom.getDescription()+ " Type your command. If you need help, type 'help.'"); - while(true) { String[] words = prompt.split(" "); String directObject = words[words.length-1]; diff --git a/src/com/company/Pencil.java b/src/com/company/Pencil.java new file mode 100644 index 0000000..d4116da --- /dev/null +++ b/src/com/company/Pencil.java @@ -0,0 +1,41 @@ +package com.company; + +public class Pencil extends Item { + + public Pencil () { + super("Pencil", "An ordinary looking orange pencil", false); + } + public Pencil(String name, String description) { + super(name, description, false); + } + + @Override + public String handle(String s) { + if(s.equalsIgnoreCase("examine")) { + return this.getDescription(); + } + else if(s.equalsIgnoreCase("Paint")){ + this.setDescription("The pencil now is yellow."); + return this.getDescription(); + } + else if(s.equalsIgnoreCase("Write")) { + return "The Communist League, an international association of workers, which could of course be only a\n" + + "secret one, under conditions obtaining at the time, commissioned us, the undersigned, at the\n" + + "Congress held in London in November 1847, to write for publication a detailed theoretical and\n" + + "practical programme for the Party. Such was the origin of the following Manifesto, the\n" + + "manuscript of which travelled to London to be printed a few weeks before the February [French]\n" + + "Revolution [in 1848]. First published in German, it has been republished in that language in at\n" + + "least twelve different editions in Germany, England, and America. It was published in English for\n" + + "the first time in 1850 in the Red Republican, London, translated by Miss Helen Macfarlane, and\n" + + "in 1871 in at least three different translations in America. The French version first appeared in\n" + + "Paris shortly before the June insurrection of 1848, and recently in Le Socialiste of New York. A\n" + + "new translation is in the course of preparation. A Polish version appeared in London shortly after\n" + + "it was first published in Germany. A Russian translation was published in Geneva in the sixties1\n" + + ".\n" + + "Into Danish, too, it was translated shortly after its appearance"; + } + else { + return "I don't know how to "+ s + "a pencil"; + } + } +}