37 Commits
1.0 ... 1.3

Author SHA1 Message Date
93f16751f1 Fixed some little problems with documenting. 2019-02-25 23:47:34 -07:00
507fe4debd Fixed some little problems with documenting. 2019-02-25 23:42:27 -07:00
2d1864bb87 Fixed the commenting on a lot of the code. Also added some stuff to Travel, fixed some bugs. 2019-02-25 23:31:39 -07:00
Nathan Lum
de3c686db7 Added Javadoc comments 2019-02-25 22:50:58 -07:00
Nathan Lum
2abef09de8 Added Javadoc comments 2019-02-25 22:00:01 -07:00
Nathan Lum
b1421e19d4 Added Javadoc comments 2019-02-25 21:15:46 -07:00
Nathan Lum
55e1ae2d5f Added Javadoc comments 2019-02-25 21:12:33 -07:00
Vikramb987
697c221323 Update Player.java 2019-02-25 20:19:40 -07:00
Vikramb987
4aaff2809a Update main.java 2019-02-25 20:19:14 -07:00
KahootChampion
581bee7bfe Test out this code BOIZ 2019-02-25 20:20:11 -07:00
KahootChampion
1295d625fb KK 2019-02-25 20:07:21 -07:00
KahootChampion
52ec4c2422 Aight fixed some stuff 2019-02-25 20:06:21 -07:00
KahootChampion
27ac100618 Test this Vikram 2019-02-25 20:01:21 -07:00
Vikramb987
94762234af Update main.java 2019-02-25 19:58:32 -07:00
Vikramb987
207d258e05 Update Start.java
very small change -- again just for testing
2019-02-25 19:47:20 -07:00
Vikramb987
f236650611 Update TaipanShop.java
javadocs and some changes to how the game ends
2019-02-25 19:46:09 -07:00
Vikramb987
757d258e3d Update Player.java
changes to how the game ends
2019-02-25 19:44:21 -07:00
KahootChampion
e7a0ddf085 Small change to javadocs for shipwarfare 2019-02-25 19:42:19 -07:00
KahootChampion
70b698c22e Java Docs BOIZ for ShipWarafare 2019-02-25 19:35:50 -07:00
Siddhant Dewani
4cc9ac5d26 Small thing, changed an output of warehouse a bit, shows user its the warehouse they are concerned with. 2019-02-25 19:16:09 -07:00
Siddhant Dewani
c66e3d5d70 Small thing, changed an output of warehouse a bit, shows user its the warehouse they are concerned with. 2019-02-25 19:06:02 -07:00
Siddhant Dewani
40ba6b0c9b Small thing, changed an output of warehouse a bit, shows user its the warehouse they are concerned with. 2019-02-25 18:53:51 -07:00
Siddhant Dewani
2ae60073c0 Small thing, changed an output of warehouse a bit, shows user its the warehouse they are concerned with. 2019-02-25 18:53:25 -07:00
Vikram
c4c4a41776 Merge remote-tracking branch 'origin/master' 2019-02-25 18:43:11 -07:00
Vikram
6b379bae3a minor changes. Still in progress. 2019-02-25 18:42:48 -07:00
Siddhant Dewani
67ddc34c65 Small thing, changed an output of warehouse a bit, shows user its the warehouse they are concerned with. 2019-02-25 18:42:40 -07:00
Vikram
b6b5c14c56 Merge remote-tracking branch 'origin/master'
# Conflicts:
#	out/production/TaipanClone/ShipWarfare.class
2019-02-25 18:33:26 -07:00
Vikram
d1c3fe0f7e minor changes. Still in progress. 2019-02-25 18:31:54 -07:00
Nathan Lum
fcb0b50468 Added Javadocs comments 2019-02-25 17:45:06 -07:00
KahootChampion
237ce1da27 Stupid error was fixed 2019-02-25 17:42:58 -07:00
Nathan Lum
3b068d869b Update main.java 2019-02-25 16:28:36 -07:00
Nathan Lum
70d9a36af5 Update Start.java 2019-02-25 16:28:09 -07:00
Vikramb987
06739ed20c Update loanShark.java 2019-02-25 14:31:34 -07:00
Vikramb987
6f3bb7d7c4 Update Bank.java
removed rartedness
2019-02-25 12:55:06 -07:00
Vikram
8d35d073e4 Merge remote-tracking branch 'origin/master' 2019-02-25 07:42:13 -07:00
Vikram
672707f5b6 Merge remote-tracking branch 'origin/master'
# Conflicts:
#	.idea/workspace.xml
#	src/ShipWarfare.java
2019-02-25 07:40:36 -07:00
Vikram
83057e863f the comment somehow made it so that I couldn't compile (using the command line i couldn't compile, i could compile file using intellij) Also, you the file extended player, which is not necessary. You also were calling gameOver() and getName() directly, you needed "player." before all those methods. 2019-02-25 07:39:57 -07:00
12 changed files with 1161 additions and 510 deletions

8
.idea/misc.xml generated
View File

@@ -1,9 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="JavadocGenerationManager">
<option name="OUTPUT_DIRECTORY" value="$USER_HOME$/Desktop/Javadocs TaipanClone" />
<option name="OPTION_HIERARCHY" value="false" />
<option name="OPTION_NAVIGATOR" value="false" />
<option name="OPTION_INDEX" value="false" />
</component>
<component name="ProjectKey"> <component name="ProjectKey">
<option name="state" value="project://63537948-39a4-48a0-9c97-34259a0fa913" /> <option name="state" value="project://63537948-39a4-48a0-9c97-34259a0fa913" />
</component> </component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8.0_201" project-jdk-type="JavaSDK"> <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8.0_141" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" /> <output url="file://$PROJECT_DIR$/out" />
</component> </component>
<component name="SvnBranchConfigurationManager"> <component name="SvnBranchConfigurationManager">

625
.idea/workspace.xml generated
View File

