Merge remote-tracking branch 'origin/master'

# Conflicts:
#	src/WarehouseGUI.java
This commit is contained in:
2019-03-10 23:05:39 -06:00
8 changed files with 565 additions and 211 deletions

2
.idea/misc.xml generated
View File

@@ -9,7 +9,7 @@
<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" project-jdk-type="JavaSDK"> <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8.0_201" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" /> <output url="file://$PROJECT_DIR$/out" />
</component> </component>
<component name="SvnBranchConfigurationManager"> <component name="SvnBranchConfigurationManager">

295
.idea/workspace.xml generated
View File

@@ -2,13 +2,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=""> <list default="true" id="3114a2b9-4919-4fdf-8fd9-d03b60109ce4" name="Default Changelist" comment="">
<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/Player.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Player.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/ShipWarfareGUI.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/ShipWarfareGUI.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/StartGUI.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/StartGUI.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/TaipanShop.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TaipanShop.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/TaipanShopGUI.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TaipanShopGUI.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/TravelGUI.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TravelGUI.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/" /> <ignored path="C:\Users\Harkamal Randhawa\IdeaProjects\TaipanClone\.idea\shelf/" />
@@ -21,83 +16,11 @@
</component> </component>
<component name="FileEditorManager"> <component name="FileEditorManager">
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300"> <leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<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="546">
<caret line="26" selection-start-line="26" selection-end-line="26" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/TaipanShop.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="399">
<caret line="62" selection-start-line="62" selection-end-line="62" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/MainGUI.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="483">
<caret line="45" column="39" selection-start-line="45" selection-start-column="39" selection-end-line="45" selection-end-column="39" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="true"> <file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/src/StartGUI.java"> <entry file="file://$PROJECT_DIR$/src/ShipWarfareGUI.java">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1497"> <state relative-caret-position="7290">
<caret line="145" column="36" selection-start-line="145" selection-start-column="36" selection-end-line="145" selection-end-column="36" /> <caret line="486" column="32" lean-forward="true" selection-start-line="486" selection-start-column="32" selection-end-line="486" selection-end-column="32" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/TravelGUI.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="19">
<caret line="436" column="33" lean-forward="true" selection-start-line="436" selection-start-column="33" selection-end-line="436" selection-end-column="33" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/TaipanShopGUI.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="124">
<caret line="779" column="4" lean-forward="true" selection-start-line="779" selection-start-column="4" selection-end-line="796" selection-end-column="5" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/loanSharkGUI.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-273">
<caret line="13" column="13" selection-start-line="13" selection-start-column="13" selection-end-line="13" selection-end-column="13" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/Travel.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="774">
<caret line="157" column="43" selection-start-line="157" selection-start-column="43" selection-end-line="157" selection-end-column="43" />
</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="-13">
<caret line="303" column="24" lean-forward="true" selection-start-line="303" selection-start-column="24" selection-end-line="303" selection-end-column="24" />
<folding> <folding>
<element signature="imports" expanded="true" /> <element signature="imports" expanded="true" />
</folding> </folding>
@@ -106,10 +29,37 @@
</entry> </entry>
</file> </file>
<file pinned="false" current-in-tab="false"> <file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/Start.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="438"> <state>
<caret line="25" column="7" lean-forward="true" selection-start-line="25" selection-start-column="7" selection-end-line="25" selection-end-column="7" /> <caret column="5" lean-forward="true" selection-start-column="5" selection-end-column="5" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/TaipanShopGUI.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="810">
<caret line="69" column="16" selection-start-line="69" selection-start-column="16" selection-end-line="69" selection-end-column="16" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/MainGUI.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="780">
<caret line="55" column="28" selection-start-line="53" selection-start-column="7" selection-end-line="55" selection-end-column="28" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/TravelGUI.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="6615">
<caret line="465" column="42" selection-start-line="465" selection-start-column="42" selection-end-line="465" selection-end-column="42" />
</state> </state>
</provider> </provider>
</entry> </entry>
@@ -125,6 +75,10 @@
</component> </component>
<component name="FindInProjectRecents"> <component name="FindInProjectRecents">
<findStrings> <findStrings>
<find>numOfLittyShips</find>
<find>delay</find>
<find>Hp</find>
<find>shipwarfare</find>
<find>destroyPeasa</find> <find>destroyPeasa</find>
<find>destr</find> <find>destr</find>
<find>destro</find> <find>destro</find>
@@ -151,10 +105,6 @@
<find>continue</find> <find>continue</find>
<find>cashTex</find> <find>cashTex</find>
<find>cashTe</find> <find>cashTe</find>
<find>10000</find>
<find>too</find>
<find>shipstatusstr</find>
<find>shipstatus</find>
</findStrings> </findStrings>
<replaceStrings> <replaceStrings>
<replace>HP</replace> <replace>HP</replace>
@@ -178,20 +128,19 @@
<option value="$PROJECT_DIR$/src/TaipanShop.java" /> <option value="$PROJECT_DIR$/src/TaipanShop.java" />
<option value="$PROJECT_DIR$/src/main.java" /> <option value="$PROJECT_DIR$/src/main.java" />
<option value="$PROJECT_DIR$/src/Travel.java" /> <option value="$PROJECT_DIR$/src/Travel.java" />
<option value="$PROJECT_DIR$/src/Player.java" />
<option value="$PROJECT_DIR$/src/ShipWarfare.java" /> <option value="$PROJECT_DIR$/src/ShipWarfare.java" />
<option value="$PROJECT_DIR$/src/ShipWarfareGUI.java" />
<option value="$PROJECT_DIR$/src/StartGUI.java" />
<option value="$PROJECT_DIR$/src/TaipanShopGUI.java" /> <option value="$PROJECT_DIR$/src/TaipanShopGUI.java" />
<option value="$PROJECT_DIR$/src/TravelGUI.java" /> <option value="$PROJECT_DIR$/src/TravelGUI.java" />
<option value="$PROJECT_DIR$/src/Player.java" />
<option value="$PROJECT_DIR$/src/ShipWarfareGUI.java" />
</list> </list>
</option> </option>
</component> </component>
<component name="ProjectFrameBounds" extendedState="6"> <component name="ProjectFrameBounds">
<option name="x" value="167" /> <option name="x" value="6" />
<option name="y" value="-11" /> <option name="y" value="26" />
<option name="width" value="1696" /> <option name="width" value="1189" />
<option name="height" value="1026" /> <option name="height" value="652" />
</component> </component>
<component name="ProjectLevelVcsManager" settingsEditedManually="true" /> <component name="ProjectLevelVcsManager" settingsEditedManually="true" />
<component name="ProjectView"> <component name="ProjectView">
@@ -199,7 +148,6 @@
<foldersAlwaysOnTop value="true" /> <foldersAlwaysOnTop value="true" />
</navigator> </navigator>
<panes> <panes>
<pane id="PackagesPane" />
<pane id="ProjectPane"> <pane id="ProjectPane">
<subPane> <subPane>
<expand> <expand>
@@ -217,16 +165,17 @@
</subPane> </subPane>
</pane> </pane>
<pane id="Scope" /> <pane id="Scope" />
<pane id="PackagesPane" />
</panes> </panes>
</component> </component>
<component name="PropertiesComponent"> <component name="PropertiesComponent">
<property name="ChangesTree.GroupingKeys" value="" /> <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="1552275701838" /> <property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1552280276915" />
<property name="extract.method.default.visibility" value="private" /> <property name="extract.method.default.visibility" value="private" />
<property name="last_opened_file_path" value="$PROJECT_DIR$/../GitHub/Cpsc233" /> <property name="last_opened_file_path" value="$PROJECT_DIR$/../GitHub/Cpsc233" />
<property name="project.structure.last.edited" value="Project" /> <property name="project.structure.last.edited" value="Modules" />
<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="editing.templates" /> <property name="settings.editor.selected.configurable" value="editing.templates" />
@@ -337,7 +286,8 @@
<workItem from="1552238757321" duration="742000" /> <workItem from="1552238757321" duration="742000" />
<workItem from="1552240770629" duration="40000" /> <workItem from="1552240770629" duration="40000" />
<workItem from="1552241394045" duration="178000" /> <workItem from="1552241394045" duration="178000" />
<workItem from="1552254283748" duration="7208000" /> <workItem from="1552254283748" duration="9473000" />
<workItem from="1552277298937" duration="2115000" />
</task> </task>
<task id="LOCAL-00001" summary="This should fix the ShipWarfare file and bring it up to date with the rest of the file."> <task id="LOCAL-00001" summary="This should fix the ShipWarfare file and bring it up to date with the rest of the file.">
<created>1550458470138</created> <created>1550458470138</created>
@@ -563,17 +513,31 @@
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1552269681200</updated> <updated>1552269681200</updated>
</task> </task>
<option name="localTasksCounter" value="33" /> <task id="LOCAL-00033" summary="Probably should upload">
<created>1552270321401</created>
<option name="number" value="00033" />
<option name="presentableId" value="LOCAL-00033" />
<option name="project" value="LOCAL" />
<updated>1552270321402</updated>
</task>
<task id="LOCAL-00034" summary="Fixed ShipWarfare bug about one-shotting.">
<created>1552279406065</created>
<option name="number" value="00034" />
<option name="presentableId" value="LOCAL-00034" />
<option name="project" value="LOCAL" />
<updated>1552279406066</updated>
</task>
<option name="localTasksCounter" value="35" />
<servers /> <servers />
</component> </component>
<component name="TimeTrackingManager"> <component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="75291000" /> <option name="totallyTimeSpent" value="75188000" />
</component> </component>
<component name="ToolWindowManager"> <component name="ToolWindowManager">
<frame x="-8" y="-8" width="1936" height="1056" extended-state="6" /> <frame x="6" y="26" width="1189" height="652" extended-state="0" />
<editor active="true" /> <editor active="true" />
<layout> <layout>
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.28997868" /> <window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.2798605" />
<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" />
@@ -582,7 +546,7 @@
<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" weight="0.32922733" /> <window_info anchor="bottom" id="Find" order="1" weight="0.32922733" />
<window_info active="true" anchor="bottom" id="Run" order="2" visible="true" weight="0.09967497" /> <window_info anchor="bottom" id="Run" order="2" weight="0.9357143" />
<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" />
@@ -670,8 +634,6 @@
<ignored-roots> <ignored-roots>
<path value="$PROJECT_DIR$" /> <path value="$PROJECT_DIR$" />
</ignored-roots> </ignored-roots>
<MESSAGE value="Brought back Vikram's changes" />
<MESSAGE value="Fixed the commenting on a lot of the code. Also added some stuff to Travel, fixed some bugs." />
<MESSAGE value="Added time stuff to Shipwarfare GUI" /> <MESSAGE value="Added time stuff to Shipwarfare GUI" />
<MESSAGE value="Nitified of getting attacked" /> <MESSAGE value="Nitified of getting attacked" />
<MESSAGE value="Notified of getting attacked" /> <MESSAGE value="Notified of getting attacked" />
@@ -695,7 +657,9 @@
<MESSAGE value="A lot of errors but easily fixable SHipwarfareGUI" /> <MESSAGE value="A lot of errors but easily fixable SHipwarfareGUI" />
<MESSAGE value="Completed SHipWarfareGUI" /> <MESSAGE value="Completed SHipWarfareGUI" />
<MESSAGE value="Completed ShipWarfareGUI" /> <MESSAGE value="Completed ShipWarfareGUI" />
<option name="LAST_COMMIT_MESSAGE" value="Completed ShipWarfareGUI" /> <MESSAGE value="Probably should upload" />
<MESSAGE value="Fixed ShipWarfare bug about one-shotting." />
<option name="LAST_COMMIT_MESSAGE" value="Fixed ShipWarfare bug about one-shotting." />
</component> </component>
<component name="editorHistoryManager"> <component name="editorHistoryManager">
<entry file="uml://JAVA/ShipWarfare"> <entry file="uml://JAVA/ShipWarfare">
@@ -737,122 +701,86 @@
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/src/Game.java" /> <entry file="file://$PROJECT_DIR$/src/Game.java" />
<entry file="file://$PROJECT_DIR$/src/Warehouse.java"> <entry file="file://$PROJECT_DIR$/src/Warehouse.java" />
<entry file="file://$PROJECT_DIR$/src/Bank.java" />
<entry file="file://$PROJECT_DIR$/src/TaipanShop.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="945"> <state relative-caret-position="27">
<caret line="45" selection-start-line="45" selection-end-line="45" /> <caret line="125" column="63" selection-start-line="125" selection-start-column="63" selection-end-line="125" selection-end-column="63" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/src/Bank.java"> <entry file="jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/javafx-src.zip!/com/sun/glass/ui/InvokeLaterDispatcher.java">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="2100"> <state relative-caret-position="140">
<caret line="100" column="6" selection-start-line="100" selection-start-column="6" selection-end-line="100" selection-end-column="6" /> <caret line="110" column="19" selection-start-line="110" selection-start-column="19" selection-end-line="110" selection-end-column="19" />
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/javafx-src.zip!/com/sun/glass/ui/InvokeLaterDispatcher.java" />
<entry file="file://$PROJECT_DIR$/src/ShopGUI" /> <entry file="file://$PROJECT_DIR$/src/ShopGUI" />
<entry file="file://$PROJECT_DIR$/src/Player.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="15">
<caret line="1" column="13" selection-start-line="1" selection-start-column="13" selection-end-line="1" selection-end-column="13" />
</state>
</provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/src/main.java"> <entry file="file://$PROJECT_DIR$/src/main.java">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="546"> <state relative-caret-position="195">
<caret line="26" selection-start-line="26" selection-end-line="26" /> <caret line="13" column="5" lean-forward="true" selection-start-line="13" selection-start-column="5" selection-end-line="13" selection-end-column="5" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/ShipWarfareGUI.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="218">
<caret line="386" column="35" selection-start-line="386" selection-start-column="35" selection-end-line="386" selection-end-column="35" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/loanShark.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1995">
<caret line="95" column="5" selection-start-line="95" selection-start-column="5" selection-end-line="95" 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="438">
<caret line="25" column="7" lean-forward="true" selection-start-line="25" selection-start-column="7" selection-end-line="25" selection-end-column="7" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/Travel.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="774">
<caret line="157" column="43" selection-start-line="157" selection-start-column="43" selection-end-line="157" selection-end-column="43" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/ShopGUI.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="693">
<caret line="113" column="15" lean-forward="true" selection-start-line="113" selection-start-column="15" selection-end-line="113" selection-end-column="15" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/loanSharkGUI.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-273">
<caret line="13" column="13" selection-start-line="13" selection-start-column="13" selection-end-line="13" selection-end-column="13" />
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/src/ShipWarfare.java"> <entry file="file://$PROJECT_DIR$/src/ShipWarfare.java">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-13"> <state relative-caret-position="-1074">
<caret line="303" column="24" lean-forward="true" selection-start-line="303" selection-start-column="24" selection-end-line="303" selection-end-column="24" /> <caret line="17" column="35" selection-start-line="17" selection-start-column="35" selection-end-line="17" selection-end-column="35" />
<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/MainGUI.java"> <entry file="file://$PROJECT_DIR$/src/TaipanShopGUI.java">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="483"> <state relative-caret-position="810">
<caret line="45" column="39" selection-start-line="45" selection-start-column="39" selection-end-line="45" selection-end-column="39" /> <caret line="69" column="16" selection-start-line="69" selection-start-column="16" selection-end-line="69" selection-end-column="16" />
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/src/TaipanShopGUI.java"> <entry file="file://$PROJECT_DIR$/src/MainGUI.java">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="124"> <state relative-caret-position="780">
<caret line="779" column="4" lean-forward="true" selection-start-line="779" selection-start-column="4" selection-end-line="796" selection-end-column="5" /> <caret line="55" column="28" selection-start-line="53" selection-start-column="7" selection-end-line="55" selection-end-column="28" />
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/src/TravelGUI.java"> <entry file="file://$PROJECT_DIR$/src/TravelGUI.java">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="19"> <state relative-caret-position="6615">
<caret line="436" column="33" lean-forward="true" selection-start-line="436" selection-start-column="33" selection-end-line="436" selection-end-column="33" /> <caret line="465" column="42" selection-start-line="465" selection-start-column="42" selection-end-line="465" selection-end-column="42" />
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/src/TaipanShop.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="399"> <state>
<caret line="62" selection-start-line="62" selection-end-line="62" /> <caret column="5" lean-forward="true" selection-start-column="5" selection-end-column="5" />
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/src/StartGUI.java"> <entry file="file://$PROJECT_DIR$/src/ShipWarfareGUI.java">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1497"> <state relative-caret-position="7290">
<caret line="145" column="36" selection-start-line="145" selection-start-column="36" selection-end-line="145" selection-end-column="36" /> <caret line="486" column="32" lean-forward="true" selection-start-line="486" selection-start-column="32" selection-end-line="486" selection-end-column="32" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state> </state>
</provider> </provider>
</entry> </entry>
@@ -913,7 +841,6 @@
<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>