@@ -1,48 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="3114a2b9-4919-4fdf-8fd9-d03b60109ce4" name="Default Changelist" comment="Really small change in Sid's code that no one will probably ever notice lol"> <list default="true" id="3114a2b9-4919-4fdf-8fd9-d03b60109ce4" name="Default Changelist" comment="Fixed the commenting on a lot of the code. Also added some stuff to Travel, fixed some bugs.">
<change beforePath="$PROJECT_DIR$/.idea/misc.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/misc.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/ShipWarfare.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/ShipWarfare.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/Travel.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Travel.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/loanShark.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/loanShark.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/main.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main.java" afterDir="false" />
</list> </list>
<ignored path="$PROJECT_DIR$/out/" /> <ignored path="$PROJECT_DIR$/out/" />
<ignored path="C:\Users\Harkamal Randhawa\IdeaProjects\TaipanClone\.idea\shelf/" />
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" /> <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" /> <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" /> <option name="LAST_RESOLUTION" value="IGNORE" />
</component> </component>
<component name="DatabaseView">
<option name="SHOW_INTERMEDIATE" value="true" />
<option name="GROUP_DATA_SOURCES" value="true" />
<option name="GROUP_SCHEMA" value="true" />
<option name="GROUP_CONTENTS" value="false" />
<option name="SORT_POSITIONED" value="false" />
<option name="SHOW_EMPTY_GROUPS" value="false" />
<option name="AUTO_SCROLL_FROM_SOURCE" value="false" />
<option name="HIDDEN_KINDS">
<set />
</option>
<expand />
<select />
</component>
<component name="FileEditorManager"> <component name="FileEditorManager">
<leaf> <leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<file pinned="false" current-in-tab="false"> <file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/loanShark.java"> <entry file="file://$PROJECT_DIR$/src/Start.java">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="450"> <state relative-caret-position="590">
<caret line="30" column="21" lean-forward="true" selection-start-line="30" selection-start-column="21" selection-end-line="30" selection-end-column="21" /> <caret line="70" column="24" lean-forward="true" selection-start-line="70" selection-start-column="24" selection-end-line="70" selection-end-column="24" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/main.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="184">
<caret line="42" column="62" selection-start-line="42" selection-start-column="62" selection-end-line="42" selection-end-column="62" />
</state> </state>
</provider> </provider>
</entry> </entry>
</file> </file>
<file pinned="false" current-in-tab="true"> <file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/src/ShipWarfare.java"> <entry file="file://$PROJECT_DIR$/src/Travel.java">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="234"> <state relative-caret-position="27">
<caret line="371" column="43" lean-forward="true" selection-start-line="371" selection-start-column="43" selection-end-line="371" selection-end-column="43" /> <caret line="125" column="63" selection-start-line="125" selection-start-column="63" selection-end-line="125" selection-end-column="63" />
<folding> <folding>
<element signature="imports" expanded="true" /> <element signature="imports" expanded="true" />
</folding> </folding>
@@ -51,19 +48,13 @@
</entry> </entry>
</file> </file>
<file pinned="false" current-in-tab="false"> <file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/Travel.java"> <entry file="file://$PROJECT_DIR$/src/TaipanShop.java">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="136"> <state relative-caret-position="168">
<caret line="63" column="38" selection-start-line="63" selection-start-column="28" selection-end-line="63" selection-end-column="38" /> <caret line="594" column="42" lean-forward="true" selection-start-line="594" selection-start-column="42" selection-end-line="594" selection-end-column="42" />
</state> <folding>
</provider> <element signature="imports" expanded="true" />
</entry> </folding>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/Start.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="353">
<caret line="33" column="9" lean-forward="true" selection-start-line="33" selection-start-column="9" selection-end-line="33" selection-end-column="9" />
</state> </state>
</provider> </provider>
</entry> </entry>
@@ -71,8 +62,26 @@
<file pinned="false" current-in-tab="false"> <file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/Bank.java"> <entry file="file://$PROJECT_DIR$/src/Bank.java">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="375"> <state relative-caret-position="-872">
<caret line="25" column="23" selection-start-line="25" selection-start-column="23" selection-end-line="25" selection-end-column="23" /> <caret line="7" column="6" lean-forward="true" selection-start-line="7" selection-start-column="6" selection-end-line="7" selection-end-column="6" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/Player.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-2606">
<caret line="24" column="5" lean-forward="true" selection-start-line="24" selection-start-column="5" selection-end-line="24" selection-end-column="5" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/ShipWarfare.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="17">
<caret line="353" column="11" selection-start-line="353" selection-start-column="11" selection-end-line="353" selection-end-column="11" />
<folding> <folding>
<element signature="imports" expanded="true" /> <element signature="imports" expanded="true" />
</folding> </folding>
@@ -80,6 +89,15 @@
</provider> </provider>
</entry> </entry>
</file> </file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/Warehouse.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="34">
<caret line="2" column="3" selection-start-line="2" selection-start-column="3" selection-end-line="2" selection-end-column="3" />
</state>
</provider>
</entry>
</file>
</leaf> </leaf>
</component> </component>
<component name="FileTemplateManagerImpl"> <component name="FileTemplateManagerImpl">
@@ -91,85 +109,57 @@
</component> </component>
<component name="FindInProjectRecents"> <component name="FindInProjectRecents">
<findStrings> <findStrings>
<find>howmuchRun</find> <find>Hp</find>
<find>setPlayer</find> <find>travel</find>
<find>setNumOf</find> <find>notDone</find>
<find>setNumOfLitty</find> <find>GetGuns</find>
<find>setNumOfLitt</find> <find>get</find>
<find>setG</find>
<find>setMoney</find>
<find>setN</find>
<find>setNum</find>
<find>startingPeasantShips</find>
<find>startingLittyShips</find>
<find>destroy</find>
<find>litty</find>
<find>peasant</find>
<find>setmone</find>
<find>set</find> <find>set</find>
<find>player.</find> <find>TaipanShop</find>
<find>System.out.println(&quot;\n*** PLACEHOLDER FOR LOAN SHARK ***\n&quot;);</find> <find>shop()</find>
<find>keep</find> <find>shop</find>
<find>showWa</find>
<find>player.get</find>
<find>throws Exception</find>
<find>would</find>
<find>.nextInt</find>
<find>getName</find>
<find>we made it</find>
<find>delayfora</find>
<find>dela</find>
<find>couldn</find>
<find>GUNS</find>
</findStrings> </findStrings>
<replaceStrings> <replaceStrings>
<replace>player.getName()</replace> <replace>HP</replace>
<replace>player.getBank()</replace> <replace>p1.get</replace>
<replace>player.setMoney(player.getMoney() + num*)</replace> <replace>p1.set</replace>
<replace>player.getOpiumHeld()</replace>
<replace>numOfPeasantShips</replace>
<replace>typeOfShip</replace>
<replace>chanceOfRun</replace>
<replace>litty</replace>
<replace>Liitty</replace>
<replace>Litty</replace>
<replace>player.set</replace>
<replace>%s</replace>
<replace>loan();</replace>
<replace>throws InterruptedException</replace>
</replaceStrings> </replaceStrings>
</component> </component>
<component name="Git.Settings"> <component name="Git.Settings">
<option name="UPDATE_CHANGES_POLICY" value="SHELVE" />
<option name="UPDATE_TYPE" value="MERGE" />
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" /> <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component> </component>
<component name="IdeDocumentHistory"> <component name="IdeDocumentHistory">
<option name="CHANGED_PATHS"> <option name="CHANGED_PATHS">
<list> <list>
<option value="$PROJECT_DIR$/src/Test.java" /> <option value="$PROJECT_DIR$/src/Core.java" />
<option value="$PROJECT_DIR$/src/Player.java" /> <option value="$PROJECT_DIR$/src/Game.java" />
<option value="$PROJECT_DIR$/src/Travel.java" />
<option value="$PROJECT_DIR$/src/main.java" />
<option value="$PROJECT_DIR$/src/TaipanShop.java" />
<option value="$PROJECT_DIR$/src/Start.java" />
<option value="$PROJECT_DIR$/src/Warehouse.java" />
<option value="$PROJECT_DIR$/src/Bank.java" />
<option value="$PROJECT_DIR$/src/loanShark.java" />
<option value="$PROJECT_DIR$/src/ShipWarfare.java" /> <option value="$PROJECT_DIR$/src/ShipWarfare.java" />
<option value="$PROJECT_DIR$/src/Player.java" />
<option value="$PROJECT_DIR$/src/Start.java" />
<option value="$PROJECT_DIR$/src/TaipanShop.java" />
<option value="$PROJECT_DIR$/src/main.java" />
<option value="$PROJECT_DIR$/src/Travel.java" />
</list> </list>
</option> </option>
</component> </component>
<component name="ProjectFrameBounds" extendedState="6"> <component name="ProjectFrameBounds" extendedState="6">
<option name="y" value="23" /> <option name="x" value="167" />
<option name="width" value="1280" /> <option name="y" value="-11" />
<option name="height" value="709" /> <option name="width" value="1696" />
<option name="height" value="1026" />
</component>
<component name="ProjectLevelVcsManager" settingsEditedManually="true">
<ConfirmationsSetting value="2" id="Add" />
</component> </component>
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
<component name="ProjectView"> <component name="ProjectView">
<navigator proportions="" version="1"> <navigator proportions="" version="1">
<foldersAlwaysOnTop value="true" /> <foldersAlwaysOnTop value="true" />
</navigator> </navigator>
<panes> <panes>
<pane id="Scope" /> <pane id="Scope" />
<pane id="PackagesPane" />
<pane id="ProjectPane"> <pane id="ProjectPane">
<subPane> <subPane>
<expand> <expand>
@@ -186,19 +176,19 @@
<select /> <select />
</subPane> </subPane>
</pane> </pane>
<pane id="PackagesPane" />
</panes> </panes>
</component> </component>
<component name="PropertiesComponent"> <component name="PropertiesComponent">
<property name="ChangesTree.GroupingKeys" value="" />
<property name="WebServerToolWindowFactoryState" value="false" /> <property name="WebServerToolWindowFactoryState" value="false" />
<property name="aspect.path.notification.shown" value="true" /> <property name="aspect.path.notification.shown" value="true" />
<property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1551066288602" /> <property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1551163322073" />
<property name="extract.method.default.visibility" value="public" /> <property name="extract.method.default.visibility" value="private" />
<property name="last_opened_file_path" value="$PROJECT_DIR$" /> <property name="last_opened_file_path" value="$USER_HOME$/Documents/GitHub/Cpsc233" />
<property name="project.structure.last.edited" value="Project" /> <property name="project.structure.last.edited" value="Project" />
<property name="project.structure.proportion" value="0.15" /> <property name="project.structure.proportion" value="0.15" />
<property name="project.structure.side.proportion" value="0.2" /> <property name="project.structure.side.proportion" value="0.2" />
<property name="settings.editor.selected.configurable" value="preferences.keymap" /> <property name="settings.editor.selected.configurable" value="editing.templates" />
</component> </component>
<component name="RunDashboard"> <component name="RunDashboard">
<option name="ruleStates"> <option name="ruleStates">
@@ -213,18 +203,8 @@
</option> </option>
</component> </component>
<component name="RunManager" selected="Application.main"> <component name="RunManager" selected="Application.main">
<configuration name="Main" type="Application" factoryName="Application" temporary="true"> <configuration name="Game" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="Main" /> <option name="MAIN_CLASS_NAME" value="Game" />
<module name="TaipanClone" />
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
<RunnerSettings RunnerId="Run" />
<ConfigurationWrapper RunnerId="Run" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
<configuration name="Player" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="Player" />
<module name="TaipanClone" /> <module name="TaipanClone" />
<method v="2"> <method v="2">
<option name="Make" enabled="true" /> <option name="Make" enabled="true" />
@@ -237,8 +217,15 @@
<option name="Make" enabled="true" /> <option name="Make" enabled="true" />
</method> </method>
</configuration> </configuration>
<configuration name="Test" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true"> <configuration name="TaipanShop" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="Test" /> <option name="MAIN_CLASS_NAME" value="TaipanShop" />
<module name="TaipanClone" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
<configuration name="Travel" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="Travel" />
<module name="TaipanClone" /> <module name="TaipanClone" />
<method v="2"> <method v="2">
<option name="Make" enabled="true" /> <option name="Make" enabled="true" />
@@ -252,24 +239,24 @@
</method> </method>
</configuration> </configuration>
<list> <list>
<item itemvalue="Application.Main" />
<item itemvalue="Application.Player" />
<item itemvalue="Application.ShipWarfare" /> <item itemvalue="Application.ShipWarfare" />
<item itemvalue="Application.Test" /> <item itemvalue="Application.TaipanShop" />
<item itemvalue="Application.Travel" />
<item itemvalue="Application.Game" />
<item itemvalue="Application.main" /> <item itemvalue="Application.main" />
</list> </list>
<recent_temporary> <recent_temporary>
<list> <list>
<item itemvalue="Application.main" /> <item itemvalue="Application.main" />
<item itemvalue="Application.TaipanShop" />
<item itemvalue="Application.Game" />
<item itemvalue="Application.ShipWarfare" /> <item itemvalue="Application.ShipWarfare" />
<item itemvalue="Application.Main" /> <item itemvalue="Application.Travel" />
<item itemvalue="Application.Test" />
<item itemvalue="Application.Player" />
</list> </list>
</recent_temporary> </recent_temporary>
</component> </component>
<component name="SvnConfiguration" cleanupOnStartRun="true"> <component name="SvnConfiguration" cleanupOnStartRun="true">
<configuration>$USER_HOME$/.subversion</configuration> <configuration>C:\Users\Harkamal Randhawa\AppData\Roaming\Subversion</configuration>
<supportedVersion>125</supportedVersion> <supportedVersion>125</supportedVersion>
</component> </component>
<component name="TaskManager"> <component name="TaskManager">
@@ -280,189 +267,104 @@
<option name="presentableId" value="Default" /> <option name="presentableId" value="Default" />
<updated>1550454898506</updated> <updated>1550454898506</updated>
<workItem from="1550454902781" duration="459000" /> <workItem from="1550454902781" duration="459000" />
<workItem from="1550550806467" duration="577000" /> <workItem from="1550458230268" duration="571000" />
<workItem from="1550552635138" duration="118000" /> <workItem from="1550459021117" duration="128000" />
<workItem from="1550553016386" duration="7671000" /> <workItem from="1550459458251" duration="1743000" />
<workItem from="1550672213804" duration="29657000" /> <workItem from="1550538713935" duration="16351000" />
<workItem from="1550872712636" duration="122000" /> <workItem from="1550614728336" duration="8160000" />
<workItem from="1550879399892" duration="1335000" /> <workItem from="1550704188250" duration="4948000" />
<workItem from="1550899071486" duration="108000" /> <workItem from="1550810552736" duration="1982000" />
<workItem from="1550954455279" duration="500000" /> <workItem from="1550878072546" duration="2009000" />
<workItem from="1551066469788" duration="198000" /> <workItem from="1551065104002" duration="1313000" />
<workItem from="1551066703607" duration="6918000" /> <workItem from="1551158469442" duration="4822000" />
</task> </task>
<task id="LOCAL-00001" summary="Added troll comments"> <task id="LOCAL-00001" summary="This should fix the ShipWarfare file and bring it up to date with the rest of the file.">
<created>1550458807806</created> <created>1550458470138</created>
<option name="number" value="00001" /> <option name="number" value="00001" />
<option name="presentableId" value="LOCAL-00001" /> <option name="presentableId" value="LOCAL-00001" />
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1550458807807</updated> <updated>1550458470138</updated>
</task> </task>
<task id="LOCAL-00002" summary="the shop now uses the player class as a parent class."> <task id="LOCAL-00002" summary="Created Core class">
<created>1550544462410</created> <created>1550540282400</created>
<option name="number" value="00002" /> <option name="number" value="00002" />
<option name="presentableId" value="LOCAL-00002" /> <option name="presentableId" value="LOCAL-00002" />
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1550544462410</updated> <updated>1550540282400</updated>
</task> </task>
<task id="LOCAL-00003" summary="the shop now uses the player class as a parent class."> <task id="LOCAL-00003" summary="Created Player class">
<created>1550544805794</created> <created>1550540820542</created>
<option name="number" value="00003" /> <option name="number" value="00003" />
<option name="presentableId" value="LOCAL-00003" /> <option name="presentableId" value="LOCAL-00003" />
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1550544805794</updated> <updated>1550540820542</updated>
</task> </task>
<task id="LOCAL-00004" summary="Vikram, these are the types of changes Harkey and I meant for you to establish."> <task id="LOCAL-00004" summary="Created Player class">
<created>1550554529721</created> <created>1550541406597</created>
<option name="number" value="00004" /> <option name="number" value="00004" />
<option name="presentableId" value="LOCAL-00004" /> <option name="presentableId" value="LOCAL-00004" />
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1550554529721</updated> <updated>1550541406597</updated>
</task> </task>
<task id="LOCAL-00005" summary="Added GameOver() Method to Player class, btw System.out.flush just straight up Thanos's the terminal at the time (clears it)."> <task id="LOCAL-00005" summary="Fixed the setters to be greater than 0">
<created>1550555424630</created> <created>1550541751914</created>
<option name="number" value="00005" /> <option name="number" value="00005" />
<option name="presentableId" value="LOCAL-00005" /> <option name="presentableId" value="LOCAL-00005" />
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1550555424631</updated> <updated>1550541751914</updated>
</task> </task>
<task id="LOCAL-00006" summary="I think I got the basic battling system down. Would appreciate i some of you guys beta tested it though and let me know the errors if there are any."> <task id="LOCAL-00006" summary="Created Player class">
<created>1550673099893</created> <created>1550543764970</created>
<option name="number" value="00006" /> <option name="number" value="00006" />
<option name="presentableId" value="LOCAL-00006" /> <option name="presentableId" value="LOCAL-00006" />
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1550673099893</updated> <updated>1550543764971</updated>
</task> </task>
<task id="LOCAL-00007" summary="Perhaps done basic ship warfare?"> <task id="LOCAL-00007" summary="Added some stuff for the Travel Class">
<created>1550674024950</created> <created>1550575512841</created>
<option name="number" value="00007" /> <option name="number" value="00007" />
<option name="presentableId" value="LOCAL-00007" /> <option name="presentableId" value="LOCAL-00007" />
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1550674024950</updated> <updated>1550575512841</updated>
</task> </task>
<task id="LOCAL-00008" summary="Perhaps done basic ship warfare? (still must add Liu yen difficulty, ships running away, and Loot)"> <task id="LOCAL-00008" summary="Added disasters as well as removing a bug from the flee method in Haris's code">
<created>1550681271530</created> <created>1550623749854</created>
<option name="number" value="00008" /> <option name="number" value="00008" />
<option name="presentableId" value="LOCAL-00008" /> <option name="presentableId" value="LOCAL-00008" />
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1550681271530</updated> <updated>1550623749854</updated>
</task> </task>
<task id="LOCAL-00009" summary="Perhaps done basic ship warfare? (still must add Liu yen difficulty, ships running away, and Loot)"> <task id="LOCAL-00009" summary="Fixed a bunch of stuff inside of Travel, but also discovered a MASSIVE problem with our code">
<created>1550704064692</created> <created>1550628232136</created>
<option name="number" value="00009" /> <option name="number" value="00009" />
<option name="presentableId" value="LOCAL-00009" /> <option name="presentableId" value="LOCAL-00009" />
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1550704064692</updated> <updated>1550628232136</updated>
</task> </task>
<task id="LOCAL-00010" summary="Added loot. Still need to have ships escape sometimes and Liu yen"> <task id="LOCAL-00010" summary="Brought back Vikram's changes">
<created>1550810365166</created> <created>1550879092914</created>
<option name="number" value="00010" /> <option name="number" value="00010" />
<option name="presentableId" value="LOCAL-00010" /> <option name="presentableId" value="LOCAL-00010" />
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1550810365166</updated> <updated>1550879092914</updated>
</task> </task>
<task id="LOCAL-00011" summary="Sloppy but completed ShipWarfare class"> <task id="LOCAL-00011" summary="Fixed the commenting on a lot of the code. Also added some stuff to Travel, fixed some bugs.">
<created>1550817871034</created> <created>1551162699319</created>
<option name="number" value="00011" /> <option name="number" value="00011" />
<option name="presentableId" value="LOCAL-00011" /> <option name="presentableId" value="LOCAL-00011" />
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1550817871034</updated> <updated>1551162699319</updated>
</task> </task>
<task id="LOCAL-00012" summary="Fixed like 3 naming/logical errors in ShipWarfare"> <option name="localTasksCounter" value="12" />
<created>1550820057346</created>
<option name="number" value="00012" />
<option name="presentableId" value="LOCAL-00012" />
<option name="project" value="LOCAL" />
<updated>1550820057346</updated>
</task>
<task id="LOCAL-00013" summary="Added a few comments to ShipWarfare">
<created>1550954954057</created>
<option name="number" value="00013" />
<option name="presentableId" value="LOCAL-00013" />
<option name="project" value="LOCAL" />
<updated>1550954954057</updated>
</task>
<task id="LOCAL-00014" summary="bunch of revisions, still in progress">
<created>1551049097974</created>
<option name="number" value="00014" />
<option name="presentableId" value="LOCAL-00014" />
<option name="project" value="LOCAL" />
<updated>1551049097974</updated>
</task>
<task id="LOCAL-00015" summary="bunch of revisions, still in progress">
<created>1551052425343</created>
<option name="number" value="00015" />
<option name="presentableId" value="LOCAL-00015" />
<option name="project" value="LOCAL" />
<updated>1551052425343</updated>
</task>
<task id="LOCAL-00016" summary="bunch of revisions, still in progress">
<created>1551052501350</created>
<option name="number" value="00016" />
<option name="presentableId" value="LOCAL-00016" />
<option name="project" value="LOCAL" />
<updated>1551052501350</updated>
</task>
<task id="LOCAL-00017" summary="bunch of revisions, still in progress">
<created>1551060038524</created>
<option name="number" value="00017" />
<option name="presentableId" value="LOCAL-00017" />
<option name="project" value="LOCAL" />
<updated>1551060038524</updated>
</task>
<task id="LOCAL-00018" summary="Worked On Sid's class a bit">
<created>1551063376717</created>
<option name="number" value="00018" />
<option name="presentableId" value="LOCAL-00018" />
<option name="project" value="LOCAL" />
<updated>1551063376717</updated>
</task>
<task id="LOCAL-00019" summary="Think I fixed Sid's code">
<created>1551065166040</created>
<option name="number" value="00019" />
<option name="presentableId" value="LOCAL-00019" />
<option name="project" value="LOCAL" />
<updated>1551065166040</updated>
</task>
<task id="LOCAL-00020" summary="Small thing, changed an output of warehouse a bit, shows user its the warehosue they are concerned with.">
<created>1551065447444</created>
<option name="number" value="00020" />
<option name="presentableId" value="LOCAL-00020" />
<option name="project" value="LOCAL" />
<updated>1551065447444</updated>
</task>
<task id="LOCAL-00021" summary="Forgot a try catch in warehouse">
<created>1551065880809</created>
<option name="number" value="00021" />
<option name="presentableId" value="LOCAL-00021" />
<option name="project" value="LOCAL" />
<updated>1551065880809</updated>
</task>
<task id="LOCAL-00022" summary="Sneaky bug in shipWarfare regarding having 0 guns is now fixed.">
<created>1551069200511</created>
<option name="number" value="00022" />
<option name="presentableId" value="LOCAL-00022" />
<option name="project" value="LOCAL" />
<updated>1551069200512</updated>
</task>
<task id="LOCAL-00023" summary="Really small change in Sid's code that no one will probably ever notice lol">
<created>1551069620616</created>
<option name="number" value="00023" />
<option name="presentableId" value="LOCAL-00023" />
<option name="project" value="LOCAL" />
<updated>1551069620616</updated>
</task>
<option name="localTasksCounter" value="24" />
<servers /> <servers />
</component> </component>
<component name="TimeTrackingManager"> <component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="53362000" /> <option name="totallyTimeSpent" value="42486000" />
</component> </component>
<component name="ToolWindowManager"> <component name="ToolWindowManager">
<frame x="0" y="23" width="1280" height="709" extended-state="6" /> <frame x="-8" y="-8" width="1696" height="1026" extended-state="7" />
<editor active="true" />
<layout> <layout>
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.31987077" /> <window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.21026894" />
<window_info id="Structure" order="1" side_tool="true" weight="0.25" /> <window_info id="Structure" order="1" side_tool="true" weight="0.25" />
<window_info id="Image Layers" order="2" /> <window_info id="Image Layers" order="2" />
<window_info id="Designer" order="3" /> <window_info id="Designer" order="3" />
@@ -470,130 +372,191 @@
<window_info id="Capture Tool" order="5" /> <window_info id="Capture Tool" order="5" />
<window_info id="Favorites" order="6" side_tool="true" /> <window_info id="Favorites" order="6" side_tool="true" />
<window_info anchor="bottom" id="Message" order="0" /> <window_info anchor="bottom" id="Message" order="0" />
<window_info anchor="bottom" id="Find" order="1" /> <window_info anchor="bottom" id="Find" order="1" weight="0.32922733" />
<window_info anchor="bottom" id="Run" order="2" sideWeight="0.4983845" weight="0.3241491" /> <window_info active="true" anchor="bottom" id="Run" order="2" visible="true" weight="0.3975364" />
<window_info anchor="bottom" id="Debug" order="3" weight="0.4" /> <window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" /> <window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" /> <window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
<window_info anchor="bottom" id="TODO" order="6" /> <window_info anchor="bottom" id="TODO" order="6" />
<window_info anchor="bottom" id="Docker" order="7" show_stripe_button="false" /> <window_info anchor="bottom" id="Docker" order="7" show_stripe_button="false" />
<window_info anchor="bottom" id="Version Control" order="8" sideWeight="0.49946696" weight="0.32901135" /> <window_info anchor="bottom" id="Version Control" order="8" sideWeight="0.49938875" weight="0.32922733" />
<window_info anchor="bottom" id="Database Changes" order="9" /> <window_info anchor="bottom" id="Database Changes" order="9" />
<window_info anchor="bottom" id="Terminal" order="10" weight="0.32936078" /> <window_info anchor="bottom" id="Terminal" order="10" weight="0.32922733" />
<window_info anchor="bottom" id="Event Log" order="11" sideWeight="0.5016155" side_tool="true" weight="0.3241491" /> <window_info anchor="bottom" id="Event Log" order="11" sideWeight="0.50061125" side_tool="true" weight="0.32922733" />
<window_info anchor="bottom" id="Messages" order="12" weight="0.048622366" /> <window_info anchor="bottom" id="Messages" order="12" sideWeight="0.49938875" weight="0.32922733" />
<window_info anchor="bottom" id="Duplicate detector" order="13" weight="0.32901135" /> <window_info anchor="bottom" id="Duplicate detector" order="13" weight="0.32922733" />
<window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" /> <window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
<window_info anchor="right" id="Ant Build" order="1" weight="0.25" /> <window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" /> <window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
<window_info anchor="right" id="Palette" order="3" /> <window_info anchor="right" id="Palette" order="3" />
<window_info anchor="right" id="Database" order="4" weight="0.32956383" /> <window_info anchor="right" id="Database" order="4" />
<window_info anchor="right" id="Theme Preview" order="5" /> <window_info anchor="right" id="Theme Preview" order="5" />
<window_info anchor="right" id="Maven" order="6" /> <window_info anchor="right" id="Maven" order="6" />
<window_info anchor="right" id="Capture Analysis" order="7" /> <window_info anchor="right" id="Capture Analysis" order="7" />
<window_info anchor="right" id="Palette&#9;" order="8" /> <window_info anchor="right" id="Palette&#9;" order="8" />
</layout> </layout>
<layout-to-restore>
<window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.21026894" />
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
<window_info id="Image Layers" order="2" />
<window_info id="Designer" order="3" />
<window_info id="UI Designer" order="4" />
<window_info id="Capture Tool" order="5" />
<window_info id="Favorites" order="6" side_tool="true" />
<window_info anchor="bottom" id="Message" order="0" />
<window_info anchor="bottom" id="Find" order="1" weight="0.32922733" />
<window_info anchor="bottom" id="Run" order="2" weight="0.3975364" />
<window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
<window_info anchor="bottom" id="TODO" order="6" />
<window_info anchor="bottom" id="Docker" order="7" show_stripe_button="false" />
<window_info anchor="bottom" id="Version Control" order="8" sideWeight="0.49938875" weight="0.32922733" />
<window_info anchor="bottom" id="Database Changes" order="9" />
<window_info anchor="bottom" id="Terminal" order="10" weight="0.32922733" />
<window_info anchor="bottom" id="Event Log" order="11" sideWeight="0.50061125" side_tool="true" weight="0.32922733" />
<window_info anchor="bottom" id="Messages" order="12" sideWeight="0.49938875" weight="0.32922733" />
<window_info anchor="bottom" id="Duplicate detector" order="13" weight="0.32922733" />
<window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
<window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
<window_info anchor="right" id="Palette" order="3" />
<window_info anchor="right" id="Database" order="4" />
<window_info anchor="right" id="Theme Preview" order="5" />
<window_info anchor="right" id="Maven" order="6" />
<window_info anchor="right" id="Capture Analysis" order="7" />
<window_info anchor="right" id="Palette&#9;" order="8" />
</layout-to-restore>
</component> </component>
<component name="TypeScriptGeneratedFilesManager"> <component name="TypeScriptGeneratedFilesManager">
<option name="version" value="1" /> <option name="version" value="1" />
</component> </component>
<component name="Vcs.Log.History.Properties">
<option name="COLUMN_ORDER">
<list>
<option value="0" />
<option value="2" />
<option value="3" />
<option value="1" />
</list>
</option>
</component>
<component name="VcsManagerConfiguration"> <component name="VcsManagerConfiguration">
<ignored-roots> <ignored-roots>
<path value="$PROJECT_DIR$" /> <path value="$PROJECT_DIR$" />
</ignored-roots> </ignored-roots>
<MESSAGE value="This should fix the project repository once and for all." /> <MESSAGE value="This should fix the project repository once and for all." />
<MESSAGE value="Added troll comments" /> <MESSAGE value="This should fix the ShipWarfare file and bring it up to date with the rest of the file." />
<MESSAGE value="the shop now uses the player class as a parent class." /> <MESSAGE value="Created Core class" />
<MESSAGE value="Vikram, these are the types of changes Harkey and I meant for you to establish." /> <MESSAGE value="Fixed the setters to be greater than 0" />
<MESSAGE value="Added GameOver() Method to Player class, btw System.out.flush just straight up Thanos's the terminal at the time (clears it)." /> <MESSAGE value="Created Player class" />
<MESSAGE value="I think I got the basic battling system down. Would appreciate i some of you guys beta tested it though and let me know the errors if there are any." /> <MESSAGE value="Added some stuff for the Travel Class" />
<MESSAGE value="Perhaps done basic ship warfare?" /> <MESSAGE value="Added disasters as well as removing a bug from the flee method in Haris's code" />
<MESSAGE value="Perhaps done basic ship warfare? (still must add Liu yen difficulty, ships running away, and Loot)" /> <MESSAGE value="Fixed a bunch of stuff inside of Travel, but also discovered a MASSIVE problem with our code" />
<MESSAGE value="Added loot. Still need to have ships escape sometimes and Liu yen" /> <MESSAGE value="Fixed stupid problem where you can't access methods above yours" />
<MESSAGE value="Sloppy but completed ShipWarfare class" /> <MESSAGE value="Brought back Vikram's changes" />
<MESSAGE value="Fixed like 3 naming/logical errors in ShipWarfare" /> <MESSAGE value="Fixed the commenting on a lot of the code. Also added some stuff to Travel, fixed some bugs." />
<MESSAGE value="Added a few comments to ShipWarfare" /> <option name="LAST_COMMIT_MESSAGE" value="Fixed the commenting on a lot of the code. Also added some stuff to Travel, fixed some bugs." />
<MESSAGE value="bunch of revisions, still in progress" />
<MESSAGE value="linked all the classes together. The project is functional." />
<MESSAGE value="Worked On Sid's class a bit" />
<MESSAGE value="Think I fixed Sid's code" />
<MESSAGE value="Small thing, changed an output of warehouse a bit, shows user its the warehosue they are concerned with." />
<MESSAGE value="Forgot a try catch in warehouse" />
<MESSAGE value="Sneaky bug in shipWarfare regarding having 0 guns is now fixed." />
<MESSAGE value="Really small change in Sid's code that no one will probably ever notice lol" />
<option name="LAST_COMMIT_MESSAGE" value="Really small change in Sid's code that no one will probably ever notice lol" />
</component> </component>
<component name="editorHistoryManager"> <component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/TaipanClone.iml"> <entry file="uml://JAVA/ShipWarfare">
<provider selected="true" editor-type-id="text-editor" /> <provider selected="true" editor-type-id="UmlEditorProvider">
</entry> <state>
<entry file="file://$PROJECT_DIR$/.idea/misc.xml"> <ID>JAVA</ID>
<provider selected="true" editor-type-id="text-editor" /> <OriginalElement>ShipWarfare</OriginalElement>
</entry> <nodes>
<entry file="file://$PROJECT_DIR$/src/Test.java" /> <node x="" y="">ShipWarfare</node>
<entry file="file://$PROJECT_DIR$/src/Player.java"> <node x="" y="">Player</node>
<provider selected="true" editor-type-id="text-editor"> </nodes>
<state relative-caret-position="540"> <notes />
<caret line="150" column="4" selection-start-line="150" selection-start-column="4" selection-end-line="150" selection-end-column="4" /> <edges />
<settings layout="Hierarchic Group" zoom="1.0" x="213.0" y="195.0" />
<SelectedNodes />
<Categories />
<SCOPE>Project Files</SCOPE>
<VISIBILITY>private</VISIBILITY>
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/src/main.java"> <entry file="uml://JAVA/TaipanShop">
<provider selected="true" editor-type-id="UmlEditorProvider">
<state>
<ID>JAVA</ID>
<OriginalElement>TaipanShop</OriginalElement>
<nodes>
<node x="" y="">TaipanShop</node>
<node x="" y="">Player</node>
</nodes>
<notes />
<edges />
<settings layout="Hierarchic Group" zoom="1.0" x="56.0" y="54.0" />
<SelectedNodes />
<Categories />
<SCOPE>All</SCOPE>
<VISIBILITY>private</VISIBILITY>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/Game.java" />
<entry file="file://$PROJECT_DIR$/src/Warehouse.java">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="375"> <state relative-caret-position="34">
<caret line="25" lean-forward="true" selection-start-line="25" selection-end-line="25" /> <caret line="2" column="3" selection-start-line="2" selection-start-column="3" selection-end-line="2" selection-end-column="3" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/Start.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="590">
<caret line="70" column="24" lean-forward="true" selection-start-line="70" selection-start-column="24" selection-end-line="70" selection-end-column="24" />
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/src/Bank.java"> <entry file="file://$PROJECT_DIR$/src/Bank.java">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="375"> <state relative-caret-position="-872">
<caret line="25" column="23" selection-start-line="25" selection-start-column="23" selection-end-line="25" selection-end-column="23" /> <caret line="7" column="6" lean-forward="true" selection-start-line="7" selection-start-column="6" selection-end-line="7" selection-end-column="6" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/ShipWarfare.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="17">
<caret line="353" column="11" selection-start-line="353" selection-start-column="11" selection-end-line="353" selection-end-column="11" />
<folding> <folding>
<element signature="imports" expanded="true" /> <element signature="imports" expanded="true" />
</folding> </folding>
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/src/Warehouse.java"> <entry file="file://$PROJECT_DIR$/src/Player.java">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="2790"> <state relative-caret-position="-2606">
<caret line="186" column="13" selection-start-line="186" selection-start-column="13" selection-end-line="186" selection-end-column="13" /> <caret line="24" column="5" lean-forward="true" selection-start-line="24" selection-start-column="5" selection-end-line="24" selection-end-column="5" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/Start.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="353">
<caret line="33" column="9" lean-forward="true" selection-start-line="33" selection-start-column="9" selection-end-line="33" selection-end-column="9" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/loanShark.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="450">
<caret line="30" column="21" lean-forward="true" selection-start-line="30" selection-start-column="21" selection-end-line="30" selection-end-column="21" />
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/src/TaipanShop.java"> <entry file="file://$PROJECT_DIR$/src/TaipanShop.java">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1710"> <state relative-caret-position="168">
<caret line="610" column="27" lean-forward="true" selection-start-line="610" selection-start-column="27" selection-end-line="610" selection-end-column="27" /> <caret line="594" column="42" lean-forward="true" selection-start-line="594" selection-start-column="42" selection-end-line="594" selection-end-column="42" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="184">
<caret line="42" column="62" selection-start-line="42" selection-start-column="62" selection-end-line="42" selection-end-column="62" />
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/src/Travel.java"> <entry file="file://$PROJECT_DIR$/src/Travel.java">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="136"> <state relative-caret-position="27">
<caret line="63" column="38" selection-start-line="63" selection-start-column="28" selection-end-line="63" selection-end-column="38" /> <caret line="125" column="63" selection-start-line="125" selection-start-column="63" selection-end-line="125" selection-end-column="63" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/ShipWarfare.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="234">
<caret line="371" column="43" lean-forward="true" selection-start-line="371" selection-start-column="43" selection-end-line="371" selection-end-column="43" />
<folding> <folding>
<element signature="imports" expanded="true" /> <element signature="imports" expanded="true" />
</folding> </folding>
@@ -640,7 +603,7 @@
</state> </state>
<state key="JdkListConfigurable.UI"> <state key="JdkListConfigurable.UI">
<settings> <settings>
<last-edited>1.8.0_201</last-edited> <last-edited>1.8</last-edited>
<splitter-proportions> <splitter-proportions>
<option name="proportions"> <option name="proportions">
<list> <list>
@@ -657,6 +620,7 @@
<option name="proportions"> <option name="proportions">
<list> <list>
<option value="0.2" /> <option value="0.2" />
<option value="0.6" />
</list> </list>
</option> </option>
</splitter-proportions> </splitter-proportions>
@@ -673,6 +637,17 @@
</splitter-proportions> </splitter-proportions>
</settings> </settings>
</state> </state>
<state key="ScopeChooserConfigurable.UI">
<settings>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
</states> </states>
</component> </component>
</project> </project>

View File

@@ -1,36 +1,62 @@
import java.sql.SQLOutput;
import java.util.Scanner; import java.util.Scanner;
public class Bank{ public class Bank{
private Player player; private Player player;
/**
* setter method that takes in a Player object as an argument.
*
* @param player object of the class Player
*/
public void setPlayer(Player player) { public void setPlayer(Player player) {
Player playerDummy = new Player(player); Player playerDummy = new Player(player);
this.player = playerDummy; this.player = playerDummy;
} }
/**
* getter method for obtaining a player object.
*
* @return returns player object
*/
public Player getPlayer(){ public Player getPlayer(){
Player playerDummy = new Player(player); Player playerDummy = new Player(player);
return playerDummy; return playerDummy;
} }
/**
* Class Constructor that takes in a type player as a parameter
*
* @param player object of the class Player
*/
public Bank(Player player){ public Bank(Player player){
Player playerDummy = new Player(player); Player playerDummy = new Player(player);
this.player = playerDummy; this.player = playerDummy;
} }
/**
* This method is used to withdraw or deposit money into the bank account
* by prompting the user if they would like to withdraw or deposit. Followed
* by prompting them to enter an amount to transfer. This method also uses the
* player class to see if the transfer can be made,and if it can it changes the
* values accordingly
*/
public void bank(){ public void bank(){
Scanner input = new Scanner(System.in); Scanner input = new Scanner(System.in);
boolean notDone = true; boolean notDone = true;
int check = 0; int check = 0;
while(notDone){ while(notDone){
//Prompt the user if they want to withdraw or deposit
System.out.println("Would you like to Withdraw or Deposit?"); System.out.println("Would you like to Withdraw or Deposit?");
String response = input.nextLine(); String response = input.nextLine();
//If user chose withdraw then subtract the amount from bank account and add it to cash
if(response.equalsIgnoreCase("W")){ if(response.equalsIgnoreCase("W")){
boolean notDone2 = true; boolean notDone2 = true;
while(notDone2){ while(notDone2){
System.out.println("How much do you wish to Withdraw?"); System.out.println("How much do you wish to Withdraw?");
int withdraw = input.nextInt(); int withdraw = input.nextInt();
//Prompt the user for the amount and check if the bank has sufficient funds
if(withdraw <= player.getBank()){ if(withdraw <= player.getBank()){
player.setMoney(withdraw + player.getMoney()); player.setMoney(withdraw + player.getMoney());
player.setBank(player.getBank()-withdraw); player.setBank(player.getBank()-withdraw);
@@ -38,9 +64,13 @@ public class Bank{
check = 1; check = 1;
} }
} }
}else if(response.equalsIgnoreCase("D")){
}
//If the user chooses to deposit the continue to this code
else if(response.equalsIgnoreCase("D")){
boolean notDone2 = true; boolean notDone2 = true;
while(notDone2){ while(notDone2){
//Prompt the user for the amount they would like to deposit and ensure suffiecent funds
System.out.println("How much do you wish to Deposit?"); System.out.println("How much do you wish to Deposit?");
int deposit = input.nextInt(); int deposit = input.nextInt();
if(deposit <= player.getMoney()){ if(deposit <= player.getMoney()){
@@ -53,6 +83,7 @@ public class Bank{
} }
if(check == 1){ if(check == 1){
boolean notDone3 = true; boolean notDone3 = true;
// Asks user if they would like to continue in bank or not
while(notDone3){ while(notDone3){
System.out.println("Would you like to continue? Y/N"); System.out.println("Would you like to continue? Y/N");
response = input.nextLine(); response = input.nextLine();

View File

@@ -1,3 +1,5 @@
import java.util.Scanner;
public class Player { public class Player {
private String name = "Taipan"; private String name = "Taipan";
@@ -16,11 +18,17 @@ public class Player {
private int wGeneral = 0; private int wGeneral = 0;
private int wArms = 0; private int wArms = 0;
private boolean retire = false; private boolean retire = false;
private int cargoSpace = 60;
public Player(){ public Player(){
} }
/**
* Copy constructor
*
* @param player object of the class Player
*/
public Player(Player player){ public Player(Player player){
this.bank = player.bank; this.bank = player.bank;
this.money = player.money; this.money = player.money;
@@ -36,128 +44,307 @@ public class Player {
this.wSilk = player.wSilk; this.wSilk = player.wSilk;
this.wGeneral = player.wGeneral; this.wGeneral = player.wGeneral;
this.wArms = player.wArms; this.wArms = player.wArms;
} }
/**
* getter method for the instance variable cargoSpace.
*
* @return returns the instance variable cargoSpace
*/
public int getCargoSpace() {
return cargoSpace;
}
/**
* setter method for the instance variable cargoSpace.
*
* @param cargoSpace takes an int that is greater than 0 as an argument
*/
public void setCargoSpace(int cargoSpace) {
if(cargoSpace > 0){
this.cargoSpace = cargoSpace;
}
}
/**
* getter method for the instance variable retire.
*
* @return returns the instance variable retire
*/
public boolean getRetire(){ public boolean getRetire(){
return retire; return retire;
} }
/**
* setter method for the instance variable retire.
*
* @param retire takes a boolean as an argument
*/
public void setRetire(boolean retire){ public void setRetire(boolean retire){
if(retire){ if(retire){
this.retire = retire; this.retire = retire;
} }
} }
/**
* getter method for the instance variable name.
*
* @return returns the instance variable name
*/
public String getName() { public String getName() {
return name; return name;
} }
/**
* setter method for the instance variable name.
*
* @param name takes a string as an argument
*/
public void setName(String name) { public void setName(String name) {
this.name = name; this.name = name;
} }
/**
* getter method for the instance variable HP.
*
* @return returns the instance variable HP
*/
public int getHP() { public int getHP() {
return HP; return HP;
} }
/**
* setter method for the instance variable HP.
*
* @param HP takes an int as an argument
*/
public void setHP(int HP) { public void setHP(int HP) {
this.HP = HP; this.HP = HP;
} }
/**
* getter method for the instance variable bank.
*
* @return returns the instance variable bank
*/
public int getBank() { public int getBank() {
return bank; return bank;
} }
/**
* setter method for the instance variable bank.
*
* @param bank takes an int that is greater than or equal to 0 as an argument
*/
public void setBank(int bank) { public void setBank(int bank) {
if (bank >= 0) { if (bank >= 0) {
this.bank = bank; this.bank = bank;
} }
} }
/**
* getter method for the instance variable money.
*
* @return returns the instance variable money
*/
public int getMoney() { public int getMoney() {
return money; return money;
} }
/**
* setter method for the instance variable money.
*
* @param money takes an int that is greater than or equal to 0 as an argument
*/
public void setMoney(int money) { public void setMoney(int money) {
if (money >= 0) { if (money >= 0) {
this.money = money; this.money = money;
} }
} }
/**
* getter method for the instance variable opiumHeld.
*
* @return returns the instance variable opiumHeld
*/
public int getOpiumHeld() { public int getOpiumHeld() {
return opiumHeld; return opiumHeld;
} }
/**
* setter method for the instance variable opiumHeld.
*
* @param opiumHeld takes an int that is greater than or equal to 0 as an argument
*/
public void setOpiumHeld(int opiumHeld) { public void setOpiumHeld(int opiumHeld) {
if (opiumHeld >= 0) { if (opiumHeld >= 0) {
this.opiumHeld = opiumHeld; this.opiumHeld = opiumHeld;
} }
} }
/**
* getter method for the instance variable silkHeld.
*
* @return returns the instance variable silkHeld
*/
public int getSilkHeld() { public int getSilkHeld() {
return silkHeld; return silkHeld;
} }
/**
* setter method for the instance variable silkHeld.
*
* @param silkHeld takes an int that is greater than or equal to 0 as an argument
*/
public void setSilkHeld(int silkHeld) { public void setSilkHeld(int silkHeld) {
if (silkHeld >= 0) { if (silkHeld >= 0) {
this.silkHeld = silkHeld; this.silkHeld = silkHeld;
} }
} }
/**
* getter method for the instance variable generalHeld.
*
* @return returns the instance variable generalHeld
*/
public int getGeneralHeld() { public int getGeneralHeld() {
return generalHeld; return generalHeld;
} }
/**
* setter method for the instance variable generalHeld.
*
* @param generalHeld takes an int that is greater than or equal to 0 as an argument
*/
public void setGeneralHeld(int generalHeld) { public void setGeneralHeld(int generalHeld) {
if (generalHeld >= 0) { if (generalHeld >= 0) {
this.generalHeld = generalHeld; this.generalHeld = generalHeld;
} }
} }
/**
* getter method for the instance variable armsHeld.
*
* @return returns the instance variable armsHeld
*/
public int getArmsHeld() { public int getArmsHeld() {
return armsHeld; return armsHeld;
} }
/**
* setter method for the instance variable armsHeld.
*
* @param armsHeld takes an int that is greater than or equal to 0 as an argument
*/
public void setArmsHeld(int armsHeld) { public void setArmsHeld(int armsHeld) {
if (armsHeld >= 0) { if (armsHeld >= 0) {
this.armsHeld = armsHeld; this.armsHeld = armsHeld;
} }
} }
/**
* getter method for the instance variable location.
*
* @return returns the instance variable location
*/
public int getLocation() { public int getLocation() {
return location; return location;
} }
/**
* setter method for the instance variable location.
*
* @param location takes an int that is greater than or equal to 0 as an argument
*/
public void setLocation(int location) { public void setLocation(int location) {
if (location >= 0) { if (location >= 0) {
this.location = location; this.location = location;
} }
} }
/**
* getter method for the instance variable guns.
*
* @return returns the instance variable guns
*/
public int getGuns() { public int getGuns() {
return guns; return guns;
} }
/**
* setter method for the instance variable guns.
*
* @param guns takes an int that is greater than or equal to 0 as an argument
*/
public void setGuns(int guns) { public void setGuns(int guns) {
if (guns >= 0) { if (guns >= 0) {
this.guns = guns; this.guns = guns;
} }
} }
/**
* getter method for the instance variable debt.
*
* @return returns the instance variable debt
*/
public int getDebt() { public int getDebt() {
return debt; return debt;
} }
/**
* setter method for the instance variable debt.
*
* @param debt takes an int that is greater than or equal to 0 as an argument
*/
public void setDebt(int debt) { public void setDebt(int debt) {
if (debt >= 0) { if (debt >= 0) {
this.debt = debt; this.debt = debt;
} }
} }
public int getwOpium(){ return wOpium; } /**
* getter method for the instance variable wOpium.
*
* @return returns the instance variable wOpium
*/
public int getwOpium() {
return wOpium;
}
/**
* setter method for the instance variable wOpium.
*
* @param wOpium takes an int that is greater than or equal to 0 as an argument
*/
public void setwOpium(int wOpium) { public void setwOpium(int wOpium) {
if (wOpium >= 0){ if (wOpium >= 0){
@@ -165,7 +352,21 @@ public class Player {
} }
} }
public int getwSilk(){return wSilk;} /**
* getter method for the instance variable wSilk.
*
* @return returns the instance variable wSilk
*/
public int getwSilk() {
return wSilk;
}
/**
* setter method for the instance variable wSilk.
*
* @param wSilk takes an int that is greater than or equal to 0 as an argument
*/
public void setwSilk(int wSilk) { public void setwSilk(int wSilk) {
if (wSilk >= 0){ if (wSilk >= 0){
@@ -173,7 +374,21 @@ public class Player {
} }
} }
public int getwGeneral(){return wGeneral;} /**
* getter method for the instance variable wGeneral.
*
* @return returns the instance variable wGeneral
*/
public int getwGeneral() {
return wGeneral;
}
/**
* setter method for the instance variable wGeneral.
*
* @param wGeneral takes an int that is greater than or equal to 0 as an argument
*/
public void setwGeneral(int wGeneral) { public void setwGeneral(int wGeneral) {
if (wGeneral >= 0){ if (wGeneral >= 0){
@@ -181,7 +396,21 @@ public class Player {
} }
} }
public int getwArms(){return wArms;} /**
* getter method for the instance variable wArms.
*
* @return returns the instance variable wArms
*/
public int getwArms() {
return wArms;
}
/**
* setter method for the instance variable wArms.
*
* @param wArms takes an int that is greater than or equal to 0 as an argument
*/
public void setwArms(int wArms) { public void setwArms(int wArms) {
if (wArms >= 0){ if (wArms >= 0){
@@ -189,9 +418,15 @@ public class Player {
} }
} }
/**
* Method to indicate that you have lost the game. If the player has lost, console will be cleared and will only
* show the statement "Game Over". After showing the message the game closes.
*
**/
public void gameOver(){ public void gameOver(){
System.out.flush(); System.out.flush();
System.out.println("Game over"); System.out.println("Game over");
System.exit(0);
} }
} }

View File

@@ -2,33 +2,49 @@ import java.util.Scanner;
import java.util.Random; import java.util.Random;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
public class ShipWarfare { public class ShipWarfare {
private int numOfPeasantShips = 0; private int numOfPeasantShips = 0;
private int numOfLittyShips = 0; private int numOfLittyShips = 0;
private boolean userAttacks = true; private boolean userAttacks = true;
private int startingPeasantShips = 0; private int startingPeasantShips = 0;
private int startingLittyShips =0; private int startingLittyShips = 0;
private int howMuchRun = 0; private int howMuchRun = 0;
private String pirateName = "Liu Yen"; private String pirateName = "Liu Yen";
private Player player; private Player player;
public ShipWarfare(Player player){ /**
* Class Constructor that takes in a type player as a parameter
* @param player object of the class Player
*/
public ShipWarfare(Player player) {
Player playerDummy = new Player(player); Player playerDummy = new Player(player);
this.player = playerDummy; this.player = playerDummy;
} }
/**
* setter method for player
* @param player object of the class Player
*/
public void setPlayer(Player player) { public void setPlayer(Player player) {
Player playerDummy = new Player(player); Player playerDummy = new Player(player);
this.player = playerDummy; this.player = playerDummy;
} }
public Player getPlayer(){ /**
* getter method for obtaining a player object.
* @return returns player object
*/
public Player getPlayer() {
Player playerDummy = new Player(player); Player playerDummy = new Player(player);
return playerDummy; return playerDummy;
} }
//This fleet is easy to defeat as a maximum of 15 ships can run away each volley, they can not tank hits /**
* This fleet is easy to defeat as a maximum of 15 ships can run away each volley, they can not tank hits
* @throws Exception in case of errors due to the delay
*/
public void peasantFleetAttack() throws Exception { public void peasantFleetAttack() throws Exception {
Scanner userResponse = new Scanner(System.in); Scanner userResponse = new Scanner(System.in);
setNumOfPeasantShips(numOfShips()); setNumOfPeasantShips(numOfShips());
@@ -41,6 +57,7 @@ public class ShipWarfare {
if (response.equalsIgnoreCase("f")) { if (response.equalsIgnoreCase("f")) {
userAttacks = true; userAttacks = true;
System.out.println("Ohh, fight ehh?"); System.out.println("Ohh, fight ehh?");
delayForSeconds(1);
boolean winOrLose = destroyPeasantShipsOrEscape(); boolean winOrLose = destroyPeasantShipsOrEscape();
if (winOrLose == true) { if (winOrLose == true) {
break; break;
@@ -54,6 +71,7 @@ public class ShipWarfare {
break; break;
} else { } else {
System.out.println("Phew! Got away safely"); System.out.println("Phew! Got away safely");
delayForSeconds(2);
break; break;
} }
@@ -63,7 +81,11 @@ public class ShipWarfare {
} }
//This fleet is difficult to defeat as a maximum of 10 ships can run away each volley, they can tank hits
/**
* This fleet is difficult to defeat as a maximum of 10 ships can run away each volley, they can tank hits
* @throws Exception in case of errors due to the delay
*/
public void littyFleetAttack() throws Exception { public void littyFleetAttack() throws Exception {
Scanner userResponse = new Scanner(System.in); Scanner userResponse = new Scanner(System.in);
setNumOfLittyShips(numOfShips()); setNumOfLittyShips(numOfShips());
@@ -83,10 +105,12 @@ public class ShipWarfare {
} else if (response.equalsIgnoreCase("r")) { } else if (response.equalsIgnoreCase("r")) {
if (runFromShips() == false) { if (runFromShips() == false) {
System.out.println("Couldn't run away!"); System.out.println("Couldn't run away!");
delayForSeconds(1);
if (destroyLittyShipsOrEscape()) if (destroyLittyShipsOrEscape())
break; break;
} else { } else {
System.out.println("Phew! Got away safely"); System.out.println("Phew! Got away safely");
delayForSeconds(2);
break; break;
} }
@@ -97,34 +121,49 @@ public class ShipWarfare {
} }
/**
* Asks user if they would like to fight or run against ships
*/
public void fightOrRunMessage() { public void fightOrRunMessage() {
System.out.printf("What do you want to do? Enter \"f\" to fight, and \"r\" to run (we have %d guns)", player.getGuns()); System.out.printf("What do you want to do? Enter \"f\" to fight, and \"r\" to run (we have %d guns)\n", player.getGuns());
}
public int numOfPeasantShips() {
return numOfPeasantShips;
} }
/**
* setter method that takes in an integer as an argument
* @param numOfLittyShips the number of ships to be used in the litty fleet attack
*/
public void setNumOfLittyShips(int numOfLittyShips) { public void setNumOfLittyShips(int numOfLittyShips) {
this.numOfLittyShips = numOfLittyShips; this.numOfLittyShips = numOfLittyShips;
startingLittyShips = numOfLittyShips; startingLittyShips = numOfLittyShips;
} }
/**
* setter method that takes in an integer as an argument
* @param numOfPeasantShips the number of ships to be used in the peasant fleet attack
*/
public void setNumOfPeasantShips(int numOfPeasantShips) { public void setNumOfPeasantShips(int numOfPeasantShips) {
this.numOfPeasantShips = numOfPeasantShips; this.numOfPeasantShips = numOfPeasantShips;
startingPeasantShips = numOfPeasantShips; startingPeasantShips = numOfPeasantShips;
} }
public void delayForASecond() throws Exception { /**
TimeUnit.SECONDS.sleep(1); * delays for a specific amount of seconds, takes an integer as an argument
* @param num the seconds to delay
* @throws Exception in case of errors due to the delay
*/
public void delayForSeconds(int num) throws Exception {
TimeUnit.SECONDS.sleep(num);
} }
//The number of ships which attack is based on the amount of money one has on hand /**
* The number of ships that attack is based on the amount of money one has on hand
* @return the number of ships which will attack
*/
public int numOfShips() { public int numOfShips() {
int numOfShipsAttacking = 0; int numOfShipsAttacking = 0;
@@ -148,7 +187,11 @@ public class ShipWarfare {
} }
//One in two chance of running away /**
* One in two chance of running away
* @return true if the user is allowed to run, false if not, the "default" is false
*/
public boolean runFromShips() { public boolean runFromShips() {
userAttacks = false; userAttacks = false;
Random randomValue = new Random(); Random randomValue = new Random();
@@ -161,7 +204,12 @@ public class ShipWarfare {
return false; return false;
} }
//The loot for defeating a litty fleet is much higher than that of a peasant one /**
* The user faces off against the litty ships and either prevails, dies, or runs away
* The loot for defeating a litty fleet is much higher than that of a peasant one
* @return true if the user wins, loses, or flees, it returns false otherwise
* @throws Exception in case of errors due to the delay
*/
public boolean destroyLittyShipsOrEscape() throws Exception { public boolean destroyLittyShipsOrEscape() throws Exception {
int calculateLoot = 0; int calculateLoot = 0;
int chanceOfEnemyRun = 0; int chanceOfEnemyRun = 0;
@@ -173,6 +221,7 @@ public class ShipWarfare {
//Player volley //Player volley
while (exitValue == 0) { while (exitValue == 0) {
if (player.getGuns() > 0) {
for (int j = 0; j < player.getGuns(); j++) { for (int j = 0; j < player.getGuns(); j++) {
if (userAttacks == true) { if (userAttacks == true) {
int hitOrMiss = randomValue.nextInt(3) + 1; int hitOrMiss = randomValue.nextInt(3) + 1;
@@ -183,13 +232,13 @@ public class ShipWarfare {
break; break;
} }
System.out.println("Got eem"); System.out.println("Got eem");
delayForASecond(); delayForSeconds(1);
} else if (hitOrMiss == 2) { } else if (hitOrMiss == 2) {
System.out.printf("ARRG! We missed %s\n", player.getName()); System.out.printf("ARRG! We missed %s\n", player.getName());
delayForASecond(); delayForSeconds(1);
} else { } else {
System.out.println("Darn! Their fleet tanked our attack"); System.out.println("Darn! Their fleet tanked our attack");
delayForASecond(); delayForSeconds(1);
} }
@@ -197,14 +246,19 @@ public class ShipWarfare {
continue; continue;
} }
} }
} else {
System.out.printf("%s! We don't have any GUNS!!!!\n",player.getName());
delayForSeconds(1);
}
if (numOfLittyShips <= 0) { if (numOfLittyShips <= 0) {
exitValue = 1; exitValue = 1;
break; break;
} }
chanceOfEnemyRun = randomValue.nextInt(2) + 1; if (player.getGuns() > 0) {
if (chanceOfEnemyRun == 2) { if (chanceOfEnemyRun == 2) {
chanceOfEnemyRun = randomValue.nextInt(2) + 1;
howMuchRun = randomValue.nextInt(10) + 1; howMuchRun = randomValue.nextInt(10) + 1;
if (howMuchRun != 0 && howMuchRun < numOfLittyShips) { if (howMuchRun != 0 && howMuchRun < numOfLittyShips) {
@@ -217,10 +271,11 @@ public class ShipWarfare {
} }
} }
} }
}
System.out.printf("%d ships remaining\n", numOfLittyShips); System.out.printf("%d ships remaining\n", numOfLittyShips);
System.out.println("Oh no, they are taking the offensive!"); System.out.println("Oh no, they are taking the offensive!");
delayForASecond(); delayForSeconds(1);
//Computer volley //Computer volley
int takeGunChance = randomValue.nextInt(4) + 1; int takeGunChance = randomValue.nextInt(4) + 1;
if (takeGunChance == 1 && player.getGuns() > 0) { if (takeGunChance == 1 && player.getGuns() > 0) {
@@ -234,7 +289,7 @@ public class ShipWarfare {
break; break;
} }
System.out.printf("EEK, our current ship status is %d%% \n", player.getHP()); System.out.printf("EEK, our current ship status is %d%% \n", player.getHP());
delayForASecond(); delayForSeconds(1);
if (userAttacks == false) { if (userAttacks == false) {
userAttacks = true; userAttacks = true;
} }
@@ -245,8 +300,10 @@ public class ShipWarfare {
if (response.equalsIgnoreCase("r")) { if (response.equalsIgnoreCase("r")) {
if (runFromShips() == false) { if (runFromShips() == false) {
System.out.println("Couldn't run away"); System.out.println("Couldn't run away");
delayForSeconds(1);
} else { } else {
exitValue = 3; System.out.println("Phew! Got away safely");
delayForSeconds(2);
break; break;
} }
} }
@@ -257,15 +314,19 @@ public class ShipWarfare {
if (exitValue == 1) { if (exitValue == 1) {
System.out.printf("\nGot eem\nVictory!\nIt appears we have defeated the enemy fleet and made it out at %d%% ship status\n", player.getHP()); System.out.printf("\nGot eem\nVictory!\nIt appears we have defeated the enemy fleet and made it out at %d%% ship status\n", player.getHP());
delayForSeconds(1);
calculateLoot = (randomValue.nextInt(startingLittyShips) + startingLittyShips) * 300; calculateLoot = (randomValue.nextInt(startingLittyShips) + startingLittyShips) * 300;
player.setMoney(player.getMoney() + calculateLoot); player.setMoney(player.getMoney() + calculateLoot);
System.out.printf("We got $%,d!\n", calculateLoot); System.out.printf("We got $%,d!\n", calculateLoot);
delayForSeconds(2);
return true; return true;
} else if (exitValue == 2) { } else if (exitValue == 2) {
player.gameOver(); player.gameOver();
return true; return true;
} else if (exitValue == 3) { } else if (exitValue == 3) {
System.out.printf("We made it out at %d%% ship status!\n", player.getHP()); System.out.printf("We made it out at %d%% ship status!\n", player.getHP());
delayForSeconds(2);
return true; return true;
} }
return false; return false;
@@ -273,6 +334,11 @@ public class ShipWarfare {
} }
/**
* The user faces off against the peasant ships and either prevails, dies, or runs away
* @return true if the user wins, loses, or flees, it returns false otherwise
* @throws Exception in case of errors due to the delay
*/
public boolean destroyPeasantShipsOrEscape() throws Exception { public boolean destroyPeasantShipsOrEscape() throws Exception {
int calculateLoot = 0; int calculateLoot = 0;
@@ -285,6 +351,8 @@ public class ShipWarfare {
//Player volley //Player volley
while (exitValue == 0) { while (exitValue == 0) {
if (player.getGuns() > 0) {
for (int j = 0; j < player.getGuns(); j++) { for (int j = 0; j < player.getGuns(); j++) {
if (userAttacks == true) { if (userAttacks == true) {
int hitOrMiss = randomValue.nextInt(2) + 1; int hitOrMiss = randomValue.nextInt(2) + 1;
@@ -295,10 +363,10 @@ public class ShipWarfare {
break; break;
} }
System.out.println("Got eem"); System.out.println("Got eem");
delayForASecond(); delayForSeconds(1);
} else { } else {
System.out.printf("ARRG! We missed %s\n", player.getName()); System.out.printf("ARRG! We missed %s\n", player.getName());
delayForASecond(); delayForSeconds(1);
} }
@@ -306,12 +374,19 @@ public class ShipWarfare {
continue; continue;
} }
} }
}
else{
System.out.printf("%s! We don't have any GUNS!!!!\n", player.getName());
delayForSeconds(1);
}
if (numOfPeasantShips <= 0) { if (numOfPeasantShips <= 0) {
exitValue = 1; exitValue = 1;
break; break;
} }
if (player.getGuns() > 0) {
chanceOfEnemyRun = randomValue.nextInt(2) + 1; chanceOfEnemyRun = randomValue.nextInt(2) + 1;
if (chanceOfEnemyRun == 2) { if (chanceOfEnemyRun == 2) {
howMuchRun = randomValue.nextInt(15) + 1; howMuchRun = randomValue.nextInt(15) + 1;
@@ -326,10 +401,12 @@ public class ShipWarfare {
} }
} }
} }
}
System.out.printf("%d ships remaining\n", numOfPeasantShips); System.out.printf("%d ships remaining\n", numOfPeasantShips);
delayForSeconds(1);
System.out.println("Oh no, they are taking the offensive!"); System.out.println("Oh no, they are taking the offensive!");
delayForASecond(); delayForSeconds(1);
//Computer volley //Computer volley
int takeGunChance = randomValue.nextInt(4) + 1; int takeGunChance = randomValue.nextInt(4) + 1;
if (takeGunChance == 1 && player.getGuns() > 0) { if (takeGunChance == 1 && player.getGuns() > 0) {
@@ -343,7 +420,7 @@ public class ShipWarfare {
break; break;
} }
System.out.printf("EEK, our current ship status is %d%% \n", player.getHP()); System.out.printf("EEK, our current ship status is %d%% \n", player.getHP());
delayForASecond(); delayForSeconds(1);
if (userAttacks == false) { if (userAttacks == false) {
userAttacks = true; userAttacks = true;
} }
@@ -366,15 +443,18 @@ public class ShipWarfare {
if (exitValue == 1) { if (exitValue == 1) {
System.out.printf("\nGot eem\nVictory!\nIt appears we have defeated the enemy fleet and made it out at %d%% ship status\n", player.getHP()); System.out.printf("\nGot eem\nVictory!\nIt appears we have defeated the enemy fleet and made it out at %d%% ship status\n", player.getHP());
delayForSeconds(1);
calculateLoot = (randomValue.nextInt(startingPeasantShips) + startingPeasantShips) * 100; calculateLoot = (randomValue.nextInt(startingPeasantShips) + startingPeasantShips) * 100;
player.setMoney(player.getMoney() + calculateLoot); player.setMoney(player.getMoney() + calculateLoot);
System.out.printf("We got $%,d!", calculateLoot); System.out.printf("We got $%,d!", calculateLoot);
delayForSeconds(2);
return true; return true;
} else if (exitValue == 2) { } else if (exitValue == 2) {
player.gameOver(); player.gameOver();
return true; return true;
} else if (exitValue == 3) { } else if (exitValue == 3) {
System.out.printf("We made it out at %d%% ship status!\n", player.getHP()); System.out.printf("We made it out at %d%% ship status!\n", player.getHP());
delayForSeconds(2);
return true; return true;
} }
return false; return false;

View File

@@ -3,22 +3,42 @@ public class Start
{ {
private Player player; private Player player;
/**
* gets the player instance variable. The method returns a copy of the instance variable for encapsulation purposes.
*
* @return playerDummy -- playerDummy is a copy of the player instance variable.
*/
public Player getPlayer() { public Player getPlayer() {
Player playerTemp = new Player(player); Player playerTemp = new Player(player);
return playerTemp; return playerTemp;
} }
/**
* sets the player instance variable equal to a copy of the parameter -- a copy is used for encapsulation purposes.
*
* @param player is a Player object that will replace the current instance of the player instance variable.
*/
public void setPlayer(Player player) { public void setPlayer(Player player) {
Player playerTemp = new Player(player); Player playerTemp = new Player(player);
this.player = playerTemp; this.player = playerTemp;
} }
/**
* Asks the user to input the name that they would like to be called in the game
*
* @param name the name that you would like to be called in the game
*/
public void setFirm (String name) { public void setFirm (String name) {
if (name.length() <= 22) { if (name.length() <= 22) {
player.setName(name); player.setName(name);
} }
} }
public void intialize()
/**
* Initializes the game by asking for your name and if you would like to start with either: 1) money and a debt or
* 2) guns and no cash/debt.
*/
public void initialize()
{ {
Scanner userInput = new Scanner(System.in); Scanner userInput = new Scanner(System.in);
System.out.println("Taipan, \nWhat will you name your firm:"); System.out.println("Taipan, \nWhat will you name your firm:");
@@ -42,10 +62,15 @@ public class Start
player.setBank(999999999); player.setBank(999999999);
player.setGuns(999); player.setGuns(999);
player.setHP(99999999); player.setHP(99999999);
player.setCargoSpace(99999999);
} }
} }
/**
* Copy constructor.
* @param player object of the class Player
*/
public Start(Player player) public Start(Player player)
{ {
Player playerTemp = new Player(player); Player playerTemp = new Player(player);

View File

@@ -3,108 +3,170 @@ import java.util.Scanner;
public class TaipanShop { public class TaipanShop {
private Player player; private Player player;
private int cargoSpace = 60;
private int currentCargo = 0;
private int opiumPrice = 16000; private int opiumPrice = 16000;
private int silkPrice = 1600; private int silkPrice = 1600;
private int armsPrice = 160; private int armsPrice = 160;
private int generalPrice = 8; private int generalPrice = 8;
/**
* This method is evoked if the user is eligible to win, and chooses to end the game (by winning).
*/
public void retire(){ public void retire(){
player.setRetire(true); player.setRetire(true);
System.out.println("You win!"); System.out.println("You win!");
System.exit(0);
} }
/**
* sets the player instance variable equal to a copy of the parameter -- a copy is used for encapsulation purposes.
*
* @param player is a Player object that will replace the current instance of the player instance variable.
*/
public void setPlayer(Player player) { public void setPlayer(Player player) {
Player playerDummy = new Player(player); Player playerDummy = new Player(player);
this.player = playerDummy; this.player = playerDummy;
} }
/**
* gets the player instance variable. The method returns a copy of the instance variable for encapsulation purposes.
*
* @return playerDummy -- playerDummy is a copy of the player instance variable.
*/
public Player getPlayer(){ public Player getPlayer(){
Player playerDummy = new Player(player); Player playerDummy = new Player(player);
return playerDummy; return playerDummy;
} }
/**
* constructor; only runs when a Player object is provided. The constructor is fully encapsulated.
*
* @param player is a Player object that will be copied and the player instance variable is set to the copy.
*/
public TaipanShop(Player player){ public TaipanShop(Player player){
Player playerDummy = new Player(player); Player playerDummy = new Player(player);
this.player = playerDummy; this.player = playerDummy;
} }
public int getCargoSpace() { /**
return cargoSpace; * getter for opiumPrice instance variable.
} *
* @return opiumPrice -- the price of opium in the shop
public void setCargoSpace(int cargoSpace) { */
if(cargoSpace > 0){
this.cargoSpace = cargoSpace;
}
}
public int getOpiumPrice() { public int getOpiumPrice() {
return opiumPrice; return opiumPrice;
} }
/**
* setter for the opiumPrice instance variable. Runs as long as the parameter is greater than 0.
*
* @param opiumPrice -- what the instance variable opiumPrice should be changed to.
*/
public void setOpiumPrice(int opiumPrice) { public void setOpiumPrice(int opiumPrice) {
if(opiumPrice > 0){ if(opiumPrice > 0){
this.opiumPrice = opiumPrice; this.opiumPrice = opiumPrice;
} }
} }
/**
* getter for silkPrice instance variable.
*
* @return silkPrice -- the price of silk in the shop.
*/
public int getSilkPrice() { public int getSilkPrice() {
return silkPrice; return silkPrice;
} }
/**
* setter for the silkPrice instance variable. Runs as long as the parameter is greater than 0.
*
* @param silkPrice -- what the instance variable silkPrice should be changed to.
*/
public void setSilkPrice(int silkPrice) { public void setSilkPrice(int silkPrice) {
if(silkPrice > 0){ if(silkPrice > 0){
this.silkPrice = silkPrice; this.silkPrice = silkPrice;
} }
} }
/**
* getter for armsPrice instance variable.
*
* @return armsPrice -- the price of arms in the shop.
*/
public int getArmsPrice() { public int getArmsPrice() {
return armsPrice; return armsPrice;
} }
/**
* setter for the armsPrice instance variable. Runs as long as the parameter is greater than 0.
*
* @param armsPrice -- what the instance variable armsPrice should be changed to.
*/
public void setArmsPrice(int armsPrice) { public void setArmsPrice(int armsPrice) {
if(armsPrice > 0){ if(armsPrice > 0){
this.armsPrice = armsPrice; this.armsPrice = armsPrice;
} }
} }
/**
* getter for generalPrice instance variable.
*
* @return generalPrice -- the price of general cargo in the shop.
*/
public int getGeneralPrice() { public int getGeneralPrice() {
return generalPrice; return generalPrice;
} }
/**
* setter for the generalPrice instance variable. Runs as long as the parameter is greater than 0.
*
* @param generalPrice -- what the instance variable generalPrice should be changed to.
*/
public void setGeneralPrice(int generalPrice) { public void setGeneralPrice(int generalPrice) {
if(generalPrice > 0){ if(generalPrice > 0){
this.generalPrice = generalPrice; this.generalPrice = generalPrice;
} }
} }
/**
* this method is evoked if the user has decided to travel elsewhere.
*/
public void travel(){ public void travel(){
Travel travel = new Travel(player); Travel travel = new Travel(player);
travel.travelTo(); travel.travelTo();
player = travel.getPlayer(); player = travel.getPlayer();
} }
/**
* this method is evoked if the user wants to use the warehouse to store items or take items out.
*/
public void warehouse(){ public void warehouse(){
Warehouse warehouse = new Warehouse(player); Warehouse warehouse = new Warehouse(player);
warehouse.changeWarehouse(); warehouse.changeWarehouse();
player = warehouse.getPlayer(); player = warehouse.getPlayer();
} }
/**
* this method is evoked if the user wants to use the bank to deposit or withdraw money.
*/
public void bank(){ public void bank(){
Bank bank = new Bank(player); Bank bank = new Bank(player);
bank.bank(); bank.bank();
player = bank.getPlayer(); player = bank.getPlayer();
} }
/**
* this method is evoked if the user wants to use get a loan or pay a loan off.
*/
public void loan(){ public void loan(){
loanShark loan = new loanShark(player); loanShark loan = new loanShark(player);
loan.loanMoney(); loan.loanMoney();
player = loan.getPlayer(); player = loan.getPlayer();
} }
private void updatePrices(){ /**
* this method is when the shop is accessed, randomizing the prices of all the items.
*/
public void updatePrices(){
String s = "\n" + player.getName() + ", the price of "; String s = "\n" + player.getName() + ", the price of ";
double value = 80*Math.random(); double value = 80*Math.random();
Random rand = new Random(); Random rand = new Random();
@@ -112,6 +174,8 @@ public class TaipanShop {
silkPrice = (rand.nextInt(201) + 60)*10; silkPrice = (rand.nextInt(201) + 60)*10;
armsPrice = (rand.nextInt(21) + 6)*10; armsPrice = (rand.nextInt(21) + 6)*10;
generalPrice = rand.nextInt(17) + 4; generalPrice = rand.nextInt(17) + 4;
// there is a 10% chance that the price of an item is increased/decreased beyond its regular range.
if(value < 8){ if(value < 8){
if(value < 2){ if(value < 2){
if(value < 1){ if(value < 1){
@@ -149,12 +213,15 @@ public class TaipanShop {
} }
} }
private void printShop(){ /**
currentCargo = player.getOpiumHeld()+player.getGuns()*10+player.getSilkHeld()+player.getArmsHeld()+player.getGeneralHeld(); * this method prints the shop UI and the player's inventory and status.
if(cargoSpace - currentCargo < 0){ */
public void printShop(){
int currentCargo = player.getOpiumHeld()+player.getGuns()*10+player.getSilkHeld()+player.getArmsHeld()+player.getGeneralHeld();
if(player.getCargoSpace() - currentCargo < 0){
System.out.println("Hold: Overloaded" + " Guns: " + player.getGuns() + " HP: " + player.getHP() +"%"); System.out.println("Hold: Overloaded" + " Guns: " + player.getGuns() + " HP: " + player.getHP() +"%");
}else{ }else{
System.out.println("Hold: " + (cargoSpace-currentCargo) + " Guns: " + player.getGuns() + " HP: " + player.getHP() +"%"); System.out.println("Hold: " + (player.getCargoSpace()-currentCargo) + " Guns: " + player.getGuns() + " HP: " + player.getHP() +"%");
} }
System.out.println("-------------------------------------------------------------"); System.out.println("-------------------------------------------------------------");
System.out.println(" Opium: " + player.getOpiumHeld() + " Silk: " + player.getSilkHeld()); System.out.println(" Opium: " + player.getOpiumHeld() + " Silk: " + player.getSilkHeld());
@@ -166,7 +233,14 @@ public class TaipanShop {
System.out.println(" Arms: " + armsPrice + " General: " + generalPrice); System.out.println(" Arms: " + armsPrice + " General: " + generalPrice);
} }
public void atLocationOne(boolean notDone, Scanner input){ /**
* This method is evoked if the user is at the location one port.
*/
public void atLocationOne(){
boolean notDone = true;
Scanner input = new Scanner(System.in);
// as long as the user does not enter a valid input, the code will run in a loop forever.
while(notDone){ while(notDone){
printShop(); printShop();
System.out.println("\nShall I Buy, Sell, Visit Bank, Get Loans, Transfer Cargo, or Quit Trading?"); System.out.println("\nShall I Buy, Sell, Visit Bank, Get Loans, Transfer Cargo, or Quit Trading?");
@@ -174,6 +248,8 @@ public class TaipanShop {
if (response.equalsIgnoreCase("B")) { if (response.equalsIgnoreCase("B")) {
boolean notDone2 = true; boolean notDone2 = true;
System.out.println("What do you wish me to buy, " + player.getName() + "?"); System.out.println("What do you wish me to buy, " + player.getName() + "?");
// when buying an item, the user must have the right amount of money, and buy non-negative amounts.
while (notDone2) { while (notDone2) {
response = input.nextLine(); response = input.nextLine();
if (response.equalsIgnoreCase("O")) { if (response.equalsIgnoreCase("O")) {
@@ -236,7 +312,8 @@ public class TaipanShop {
} }
} else if (response.equalsIgnoreCase("S")) { } // when selling, the user must enter a non-negative amount of items, and not more than what they have.
else if (response.equalsIgnoreCase("S")) {
boolean notDone2 = true; boolean notDone2 = true;
System.out.println("What do you wish me to sell, " + player.getName() + "?"); System.out.println("What do you wish me to sell, " + player.getName() + "?");
while (notDone2) { while (notDone2) {
@@ -307,14 +384,22 @@ public class TaipanShop {
warehouse(); warehouse();
}else if (response.equalsIgnoreCase("G")||response.equalsIgnoreCase("L")) { }else if (response.equalsIgnoreCase("G")||response.equalsIgnoreCase("L")) {
loan(); loan();
}else if (response.equalsIgnoreCase("Q")) { } // if the user wishes to quit trading, they may do so. Doing this breaks them out of the loop.
else if (response.equalsIgnoreCase("Q")) {
travel(); travel();
notDone = false; notDone = false;
} }
} }
} }
public void notAtLocationOne(boolean notDone, Scanner input){ /**
* This method is evoked when the user is at any port other than location one.
*/
public void notAtLocationOne(){
boolean notDone = true;
Scanner input = new Scanner(System.in);
// as long as the user does not enter a valid input, the code will run in a loop forever.
while(notDone){ while(notDone){
printShop(); printShop();
System.out.println("\nShall I Buy, Sell, or Quit Trading?"); System.out.println("\nShall I Buy, Sell, or Quit Trading?");
@@ -322,6 +407,8 @@ public class TaipanShop {
if (response.equalsIgnoreCase("B")) { if (response.equalsIgnoreCase("B")) {
boolean notDone2 = true; boolean notDone2 = true;
System.out.println("What do you wish me to buy, " + player.getName() + "?"); System.out.println("What do you wish me to buy, " + player.getName() + "?");
// when buying an item, the user must have the right amount of money, and buy non-negative amounts.
while (notDone2) { while (notDone2) {
response = input.nextLine(); response = input.nextLine();
if (response.equalsIgnoreCase("O")) { if (response.equalsIgnoreCase("O")) {
@@ -384,7 +471,8 @@ public class TaipanShop {
} }
} else if (response.equalsIgnoreCase("S")) { } // when selling, the user must enter a non-negative amount of items, and not more than what they have.
else if (response.equalsIgnoreCase("S")) {
boolean notDone2 = true; boolean notDone2 = true;
System.out.println("What do you wish me to sell, " + player.getName() + "?"); System.out.println("What do you wish me to sell, " + player.getName() + "?");
while (notDone2) { while (notDone2) {
@@ -447,14 +535,22 @@ public class TaipanShop {
} }
} }
} }
} else if (response.equalsIgnoreCase("Q")) { } // if the user wishes to quit trading, they may do so. Doing this breaks them out of the loop.
else if (response.equalsIgnoreCase("Q")) {
travel(); travel();
notDone = false; notDone = false;
} }
} }
} }
public void retireAndLocationOne(boolean notDone, Scanner input){ /**
* this method is run if the user is eligible to win, and is at location one.
*/
public void retireAndLocationOne(){
boolean notDone = true;
Scanner input = new Scanner(System.in);
// as long as the user does not enter a valid input, the code will run in a loop forever.
while(notDone){ while(notDone){
printShop(); printShop();
System.out.println("\nShall I Buy, Sell, Visit Bank, Transfer Cargo, Get Loans, Retire, or Quit Trading?"); System.out.println("\nShall I Buy, Sell, Visit Bank, Transfer Cargo, Get Loans, Retire, or Quit Trading?");
@@ -462,6 +558,8 @@ public class TaipanShop {
if (response.equalsIgnoreCase("B")) { if (response.equalsIgnoreCase("B")) {
boolean notDone2 = true; boolean notDone2 = true;
System.out.println("What do you wish me to buy, " + player.getName() + "?"); System.out.println("What do you wish me to buy, " + player.getName() + "?");
// when buying an item, the user must have the right amount of money, and buy non-negative amounts.
while (notDone2) { while (notDone2) {
response = input.nextLine(); response = input.nextLine();
if (response.equalsIgnoreCase("O")) { if (response.equalsIgnoreCase("O")) {
@@ -523,7 +621,8 @@ public class TaipanShop {
} }
} }
} else if (response.equalsIgnoreCase("S")) { } // when selling, the user must enter a non-negative amount of items, and not more than what they have.
else if (response.equalsIgnoreCase("S")) {
boolean notDone2 = true; boolean notDone2 = true;
System.out.println("What do you wish me to sell, " + player.getName() + "?"); System.out.println("What do you wish me to sell, " + player.getName() + "?");
while (notDone2) { while (notDone2) {
@@ -592,28 +691,36 @@ public class TaipanShop {
bank(); bank();
} else if (response.equalsIgnoreCase("T")) { } else if (response.equalsIgnoreCase("T")) {
warehouse(); warehouse();
}else if (response.equalsIgnoreCase("G")||response.equalsIgnoreCase("L")) { } else if (response.equalsIgnoreCase("G")||response.equalsIgnoreCase("L")) {
loan(); loan();
}else if (response.equalsIgnoreCase("Q")) { } // if the user wishes to quit trading, they may do so. Doing this breaks them out of the loop.
else if (response.equalsIgnoreCase("Q")) {
travel(); travel();
notDone = false; notDone = false;
} else if (response.equalsIgnoreCase("R")) { } // if the user wishes to retire and win the game, they may do so. Doing this breaks them out of the loop.
else if (response.equalsIgnoreCase("R")) {
retire(); retire();
notDone = false; notDone = false;
} }
} }
} }
/**
* the general method that utilizes all the other methods to form a fully functioning shop.
*/
public void shop() { public void shop() {
updatePrices(); updatePrices();
Scanner input = new Scanner(System.in);
boolean notDone = true; // first case is triggered if the user is at location one, and has less than $1 million net worth
if (player.getLocation() == 1 && player.getBank()+player.getMoney()-player.getDebt() < 1000000) { if (player.getLocation() == 1 && player.getBank()+player.getMoney()-player.getDebt() < 1000000) {
atLocationOne(notDone, input); atLocationOne();
}else if(player.getLocation() != 1) { } // the second case is triggered if the user is at a location other than location one.
notAtLocationOne(notDone, input); else if(player.getLocation() != 1) {
}else{ notAtLocationOne();
retireAndLocationOne(notDone, input); } // the last case is triggered when the other conditions are not met; it is triggered when the user has a net
// worth that is greater than or equal to $1 million and is at location one.
else{
retireAndLocationOne();
} }
} }
} }

View File

@@ -5,21 +5,42 @@ public class Travel {
private Player player; private Player player;
/**
* sets the player instance variable equal to a copy of the parameter -- a copy is used for encapsulation purposes.
*
* @param player is a Player object that will replace the current instance of the player instance variable.
*/
public void setPlayer(Player player) { public void setPlayer(Player player) {
Player playerDummy = new Player(player); Player playerDummy = new Player(player);
this.player = playerDummy; this.player = playerDummy;
} }
/**
* getter method for obtaining a player object.
*
* @return returns player object
*/
public Player getPlayer() { public Player getPlayer() {
Player playerDummy = new Player(player); Player playerDummy = new Player(player);
return playerDummy; return playerDummy;
} }
/**
* constructor; only runs when a Player object is provided. The constructor is fully encapsulated.
*
* @param player is a Player object that will be copied and the player instance variable is set to the copy.
*/
public Travel(Player player) { public Travel(Player player) {
Player playerDummy = new Player(player); Player playerDummy = new Player(player);
this.player = playerDummy; this.player = playerDummy;
} }
/**
* When provided a location number: the method returns a print statement stating the location's name and call another
* method to change the location of the Player object.
*
* @param locationOfTravel is a Player object that will be copied and the player instance variable is set to the copy.
*/
private void seaAtlas(int locationOfTravel) { private void seaAtlas(int locationOfTravel) {
switch (locationOfTravel) { switch (locationOfTravel) {
case 1: case 1:
@@ -53,25 +74,41 @@ public class Travel {
} }
} }
/**
* Based on random chance either attacks the player with enemy ships, throws them to a different location or does nothing.
*
* @param locationOfTravel is used to see where the player is going to travel, just in case their location is changed
* by a typhoon.
**/
private void randomEventSea(int locationOfTravel) throws Exception { private void randomEventSea(int locationOfTravel) throws Exception {
Random rand = new Random(); Random rand = new Random();
int randGenNum = rand.nextInt(3) + 1; int randGenNum = rand.nextInt(3) + 1;
if (randGenNum == 1) { if (randGenNum == 1) {
peasantFleet(); peasantFleet();
} else if (randGenNum == 2) { }else if (randGenNum == 2) {
disaster(locationOfTravel); disaster(locationOfTravel);
}
System.out.println("We made it!"); System.out.println("We made it!");
} }
}
/**
* Based on random chance either throws the player character off course, or continues them on their way to their
* destination.
*
* @param locationOfTravel is used to see where the player is going to travel, just in case their location is changed
* by a typhoon.
**/
private void disaster(int locationOfTravel) { private void disaster(int locationOfTravel) {
//Tells player that there is a storm approaching.
System.out.print("Storm " + player.getName() + "! "); System.out.print("Storm " + player.getName() + "! ");
Random rand = new Random(); Random rand = new Random();
int randGenNum = rand.nextInt(5) + 1; int randGenNum = rand.nextInt(5) + 1;
//If the player lands within this range, nothing happens to them
//Else they randomly get thrown into a location they weren't planning on going to(Anything but location of Travel).
if (randGenNum <= 2) { if (randGenNum <= 2) {
System.out.println(" We made it through!"); System.out.println(" We made it through!");
} else { }else {
while (randGenNum == locationOfTravel) { while (randGenNum == locationOfTravel) {
randGenNum = rand.nextInt(7) + 1; randGenNum = rand.nextInt(7) + 1;
if (randGenNum != locationOfTravel) { if (randGenNum != locationOfTravel) {
@@ -82,32 +119,45 @@ public class Travel {
} }
} }
/**
* To use the peasant fleet class while still maintaining encapsulation we have to create a ShipWarefare object and
* run the method from there. After the method has been run we can update the player object in this class.
* @throws Exception throws Exception so that we can use the time library to make the player if we want to.
**/
public void peasantFleet() throws Exception { public void peasantFleet() throws Exception {
ShipWarfare attackShip = new ShipWarfare(player); ShipWarfare attackShip = new ShipWarfare(player);
attackShip.peasantFleetAttack(); attackShip.peasantFleetAttack();
player = attackShip.getPlayer(); player = attackShip.getPlayer();
} }
/**
*Used to travel between different areas inside of the game world.
* If the player's inventory is too full it won't run.
* Also calculates loan and bank interest between the jumps between islands.
**/
public void travelTo() { public void travelTo() {
Scanner keyboard = new Scanner(System.in); Scanner keyboard = new Scanner(System.in);
String response; String response;
int tempInt; int tempInt;
boolean hasTraveled = false; boolean hasTraveled = false;
//Only lets the player leave the port if their inventory is greater than or equal to the sum of the items in the inventory.
if(player.getCargoSpace() >= (player.getOpiumHeld()+ (player.getGuns()*10)+player.getSilkHeld() + player.getArmsHeld() + player.getGeneralHeld())){
while (true) { while (true) {
System.out.println("\n" + player.getName() + ", do you wish to go to:\n"); System.out.println("\n" + player.getName() + ", do you wish to go to:\n");
System.out.println("1) Hong Kong, 2) Shanghai, 3) Nagasaki,\n4) Saigon, 5) Manila, 6) Singapore, or 7) Batavia?"); System.out.println("1) Hong Kong, 2) Shanghai, 3) Nagasaki,\n4) Saigon, 5) Manila, 6) Singapore, or 7) Batavia?");
response = keyboard.nextLine(); response = keyboard.nextLine();
//Just in case the player types something that was not intended. It will refresh the question and ask it again
try { try {
tempInt = Integer.parseInt(response); tempInt = Integer.parseInt(response);
System.out.println(tempInt + " " + player.getLocation()); //Makes sure you can't travel to your own location.
if (tempInt != player.getLocation()) { if (tempInt != player.getLocation()) {
randomEventSea(tempInt); randomEventSea(tempInt);
seaAtlas(tempInt); seaAtlas(tempInt);
hasTraveled = true; hasTraveled = true;
player.setBank((int)(player.getBank() * 1.01)); player.setBank((int) (player.getBank() * 1.01));
player.setDebt((int)(player.getDebt() * 1.01)); player.setDebt((int) (player.getDebt() * 1.01));
} else System.out.println("\nYou're already here " + player.getName() + "."); } else System.out.println("\nYou're already here " + player.getName() + ".");
} catch (Exception e) { } catch (Exception e) {
System.out.print("\nSorry, " + player.getName() + " could you say that again?"); System.out.print("\nSorry, " + player.getName() + " could you say that again?");
@@ -117,4 +167,8 @@ public class Travel {
} }
} }
} }
else{
System.out.println(player.getName() + " the cargo is too heavy! We can't set sail!");
}
}
} }

View File

@@ -1,5 +1,9 @@
import java.util.Scanner; import java.util.Scanner;
/**
* The purpose of this class is to create a warehouse where the goods
* can be safely stored without holing space on the ship!
*/
public class Warehouse { public class Warehouse {
/*private int wOpium = 0; /*private int wOpium = 0;
private int wSilk = 0; private int wSilk = 0;
@@ -7,43 +11,75 @@ public class Warehouse {
private int wArms = 0;*/ private int wArms = 0;*/
private Player player; private Player player;
/**
* setter method that takes in a Player object as an argument.
*
* @param player object of the class Player
*/
public void setPlayer(Player player) { public void setPlayer(Player player) {
Player playerDumy = new Player(player); Player playerDumy = new Player(player);
this.player = playerDumy; this.player = playerDumy;
} }
/**
* getter method for obtaining a player object.
*
* @return returns player object
*/
public Player getPlayer() { public Player getPlayer() {
Player playerDummy = new Player(player); Player playerDummy = new Player(player);
return playerDummy; return playerDummy;
} }
/**
* Class Constructor that takes in a type player as a parameter
*
* @param player object of the class Player
*/
public Warehouse(Player player) { public Warehouse(Player player) {
Player playerDummy = new Player(player); Player playerDummy = new Player(player);
this.player = playerDummy; this.player = playerDummy;
} }
/**
* This method adds an amount of a certain good
* the user is prompted to enter the amount they would like to
* add followed by the good they would like to add to the warehouse.
* the method checks if the player has sufficient goods to transfer, and if the player does
* then the method executes the transfer
*
*/
public void addAmount() { public void addAmount() {
boolean askGood = false; boolean askGood = false;
String amount; String amount;
int finalAmount = 0; int finalAmount = 0;
System.out.println("Please enter the amount of the good you would like to ADD."); System.out.println("Please enter the amount of the good you would like to ADD.");
Scanner keyboard = new Scanner(System.in); Scanner keyboard = new Scanner(System.in);
amount = keyboard.nextLine(); amount = keyboard.nextLine();//Asks the user for the amount of the good they would like to add
/*The try function ensures that the program does not crash
due to any errors while giving the program an incorrect input*/
try { try {
//The if statement checks that you have enough resources to make the transfer
if (Integer.parseInt(amount) <= player.getOpiumHeld() || Integer.parseInt(amount) <= player.getSilkHeld() || Integer.parseInt(amount) <= player.getGeneralHeld() || Integer.parseInt(amount) <= player.getArmsHeld()) { if (Integer.parseInt(amount) <= player.getOpiumHeld() || Integer.parseInt(amount) <= player.getSilkHeld() || Integer.parseInt(amount) <= player.getGeneralHeld() || Integer.parseInt(amount) <= player.getArmsHeld()) {
finalAmount = Integer.parseInt(amount); finalAmount = Integer.parseInt(amount);
askGood = true; askGood = true;
} else { }
//Else statement lets the user know that they do not hav enough goods to make the requested transfer
else {
System.out.println("Nice try but you don't have any items of that quantity!"); System.out.println("Nice try but you don't have any items of that quantity!");
askGood = false; askGood = false;
} }
//Ensures that goods are only transferred if they have the specified amount
//The user is prompted to enter which good they want to transfer
if (askGood == true) { if (askGood == true) {
String good; String good;
System.out.println("Please enter a good to transfer O, S, G, A :"); System.out.println("Please enter a good to transfer O, S, G, A :");
good = keyboard.nextLine(); good = keyboard.nextLine();
int held = 0; int held = 0;
//The following set of loops check to see which good the user has selected and makes the transfer
if (Integer.parseInt(amount) > 0) { if (Integer.parseInt(amount) > 0) {
if (good.equalsIgnoreCase("O")) { if (good.equalsIgnoreCase("O")) {
if (player.getOpiumHeld() >= Integer.parseInt(amount)) { if (player.getOpiumHeld() >= Integer.parseInt(amount)) {
@@ -81,36 +117,57 @@ public class Warehouse {
System.out.println("You don't even have that much Arms!"); System.out.println("You don't even have that much Arms!");
} }
} }
} else { }
//Ensures no negative amounts are entered
else {
System.out.println("Sorry this transfer cannot be made"); System.out.println("Sorry this transfer cannot be made");
} }
} }
//If the program errors out this is the message displayed and the method is re-run, so that the game does not end.
} catch (Exception e) { } catch (Exception e) {
System.out.println("Wait, that's not a valid input please try again"); System.out.println("Wait, that's not a valid input please try again");
} }
} }
/**
* This method removes an amount of a certain good
* the user is prompted to enter the amount they would like to
* remove followed by the good they would like to remove from the warehouse.
* the method checks if the player has sufficient goods to transfer, and if the player does
* then the method executes the transfer
*
*/
public void removeAmount() { public void removeAmount() {
String amount; String amount;
boolean askGood = false; boolean askGood = false;
int finalAmount = 0; int finalAmount = 0;
System.out.println("Please enter the amount of the good you would like to REMOVE"); System.out.println("Please enter the amount of the good you would like to REMOVE");
Scanner keyboard = new Scanner(System.in); Scanner keyboard = new Scanner(System.in);
//Prompts the user for the amount they would like to remove
amount = keyboard.nextLine(); amount = keyboard.nextLine();
//The if statement checks that you have enough resources to make the transfer
try { try {
//The if statement checks that you have enough resources to make the transfer
if (Integer.parseInt(amount) <= player.getwOpium() || Integer.parseInt(amount) <= player.getwSilk() || Integer.parseInt(amount) <= player.getwGeneral() || Integer.parseInt(amount) <= player.getwArms()) { if (Integer.parseInt(amount) <= player.getwOpium() || Integer.parseInt(amount) <= player.getwSilk() || Integer.parseInt(amount) <= player.getwGeneral() || Integer.parseInt(amount) <= player.getwArms()) {
finalAmount = Integer.parseInt(amount); finalAmount = Integer.parseInt(amount);
askGood = true; askGood = true;
} else { }
//Else statement lets the user know that they do not hav enough goods to make the requested transfer
else {
System.out.println("Nice try but you don't have any items of that quantity in the warehouse!"); System.out.println("Nice try but you don't have any items of that quantity in the warehouse!");
askGood = false; askGood = false;
} }
//Ensures that goods are only transferred if they have the specified amount
//The user is prompted to enter which good they want to transfer
if (askGood == true) { if (askGood == true) {
String good; String good;
System.out.println("Please enter a good to transfer O, S, G, A :"); System.out.println("Please enter a good to transfer O, S, G, A :");
good = keyboard.nextLine(); good = keyboard.nextLine();
int held = 0; int held = 0;
//The following set of loops check to see which good the user has selected and makes the transfer and amount > 0
if (Integer.parseInt(amount) > 0) { if (Integer.parseInt(amount) > 0) {
if (good.equalsIgnoreCase("O")) { if (good.equalsIgnoreCase("O")) {
if (player.getwOpium() >= Integer.parseInt(amount)) { if (player.getwOpium() >= Integer.parseInt(amount)) {
@@ -147,16 +204,24 @@ public class Warehouse {
} }
} }
} else { }
//Ensures the value entered is positive
else {
System.out.println("Sorry this transfer cannot be made"); System.out.println("Sorry this transfer cannot be made");
} }
} }
}catch (Exception e){ }
//If the program errors out this is the message displayed and the method is re-run, so that the game does not end.
catch (Exception e){
System.out.println("Wait, that's not a valid input please try again"); System.out.println("Wait, that's not a valid input please try again");
} }
} }
/**
* This method prints the stock that is in the warehouse currently using the get and set
* methods from the player class. This is to allow the user to be able to know how much they have
* stored in the warehouse
*/
public void showWarehouse() { public void showWarehouse() {
System.out.println("--------------------\nWarehouse\n--------------------"); System.out.println("--------------------\nWarehouse\n--------------------");
System.out.println("Opium : " + player.getwOpium()); System.out.println("Opium : " + player.getwOpium());
@@ -165,7 +230,11 @@ public class Warehouse {
System.out.println("Arms : " + player.getwArms()); System.out.println("Arms : " + player.getwArms());
} }
/**
* This method combines the add and remove methods and prompts the user to
* enter what they would like to do. Add or remove and accordingly invokes
* the required methods
*/
public void changeWarehouse() { public void changeWarehouse() {
boolean keepGoing = true; boolean keepGoing = true;
while (keepGoing) { while (keepGoing) {
@@ -187,6 +256,7 @@ public class Warehouse {
} }
String check; String check;
//Check to see if the player wants to continue in the warehouse or they are done
System.out.println("Would you like to do any other business? Y / N?"); System.out.println("Would you like to do any other business? Y / N?");
check = keyboard.nextLine(); check = keyboard.nextLine();
check = keyboard.nextLine(); check = keyboard.nextLine();
@@ -199,7 +269,4 @@ public class Warehouse {
} }
} }
public static void main(String[] args) {
}
} }

View File

@@ -2,38 +2,86 @@ import java.util.Scanner;
public class loanShark { public class loanShark {
private Player player; private Player player;
/**
* setter method that takes in a Player object as an argument.
*
* @param player object of the class Player
*/
public void setPlayer(Player player) { public void setPlayer(Player player) {
Player playerDummy = new Player(player); Player playerDummy = new Player(player);
this.player = playerDummy; this.player = playerDummy;
} }
/**
* getter method for obtaining a player object.
*
* @return returns player object
*/
public Player getPlayer(){ public Player getPlayer(){
Player playerDummy = new Player(player); Player playerDummy = new Player(player);
return playerDummy; return playerDummy;
} }
/**
* Class Constructor that takes in a type player as a parameter
*
* @param player object of the class Player
*/
public loanShark(Player player){ public loanShark(Player player){
Player playerDummy = new Player(player); Player playerDummy = new Player(player);
this.player = playerDummy; this.player = playerDummy;
} }
/**
* This methods purpose is to loan the player the funds it wants
* or pay its outstanding debts. The method prompts the user if they
* would like to borrow money or repay. depending on what the player chooses
* the corresponding loop is evoked. The player can only be loaned 2 times the
* money they have minus the debt id their debt exceeds the cash balance, the loan
* cannot be given.
*/
public void loanMoney() { public void loanMoney() {
boolean keepGoing = true; boolean keepGoing = true;
while(keepGoing) { while(keepGoing) {
String check;
Scanner keyboard = new Scanner(System.in);
System.out.println("Would you like to return money or borrow money?");
//Prompts the user or what they would like to do
check = keyboard.nextLine();
//If the user chooses to return money, the money is subtracted from the cash amount and debt
if(check.equalsIgnoreCase("r")){
int returnAsk = 0;
System.out.println("Please enter how much you would like to return?");
returnAsk = keyboard.nextInt();
if(returnAsk <= player.getDebt() && returnAsk >= 0) {
player.setDebt(player.getDebt() - returnAsk);
player.setMoney(player.getMoney() - returnAsk);
}
//if you try to return more money than you owe it wont allow you to
else if(returnAsk > player.getDebt()){
System.out.println("You don't need to return that much!");
}
//No negative amounts are allowed
else{
System.out.println("You can't return a negative amount.");
}
}
//If the user chooses to borrow, the money is added to cash and the debt is increased
else if(check.equalsIgnoreCase("b")){
int loanAsk = 0; int loanAsk = 0;
System.out.println("Please enter how much you would like to borrow"); System.out.println("Please enter how much you would like to borrow");
Scanner keyboard = new Scanner(System.in); //Prompts user for the amount they would like to borrow
loanAsk = keyboard.nextInt(); loanAsk = keyboard.nextInt();
if(loanAsk <= 2*(player.getMoney() - player.getDebt())) { if(loanAsk <= 2*(player.getMoney() - player.getDebt())&& loanAsk >= 0) {
player.setDebt(player.getDebt() + loanAsk); player.setDebt(player.getDebt() + loanAsk);
player.setMoney(player.getMoney() + loanAsk); player.setMoney(player.getMoney() + loanAsk);
} }
//updated //If the requested money exceeds 2*(cash - debt) then the loan cannot be given
else{ else{
System.out.println("Sorry you can't be loaned that much"); System.out.println("Sorry you can't be loaned that much");
break; break;
} }
String check; }
//Asks the player if they have any other things to do with the load shark
System.out.println("Would you like to do any other business? Y / N?"); System.out.println("Would you like to do any other business? Y / N?");
check = keyboard.nextLine(); check = keyboard.nextLine();
check = keyboard.nextLine(); check = keyboard.nextLine();

View File

@@ -2,23 +2,46 @@ public class main {
private Player player = new Player(); private Player player = new Player();
/**
* getter method for the Player object player.
*
* @return returns a copy of the object player
*/
public Player getPlayer(){ public Player getPlayer(){
Player copy = new Player(player); Player copy = new Player(player);
return copy; return copy;
} }
/**
* Initializes the Taipan shop with the players stats after the player finishes shopping, it updates the player object and returns it.
*
* @param shop player object from the main class used to update the shop class
*/
public void shop(TaipanShop shop){ public void shop(TaipanShop shop){
shop.setPlayer(player); shop.setPlayer(player);
shop.shop(); shop.shop();
player = shop.getPlayer(); player = shop.getPlayer();
} }
/**
* Initializes the player object with 5 guns or $400 and $5000 debt.
*
* @param start player object from the main class used to update the start class
*/
public void start(Start start){ public void start(Start start){
start.setPlayer(player); start.setPlayer(player);
start.intialize(); start.initialize();
player = start.getPlayer(); player = start.getPlayer();
} }
/**
* Updates main class with player data and starts the game.
* The game will only run as long as the player has not retired or has been destroyed.
* @param args Just the console for the player to look at.
*/
public static void main(String[] args) { public static void main(String[] args) {
main main = new main(); main main = new main();
TaipanShop littyShop = new TaipanShop(main.getPlayer()); TaipanShop littyShop = new TaipanShop(main.getPlayer());