View File

@@ -5,8 +5,7 @@
<content url="file://$MODULE_DIR$"> <content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content> </content>
<orderEntry type="inheritedJdk" /> <orderEntry type="jdk" jdkName="1.8.0_201" jdkType="JavaSDK" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
</component> </component>
</module> </module>

View File

@@ -59,6 +59,7 @@ 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;
this.cargoSpace = player.cargoSpace;
} }
/** /**

View File

@@ -250,7 +250,10 @@ public class ShipWarfareGUI {
player.setGuns(player.getGuns() - 1); player.setGuns(player.getGuns() - 1);
gunFrustration = true; gunFrustration = true;
} else { } else {
player.setHP(player.getHP() - (1 + randomValue.nextInt(10))); if (numOfPeasantShips>0) {
player.setHP(player.getHP() - (1 + randomValue.nextInt(10)));
}
} }
if (player.getHP() <= 0) { if (player.getHP() <= 0) {
exitValue = 2; exitValue = 2;
@@ -290,6 +293,12 @@ public class ShipWarfareGUI {
return false; return false;
} }
/**
* Sets up the graphical part of ShipWarfare and includes all logic for the class
* @param stage sets the stage to which we will execute the scene of the ShipWarfare class
* @return stage so that another class can switch to the stage
*/
public Stage initializeShip(Stage stage){ public Stage initializeShip(Stage stage){
setNumOfPeasantShips(numOfShips()); setNumOfPeasantShips(numOfShips());
@@ -375,6 +384,10 @@ public class ShipWarfareGUI {
//Fight //Fight
fightButton.setOnAction(new EventHandler<ActionEvent>() { fightButton.setOnAction(new EventHandler<ActionEvent>() {
@Override @Override
/**
* Fight Button, engages in fight logic and graphical interface
* @param event, once button is clicked, executes graphical information
*/
public void handle(ActionEvent event) { public void handle(ActionEvent event) {
counter++; counter++;
chooseFightOrRun.setText("Ohh, Fight ehh?"); chooseFightOrRun.setText("Ohh, Fight ehh?");
@@ -386,6 +399,10 @@ public class ShipWarfareGUI {
runButton.setVisible(false); runButton.setVisible(false);
continueButton.setOnAction(new EventHandler<ActionEvent>() { continueButton.setOnAction(new EventHandler<ActionEvent>() {
@Override @Override
/**
* Switches to Taipan Shop scene
* @param event, once button is clicked, executes graphical information
*/
public void handle(ActionEvent event) { public void handle(ActionEvent event) {
TaipanShopGUI shop = new TaipanShopGUI(player); TaipanShopGUI shop = new TaipanShopGUI(player);
shop.initializeShop(stage); shop.initializeShop(stage);
@@ -408,6 +425,10 @@ public class ShipWarfareGUI {
//Flee //Flee
runButton.setOnAction(new EventHandler<ActionEvent>() { runButton.setOnAction(new EventHandler<ActionEvent>() {
@Override @Override
/**
* Run Button, engages in run logic and graphical interface
* @param event, once button is clicked, executes graphical information
*/
public void handle(ActionEvent event) { public void handle(ActionEvent event) {
chooseFightOrRun.setText("Ayy captain we will try to run!"); chooseFightOrRun.setText("Ayy captain we will try to run!");
counter++; counter++;
@@ -424,6 +445,10 @@ public class ShipWarfareGUI {
runButton.setVisible(false); runButton.setVisible(false);
continueButton.setOnAction(new EventHandler<ActionEvent>() { continueButton.setOnAction(new EventHandler<ActionEvent>() {
@Override @Override
/**
* Switches to Taipan Shop scene
* @param event, once button is clicked, executes graphical information
*/
public void handle(ActionEvent event) { public void handle(ActionEvent event) {
TaipanShopGUI shop = new TaipanShopGUI(player); TaipanShopGUI shop = new TaipanShopGUI(player);
shop.initializeShop(stage); shop.initializeShop(stage);
@@ -458,6 +483,10 @@ public class ShipWarfareGUI {
return stage; return stage;
} }
/**
* sets scene and runs stage
* @param primaryStage the stage in which the scene may be run and switched to
*/
public void start(Stage primaryStage){ public void start(Stage primaryStage){
primaryStage = initializeShip(primaryStage); primaryStage = initializeShip(primaryStage);
primaryStage.show(); primaryStage.show();

View File

@@ -143,9 +143,9 @@ public class StartGUI {
if (response.equalsIgnoreCase("Vikram")) { if (response.equalsIgnoreCase("Vikram")) {
player.setMoney(999999999); player.setMoney(999999999);
player.setBank(999999999); player.setBank(999999999);
player.setGuns(0); player.setGuns(999);
player.setHP(99999999); player.setHP(999999999);
player.setCargoSpace(Integer.MAX_VALUE); player.setCargoSpace(999999999);
} }
setFirm(response); setFirm(response);

View File

@@ -55,13 +55,6 @@ public class TaipanShopGUI {
this.player = playerDummy; this.player = playerDummy;
} }
public void startTaipanShop(Stage stage){
stage = initializeShop(stage);
updateStage();
updatePrices();
stage.show();
}
/** /**
* This method is evoked if the user is eligible to win, and chooses to end the game (by winning). * This method is evoked if the user is eligible to win, and chooses to end the game (by winning).
*/ */
@@ -222,11 +215,23 @@ public class TaipanShopGUI {
} }
} }
/**
* Sets the default dialogue of simply stating the prices of the items.
*/
public void defaultTextOut(){ public void defaultTextOut(){
textOut.setText(String.format("\t%s, present prices per unit here are:\n\n\t\tOpium: %d\t\t\tSilk: %d\n\t\tArms: %d\t\t\tGeneral: %d", player.getName(), getOpiumPrice(), getSilkPrice(), getArmsPrice(), getGeneralPrice())); textOut.setText(String.format("\t%s, present prices per unit here are:\n\n\t\tOpium: %d\t\t\tSilk: %d\n\t\tArms: %d\t\t\tGeneral: %d", player.getName(), getOpiumPrice(), getSilkPrice(), getArmsPrice(), getGeneralPrice()));
} }
/**
* Sets up buttons according to which "state" is inputted. When used in "shop", only the item buttons are visible.
* When used in "reset", all the item buttons are invisible; if the user is at location one and is eligible to win,
* then all utilities and the retire button are visible. If the user is not at location one, then the user can only
* buy, sell, or exit. If the user is at location one and is not eligible to win, then all utilities are visible but
* the retire button is not. When used in "input" everything near the bottom is invisible except for the text area.
*
* @param state -- the state determines which buttons are visible and which are not.
*/
public void buttonSetup(String state) { public void buttonSetup(String state) {
if (state.equals("shop")) { if (state.equals("shop")) {
buyButton.setVisible(false); buyButton.setVisible(false);
@@ -248,7 +253,7 @@ public class TaipanShopGUI {
silkButton.setText("Silk"); silkButton.setText("Silk");
armsButton.setText("Arms"); armsButton.setText("Arms");
generalButton.setText("General"); generalButton.setText("General");
if (player.getLocation() != 1 && player.getBank() + player.getMoney() - player.getDebt() < 1000000) { if (player.getLocation() != 1) {
buyButton.setVisible(true); buyButton.setVisible(true);
sellButton.setVisible(true); sellButton.setVisible(true);
bankButton.setVisible(false); bankButton.setVisible(false);
@@ -261,7 +266,8 @@ public class TaipanShopGUI {
numberInput.setVisible(false); numberInput.setVisible(false);
generalButton.setVisible(false); generalButton.setVisible(false);
retireButton.setVisible(false); retireButton.setVisible(false);
}else if(player.getBank() + player.getMoney() - player.getDebt() < 1000000){ }
if(player.getBank() + player.getMoney() - player.getDebt() < 1000000 && player.getLocation() == 1){
buyButton.setVisible(true); buyButton.setVisible(true);
sellButton.setVisible(true); sellButton.setVisible(true);
bankButton.setVisible(true); bankButton.setVisible(true);
@@ -274,7 +280,7 @@ public class TaipanShopGUI {
generalButton.setVisible(false); generalButton.setVisible(false);
armsButton.setVisible(false); armsButton.setVisible(false);
retireButton.setVisible(false); retireButton.setVisible(false);
}else{ }else if(player.getLocation() == 1){
buyButton.setVisible(true); buyButton.setVisible(true);
sellButton.setVisible(true); sellButton.setVisible(true);
bankButton.setVisible(true); bankButton.setVisible(true);
@@ -304,6 +310,9 @@ public class TaipanShopGUI {
} }
} }
/**
*
*/
public void shop(){ public void shop(){
String originalDialogue = textOut.getText(); String originalDialogue = textOut.getText();
int num = Integer.parseInt(numberInput.getText().replace(" ", "")); int num = Integer.parseInt(numberInput.getText().replace(" ", ""));
@@ -370,7 +379,7 @@ public class TaipanShopGUI {
} }
} }
public Stage initializeShop(Stage stage){ public void initializeShop(Stage stage){
Font size14 = new Font(14.0); Font size14 = new Font(14.0);
Rectangle dialogueRectangle = new Rectangle(); Rectangle dialogueRectangle = new Rectangle();
dialogueRectangle.setFill(javafx.scene.paint.Color.WHITE); dialogueRectangle.setFill(javafx.scene.paint.Color.WHITE);
@@ -759,8 +768,6 @@ public class TaipanShopGUI {
updatePrices(); updatePrices();
defaultTextOut(); defaultTextOut();
updateStage(); updateStage();
return stage;
} }
public String getStringLocation(){ public String getStringLocation(){

View File

@@ -11,6 +11,10 @@ import javafx.scene.text.Font;
import javafx.scene.text.Text; import javafx.scene.text.Text;
import javafx.stage.Stage; import javafx.stage.Stage;
/**
* A class that makes the GUI for the Warehouse class.
*
*/
public class WarehouseGUI { public class WarehouseGUI {
private Player player; private Player player;
@@ -19,6 +23,7 @@ public class WarehouseGUI {
private HBox hBox; private HBox hBox;
private Button withdraw; private Button withdraw;
private Button deposit; private Button deposit;
private Button goBack;
private VBox vBox; private VBox vBox;
private Text playerName; private Text playerName;
private Text text; private Text text;
@@ -43,22 +48,42 @@ public class WarehouseGUI {
private CheckMenuItem arms; private CheckMenuItem arms;
private CheckMenuItem silk; private CheckMenuItem silk;
private CheckMenuItem opium; private CheckMenuItem opium;
/**
* A constructor that takes an object of type Player as an argument
*
* @param player object of the class Player
*/
public WarehouseGUI(Player player) { public WarehouseGUI(Player player) {
Player playerDummy = new Player(player); Player playerDummy = new Player(player);
this.player = playerDummy; this.player = playerDummy;
} }
/**
* Setter method for the Player object, player
*
* @param player an object of type 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 the Player object, player.
*
* @return returns a copy of the Player object, player
*/
public Player getPlayer(){ public Player getPlayer(){
Player playerDummy = new Player(player); Player playerDummy = new Player(player);
return playerDummy; return playerDummy;
} }
/**
* initializes the GUI for the warehouse aspect of our game.
*
* @param stage an object of type Stage
* @return returns the stage of the GUI
*/
public Stage initializeWarehouse(Stage stage) { public Stage initializeWarehouse(Stage stage) {
title = new Text(); title = new Text();
@@ -93,10 +118,19 @@ public class WarehouseGUI {
borderPane.setPrefHeight(480.0); borderPane.setPrefHeight(480.0);
borderPane.setPrefWidth(600.0); borderPane.setPrefWidth(600.0);
/**
* Sets the preferred width and height of the borderpane window to 600 by 480.
*
*/
borderPane.setPrefHeight(480.0); borderPane.setPrefHeight(480.0);
borderPane.setPrefWidth(600.0); borderPane.setPrefWidth(600.0);
/**
* Creates a label "Hong Kong Warehouse: at the top of the borderpane.
*
*/
borderPane.setAlignment(title, javafx.geometry.Pos.CENTER); borderPane.setAlignment(title, javafx.geometry.Pos.CENTER);
title.setStrokeType(javafx.scene.shape.StrokeType.OUTSIDE); title.setStrokeType(javafx.scene.shape.StrokeType.OUTSIDE);
title.setStrokeWidth(0.0); title.setStrokeWidth(0.0);
title.setText("Hong Kong Warehouse"); title.setText("Hong Kong Warehouse");
@@ -115,17 +149,29 @@ public class WarehouseGUI {
title.setFont(new Font(24.0)); title.setFont(new Font(24.0));
borderPane.setTop(title); borderPane.setTop(title);
BorderPane.setAlignment(hBox, javafx.geometry.Pos.CENTER); /**
* creates an HBox at the center of the borderpane with a width of 200 and height of 100.
*
*/
borderPane.setAlignment(hBox, javafx.geometry.Pos.CENTER);
hBox.setAlignment(javafx.geometry.Pos.CENTER); hBox.setAlignment(javafx.geometry.Pos.CENTER);
hBox.setPrefHeight(100.0); hBox.setPrefHeight(100.0);
hBox.setPrefWidth(200.0); hBox.setPrefWidth(200.0);
/**
* Creates a button with text "Withdraw" which handles user events.
*
*/
withdraw.setContentDisplay(javafx.scene.control.ContentDisplay.CENTER); withdraw.setContentDisplay(javafx.scene.control.ContentDisplay.CENTER);
withdraw.setMnemonicParsing(false); withdraw.setMnemonicParsing(false);
withdraw.setPrefWidth(250.0);
withdraw.setText("Withdraw"); withdraw.setText("Withdraw");
// Set the event handler when the deposit button is clicked
withdraw.setOnAction(new EventHandler<ActionEvent>() { withdraw.setOnAction(new EventHandler<ActionEvent>() {
/**
* Creates a button with text "Deposit" which handles user events.
*
*/
@Override @Override
public void handle(ActionEvent event) { public void handle(ActionEvent event) {
int withdraw = Integer.parseInt(textIn.getText()); int withdraw = Integer.parseInt(textIn.getText());
@@ -142,10 +188,11 @@ public class WarehouseGUI {
); );
deposit.setMnemonicParsing(false); deposit.setMnemonicParsing(false);
deposit.setPrefWidth(250.0);
deposit.setText("Deposit"); deposit.setText("Deposit");
deposit.setTextAlignment(javafx.scene.text.TextAlignment.CENTER); deposit.setTextAlignment(javafx.scene.text.TextAlignment.CENTER);
borderPane.setBottom(hBox);
// Set the event handler when the deposit button is clicked
deposit.setOnAction(new EventHandler<ActionEvent>() { deposit.setOnAction(new EventHandler<ActionEvent>() {
@Override @Override
public void handle(ActionEvent event) { public void handle(ActionEvent event) {
@@ -154,7 +201,6 @@ public class WarehouseGUI {
} }
); );
splitMenu.setMnemonicParsing(false); splitMenu.setMnemonicParsing(false);
splitMenu.setText("Item"); splitMenu.setText("Item");
@@ -175,6 +221,10 @@ public class WarehouseGUI {
vBox.setPrefHeight(156.0); vBox.setPrefHeight(156.0);
vBox.setPrefWidth(106.0); vBox.setPrefWidth(106.0);
/**
* Creates a label with text "Player" with size 18 font and default font style.
*
*/
playerName.setStrokeType(javafx.scene.shape.StrokeType.OUTSIDE); playerName.setStrokeType(javafx.scene.shape.StrokeType.OUTSIDE);
playerName.setStrokeWidth(0.0); playerName.setStrokeWidth(0.0);
playerName.setText("Player"); playerName.setText("Player");
@@ -182,12 +232,20 @@ public class WarehouseGUI {
playerName.setWrappingWidth(103.47265625); playerName.setWrappingWidth(103.47265625);
playerName.setFont(new Font(18.0)); playerName.setFont(new Font(18.0));
/**
* Creates a label with no text for aesthetic spacing purposes.
*
*/
text.setStrokeType(javafx.scene.shape.StrokeType.OUTSIDE); text.setStrokeType(javafx.scene.shape.StrokeType.OUTSIDE);
text.setStrokeWidth(0.0); text.setStrokeWidth(0.0);
text.setTextAlignment(javafx.scene.text.TextAlignment.CENTER); text.setTextAlignment(javafx.scene.text.TextAlignment.CENTER);
text.setWrappingWidth(103.47265625); text.setWrappingWidth(103.47265625);
text.setFont(new Font(18.0)); text.setFont(new Font(18.0));
/**
* Creates a label with text "Opium" under the "Player" label with size 18 font and default font style
*
*/
opiumPlayer.setAlignment(javafx.geometry.Pos.CENTER); opiumPlayer.setAlignment(javafx.geometry.Pos.CENTER);
opiumPlayer.setContentDisplay(javafx.scene.control.ContentDisplay.CENTER); opiumPlayer.setContentDisplay(javafx.scene.control.ContentDisplay.CENTER);
opiumPlayer.setPrefWidth(100.0); opiumPlayer.setPrefWidth(100.0);
@@ -195,16 +253,28 @@ public class WarehouseGUI {
opiumPlayer.setTextAlignment(javafx.scene.text.TextAlignment.CENTER); opiumPlayer.setTextAlignment(javafx.scene.text.TextAlignment.CENTER);
opiumPlayer.setFont(new Font(18.0)); opiumPlayer.setFont(new Font(18.0));
/**
* Creates a label with text "Silk" under the "Player" label with size 18 font and default font style.
*
*/
silkPlayer.setAlignment(javafx.geometry.Pos.CENTER); silkPlayer.setAlignment(javafx.geometry.Pos.CENTER);
silkPlayer.setPrefWidth(100.0); silkPlayer.setPrefWidth(100.0);
silkPlayer.setText("Silk"); silkPlayer.setText("Silk");
silkPlayer.setFont(new Font(18.0)); silkPlayer.setFont(new Font(18.0));
/**
* Creates a label with text "Arms" under the "Player" label with size 18 font and default font style.
*
*/
armsPlayer.setAlignment(javafx.geometry.Pos.CENTER); armsPlayer.setAlignment(javafx.geometry.Pos.CENTER);
armsPlayer.setPrefWidth(100.0); armsPlayer.setPrefWidth(100.0);
armsPlayer.setText("Arms"); armsPlayer.setText("Arms");
armsPlayer.setFont(new Font(18.0)); armsPlayer.setFont(new Font(18.0));
/**
* Creates a label with text "General" under the "Player" label with size 18 font and default font style.
*
*/
generalPlayer.setAlignment(javafx.geometry.Pos.CENTER); generalPlayer.setAlignment(javafx.geometry.Pos.CENTER);
generalPlayer.setPrefWidth(100.0); generalPlayer.setPrefWidth(100.0);
generalPlayer.setText("General"); generalPlayer.setText("General");
@@ -212,6 +282,10 @@ public class WarehouseGUI {
generalPlayer.setFont(new Font(18.0)); generalPlayer.setFont(new Font(18.0));
borderPane.setLeft(vBox); borderPane.setLeft(vBox);
/**
* Creates a VBox at the center of the borderpane with a width of 261 and a height of 343.
*
*/
BorderPane.setAlignment(vBox0, javafx.geometry.Pos.TOP_LEFT); BorderPane.setAlignment(vBox0, javafx.geometry.Pos.TOP_LEFT);
vBox0.setAlignment(javafx.geometry.Pos.CENTER); vBox0.setAlignment(javafx.geometry.Pos.CENTER);
vBox0.setPrefHeight(343.0); vBox0.setPrefHeight(343.0);
@@ -350,6 +424,10 @@ public class WarehouseGUI {
vBox0.setPrefHeight(343.0); vBox0.setPrefHeight(343.0);
vBox0.setPrefWidth(261.0); vBox0.setPrefWidth(261.0);
/**
* Creates a label with text "Warehouse" with size 18 font and default font style.
*
*/
text0.setStrokeType(javafx.scene.shape.StrokeType.OUTSIDE); text0.setStrokeType(javafx.scene.shape.StrokeType.OUTSIDE);
text0.setStrokeWidth(0.0); text0.setStrokeWidth(0.0);
text0.setText("Warehouse"); text0.setText("Warehouse");
@@ -357,12 +435,20 @@ public class WarehouseGUI {
text0.setWrappingWidth(103.47265625); text0.setWrappingWidth(103.47265625);
text0.setFont(new Font(18.0)); text0.setFont(new Font(18.0));
/**
* Creates a label with no text for aesthetic spacing purposes.
*
*/
text1.setStrokeType(javafx.scene.shape.StrokeType.OUTSIDE); text1.setStrokeType(javafx.scene.shape.StrokeType.OUTSIDE);
text1.setStrokeWidth(0.0); text1.setStrokeWidth(0.0);
text1.setTextAlignment(javafx.scene.text.TextAlignment.CENTER); text1.setTextAlignment(javafx.scene.text.TextAlignment.CENTER);
text1.setWrappingWidth(103.47265625); text1.setWrappingWidth(103.47265625);
text1.setFont(new Font(18.0)); text1.setFont(new Font(18.0));
/**
* Creates a label with text "Opium" under the "Warehouse" label with size 18 font and default font style.
*
*/
opiumWarehouse.setStrokeType(javafx.scene.shape.StrokeType.OUTSIDE); opiumWarehouse.setStrokeType(javafx.scene.shape.StrokeType.OUTSIDE);
opiumWarehouse.setStrokeWidth(0.0); opiumWarehouse.setStrokeWidth(0.0);
opiumWarehouse.setText("Opium"); opiumWarehouse.setText("Opium");
@@ -370,6 +456,10 @@ public class WarehouseGUI {
opiumWarehouse.setWrappingWidth(103.47265625); opiumWarehouse.setWrappingWidth(103.47265625);
opiumWarehouse.setFont(new Font(18.0)); opiumWarehouse.setFont(new Font(18.0));
/**
* Creates a label with text "Silk" under the "Warehouse" label with size 18 font and default font style.
*
*/
silkWarehouse.setStrokeType(javafx.scene.shape.StrokeType.OUTSIDE); silkWarehouse.setStrokeType(javafx.scene.shape.StrokeType.OUTSIDE);
silkWarehouse.setStrokeWidth(0.0); silkWarehouse.setStrokeWidth(0.0);
silkWarehouse.setText("Silk"); silkWarehouse.setText("Silk");
@@ -377,6 +467,10 @@ public class WarehouseGUI {
silkWarehouse.setWrappingWidth(103.47265625); silkWarehouse.setWrappingWidth(103.47265625);
silkWarehouse.setFont(new Font(18.0)); silkWarehouse.setFont(new Font(18.0));
/**
* Creates a label with text "Arms" under the "Warehouse" label with size 18 font and default font style.
*
*/
armsWarehouse.setStrokeType(javafx.scene.shape.StrokeType.OUTSIDE); armsWarehouse.setStrokeType(javafx.scene.shape.StrokeType.OUTSIDE);
armsWarehouse.setStrokeWidth(0.0); armsWarehouse.setStrokeWidth(0.0);
armsWarehouse.setText("Arms"); armsWarehouse.setText("Arms");
@@ -384,6 +478,10 @@ public class WarehouseGUI {
armsWarehouse.setWrappingWidth(103.47265625); armsWarehouse.setWrappingWidth(103.47265625);
armsWarehouse.setFont(new Font(18.0)); armsWarehouse.setFont(new Font(18.0));
/**
* Creates a label with text "General" under the "Warehouse" label with size 18 font and default font style.
*
*/
generalWarehouse.setStrokeType(javafx.scene.shape.StrokeType.OUTSIDE); generalWarehouse.setStrokeType(javafx.scene.shape.StrokeType.OUTSIDE);
generalWarehouse.setStrokeWidth(0.0); generalWarehouse.setStrokeWidth(0.0);
generalWarehouse.setText("General"); generalWarehouse.setText("General");
@@ -392,22 +490,37 @@ public class WarehouseGUI {
generalWarehouse.setFont(new Font(18.0)); generalWarehouse.setFont(new Font(18.0));
borderPane.setCenter(vBox0); borderPane.setCenter(vBox0);
/**
* Creates a VBox at the center of the borderpane with a width of 152 and a height of 48.
*
*/
borderPane.setAlignment(vBox1, javafx.geometry.Pos.CENTER); borderPane.setAlignment(vBox1, javafx.geometry.Pos.CENTER);
vBox1.setPrefHeight(48.0); vBox1.setPrefHeight(48.0);
vBox1.setPrefWidth(152.0); vBox1.setPrefWidth(152.0);
/**
* Creates a label with "In use:" text with size 18 font and default font style.
*
*/
inUseWarehouse.setStrokeType(javafx.scene.shape.StrokeType.OUTSIDE); inUseWarehouse.setStrokeType(javafx.scene.shape.StrokeType.OUTSIDE);
inUseWarehouse.setStrokeWidth(0.0); inUseWarehouse.setStrokeWidth(0.0);
inUseWarehouse.setText("In use:"); inUseWarehouse.setText("In use:");
inUseWarehouse.setFont(new Font(18.0)); inUseWarehouse.setFont(new Font(18.0));
/**
* Creates a label with "Vacant:" text with size 18 font and default font style.
*
*/
vacantWarehouse.setStrokeType(javafx.scene.shape.StrokeType.OUTSIDE); vacantWarehouse.setStrokeType(javafx.scene.shape.StrokeType.OUTSIDE);
vacantWarehouse.setStrokeWidth(0.0); vacantWarehouse.setStrokeWidth(0.0);
vacantWarehouse.setText("Vacant:"); vacantWarehouse.setText("Vacant:");
vacantWarehouse.setFont(new Font(18.0)); vacantWarehouse.setFont(new Font(18.0));
borderPane.setRight(vBox1); borderPane.setRight(vBox1);
/**
* Adds all the labels and buttons to their respective boxes.
*
*/
splitMenu.getItems().add(general); splitMenu.getItems().add(general);
splitMenu.getItems().add(arms); splitMenu.getItems().add(arms);
splitMenu.getItems().add(silk); splitMenu.getItems().add(silk);
@@ -439,9 +552,287 @@ public class WarehouseGUI {
return stage; return stage;
} }
/**
* When run, shows the stage as a graphical interface through JavaFX.
*
* @param primaryStage object of type Stage
*/
public void start(Stage primaryStage) { public void start(Stage primaryStage) {
WarehouseGUI warehouseGUI = new WarehouseGUI(player); WarehouseGUI warehouseGUI = new WarehouseGUI(player);
warehouseGUI.initializeWarehouse(primaryStage); warehouseGUI.initializeWarehouse(primaryStage);
primaryStage.show(); primaryStage.show();
} }
/**
* 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 {
/*private int wOpium = 0;
private int wSilk = 0;
private int wGeneral = 0;
private int wArms = 0;*/
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) {
Player playerDummy = new Player(player);
this.player = playerDummy;
}
/**
* getter method for obtaining a player object.
*
* @return returns player object
*/
public Player getPlayer() {
Player playerDummy = new Player(player);
return playerDummy;
}
/**
* Class Constructor that takes in a type player as a parameter
*
* @param player object of the class Player
*/
public Warehouse(Player player) {
Player playerDummy = new Player(player);
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() {
boolean askGood = false;
String amount;
int finalAmount = 0;
System.out.println("Please enter the amount of the good you would like to ADD.");
Scanner keyboard = new Scanner(System.in);
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 {
//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()) {
finalAmount = Integer.parseInt(amount);
askGood = true;
}
//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!");
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) {
String good;
System.out.println("Please enter a good to transfer O, S, G, A :");
good = keyboard.nextLine();
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 (good.equalsIgnoreCase("O")) {
if (player.getOpiumHeld() >= Integer.parseInt(amount)) {
player.setwOpium(player.getwOpium() + finalAmount);
held = player.getOpiumHeld();
player.setOpiumHeld(held - finalAmount);
System.out.println(player.getOpiumHeld());
} else {
System.out.println("You don't even have that much opium!");
}
} else if (good.equalsIgnoreCase("S")) {
if (player.getSilkHeld() >= Integer.parseInt(amount)) {
player.setwSilk(player.getwSilk() + finalAmount);
held = player.getSilkHeld();
player.setSilkHeld(held - finalAmount);
} else {
System.out.println("You don't even have that much silk!");
}
} else if (good.equalsIgnoreCase("G")) {
if (player.getGeneralHeld() >= Integer.parseInt(amount)) {
player.setwGeneral(player.getwGeneral() + finalAmount);
held = player.getGeneralHeld();
player.setGeneralHeld(held - finalAmount);
} else {
System.out.println("You don't even have that much general cargo!");
}
} else if (good.equalsIgnoreCase("A")) {
if (player.getArmsHeld() >= Integer.parseInt(amount)) {
player.setwArms(player.getwArms() + finalAmount);
held = player.getArmsHeld();
player.setArmsHeld(held - finalAmount);
} else {
System.out.println("You don't even have that much Arms!");
}
}
}
//Ensures no negative amounts are entered
else {
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) {
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() {
String amount;
boolean askGood = false;
int finalAmount = 0;
System.out.println("Please enter the amount of the good you would like to REMOVE");
Scanner keyboard = new Scanner(System.in);
//Prompts the user for the amount they would like to remove
amount = keyboard.nextLine();
//The if statement checks that you have enough resources to make the transfer
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()) {
finalAmount = Integer.parseInt(amount);
askGood = true;
}
//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!");
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) {
String good;
System.out.println("Please enter a good to transfer O, S, G, A :");
good = keyboard.nextLine();
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 (good.equalsIgnoreCase("O")) {
if (player.getwOpium() >= Integer.parseInt(amount)) {
player.setwOpium(player.getwOpium() - Integer.parseInt(amount));
held = player.getOpiumHeld();
player.setOpiumHeld(held + finalAmount);
} else {
System.out.println("You don't have that much opium stored in the warehouse!");
}
} else if (good.equalsIgnoreCase("S")) {
if (player.getwSilk() >= Integer.parseInt(amount)) {
player.setwSilk(player.getwSilk() - Integer.parseInt(amount));
held = player.getSilkHeld();
player.setSilkHeld(held + finalAmount);
} else {
System.out.println("You don't have that much silk stored in the warehouse!");
}
} else if (good.equalsIgnoreCase("G")) {
if (player.getwGeneral() >= Integer.parseInt(amount)) {
player.setwGeneral(player.getwGeneral() - Integer.parseInt(amount));
held = player.getGeneralHeld();
player.setGeneralHeld(held + finalAmount);
} else {
System.out.println("You don't have that much general cargo stored in the warehouse!");
}
} else if (good.equalsIgnoreCase("A")) {
if (player.getwArms() >= Integer.parseInt(amount)) {
player.setwArms(player.getwArms() - Integer.parseInt(amount));
held = player.getArmsHeld();
player.setArmsHeld(held + finalAmount);
} else {
System.out.println("You don't have that much arms stored in the warehouse!");
}
}
}
//Ensures the value entered is positive
else {
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){
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() {
System.out.println("--------------------\nWarehouse\n--------------------");
System.out.println("Opium : " + player.getwOpium());
System.out.println("Silk : " + player.getwSilk());
System.out.println("General : " + player.getwGeneral());
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() {
boolean keepGoing = true;
while (keepGoing) {
this.showWarehouse();
String input = " ";
System.out.println("Would you like to add(A) or remove(R) resources? ");
Scanner keyboard = new Scanner(System.in);
input = keyboard.next();
if (input.equalsIgnoreCase("R")) {
this.removeAmount();
this.showWarehouse();
} else if (input.equalsIgnoreCase("A")) {
this.addAmount();
this.showWarehouse();
}
else{
System.out.println("Don't waste the warehouse's time, try again later with a valid input");
}
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?");
check = keyboard.nextLine();
check = keyboard.nextLine();
if (check.equalsIgnoreCase("Y")) {
keepGoing = true;
} else if (check.equalsIgnoreCase("N")) {
keepGoing = false;
}
}
}
}
} }