made everything use inheritance instead of whatever we were doing before.
This commit is contained in:
238
.idea/workspace.xml
generated
238
.idea/workspace.xml
generated
@@ -3,6 +3,13 @@
|
|||||||
<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/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/BankGUI.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/BankGUI.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/GameEndGUI.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/GameEndGUI.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/LoanSharkGUI.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/LoanSharkGUI.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/MainGUI.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/MainGUI.java" 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/TaipanShopGUI.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TaipanShopGUI.java" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/src/TaipanShopGUI.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TaipanShopGUI.java" afterDir="false" />
|
||||||
</list>
|
</list>
|
||||||
<ignored path="$PROJECT_DIR$/out/" />
|
<ignored path="$PROJECT_DIR$/out/" />
|
||||||
@@ -17,54 +24,14 @@
|
|||||||
<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">
|
<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="651">
|
|
||||||
<caret line="38" column="39" selection-start-line="38" selection-start-column="39" selection-end-line="38" selection-end-column="39" />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
</file>
|
|
||||||
<file pinned="false" current-in-tab="false">
|
|
||||||
<entry file="file://$PROJECT_DIR$/src/StartGUI.java">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="308">
|
|
||||||
<caret line="214" column="38" selection-start-line="214" selection-start-column="38" selection-end-line="214" selection-end-column="38" />
|
|
||||||
<folding>
|
|
||||||
<element signature="imports" expanded="true" />
|
|
||||||
</folding>
|
|
||||||
</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="1764">
|
|
||||||
<caret line="84" column="44" selection-start-line="84" selection-start-column="44" selection-end-line="84" selection-end-column="44" />
|
|
||||||
</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="9114">
|
|
||||||
<caret line="459" column="33" selection-start-line="459" selection-start-column="33" selection-end-line="459" selection-end-column="33" />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
</file>
|
|
||||||
<file pinned="false" current-in-tab="true">
|
|
||||||
<entry file="file://$PROJECT_DIR$/src/TaipanShopGUI.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="-48">
|
<state relative-caret-position="294">
|
||||||
<caret line="626" column="115" selection-start-line="626" selection-start-column="115" selection-end-line="626" selection-end-column="115" />
|
<caret line="14" column="34" lean-forward="true" selection-start-line="14" selection-start-column="34" selection-end-line="14" selection-end-column="34" />
|
||||||
<folding>
|
<folding>
|
||||||
<element signature="n#!!doc" expanded="true" />
|
<element signature="n#!!doc" expanded="true" />
|
||||||
<element signature="imports" expanded="true" />
|
<element signature="e#23112#23113#0" expanded="true" />
|
||||||
<element signature="e#23685#23686#0" expanded="true" />
|
<element signature="e#23157#23158#0" expanded="true" />
|
||||||
<element signature="e#23730#23731#0" expanded="true" />
|
|
||||||
</folding>
|
</folding>
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
@@ -73,8 +40,17 @@
|
|||||||
<file pinned="false" current-in-tab="false">
|
<file pinned="false" current-in-tab="false">
|
||||||
<entry file="file://$PROJECT_DIR$/src/GameEndGUI.java">
|
<entry file="file://$PROJECT_DIR$/src/GameEndGUI.java">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="42">
|
<state relative-caret-position="506">
|
||||||
<caret line="14" column="13" selection-start-line="14" selection-start-column="13" selection-end-line="14" selection-end-column="13" />
|
<caret line="114" column="58" selection-start-line="114" selection-start-column="58" selection-end-line="114" selection-end-column="58" />
|
||||||
|
</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="622">
|
||||||
|
<caret line="160" column="58" lean-forward="true" selection-start-line="160" selection-start-column="58" selection-end-line="160" selection-end-column="58" />
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
@@ -82,8 +58,20 @@
|
|||||||
<file pinned="false" current-in-tab="false">
|
<file pinned="false" current-in-tab="false">
|
||||||
<entry file="file://$PROJECT_DIR$/src/ShipWarfareGUI.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="281">
|
<state relative-caret-position="4067">
|
||||||
<caret line="435" column="11" selection-start-line="435" selection-start-column="8" selection-end-line="435" selection-end-column="11" />
|
<caret line="452" column="71" selection-start-line="452" selection-start-column="71" selection-end-line="452" selection-end-column="71" />
|
||||||
|
<folding>
|
||||||
|
<element signature="imports" expanded="true" />
|
||||||
|
</folding>
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
</file>
|
||||||
|
<file pinned="false" current-in-tab="true">
|
||||||
|
<entry file="file://$PROJECT_DIR$/src/StartGUI.java">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="476">
|
||||||
|
<caret line="74" column="5" lean-forward="true" selection-start-line="67" selection-start-column="4" selection-end-line="74" selection-end-column="5" />
|
||||||
<folding>
|
<folding>
|
||||||
<element signature="imports" expanded="true" />
|
<element signature="imports" expanded="true" />
|
||||||
</folding>
|
</folding>
|
||||||
@@ -92,10 +80,38 @@
|
|||||||
</entry>
|
</entry>
|
||||||
</file>
|
</file>
|
||||||
<file pinned="false" current-in-tab="false">
|
<file pinned="false" current-in-tab="false">
|
||||||
<entry file="file://$PROJECT_DIR$/src/LoanSharkGUI.java">
|
<entry file="file://$PROJECT_DIR$/src/BankGUI.java">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="525">
|
<state relative-caret-position="168">
|
||||||
<caret line="35" column="7" selection-start-line="35" selection-start-column="7" selection-end-line="35" selection-end-column="7" />
|
<caret line="18" column="7" lean-forward="true" selection-start-line="18" selection-start-column="7" selection-end-line="18" selection-end-column="7" />
|
||||||
|
</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="504">
|
||||||
|
<caret line="25" column="28" lean-forward="true" selection-start-line="25" selection-start-column="28" selection-end-line="25" selection-end-column="28" />
|
||||||
|
<folding>
|
||||||
|
<element signature="e#1205#1206#0" expanded="true" />
|
||||||
|
<element signature="e#1233#1234#0" expanded="true" />
|
||||||
|
</folding>
|
||||||
|
</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="1512">
|
||||||
|
<caret line="72" column="5" selection-start-line="72" selection-start-column="5" selection-end-line="72" selection-end-column="5" />
|
||||||
|
<folding>
|
||||||
|
<element signature="e#1049#1050#0" expanded="true" />
|
||||||
|
<element signature="e#1082#1083#0" expanded="true" />
|
||||||
|
<element signature="e#1114#1115#0" expanded="true" />
|
||||||
|
<element signature="e#1153#1154#0" expanded="true" />
|
||||||
|
</folding>
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
@@ -111,8 +127,6 @@
|
|||||||
</component>
|
</component>
|
||||||
<component name="FindInProjectRecents">
|
<component name="FindInProjectRecents">
|
||||||
<findStrings>
|
<findStrings>
|
||||||
<find>destr</find>
|
|
||||||
<find>destro</find>
|
|
||||||
<find>hitco</find>
|
<find>hitco</find>
|
||||||
<find>game</find>
|
<find>game</find>
|
||||||
<find>numOf</find>
|
<find>numOf</find>
|
||||||
@@ -141,6 +155,8 @@
|
|||||||
<find>warehouse</find>
|
<find>warehouse</find>
|
||||||
<find>warehouse\n</find>
|
<find>warehouse\n</find>
|
||||||
<find>run</find>
|
<find>run</find>
|
||||||
|
<find>player.</find>
|
||||||
|
<find>GUI()</find>
|
||||||
</findStrings>
|
</findStrings>
|
||||||
<replaceStrings>
|
<replaceStrings>
|
||||||
<replace>HP</replace>
|
<replace>HP</replace>
|
||||||
@@ -149,10 +165,10 @@
|
|||||||
<replace>shipWarfare.getHowMuchRun()</replace>
|
<replace>shipWarfare.getHowMuchRun()</replace>
|
||||||
<replace>shipWarfare.isUserAttacks()</replace>
|
<replace>shipWarfare.isUserAttacks()</replace>
|
||||||
<replace>shipWarfare.getNumOfPeasantShips()</replace>
|
<replace>shipWarfare.getNumOfPeasantShips()</replace>
|
||||||
|
<replace>GUI(getPlayer())</replace>
|
||||||
</replaceStrings>
|
</replaceStrings>
|
||||||
</component>
|
</component>
|
||||||
<component name="Git.Settings">
|
<component name="Git.Settings">
|
||||||
<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">
|
||||||
@@ -167,9 +183,13 @@
|
|||||||
<option value="$PROJECT_DIR$/src/ShipWarfare.java" />
|
<option value="$PROJECT_DIR$/src/ShipWarfare.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/Player.java" />
|
||||||
|
<option value="$PROJECT_DIR$/src/TaipanShopGUI.java" />
|
||||||
|
<option value="$PROJECT_DIR$/src/BankGUI.java" />
|
||||||
|
<option value="$PROJECT_DIR$/src/MainGUI.java" />
|
||||||
|
<option value="$PROJECT_DIR$/src/GameEndGUI.java" />
|
||||||
|
<option value="$PROJECT_DIR$/src/LoanSharkGUI.java" />
|
||||||
<option value="$PROJECT_DIR$/src/ShipWarfareGUI.java" />
|
<option value="$PROJECT_DIR$/src/ShipWarfareGUI.java" />
|
||||||
<option value="$PROJECT_DIR$/src/StartGUI.java" />
|
<option value="$PROJECT_DIR$/src/StartGUI.java" />
|
||||||
<option value="$PROJECT_DIR$/src/TaipanShopGUI.java" />
|
|
||||||
</list>
|
</list>
|
||||||
</option>
|
</option>
|
||||||
</component>
|
</component>
|
||||||
@@ -185,7 +205,7 @@
|
|||||||
<foldersAlwaysOnTop value="true" />
|
<foldersAlwaysOnTop value="true" />
|
||||||
</navigator>
|
</navigator>
|
||||||
<panes>
|
<panes>
|
||||||
<pane id="PackagesPane" />
|
<pane id="Scope" />
|
||||||
<pane id="ProjectPane">
|
<pane id="ProjectPane">
|
||||||
<subPane>
|
<subPane>
|
||||||
<expand>
|
<expand>
|
||||||
@@ -202,14 +222,14 @@
|
|||||||
<select />
|
<select />
|
||||||
</subPane>
|
</subPane>
|
||||||
</pane>
|
</pane>
|
||||||
<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="1552351596289" />
|
<property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1553037216345" />
|
||||||
<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="Modules" />
|
<property name="project.structure.last.edited" value="Modules" />
|
||||||
@@ -325,6 +345,8 @@
|
|||||||
<workItem from="1552241394045" duration="178000" />
|
<workItem from="1552241394045" duration="178000" />
|
||||||
<workItem from="1552254283748" duration="9473000" />
|
<workItem from="1552254283748" duration="9473000" />
|
||||||
<workItem from="1552277298937" duration="10904000" />
|
<workItem from="1552277298937" duration="10904000" />
|
||||||
|
<workItem from="1553035977312" duration="71000" />
|
||||||
|
<workItem from="1553036106507" duration="948000" />
|
||||||
</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>
|
||||||
@@ -617,13 +639,13 @@
|
|||||||
<servers />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
<component name="TimeTrackingManager">
|
<component name="TimeTrackingManager">
|
||||||
<option name="totallyTimeSpent" value="86013000" />
|
<option name="totallyTimeSpent" value="87696000" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ToolWindowManager">
|
<component name="ToolWindowManager">
|
||||||
<frame x="-8" y="-8" width="1936" height="1056" extended-state="6" />
|
<frame x="-8" y="-8" width="1936" height="1056" extended-state="6" />
|
||||||
<editor active="true" />
|
<editor active="true" />
|
||||||
<layout>
|
<layout>
|
||||||
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.18123667" />
|
<window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.19349681" />
|
||||||
<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" />
|
||||||
@@ -632,7 +654,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.9357143" />
|
<window_info anchor="bottom" id="Run" order="2" visible="true" weight="0.08342362" />
|
||||||
<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" />
|
||||||
@@ -798,15 +820,8 @@
|
|||||||
<entry file="file://$PROJECT_DIR$/src/ShipWarfare.java" />
|
<entry file="file://$PROJECT_DIR$/src/ShipWarfare.java" />
|
||||||
<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="9114">
|
<state relative-caret-position="546">
|
||||||
<caret line="459" column="33" selection-start-line="459" selection-start-column="33" selection-end-line="459" selection-end-column="33" />
|
<caret line="41" column="42" selection-start-line="41" selection-start-column="42" selection-end-line="41" selection-end-column="42" />
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
<entry file="file://$PROJECT_DIR$/src/Player.java">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="1764">
|
|
||||||
<caret line="84" column="44" selection-start-line="84" selection-start-column="44" selection-end-line="84" selection-end-column="44" />
|
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
@@ -817,49 +832,79 @@
|
|||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/src/GameEndGUI.java">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="42">
|
|
||||||
<caret line="14" column="13" selection-start-line="14" selection-start-column="13" selection-end-line="14" selection-end-column="13" />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
<entry file="file://$PROJECT_DIR$/src/MainGUI.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="651">
|
<state relative-caret-position="504">
|
||||||
<caret line="38" column="39" selection-start-line="38" selection-start-column="39" selection-end-line="38" selection-end-column="39" />
|
<caret line="25" column="28" lean-forward="true" selection-start-line="25" selection-start-column="28" selection-end-line="25" selection-end-column="28" />
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
<entry file="file://$PROJECT_DIR$/src/StartGUI.java">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="308">
|
|
||||||
<caret line="214" column="38" selection-start-line="214" selection-start-column="38" selection-end-line="214" selection-end-column="38" />
|
|
||||||
<folding>
|
<folding>
|
||||||
<element signature="imports" expanded="true" />
|
<element signature="e#1205#1206#0" expanded="true" />
|
||||||
|
<element signature="e#1233#1234#0" expanded="true" />
|
||||||
</folding>
|
</folding>
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/src/ShipWarfareGUI.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="281">
|
<state relative-caret-position="1512">
|
||||||
<caret line="435" column="11" selection-start-line="435" selection-start-column="8" selection-end-line="435" selection-end-column="11" />
|
<caret line="72" column="5" selection-start-line="72" selection-start-column="5" selection-end-line="72" selection-end-column="5" />
|
||||||
<folding>
|
<folding>
|
||||||
<element signature="imports" expanded="true" />
|
<element signature="e#1049#1050#0" expanded="true" />
|
||||||
|
<element signature="e#1082#1083#0" expanded="true" />
|
||||||
|
<element signature="e#1114#1115#0" expanded="true" />
|
||||||
|
<element signature="e#1153#1154#0" expanded="true" />
|
||||||
</folding>
|
</folding>
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/src/BankGUI.java">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="168">
|
||||||
|
<caret line="18" column="7" lean-forward="true" selection-start-line="18" selection-start-column="7" selection-end-line="18" selection-end-column="7" />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/src/TaipanShopGUI.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="-48">
|
<state relative-caret-position="294">
|
||||||
<caret line="626" column="115" selection-start-line="626" selection-start-column="115" selection-end-line="626" selection-end-column="115" />
|
<caret line="14" column="34" lean-forward="true" selection-start-line="14" selection-start-column="34" selection-end-line="14" selection-end-column="34" />
|
||||||
<folding>
|
<folding>
|
||||||
<element signature="n#!!doc" expanded="true" />
|
<element signature="n#!!doc" expanded="true" />
|
||||||
|
<element signature="e#23112#23113#0" expanded="true" />
|
||||||
|
<element signature="e#23157#23158#0" expanded="true" />
|
||||||
|
</folding>
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/src/GameEndGUI.java">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="506">
|
||||||
|
<caret line="114" column="58" selection-start-line="114" selection-start-column="58" selection-end-line="114" selection-end-column="58" />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/src/LoanSharkGUI.java">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="622">
|
||||||
|
<caret line="160" column="58" lean-forward="true" selection-start-line="160" selection-start-column="58" selection-end-line="160" selection-end-column="58" />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/src/ShipWarfareGUI.java">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="4067">
|
||||||
|
<caret line="452" column="71" selection-start-line="452" selection-start-column="71" selection-end-line="452" selection-end-column="71" />
|
||||||
|
<folding>
|
||||||
|
<element signature="imports" expanded="true" />
|
||||||
|
</folding>
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/src/StartGUI.java">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="476">
|
||||||
|
<caret line="74" column="5" lean-forward="true" selection-start-line="67" selection-start-column="4" selection-end-line="74" selection-end-column="5" />
|
||||||
|
<folding>
|
||||||
<element signature="imports" expanded="true" />
|
<element signature="imports" expanded="true" />
|
||||||
<element signature="e#23685#23686#0" expanded="true" />
|
|
||||||
<element signature="e#23730#23731#0" expanded="true" />
|
|
||||||
</folding>
|
</folding>
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
@@ -904,7 +949,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>
|
||||||
@@ -921,6 +966,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>
|
||||||
|
|||||||
@@ -10,37 +10,16 @@ import javafx.scene.layout.HBox;
|
|||||||
import javafx.scene.layout.VBox;
|
import javafx.scene.layout.VBox;
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
|
|
||||||
public class BankGUI {
|
public class BankGUI extends 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) {
|
|
||||||
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
|
* Class Constructor that takes in a type player as a parameter
|
||||||
* <p>
|
*
|
||||||
* //* @param player object of the class Player
|
* @param player object of the class Player
|
||||||
*/
|
*/
|
||||||
public BankGUI(Player player) {
|
public BankGUI(Player player) {
|
||||||
Player playerDummy = new Player(player);
|
Player playerDummy = new Player(player);
|
||||||
this.player = playerDummy;
|
setPlayer(playerDummy);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -61,10 +40,10 @@ public class BankGUI {
|
|||||||
HBox hbx2 = new HBox(30);
|
HBox hbx2 = new HBox(30);
|
||||||
VBox vbx1 = new VBox(30);
|
VBox vbx1 = new VBox(30);
|
||||||
|
|
||||||
Label l1 = new Label("Player: " + player.getName());
|
Label l1 = new Label("Player: " + getName());
|
||||||
Label l2 = new Label("Current Balance: " + player.getBank());
|
Label l2 = new Label("Current Balance: " + getBank());
|
||||||
Label l3 = new Label("Enter Amount: ");
|
Label l3 = new Label("Enter Amount: ");
|
||||||
Label l4 = new Label("Current cash: " + player.getMoney());
|
Label l4 = new Label("Current cash: " + getMoney());
|
||||||
Label l5 = new Label(" ");
|
Label l5 = new Label(" ");
|
||||||
|
|
||||||
Button b1 = new Button("Withdraw");
|
Button b1 = new Button("Withdraw");
|
||||||
@@ -114,17 +93,17 @@ public class BankGUI {
|
|||||||
try {
|
try {
|
||||||
int withdraw = Integer.parseInt(txtField1.getText());
|
int withdraw = Integer.parseInt(txtField1.getText());
|
||||||
if(withdraw < 0){
|
if(withdraw < 0){
|
||||||
l5.setText("Come on " + player.getName() + " are you trying to fool me??? \n No negative Numbers Please");
|
l5.setText("Come on " + getName() + " are you trying to fool me??? \n No negative Numbers Please");
|
||||||
}
|
}
|
||||||
else if (withdraw <= player.getBank()) {
|
else if (withdraw <= getBank()) {
|
||||||
player.setMoney(withdraw + player.getMoney());
|
setMoney(withdraw + getMoney());
|
||||||
player.setBank(player.getBank() - withdraw);
|
setBank(getBank() - withdraw);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
l5.setText("Sorry you cannot withdraw that much");
|
l5.setText("Sorry you cannot withdraw that much");
|
||||||
}
|
}
|
||||||
l2.setText("Current Balance: " + player.getBank());
|
l2.setText("Current Balance: " + getBank());
|
||||||
l4.setText("Current cash: " + player.getMoney());
|
l4.setText("Current cash: " + getMoney());
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
l5.setText("Please enter a valid value");
|
l5.setText("Please enter a valid value");
|
||||||
@@ -146,14 +125,14 @@ public class BankGUI {
|
|||||||
if(deposit < 0){
|
if(deposit < 0){
|
||||||
l5.setText("Nice Try!!! No negative Numbers Please");
|
l5.setText("Nice Try!!! No negative Numbers Please");
|
||||||
}
|
}
|
||||||
else if (deposit <= player.getMoney()) {
|
else if (deposit <= getMoney()) {
|
||||||
player.setBank(deposit + player.getBank());
|
setBank(deposit + getBank());
|
||||||
player.setMoney(player.getMoney() - deposit);
|
setMoney(getMoney() - deposit);
|
||||||
} else {
|
} else {
|
||||||
l5.setText("Sorry you cannot deposit that much.$");
|
l5.setText("Sorry you cannot deposit that much.$");
|
||||||
}
|
}
|
||||||
l2.setText("Current Balance: " + player.getBank());
|
l2.setText("Current Balance: " + getBank());
|
||||||
l4.setText("Current cash: " + player.getMoney());
|
l4.setText("Current cash: " + getMoney());
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
@@ -170,7 +149,7 @@ public class BankGUI {
|
|||||||
b3.setOnAction(new EventHandler<ActionEvent>() {
|
b3.setOnAction(new EventHandler<ActionEvent>() {
|
||||||
@Override
|
@Override
|
||||||
public void handle(ActionEvent event) {
|
public void handle(ActionEvent event) {
|
||||||
TaipanShopGUI shopGUI = new TaipanShopGUI(player);
|
TaipanShopGUI shopGUI = new TaipanShopGUI(getPlayer());
|
||||||
shopGUI.initializeShop(primaryStage);
|
shopGUI.initializeShop(primaryStage);
|
||||||
primaryStage.show();
|
primaryStage.show();
|
||||||
}
|
}
|
||||||
@@ -193,7 +172,7 @@ public class BankGUI {
|
|||||||
* @param primaryStage the stage in which the scene may be run and switched to
|
* @param primaryStage the stage in which the scene may be run and switched to
|
||||||
*/
|
*/
|
||||||
public void start(Stage primaryStage) {
|
public void start(Stage primaryStage) {
|
||||||
BankGUI bank = new BankGUI(player);
|
BankGUI bank = new BankGUI(getPlayer());
|
||||||
bank.initializeBank(primaryStage);
|
bank.initializeBank(primaryStage);
|
||||||
primaryStage.show();
|
primaryStage.show();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import javafx.stage.Stage;
|
|||||||
* GameEndGUI class, Initializes and displays the graphical interface for when you lose
|
* GameEndGUI class, Initializes and displays the graphical interface for when you lose
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class GameEndGUI {
|
public class GameEndGUI extends Player{
|
||||||
|
|
||||||
private Label title;
|
private Label title;
|
||||||
private VBox vBox;
|
private VBox vBox;
|
||||||
@@ -20,11 +20,10 @@ public class GameEndGUI {
|
|||||||
private Label gunsHeld;
|
private Label gunsHeld;
|
||||||
private Label netWorth;
|
private Label netWorth;
|
||||||
private BorderPane borderPane;
|
private BorderPane borderPane;
|
||||||
private Player player;
|
|
||||||
|
|
||||||
public GameEndGUI(Player player) {
|
public GameEndGUI(Player player) {
|
||||||
Player playerDummy = new Player(player);
|
Player playerDummy = new Player(player);
|
||||||
this.player = playerDummy;
|
setPlayer(playerDummy);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -79,7 +78,7 @@ public class GameEndGUI {
|
|||||||
/**
|
/**
|
||||||
* If health is below or equal to 0 then the game will either show the gameOver screen or the win screen
|
* If health is below or equal to 0 then the game will either show the gameOver screen or the win screen
|
||||||
* */
|
* */
|
||||||
if (player.getHP() <= 0) {
|
if (getHP() <= 0) {
|
||||||
title.setText("Game Over!");
|
title.setText("Game Over!");
|
||||||
} else {
|
} else {
|
||||||
title.setText("Congratulations!");
|
title.setText("Congratulations!");
|
||||||
@@ -88,14 +87,14 @@ public class GameEndGUI {
|
|||||||
/**
|
/**
|
||||||
* Calculates the networth of the player by the end of the game
|
* Calculates the networth of the player by the end of the game
|
||||||
* */
|
* */
|
||||||
netWorthInt = player.getMoney() + (player.getOpiumHeld() * 16000) + (player.getSilkHeld() * 160) + (player.getArmsHeld() * 160) + (player.getGeneralHeld() * 8);
|
netWorthInt = getMoney() + (getOpiumHeld() * 16000) + (getSilkHeld() * 160) + (getArmsHeld() * 160) + (getGeneralHeld() * 8);
|
||||||
netWorthInt += (player.getwOpium() * 16000) + (player.getwSilk() * 160) + (player.getwArms() * 160) + (player.getwGeneral() * 8);
|
netWorthInt += (getwOpium() * 16000) + (getwSilk() * 160) + (getwArms() * 160) + (getwGeneral() * 8);
|
||||||
netWorthInt -= player.getDebt();
|
netWorthInt -= getDebt();
|
||||||
|
|
||||||
|
|
||||||
//Updating the endgame stats of the player
|
//Updating the endgame stats of the player
|
||||||
firmName.setText("Firm Name: " + player.getName());
|
firmName.setText("Firm Name: " + getName());
|
||||||
gunsHeld.setText("Guns Held: " + player.getGuns());
|
gunsHeld.setText("Guns Held: " + getGuns());
|
||||||
netWorth.setText("Net Worth: " + netWorthInt);
|
netWorth.setText("Net Worth: " + netWorthInt);
|
||||||
|
|
||||||
Scene root = new Scene(borderPane, 600, 480);
|
Scene root = new Scene(borderPane, 600, 480);
|
||||||
@@ -113,7 +112,7 @@ public class GameEndGUI {
|
|||||||
* @param primaryStage the stage in which the scene may be run and switched to
|
* @param primaryStage the stage in which the scene may be run and switched to
|
||||||
*/
|
*/
|
||||||
public void start(Stage primaryStage) {
|
public void start(Stage primaryStage) {
|
||||||
GameEndGUI gameEndGUI = new GameEndGUI(player);
|
GameEndGUI gameEndGUI = new GameEndGUI(getPlayer());
|
||||||
gameEndGUI.initializeGameEndGUI(primaryStage);
|
gameEndGUI.initializeGameEndGUI(primaryStage);
|
||||||
primaryStage.show();
|
primaryStage.show();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,39 +10,28 @@ import javafx.scene.layout.HBox;
|
|||||||
import javafx.scene.layout.VBox;
|
import javafx.scene.layout.VBox;
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
|
|
||||||
public class LoanSharkGUI {
|
public class LoanSharkGUI extends 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) {
|
|
||||||
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
|
* Class Constructor that takes in a type player as a parameter
|
||||||
* <p>
|
*
|
||||||
* //* @param player object of the class Player
|
* @param player object of the class Player
|
||||||
*/
|
*/
|
||||||
public LoanSharkGUI(Player player) {
|
public LoanSharkGUI(Player player) {
|
||||||
Player playerDummy = new Player(player);
|
Player playerDummy = new Player(player);
|
||||||
this.player = playerDummy;
|
setPlayer(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 if their debt exceeds the cash balance, the loan
|
||||||
|
* cannot be given.
|
||||||
|
*
|
||||||
|
* @param primaryStage the stage upon which the GUI will be imposed
|
||||||
|
*/
|
||||||
public Stage initializeLoanShark(Stage primaryStage) {
|
public Stage initializeLoanShark(Stage primaryStage) {
|
||||||
primaryStage.setTitle("Loan Shark");
|
primaryStage.setTitle("Loan Shark");
|
||||||
|
|
||||||
@@ -53,9 +42,9 @@ public class LoanSharkGUI {
|
|||||||
VBox vbx1 = new VBox(10);
|
VBox vbx1 = new VBox(10);
|
||||||
|
|
||||||
//Declaring all Variables
|
//Declaring all Variables
|
||||||
Label l1 = new Label("Player: " + player.getName());
|
Label l1 = new Label("Player: " + getName());
|
||||||
Label l2 = new Label("Current Debt " + player.getDebt());
|
Label l2 = new Label("Current Debt " + getDebt());
|
||||||
Label l4 = new Label("Current cash: " + player.getMoney());
|
Label l4 = new Label("Current cash: " + getMoney());
|
||||||
Label l3 = new Label("Enter Amount: ");
|
Label l3 = new Label("Enter Amount: ");
|
||||||
Label l5 = new Label(" ");
|
Label l5 = new Label(" ");
|
||||||
|
|
||||||
@@ -96,10 +85,10 @@ public class LoanSharkGUI {
|
|||||||
try {
|
try {
|
||||||
|
|
||||||
int loanAsk = Integer.parseInt(txtField1.getText());
|
int loanAsk = Integer.parseInt(txtField1.getText());
|
||||||
if (loanAsk <= 2 * (player.getMoney() - player.getDebt()) && loanAsk >= 0) {
|
if (loanAsk <= 2 * (getMoney() - getDebt()) && loanAsk >= 0) {
|
||||||
player.setDebt(player.getDebt() + loanAsk);
|
setDebt(getDebt() + loanAsk);
|
||||||
player.setMoney(player.getMoney() + loanAsk);
|
setMoney(getMoney() + loanAsk);
|
||||||
l4.setText("Current cash: " + player.getMoney());
|
l4.setText("Current cash: " + getMoney());
|
||||||
} else if (loanAsk < 0) {
|
} else if (loanAsk < 0) {
|
||||||
l5.setText("Sorry you cannot enter negative numbers");
|
l5.setText("Sorry you cannot enter negative numbers");
|
||||||
}
|
}
|
||||||
@@ -108,7 +97,7 @@ public class LoanSharkGUI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
l2.setText("Debt: " + player.getDebt());
|
l2.setText("Debt: " + getDebt());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
l5.setText("Please enter a valid value");
|
l5.setText("Please enter a valid value");
|
||||||
}
|
}
|
||||||
@@ -121,26 +110,26 @@ public class LoanSharkGUI {
|
|||||||
// Set the event handler when the withdraw button is clicked
|
// Set the event handler when the withdraw button is clicked
|
||||||
b2.setOnAction(new EventHandler<ActionEvent>() {
|
b2.setOnAction(new EventHandler<ActionEvent>() {
|
||||||
@Override
|
@Override
|
||||||
public void handle(ActionEvent event) {
|
public void handle(ActionEvent event) {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
|
||||||
int returnAsk = Integer.parseInt(txtField1.getText());
|
int returnAsk = Integer.parseInt(txtField1.getText());
|
||||||
if (returnAsk > player.getDebt()) {
|
if (returnAsk > getDebt()) {
|
||||||
l5.setText("You dont need to return that much");
|
l5.setText("You dont need to return that much");
|
||||||
}
|
}
|
||||||
else if (returnAsk <= player.getDebt() && returnAsk >= 0 && player.getMoney() >= returnAsk) {
|
else if (returnAsk <= getDebt() && returnAsk >= 0 && getMoney() >= returnAsk) {
|
||||||
player.setDebt(player.getDebt() - returnAsk);
|
setDebt(getDebt() - returnAsk);
|
||||||
player.setMoney(player.getMoney() - returnAsk);
|
setMoney(getMoney() - returnAsk);
|
||||||
l4.setText("Current cash: " + player.getMoney());
|
l4.setText("Current cash: " + getMoney());
|
||||||
}
|
}
|
||||||
else if(player.getMoney() < returnAsk) {
|
else if(getMoney() < returnAsk) {
|
||||||
l5.setText("Look " + player.getName() + ", you are being cheap!");
|
l5.setText("Look " + getName() + ", you are being cheap!");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
l5.setText("Sorry you cannot return a negative amount");
|
l5.setText("Sorry you cannot return a negative amount");
|
||||||
}
|
}
|
||||||
l2.setText("Debt: " + player.getDebt());
|
l2.setText("Debt: " + getDebt());
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
l5.setText("Please enter a valid value");
|
l5.setText("Please enter a valid value");
|
||||||
@@ -152,7 +141,7 @@ public class LoanSharkGUI {
|
|||||||
b3.setOnAction(new EventHandler<ActionEvent>() {
|
b3.setOnAction(new EventHandler<ActionEvent>() {
|
||||||
@Override
|
@Override
|
||||||
public void handle(ActionEvent event) {
|
public void handle(ActionEvent event) {
|
||||||
TaipanShopGUI shopGUI = new TaipanShopGUI(player);
|
TaipanShopGUI shopGUI = new TaipanShopGUI(getPlayer());
|
||||||
shopGUI.initializeShop(primaryStage);
|
shopGUI.initializeShop(primaryStage);
|
||||||
primaryStage.show();
|
primaryStage.show();
|
||||||
}
|
}
|
||||||
@@ -169,20 +158,10 @@ public class LoanSharkGUI {
|
|||||||
|
|
||||||
|
|
||||||
public void start(Stage primaryStage) {
|
public void start(Stage primaryStage) {
|
||||||
LoanSharkGUI loan = new LoanSharkGUI(player);
|
LoanSharkGUI loan = new LoanSharkGUI(getPlayer());
|
||||||
loan.initializeLoanShark(primaryStage);
|
loan.initializeLoanShark(primaryStage);
|
||||||
primaryStage.show();
|
primaryStage.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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.
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -9,30 +9,6 @@ import javafx.stage.Stage;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
public class MainGUI extends Application {
|
public class MainGUI extends Application {
|
||||||
private Player player = new Player();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* getter method for the Player object player.
|
|
||||||
*
|
|
||||||
* @return returns a copy of the object player
|
|
||||||
*/
|
|
||||||
|
|
||||||
public Player getPlayer() {
|
|
||||||
Player copy = new Player(player);
|
|
||||||
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(TaipanShopGUI shop) {
|
|
||||||
shop.setPlayer(player);
|
|
||||||
shop.shop();
|
|
||||||
player = shop.getPlayer();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates main class with player data and starts the game.
|
* Updates main class with player data and starts the game.
|
||||||
@@ -45,7 +21,7 @@ public class MainGUI extends Application {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void start(Stage primaryStage) throws Exception {
|
public void start(Stage primaryStage) throws Exception {
|
||||||
StartGUI start = new StartGUI(player);
|
StartGUI start = new StartGUI(new Player());
|
||||||
start.initializeStart(primaryStage);
|
start.initializeStart(primaryStage);
|
||||||
primaryStage.show();
|
primaryStage.show();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,8 +5,6 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
public class Player {
|
public class Player {
|
||||||
|
|
||||||
private String name = "Taipan";
|
private String name = "Taipan";
|
||||||
@@ -33,28 +31,7 @@ public class Player {
|
|||||||
private int isPriceChanged = 0;
|
private int isPriceChanged = 0;
|
||||||
|
|
||||||
public Player() {
|
public Player() {
|
||||||
this.name = "Taipan";
|
|
||||||
this.bank = 0;
|
|
||||||
this.money = 0;
|
|
||||||
this.opiumHeld = 0;
|
|
||||||
this.silkHeld = 0;
|
|
||||||
this.generalHeld = 0;
|
|
||||||
this.armsHeld = 0;
|
|
||||||
this.location = 1;
|
|
||||||
this.guns = 0;
|
|
||||||
this.HP = 100;
|
|
||||||
this.debt = 0;
|
|
||||||
this.wOpium = 0;
|
|
||||||
this.wSilk = 0;
|
|
||||||
this.wGeneral = 0;
|
|
||||||
this.wArms = 0;
|
|
||||||
this.retire = false;
|
|
||||||
this.opiumPrice = 1600;
|
|
||||||
this.silkPrice = 1600;
|
|
||||||
this.armsPrice = 160;
|
|
||||||
this.generalPrice = 8;
|
|
||||||
this.cargoSpace = 60;
|
|
||||||
this.isPriceChanged = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -63,6 +40,14 @@ public class Player {
|
|||||||
* @param player object of the class Player
|
* @param player object of the class Player
|
||||||
*/
|
*/
|
||||||
public Player(Player player) {
|
public Player(Player player) {
|
||||||
|
setPlayer(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Player getPlayer(){
|
||||||
|
return new Player(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPlayer(Player player){
|
||||||
this.name = player.name;
|
this.name = player.name;
|
||||||
this.bank = player.bank;
|
this.bank = player.bank;
|
||||||
this.money = player.money;
|
this.money = player.money;
|
||||||
@@ -84,6 +69,7 @@ public class Player {
|
|||||||
this.generalPrice = player.generalPrice;
|
this.generalPrice = player.generalPrice;
|
||||||
this.cargoSpace = player.cargoSpace;
|
this.cargoSpace = player.cargoSpace;
|
||||||
this.isPriceChanged = player.isPriceChanged;
|
this.isPriceChanged = player.isPriceChanged;
|
||||||
|
this.retire = player.retire;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -19,10 +19,8 @@ import javafx.stage.Stage;
|
|||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
public class ShipWarfareGUI {
|
public class ShipWarfareGUI extends Player{
|
||||||
|
|
||||||
|
|
||||||
private Player player = new Player();
|
|
||||||
private HBox hBox;
|
private HBox hBox;
|
||||||
private Button fightButton;
|
private Button fightButton;
|
||||||
private Button runButton;
|
private Button runButton;
|
||||||
@@ -39,17 +37,6 @@ public class ShipWarfareGUI {
|
|||||||
private Button continueButton;
|
private Button continueButton;
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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 ShipWarfareGUI(Player player) {
|
|
||||||
Player playerDummy = new Player(player);
|
|
||||||
this.player = playerDummy;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private int numOfPeasantShips = 0;
|
private int numOfPeasantShips = 0;
|
||||||
private int numOfLittyShips = 0;
|
private int numOfLittyShips = 0;
|
||||||
private boolean userAttacks = true;
|
private boolean userAttacks = true;
|
||||||
@@ -59,24 +46,15 @@ public class ShipWarfareGUI {
|
|||||||
private int counter = 0;
|
private int counter = 0;
|
||||||
private String pirateName = "Liu Yen";
|
private String pirateName = "Liu Yen";
|
||||||
|
|
||||||
/**
|
|
||||||
* setter method for player
|
|
||||||
*
|
|
||||||
* @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.
|
* constructor; only runs when a Player object is provided. The constructor is fully encapsulated.
|
||||||
*
|
*
|
||||||
* @return returns player object
|
* @param player is a Player object that will be copied and the player instance variable is set to the copy.
|
||||||
*/
|
*/
|
||||||
public Player getPlayer() {
|
public ShipWarfareGUI(Player player) {
|
||||||
Player playerDummy = new Player(player);
|
Player playerDummy = new Player(player);
|
||||||
return playerDummy;
|
setPlayer(playerDummy);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -103,16 +81,16 @@ public class ShipWarfareGUI {
|
|||||||
int numOfShipsAttacking = 0;
|
int numOfShipsAttacking = 0;
|
||||||
Random randomValue = new Random();
|
Random randomValue = new Random();
|
||||||
|
|
||||||
if (player.getMoney() <= 100000) {
|
if (getMoney() <= 100000) {
|
||||||
//Minimum one ship will attack, maximum 20
|
//Minimum one ship will attack, maximum 20
|
||||||
numOfShipsAttacking = randomValue.nextInt(20) + 1;
|
numOfShipsAttacking = randomValue.nextInt(20) + 1;
|
||||||
} else if (player.getMoney() <= 200000) {
|
} else if (getMoney() <= 200000) {
|
||||||
//Minimum 30 Ships will attack, maximum 70
|
//Minimum 30 Ships will attack, maximum 70
|
||||||
numOfShipsAttacking = randomValue.nextInt(40) + 31;
|
numOfShipsAttacking = randomValue.nextInt(40) + 31;
|
||||||
} else if (player.getMoney() <= 500000) {
|
} else if (getMoney() <= 500000) {
|
||||||
//Minimum 50 ships will attack, maximum 140
|
//Minimum 50 ships will attack, maximum 140
|
||||||
numOfShipsAttacking = randomValue.nextInt(90) + 51;
|
numOfShipsAttacking = randomValue.nextInt(90) + 51;
|
||||||
} else if (player.getMoney() >= 1000000) {
|
} else if (getMoney() >= 1000000) {
|
||||||
//Minimum 100 ships will attack, maximum 300 ships
|
//Minimum 100 ships will attack, maximum 300 ships
|
||||||
numOfShipsAttacking = randomValue.nextInt(200) + 101;
|
numOfShipsAttacking = randomValue.nextInt(200) + 101;
|
||||||
}
|
}
|
||||||
@@ -196,9 +174,9 @@ public class ShipWarfareGUI {
|
|||||||
|
|
||||||
//Player volley
|
//Player volley
|
||||||
//while (exitValue == 0) {
|
//while (exitValue == 0) {
|
||||||
if (player.getGuns() > 0) {
|
if (getGuns() > 0) {
|
||||||
|
|
||||||
for (int j = 0; j < player.getGuns(); j++) {
|
for (int j = 0; j < getGuns(); j++) {
|
||||||
if (userAttacks == true) {
|
if (userAttacks == true) {
|
||||||
int hitOrMiss = randomValue.nextInt(2) + 1;
|
int hitOrMiss = randomValue.nextInt(2) + 1;
|
||||||
if (hitOrMiss == 2) {
|
if (hitOrMiss == 2) {
|
||||||
@@ -230,7 +208,7 @@ public class ShipWarfareGUI {
|
|||||||
exitValue = 1;
|
exitValue = 1;
|
||||||
//break;
|
//break;
|
||||||
}
|
}
|
||||||
if (player.getGuns() > 0) {
|
if (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;
|
||||||
@@ -240,12 +218,12 @@ public class ShipWarfareGUI {
|
|||||||
setNumOfPeasantShips(numOfPeasantShips - howMuchRun);
|
setNumOfPeasantShips(numOfPeasantShips - howMuchRun);
|
||||||
if (userAttacks == true) {
|
if (userAttacks == true) {
|
||||||
if (howMuchRun > 0) {
|
if (howMuchRun > 0) {
|
||||||
runAwayOrLeft.setText(String.format("Cowards! %d ships ran away %s! ", howMuchRun, player.getName()));
|
runAwayOrLeft.setText(String.format("Cowards! %d ships ran away %s! ", howMuchRun, getName()));
|
||||||
//runAwayOrLeft.setVisible(true);
|
//runAwayOrLeft.setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
report.setText((String.format("Escaped %d of them %s!", howMuchRun, player.getName())));
|
report.setText((String.format("Escaped %d of them %s!", howMuchRun, getName())));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -255,47 +233,47 @@ public class ShipWarfareGUI {
|
|||||||
shipsRemaining.setText(String.format("%d ships remaining and they look angry!", numOfPeasantShips));
|
shipsRemaining.setText(String.format("%d ships remaining and they look angry!", numOfPeasantShips));
|
||||||
//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 && getGuns() > 0) {
|
||||||
player.setGuns(player.getGuns() - 1);
|
setGuns(getGuns() - 1);
|
||||||
gunFrustration = true;
|
gunFrustration = true;
|
||||||
} else {
|
} else {
|
||||||
if (numOfPeasantShips > 0) {
|
if (numOfPeasantShips > 0) {
|
||||||
player.setHP(player.getHP() - (1 + randomValue.nextInt(10)));
|
setHP(getHP() - (1 + randomValue.nextInt(10)));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (player.getHP() <= 0) {
|
if (getHP() <= 0) {
|
||||||
exitValue = 2;
|
exitValue = 2;
|
||||||
//break;
|
//break;
|
||||||
}
|
}
|
||||||
if (gunFrustration == true) {
|
if (gunFrustration == true) {
|
||||||
gunsLeftOrTaken.setText(String.format("Dang it! We only have %d guns left", player.getGuns()));
|
gunsLeftOrTaken.setText(String.format("Dang it! We only have %d guns left", getGuns()));
|
||||||
} else {
|
} else {
|
||||||
gunsLeftOrTaken.setText(String.format("We still have %d guns left", player.getGuns()));
|
gunsLeftOrTaken.setText(String.format("We still have %d guns left", getGuns()));
|
||||||
}
|
}
|
||||||
|
|
||||||
HPLeft.setText(String.format("EEK, our current ship status is %d%% ", player.getHP()));
|
HPLeft.setText(String.format("EEK, our current ship status is %d%% ", getHP()));
|
||||||
if (userAttacks == false) {
|
if (userAttacks == false) {
|
||||||
userAttacks = true;
|
userAttacks = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
continueToFight.setText(String.format("Captain, what are your orders? (Click the fight button or the run button)", player.getGuns()));
|
continueToFight.setText(String.format("Captain, what are your orders? (Click the fight button or the run button)", getGuns()));
|
||||||
|
|
||||||
if (exitValue == 1) {
|
if (exitValue == 1) {
|
||||||
wipe();
|
wipe();
|
||||||
chooseFightOrRun.setText(String.format("Ayy! We won and survived at %d%% ship status!", player.getHP()));
|
chooseFightOrRun.setText(String.format("Ayy! We won and survived at %d%% ship status!", getHP()));
|
||||||
calculateLoot = (startingPeasantShips * 100) + randomValue.nextInt(startingPeasantShips) * 200;
|
calculateLoot = (startingPeasantShips * 100) + randomValue.nextInt(startingPeasantShips) * 200;
|
||||||
player.setMoney(player.getMoney() + calculateLoot);
|
setMoney(getMoney() + calculateLoot);
|
||||||
report.setText(String.format("Our firm has earned $%,d in loot! ", calculateLoot));
|
report.setText(String.format("Our firm has earned $%,d in loot! ", calculateLoot));
|
||||||
continueButton.setVisible(true);
|
continueButton.setVisible(true);
|
||||||
return true;
|
return true;
|
||||||
} else if (exitValue == 2) {
|
} else if (exitValue == 2) {
|
||||||
GameEndGUI gameEndGUI = new GameEndGUI(player);
|
GameEndGUI gameEndGUI = new GameEndGUI(getPlayer());
|
||||||
gameEndGUI.initializeGameEndGUI(stage);
|
gameEndGUI.initializeGameEndGUI(stage);
|
||||||
stage.show();
|
stage.show();
|
||||||
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", getHP());
|
||||||
continueButton.setVisible(true);
|
continueButton.setVisible(true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -414,7 +392,7 @@ public class ShipWarfareGUI {
|
|||||||
* @param event, once button is clicked, executes graphical information
|
* @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(getPlayer());
|
||||||
shop.initializeShop(stage);
|
shop.initializeShop(stage);
|
||||||
stage.show();
|
stage.show();
|
||||||
}
|
}
|
||||||
@@ -460,7 +438,7 @@ public class ShipWarfareGUI {
|
|||||||
* @param event, once button is clicked, executes graphical information
|
* @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(getPlayer());
|
||||||
shop.initializeShop(stage);
|
shop.initializeShop(stage);
|
||||||
stage.show();
|
stage.show();
|
||||||
}
|
}
|
||||||
@@ -472,7 +450,7 @@ public class ShipWarfareGUI {
|
|||||||
} else {
|
} else {
|
||||||
completeWipe();
|
completeWipe();
|
||||||
report.setText("Phew! Got away safely");
|
report.setText("Phew! Got away safely");
|
||||||
TaipanShopGUI shop = new TaipanShopGUI(player);
|
TaipanShopGUI shop = new TaipanShopGUI(getPlayer());
|
||||||
shop.initializeShop(stage);
|
shop.initializeShop(stage);
|
||||||
stage.show();
|
stage.show();
|
||||||
|
|
||||||
|
|||||||
@@ -9,16 +9,15 @@ import javafx.scene.text.Font;
|
|||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 2019-03-10
|
* 2019-03-10
|
||||||
* Authors: Harkamal, Vikram, Haris, Siddhant, Nathan
|
* Authors: Harkamal, Vikram, Haris, Siddhant, Nathan
|
||||||
* StartGUI class, Initializes and displays the start menu for Taipan
|
* StartGUI class, Initializes and displays the start menu for Taipan
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
public class StartGUI {
|
public class StartGUI extends Player{
|
||||||
|
|
||||||
private Player player;
|
|
||||||
private BorderPane borderPane = new BorderPane();
|
private BorderPane borderPane = new BorderPane();
|
||||||
private HBox hBox = new HBox();
|
private HBox hBox = new HBox();
|
||||||
private TextField nameField = new TextField();
|
private TextField nameField = new TextField();
|
||||||
@@ -33,23 +32,12 @@ public class StartGUI {
|
|||||||
private Label authors = new Label();
|
private Label authors = new Label();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gets the player instance variable. The method returns a copy of the instance variable for encapsulation purposes.
|
* Copy constructor.
|
||||||
*
|
* @param player object of the class Player
|
||||||
* @return playerDummy -- playerDummy is a copy of the player instance variable.
|
|
||||||
*/
|
*/
|
||||||
public Player getPlayer() {
|
public StartGUI(Player player) {
|
||||||
Player playerTemp = new Player(player);
|
Player playerTemp = new Player(player);
|
||||||
return playerTemp;
|
setPlayer(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) {
|
|
||||||
Player playerTemp = new Player(player);
|
|
||||||
this.player = playerTemp;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -59,22 +47,12 @@ public class StartGUI {
|
|||||||
*/
|
*/
|
||||||
public void setFirm(String name) {
|
public void setFirm(String name) {
|
||||||
if (name.length() <= 22) {
|
if (name.length() <= 22) {
|
||||||
player.setName(name);
|
super.setName(name);
|
||||||
} else {
|
} else {
|
||||||
player.setName("Taipan");
|
super.setName("Taipan");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
**
|
|
||||||
* Copy constructor.
|
|
||||||
* @param player object of the class Player
|
|
||||||
*/
|
|
||||||
public StartGUI(Player player) {
|
|
||||||
Player playerTemp = new Player(player);
|
|
||||||
this.player = playerTemp;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes the Start GUI the game.
|
* Initializes the Start GUI the game.
|
||||||
*
|
*
|
||||||
@@ -199,26 +177,26 @@ public class StartGUI {
|
|||||||
@Override
|
@Override
|
||||||
public void handle(ActionEvent event) {
|
public void handle(ActionEvent event) {
|
||||||
if (Start.getSelectedToggle() == cashChoice) {
|
if (Start.getSelectedToggle() == cashChoice) {
|
||||||
player.setMoney(400);
|
setMoney(400);
|
||||||
player.setDebt(5000);
|
setDebt(5000);
|
||||||
|
|
||||||
}
|
}
|
||||||
if (Start.getSelectedToggle() == gunChoice) {
|
if (Start.getSelectedToggle() == gunChoice) {
|
||||||
player.setGuns(5);
|
setGuns(5);
|
||||||
}
|
}
|
||||||
|
|
||||||
String response = nameField.getText();
|
String response = nameField.getText();
|
||||||
// purely for testing purposes.
|
// purely for testing purposes.
|
||||||
if (response.equalsIgnoreCase("Vikram")) {
|
if (response.equalsIgnoreCase("Vikram")) {
|
||||||
player.setMoney(999999999);
|
setMoney(999999999);
|
||||||
player.setBank(999999999);
|
setBank(999999999);
|
||||||
player.setGuns(999);
|
setGuns(999);
|
||||||
player.setHP(99999999);
|
setHP(99999999);
|
||||||
player.setCargoSpace(Integer.MAX_VALUE);
|
setCargoSpace(Integer.MAX_VALUE);
|
||||||
}
|
}
|
||||||
setFirm(response);
|
setFirm(response);
|
||||||
|
|
||||||
TaipanShopGUI shop = new TaipanShopGUI(player);
|
TaipanShopGUI shop = new TaipanShopGUI(getPlayer());
|
||||||
shop.initializeShop(stage);
|
shop.initializeShop(stage);
|
||||||
stage.show();
|
stage.show();
|
||||||
//title.setText("SHOP PLACEHOLDER");
|
//title.setText("SHOP PLACEHOLDER");
|
||||||
|
|||||||
@@ -20,8 +20,7 @@ import javafx.scene.text.Font;
|
|||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
public class TaipanShopGUI {
|
public class TaipanShopGUI extends Player{
|
||||||
private Player player;
|
|
||||||
private Label firm = new Label();
|
private Label firm = new Label();
|
||||||
private Label wItemsText = new Label();
|
private Label wItemsText = new Label();
|
||||||
private Label wItemSpaceText = new Label();
|
private Label wItemSpaceText = new Label();
|
||||||
@@ -53,86 +52,64 @@ public class TaipanShopGUI {
|
|||||||
*/
|
*/
|
||||||
public TaipanShopGUI(Player player) {
|
public TaipanShopGUI(Player player) {
|
||||||
Player playerDummy = new Player(player);
|
Player playerDummy = new Player(player);
|
||||||
this.player = playerDummy;
|
setPlayer(playerDummy);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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).
|
||||||
*/
|
*/
|
||||||
public void retire(Stage stage) {
|
public void retire(Stage stage) {
|
||||||
player.setRetire(true);
|
setRetire(true);
|
||||||
GameEndGUI gameEndGUI = new GameEndGUI(player);
|
GameEndGUI gameEndGUI = new GameEndGUI(getPlayer());
|
||||||
gameEndGUI.initializeGameEndGUI(stage);
|
gameEndGUI.initializeGameEndGUI(stage);
|
||||||
stage.show();
|
stage.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 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) {
|
|
||||||
Player playerDummy = new Player(player);
|
|
||||||
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() {
|
|
||||||
Player playerDummy = new Player(player);
|
|
||||||
return playerDummy;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* this method is when the shop is accessed, randomizing the prices of all the items.
|
* this method is when the shop is accessed, randomizing the prices of all the items.
|
||||||
*/
|
*/
|
||||||
public void updatePrices() {
|
public void updatePrices() {
|
||||||
String s = "\t" + player.getName() + ", the price of ";
|
String s = "\t" + getName() + ", the price of ";
|
||||||
double value = 80 * Math.random();
|
double value = 80 * Math.random();
|
||||||
Random rand = new Random();
|
Random rand = new Random();
|
||||||
player.setOpiumPrice((rand.nextInt(201) + 60) * 100);
|
setOpiumPrice((rand.nextInt(201) + 60) * 100);
|
||||||
player.setSilkPrice((rand.nextInt(201) + 60) * 10);
|
setSilkPrice((rand.nextInt(201) + 60) * 10);
|
||||||
player.setArmsPrice((rand.nextInt(21) + 6) * 10);
|
setArmsPrice((rand.nextInt(21) + 6) * 10);
|
||||||
player.setGeneralPrice((rand.nextInt(17) + 4));
|
setGeneralPrice((rand.nextInt(17) + 4));
|
||||||
|
|
||||||
// there is a 10% chance that the price of an item is increased/decreased beyond its regular range.
|
// 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) {
|
||||||
player.setOpiumPrice(player.getOpiumPrice() / 5);
|
setOpiumPrice(getOpiumPrice() / 5);
|
||||||
textOut.setText(s + "Opium has dropped to " + player.getOpiumPrice() + "!!!\n" + textOut.getText());
|
textOut.setText(s + "Opium has dropped to " + getOpiumPrice() + "!!!\n" + textOut.getText());
|
||||||
} else {
|
} else {
|
||||||
player.setOpiumPrice(player.getOpiumPrice() * 5);
|
setOpiumPrice(getOpiumPrice() * 5);
|
||||||
textOut.setText(s + "Opium has risen to " + player.getOpiumPrice() + "!!!\n" + textOut.getText());
|
textOut.setText(s + "Opium has risen to " + getOpiumPrice() + "!!!\n" + textOut.getText());
|
||||||
}
|
}
|
||||||
} else if (value < 4) {
|
} else if (value < 4) {
|
||||||
if (value < 3) {
|
if (value < 3) {
|
||||||
player.setSilkPrice(player.getSilkPrice() / 5);
|
setSilkPrice(getSilkPrice() / 5);
|
||||||
textOut.setText(s + "Silk has dropped to " + player.getSilkPrice() + "!!!\n" + textOut.getText());
|
textOut.setText(s + "Silk has dropped to " + getSilkPrice() + "!!!\n" + textOut.getText());
|
||||||
} else {
|
} else {
|
||||||
player.setSilkPrice(player.getSilkPrice() * 5);
|
setSilkPrice(getSilkPrice() * 5);
|
||||||
textOut.setText(s + "Silk has risen to " + player.getSilkPrice() + "!!!\n" + textOut.getText());
|
textOut.setText(s + "Silk has risen to " + getSilkPrice() + "!!!\n" + textOut.getText());
|
||||||
}
|
}
|
||||||
} else if (value < 6) {
|
} else if (value < 6) {
|
||||||
if (value < 3) {
|
if (value < 3) {
|
||||||
player.setArmsPrice(player.getArmsPrice() / 5);
|
setArmsPrice(getArmsPrice() / 5);
|
||||||
textOut.setText(s + "Arms has dropped to " + player.getArmsPrice() + "!!!\n" + textOut.getText());
|
textOut.setText(s + "Arms has dropped to " + getArmsPrice() + "!!!\n" + textOut.getText());
|
||||||
} else {
|
} else {
|
||||||
player.setArmsPrice(player.getArmsPrice() * 5);
|
setArmsPrice(getArmsPrice() * 5);
|
||||||
textOut.setText(s + "Arms has risen to " + player.getArmsPrice() + "!!!\n" + textOut.getText());
|
textOut.setText(s + "Arms has risen to " + getArmsPrice() + "!!!\n" + textOut.getText());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (value < 7) {
|
if (value < 7) {
|
||||||
player.setGeneralPrice(1);
|
setGeneralPrice(1);
|
||||||
textOut.setText(s + "General Cargo has dropped to 1!!!\n" + textOut.getText());
|
textOut.setText(s + "General Cargo has dropped to 1!!!\n" + textOut.getText());
|
||||||
} else {
|
} else {
|
||||||
player.setGeneralPrice(player.getGeneralPrice() * 5);
|
setGeneralPrice(getGeneralPrice() * 5);
|
||||||
textOut.setText(s + "General Cargo has risen to " + player.getGeneralPrice() + "!!!\n" + textOut.getText());
|
textOut.setText(s + "General Cargo has risen to " + getGeneralPrice() + "!!!\n" + textOut.getText());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -142,7 +119,7 @@ public class TaipanShopGUI {
|
|||||||
* Sets the default dialogue of simply stating the prices of the items.
|
* 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(), player.getOpiumPrice(), player.getSilkPrice(), player.getArmsPrice(), player.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", getName(), getOpiumPrice(), getSilkPrice(), getArmsPrice(), getGeneralPrice()));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -176,7 +153,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) {
|
if (getLocation() != 1) {
|
||||||
buyButton.setVisible(true);
|
buyButton.setVisible(true);
|
||||||
sellButton.setVisible(true);
|
sellButton.setVisible(true);
|
||||||
bankButton.setVisible(false);
|
bankButton.setVisible(false);
|
||||||
@@ -190,7 +167,7 @@ public class TaipanShopGUI {
|
|||||||
generalButton.setVisible(false);
|
generalButton.setVisible(false);
|
||||||
retireButton.setVisible(false);
|
retireButton.setVisible(false);
|
||||||
}
|
}
|
||||||
if (player.getBank() + player.getMoney() - player.getDebt() < 1000000 && player.getLocation() == 1) {
|
if (getBank() + getMoney() - getDebt() < 1000000 && getLocation() == 1) {
|
||||||
buyButton.setVisible(true);
|
buyButton.setVisible(true);
|
||||||
sellButton.setVisible(true);
|
sellButton.setVisible(true);
|
||||||
bankButton.setVisible(true);
|
bankButton.setVisible(true);
|
||||||
@@ -203,7 +180,7 @@ public class TaipanShopGUI {
|
|||||||
generalButton.setVisible(false);
|
generalButton.setVisible(false);
|
||||||
armsButton.setVisible(false);
|
armsButton.setVisible(false);
|
||||||
retireButton.setVisible(false);
|
retireButton.setVisible(false);
|
||||||
} else if (player.getLocation() == 1) {
|
} else if (getLocation() == 1) {
|
||||||
buyButton.setVisible(true);
|
buyButton.setVisible(true);
|
||||||
sellButton.setVisible(true);
|
sellButton.setVisible(true);
|
||||||
bankButton.setVisible(true);
|
bankButton.setVisible(true);
|
||||||
@@ -240,64 +217,64 @@ public class TaipanShopGUI {
|
|||||||
String originalDialogue = textOut.getText();
|
String originalDialogue = textOut.getText();
|
||||||
int num = Integer.parseInt(numberInput.getText().replace(" ", ""));
|
int num = Integer.parseInt(numberInput.getText().replace(" ", ""));
|
||||||
if (buyButton.getText().contains(".")) {
|
if (buyButton.getText().contains(".")) {
|
||||||
if (opiumButton.getText().contains(".") && num <= player.getMoney() / player.getOpiumPrice() && num >= 0) {
|
if (opiumButton.getText().contains(".") && num <= getMoney() / getOpiumPrice() && num >= 0) {
|
||||||
player.setMoney(player.getMoney() - num * player.getOpiumPrice());
|
setMoney(getMoney() - num * getOpiumPrice());
|
||||||
player.setOpiumHeld(player.getOpiumHeld() + num);
|
setOpiumHeld(getOpiumHeld() + num);
|
||||||
} else if (num >= 0 && opiumButton.getText().contains(".")) {
|
} else if (num >= 0 && opiumButton.getText().contains(".")) {
|
||||||
textOut.setText(originalDialogue + "\n\t" + player.getName() + ", you can't afford that!");
|
textOut.setText(originalDialogue + "\n\t" + getName() + ", you can't afford that!");
|
||||||
} else if (opiumButton.getText().contains(".")) {
|
} else if (opiumButton.getText().contains(".")) {
|
||||||
textOut.setText(originalDialogue + "\n\t" + player.getName() + ", how am I supposed to buy " + "'" + num + "'" + " Opium?");
|
textOut.setText(originalDialogue + "\n\t" + getName() + ", how am I supposed to buy " + "'" + num + "'" + " Opium?");
|
||||||
} else if (silkButton.getText().contains(".") && num <= player.getMoney() / player.getOpiumPrice() && num >= 0) {
|
} else if (silkButton.getText().contains(".") && num <= getMoney() / getOpiumPrice() && num >= 0) {
|
||||||
player.setSilkHeld(player.getSilkHeld() + num);
|
setSilkHeld(getSilkHeld() + num);
|
||||||
player.setMoney(player.getMoney() - num * player.getOpiumPrice());
|
setMoney(getMoney() - num * getOpiumPrice());
|
||||||
} else if (num >= 0 && silkButton.getText().contains(".")) {
|
} else if (num >= 0 && silkButton.getText().contains(".")) {
|
||||||
textOut.setText(originalDialogue + "\n\t" + player.getName() + ", you can't afford that!");
|
textOut.setText(originalDialogue + "\n\t" + getName() + ", you can't afford that!");
|
||||||
} else if (silkButton.getText().contains(".")) {
|
} else if (silkButton.getText().contains(".")) {
|
||||||
textOut.setText(originalDialogue + "\n\t" + player.getName() + ", how am I supposed to buy " + "'" + num + "'" + " Silk?");
|
textOut.setText(originalDialogue + "\n\t" + getName() + ", how am I supposed to buy " + "'" + num + "'" + " Silk?");
|
||||||
} else if (armsButton.getText().contains(".") && num <= player.getMoney() / player.getArmsPrice() && num >= 0) {
|
} else if (armsButton.getText().contains(".") && num <= getMoney() / getArmsPrice() && num >= 0) {
|
||||||
player.setArmsHeld(player.getArmsHeld() + num);
|
setArmsHeld(getArmsHeld() + num);
|
||||||
player.setMoney(player.getMoney() - num * player.getArmsPrice());
|
setMoney(getMoney() - num * getArmsPrice());
|
||||||
} else if (num >= 0 && armsButton.getText().contains(".")) {
|
} else if (num >= 0 && armsButton.getText().contains(".")) {
|
||||||
textOut.setText(originalDialogue + "\n\t" + player.getName() + ", you can't afford that!");
|
textOut.setText(originalDialogue + "\n\t" + getName() + ", you can't afford that!");
|
||||||
} else if (armsButton.getText().contains(".")) {
|
} else if (armsButton.getText().contains(".")) {
|
||||||
textOut.setText(originalDialogue + "\n\t" + player.getName() + ", how am I supposed to buy " + "'" + num + "'" + " Arms?");
|
textOut.setText(originalDialogue + "\n\t" + getName() + ", how am I supposed to buy " + "'" + num + "'" + " Arms?");
|
||||||
} else if (generalButton.getText().contains(".") && num <= player.getMoney() / player.getGeneralPrice() && num >= 0) {
|
} else if (generalButton.getText().contains(".") && num <= getMoney() / getGeneralPrice() && num >= 0) {
|
||||||
player.setGeneralHeld(player.getGeneralHeld()+num);
|
setGeneralHeld(getGeneralHeld()+num);
|
||||||
player.setMoney(player.getMoney() - num * player.getGeneralPrice());
|
setMoney(getMoney() - num * getGeneralPrice());
|
||||||
} else if (num >= 0 && generalButton.getText().contains(".")) {
|
} else if (num >= 0 && generalButton.getText().contains(".")) {
|
||||||
textOut.setText(originalDialogue + "\n\t" + player.getName() + ", you can't afford that!");
|
textOut.setText(originalDialogue + "\n\t" + getName() + ", you can't afford that!");
|
||||||
} else if (generalButton.getText().contains(".")) {
|
} else if (generalButton.getText().contains(".")) {
|
||||||
textOut.setText(originalDialogue + "\n\t" + player.getName() + ", how am I supposed to buy " + "'" + num + "'" + " General Cargo?");
|
textOut.setText(originalDialogue + "\n\t" + getName() + ", how am I supposed to buy " + "'" + num + "'" + " General Cargo?");
|
||||||
}
|
}
|
||||||
} else if (sellButton.getText().contains(".")) {
|
} else if (sellButton.getText().contains(".")) {
|
||||||
if (opiumButton.getText().contains(".") && num <= player.getOpiumHeld() && num >= 0) {
|
if (opiumButton.getText().contains(".") && num <= getOpiumHeld() && num >= 0) {
|
||||||
player.setOpiumHeld(player.getOpiumHeld() - num);
|
setOpiumHeld(getOpiumHeld() - num);
|
||||||
player.setMoney(player.getMoney() + num * player.getOpiumPrice());
|
setMoney(getMoney() + num * getOpiumPrice());
|
||||||
} else if (num >= 0 && opiumButton.getText().contains(".")) {
|
} else if (num >= 0 && opiumButton.getText().contains(".")) {
|
||||||
textOut.setText(originalDialogue + "\n\t" + player.getName() + ", you don't have that many to sell!");
|
textOut.setText(originalDialogue + "\n\t" + getName() + ", you don't have that many to sell!");
|
||||||
} else if (opiumButton.getText().contains(".")) {
|
} else if (opiumButton.getText().contains(".")) {
|
||||||
textOut.setText(originalDialogue + "\n\t" + player.getName() + ", how am I supposed to sell " + "'" + num + "'" + " Opium?");
|
textOut.setText(originalDialogue + "\n\t" + getName() + ", how am I supposed to sell " + "'" + num + "'" + " Opium?");
|
||||||
} else if (silkButton.getText().contains(".") && num <= player.getSilkHeld() && num >= 0) {
|
} else if (silkButton.getText().contains(".") && num <= getSilkHeld() && num >= 0) {
|
||||||
player.setSilkHeld(player.getSilkHeld() - num);
|
setSilkHeld(getSilkHeld() - num);
|
||||||
player.setMoney(player.getMoney() + num * player.getOpiumPrice());
|
setMoney(getMoney() + num * getOpiumPrice());
|
||||||
} else if (num >= 0 && silkButton.getText().contains(".")) {
|
} else if (num >= 0 && silkButton.getText().contains(".")) {
|
||||||
textOut.setText(originalDialogue + "\n\t" + player.getName() + ", you don't have that many to sell!");
|
textOut.setText(originalDialogue + "\n\t" + getName() + ", you don't have that many to sell!");
|
||||||
} else if (silkButton.getText().contains(".")) {
|
} else if (silkButton.getText().contains(".")) {
|
||||||
textOut.setText(originalDialogue + "\n\t" + player.getName() + ", how am I supposed to sell " + "'" + num + "'" + " Silk?");
|
textOut.setText(originalDialogue + "\n\t" + getName() + ", how am I supposed to sell " + "'" + num + "'" + " Silk?");
|
||||||
} else if (armsButton.getText().contains(".") && num <= player.getArmsHeld() && num >= 0) {
|
} else if (armsButton.getText().contains(".") && num <= getArmsHeld() && num >= 0) {
|
||||||
player.setArmsHeld(player.getArmsHeld() - num);
|
setArmsHeld(getArmsHeld() - num);
|
||||||
player.setMoney(player.getMoney() + num * player.getArmsPrice());
|
setMoney(getMoney() + num * getArmsPrice());
|
||||||
} else if (num >= 0 && armsButton.getText().contains(".")) {
|
} else if (num >= 0 && armsButton.getText().contains(".")) {
|
||||||
textOut.setText(originalDialogue + "\n\t" + player.getName() + ", you don't have that many to sell!");
|
textOut.setText(originalDialogue + "\n\t" + getName() + ", you don't have that many to sell!");
|
||||||
} else if (armsButton.getText().contains(".")) {
|
} else if (armsButton.getText().contains(".")) {
|
||||||
textOut.setText(originalDialogue + "\n\t" + player.getName() + ", how am I supposed to sell " + "'" + num + "'" + " Arms?");
|
textOut.setText(originalDialogue + "\n\t" + getName() + ", how am I supposed to sell " + "'" + num + "'" + " Arms?");
|
||||||
} else if (generalButton.getText().contains(".") && num <= player.getGeneralHeld() && num >= 0) {
|
} else if (generalButton.getText().contains(".") && num <= getGeneralHeld() && num >= 0) {
|
||||||
player.setGeneralHeld(player.getGeneralHeld() - num);
|
setGeneralHeld(getGeneralHeld() - num);
|
||||||
player.setMoney(player.getMoney() + num * player.getGeneralPrice());
|
setMoney(getMoney() + num * getGeneralPrice());
|
||||||
} else if (num >= 0 && generalButton.getText().contains(".")) {
|
} else if (num >= 0 && generalButton.getText().contains(".")) {
|
||||||
textOut.setText(originalDialogue + "\n\t" + player.getName() + ", you don't have that many to sell!");
|
textOut.setText(originalDialogue + "\n\t" + getName() + ", you don't have that many to sell!");
|
||||||
} else {
|
} else {
|
||||||
textOut.setText(originalDialogue + "\n\t" + player.getName() + ", how am I supposed to sell " + "'" + num + "'" + " General Cargo?");
|
textOut.setText(originalDialogue + "\n\t" + getName() + ", how am I supposed to sell " + "'" + num + "'" + " General Cargo?");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -470,7 +447,7 @@ public class TaipanShopGUI {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void handle(ActionEvent event) {
|
public void handle(ActionEvent event) {
|
||||||
WarehouseGUI warehouseGUI = new WarehouseGUI(player);
|
WarehouseGUI warehouseGUI = new WarehouseGUI(getPlayer());
|
||||||
warehouseGUI.initializeWarehouse(stage);
|
warehouseGUI.initializeWarehouse(stage);
|
||||||
stage.show();
|
stage.show();
|
||||||
}
|
}
|
||||||
@@ -509,8 +486,8 @@ public class TaipanShopGUI {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void handle(ActionEvent event) {
|
public void handle(ActionEvent event) {
|
||||||
player.setIsPriceChanged(1);
|
setIsPriceChanged(1);
|
||||||
TravelGUI travelGUI = new TravelGUI(player);
|
TravelGUI travelGUI = new TravelGUI(getPlayer());
|
||||||
travelGUI.initializeTravel(stage);
|
travelGUI.initializeTravel(stage);
|
||||||
stage.show();
|
stage.show();
|
||||||
//System.out.println("PLACEHOLDER FOR TRAVEL");
|
//System.out.println("PLACEHOLDER FOR TRAVEL");
|
||||||
@@ -554,9 +531,9 @@ public class TaipanShopGUI {
|
|||||||
defaultTextOut();
|
defaultTextOut();
|
||||||
String extraText;
|
String extraText;
|
||||||
if (buyButton.getText().contains(".")) {
|
if (buyButton.getText().contains(".")) {
|
||||||
extraText = String.format(" (You can afford %d)", player.getMoney() / player.getOpiumPrice());
|
extraText = String.format(" (You can afford %d)", getMoney() / getOpiumPrice());
|
||||||
} else {
|
} else {
|
||||||
extraText = String.format(" (You have %d)", player.getOpiumHeld());
|
extraText = String.format(" (You have %d)", getOpiumHeld());
|
||||||
}
|
}
|
||||||
textOut.setText(textOut.getText() + "\n\tWhat quantity of Opium?" + extraText);
|
textOut.setText(textOut.getText() + "\n\tWhat quantity of Opium?" + extraText);
|
||||||
}
|
}
|
||||||
@@ -581,9 +558,9 @@ public class TaipanShopGUI {
|
|||||||
defaultTextOut();
|
defaultTextOut();
|
||||||
String extraText;
|
String extraText;
|
||||||
if (buyButton.getText().contains(".")) {
|
if (buyButton.getText().contains(".")) {
|
||||||
extraText = String.format(" (You can afford %d)", player.getMoney() / player.getSilkPrice());
|
extraText = String.format(" (You can afford %d)", getMoney() / getSilkPrice());
|
||||||
} else {
|
} else {
|
||||||
extraText = String.format(" (You have %d)", player.getSilkHeld());
|
extraText = String.format(" (You have %d)", getSilkHeld());
|
||||||
}
|
}
|
||||||
textOut.setText(textOut.getText() + "\n\tWhat quantity of Silk?" + extraText);
|
textOut.setText(textOut.getText() + "\n\tWhat quantity of Silk?" + extraText);
|
||||||
}
|
}
|
||||||
@@ -606,9 +583,9 @@ public class TaipanShopGUI {
|
|||||||
defaultTextOut();
|
defaultTextOut();
|
||||||
String extraText;
|
String extraText;
|
||||||
if (buyButton.getText().contains(".")) {
|
if (buyButton.getText().contains(".")) {
|
||||||
extraText = String.format(" (You can afford %d)", player.getMoney() / player.getArmsPrice());
|
extraText = String.format(" (You can afford %d)", getMoney() / getArmsPrice());
|
||||||
} else {
|
} else {
|
||||||
extraText = String.format(" (You have %d)", player.getArmsHeld());
|
extraText = String.format(" (You have %d)", getArmsHeld());
|
||||||
}
|
}
|
||||||
textOut.setText(textOut.getText() + "\n\tWhat quantity of Arms?" + extraText);
|
textOut.setText(textOut.getText() + "\n\tWhat quantity of Arms?" + extraText);
|
||||||
}
|
}
|
||||||
@@ -635,9 +612,9 @@ public class TaipanShopGUI {
|
|||||||
defaultTextOut();
|
defaultTextOut();
|
||||||
String extraText;
|
String extraText;
|
||||||
if (buyButton.getText().contains(".")) {
|
if (buyButton.getText().contains(".")) {
|
||||||
extraText = String.format(" (You can afford %d)", player.getMoney() / player.getGeneralPrice());
|
extraText = String.format(" (You can afford %d)", getMoney() / getGeneralPrice());
|
||||||
} else {
|
} else {
|
||||||
extraText = String.format(" (You have %d)", player.getGeneralHeld());
|
extraText = String.format(" (You have %d)", getGeneralHeld());
|
||||||
}
|
}
|
||||||
textOut.setText(textOut.getText() + "\n\tWhat quantity of General Cargo?" + extraText);
|
textOut.setText(textOut.getText() + "\n\tWhat quantity of General Cargo?" + extraText);
|
||||||
}
|
}
|
||||||
@@ -769,7 +746,7 @@ public class TaipanShopGUI {
|
|||||||
|
|
||||||
// general updates to the buttons, user stats/inventory, and text.
|
// general updates to the buttons, user stats/inventory, and text.
|
||||||
buttonSetup("reset");
|
buttonSetup("reset");
|
||||||
if(player.getIsPriceChanged() == 0 || player.getIsPriceChanged() == 2){
|
if(getIsPriceChanged() == 0 || getIsPriceChanged() == 2){
|
||||||
updatePrices();
|
updatePrices();
|
||||||
}
|
}
|
||||||
defaultTextOut();
|
defaultTextOut();
|
||||||
@@ -783,7 +760,7 @@ public class TaipanShopGUI {
|
|||||||
*/
|
*/
|
||||||
public String getStringLocation() {
|
public String getStringLocation() {
|
||||||
String location;
|
String location;
|
||||||
switch (player.getLocation()) {
|
switch (getLocation()) {
|
||||||
case 1:
|
case 1:
|
||||||
location = "Hong Kong";
|
location = "Hong Kong";
|
||||||
break;
|
break;
|
||||||
@@ -819,7 +796,7 @@ public class TaipanShopGUI {
|
|||||||
*/
|
*/
|
||||||
public String shipStatusString() {
|
public String shipStatusString() {
|
||||||
String shipStatus;
|
String shipStatus;
|
||||||
switch (player.getHP() / 10) {
|
switch (getHP() / 10) {
|
||||||
case 10:
|
case 10:
|
||||||
shipStatus = "Mint Condition";
|
shipStatus = "Mint Condition";
|
||||||
break;
|
break;
|
||||||
@@ -864,22 +841,22 @@ public class TaipanShopGUI {
|
|||||||
* updates the text associated with the user's inventory.
|
* updates the text associated with the user's inventory.
|
||||||
*/
|
*/
|
||||||
public void updateStage() {
|
public void updateStage() {
|
||||||
firm.setText(String.format("Firm: %s, %s", player.getName(), getStringLocation()));
|
firm.setText(String.format("Firm: %s, %s", getName(), getStringLocation()));
|
||||||
wItemsText.setText(String.format("\n %d\n %d\n %d\n %d", player.getwOpium(), player.getwSilk(), player.getwArms(), player.getwGeneral()));
|
wItemsText.setText(String.format("\n %d\n %d\n %d\n %d", getwOpium(), getwSilk(), getwArms(), getwGeneral()));
|
||||||
int itemsInWarehouse = player.getwOpium() + player.getwGeneral() + player.getwArms() + player.getwSilk();
|
int itemsInWarehouse = getwOpium() + getwGeneral() + getwArms() + getwSilk();
|
||||||
wItemSpaceText.setText(String.format("\n\t\tIn use:\n\t\t %d \n\t\tVacant:\n\t\t %d", itemsInWarehouse, (10000 - itemsInWarehouse)));
|
wItemSpaceText.setText(String.format("\n\t\tIn use:\n\t\t %d \n\t\tVacant:\n\t\t %d", itemsInWarehouse, (10000 - itemsInWarehouse)));
|
||||||
locationText.setText(String.format("Location\n%s", getStringLocation()));
|
locationText.setText(String.format("Location\n%s", getStringLocation()));
|
||||||
int itemsInInventory = player.getCargoSpace() - player.getSilkHeld() - player.getOpiumHeld() - player.getGeneralHeld() - player.getArmsHeld() - 10 * player.getGuns();
|
int itemsInInventory = getCargoSpace() - getSilkHeld() - getOpiumHeld() - getGeneralHeld() - getArmsHeld() - 10 * getGuns();
|
||||||
if (itemsInInventory < 0) {
|
if (itemsInInventory < 0) {
|
||||||
inventoryText.setText(" Overloaded\n\t Opium\n\t Silk\n\t Arms\n\t General");
|
inventoryText.setText(" Overloaded\n\t Opium\n\t Silk\n\t Arms\n\t General");
|
||||||
} else {
|
} else {
|
||||||
inventoryText.setText(String.format(" Hold %d\n\t Opium\n\t Silk\n\t Arms\n\t General", itemsInInventory));
|
inventoryText.setText(String.format(" Hold %d\n\t Opium\n\t Silk\n\t Arms\n\t General", itemsInInventory));
|
||||||
}
|
}
|
||||||
gunsText.setText(String.format("Guns %d\n\n\n\n ", player.getGuns()));
|
gunsText.setText(String.format("Guns %d\n\n\n\n ", getGuns()));
|
||||||
inventoryHeldText.setText(String.format("\n %d\n %d\n %d\n %d", player.getOpiumHeld(), player.getSilkHeld(), player.getArmsHeld(), player.getGeneralHeld()));
|
inventoryHeldText.setText(String.format("\n %d\n %d\n %d\n %d", getOpiumHeld(), getSilkHeld(), getArmsHeld(), getGeneralHeld()));
|
||||||
shipStatusText.setText(String.format("\tDebt\n\t%d\n\n\tShip status\n\t%s: %d", player.getDebt(), shipStatusString(), player.getHP()));
|
shipStatusText.setText(String.format("\tDebt\n\t%d\n\n\tShip status\n\t%s: %d", getDebt(), shipStatusString(), getHP()));
|
||||||
cashText.setText(String.format(" Cash: $%,d", player.getMoney()));
|
cashText.setText(String.format(" Cash: $%,d", getMoney()));
|
||||||
bankText.setText(String.format("Bank: $%,d", player.getBank()));
|
bankText.setText(String.format("Bank: $%,d", getBank()));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
/**
|
/**
|
||||||
* TravelGUI is the class in which takes the player from location to location
|
* TravelGUI is the class in which takes the player from location to location
|
||||||
*
|
*
|
||||||
* Author: Harkamal Randhawa
|
* Author: Harkamal Randhawa
|
||||||
*/
|
*/
|
||||||
import javafx.geometry.Pos;
|
import javafx.geometry.Pos;
|
||||||
import javafx.scene.Scene;
|
import javafx.scene.Scene;
|
||||||
import javafx.scene.control.Button;
|
import javafx.scene.control.Button;
|
||||||
@@ -16,8 +16,7 @@ import javafx.scene.shape.Rectangle;
|
|||||||
import javafx.scene.text.Font;
|
import javafx.scene.text.Font;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
public class TravelGUI{
|
public class TravelGUI extends Player{
|
||||||
private Player player;
|
|
||||||
private TaipanShopGUI shop;
|
private TaipanShopGUI shop;
|
||||||
private Label firm = new Label();
|
private Label firm = new Label();
|
||||||
private Label wItemsText = new Label();
|
private Label wItemsText = new Label();
|
||||||
@@ -41,7 +40,6 @@ public class TravelGUI{
|
|||||||
private Boolean stormScene = false;
|
private Boolean stormScene = false;
|
||||||
private Boolean sceneContinue = false;
|
private Boolean sceneContinue = false;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* constructor; only runs when a Player object is provided. The constructor is fully encapsulated.
|
* constructor; only runs when a Player object is provided. The constructor is fully encapsulated.
|
||||||
*
|
*
|
||||||
@@ -50,7 +48,7 @@ public class TravelGUI{
|
|||||||
public TravelGUI(Player player) {
|
public TravelGUI(Player player) {
|
||||||
Player playerDummy = new Player(player);
|
Player playerDummy = new Player(player);
|
||||||
this.shop = new TaipanShopGUI(player);
|
this.shop = new TaipanShopGUI(player);
|
||||||
this.player = playerDummy;
|
setPlayer(playerDummy);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -166,7 +164,7 @@ public class TravelGUI{
|
|||||||
|
|
||||||
//Goes back to shop
|
//Goes back to shop
|
||||||
quitButton.setOnAction(event -> {
|
quitButton.setOnAction(event -> {
|
||||||
TaipanShopGUI taipanShopGUI = new TaipanShopGUI(player);
|
TaipanShopGUI taipanShopGUI = new TaipanShopGUI(getPlayer());
|
||||||
taipanShopGUI.initializeShop(stage);
|
taipanShopGUI.initializeShop(stage);
|
||||||
stage.show();
|
stage.show();
|
||||||
});
|
});
|
||||||
@@ -174,12 +172,12 @@ public class TravelGUI{
|
|||||||
//Continues on to either shop or shipwarfare
|
//Continues on to either shop or shipwarfare
|
||||||
continueButton.setOnAction(event -> {
|
continueButton.setOnAction(event -> {
|
||||||
if(peasantShipScene){
|
if(peasantShipScene){
|
||||||
ShipWarfareGUI ship = new ShipWarfareGUI(player);
|
ShipWarfareGUI ship = new ShipWarfareGUI(getPlayer());
|
||||||
ship.initializeShip(stage);
|
ship.initializeShip(stage);
|
||||||
stage.show();
|
stage.show();
|
||||||
}
|
}
|
||||||
else if(shopScene){
|
else if(shopScene){
|
||||||
TaipanShopGUI shop = new TaipanShopGUI(player);
|
TaipanShopGUI shop = new TaipanShopGUI(getPlayer());
|
||||||
shop.initializeShop(stage);
|
shop.initializeShop(stage);
|
||||||
stage.show();
|
stage.show();
|
||||||
}
|
}
|
||||||
@@ -199,43 +197,43 @@ public class TravelGUI{
|
|||||||
}
|
}
|
||||||
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.
|
//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())){
|
if(getCargoSpace() >= (getOpiumHeld()+ (getGuns()*10)+getSilkHeld() + getArmsHeld() + getGeneralHeld())){
|
||||||
//Just in case the player types something that was not intended. It will refresh the question and ask it again
|
//Just in case the player types something that was not intended. It will refresh the question and ask it again
|
||||||
try {
|
try {
|
||||||
//Makes sure you can't travel to your own location.
|
//Makes sure you can't travel to your own location.
|
||||||
if (response != player.getLocation() && response > 0 && 8 > response && event.getCode().equals(KeyCode.ENTER)||event.getCode().equals(KeyCode.Z)){
|
if (response != getLocation() && response > 0 && 8 > response && event.getCode().equals(KeyCode.ENTER)||event.getCode().equals(KeyCode.Z)){
|
||||||
hasTraveled = seaAtlas(response);
|
hasTraveled = seaAtlas(response);
|
||||||
randomEventSea(response,stage);
|
randomEventSea(response,stage);
|
||||||
player.setBank((int) (player.getBank() * 1.01));
|
setBank((int) (getBank() * 1.01));
|
||||||
player.setDebt((int) (player.getDebt() * 1.01));
|
setDebt((int) (getDebt() * 1.01));
|
||||||
player.setIsPriceChanged(2);
|
setIsPriceChanged(2);
|
||||||
//shopScene = false;
|
//shopScene = false;
|
||||||
//stormScene = false;
|
//stormScene = false;
|
||||||
|
|
||||||
} else{
|
} else{
|
||||||
if(response == player.getLocation()){
|
if(response == getLocation()){
|
||||||
textOut.setText(" " + "You're already here " + player.getName() + "\n");
|
textOut.setText(" " + "You're already here " + getName() + "\n");
|
||||||
}
|
|
||||||
else{
|
|
||||||
textOut.setText(" " + player.getName() + "; Sorry but could you say that again?");
|
|
||||||
}
|
|
||||||
|
|
||||||
textOut.setText(textOut.getText() + "\n\n 1) Hong Kong, 2) Shanghai, 3) Nagasaki, 4) Saigon,\n 5) Manila, 6) Singapore, or 7) Batavia?");
|
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
else{
|
||||||
textOut.setText(" " + "Sorry, " + player.getName() + " could you say that again?");
|
textOut.setText(" " + getName() + "; Sorry but could you say that again?");
|
||||||
}
|
}
|
||||||
if (hasTraveled) {
|
|
||||||
continueButton.setVisible(true);
|
textOut.setText(textOut.getText() + "\n\n 1) Hong Kong, 2) Shanghai, 3) Nagasaki, 4) Saigon,\n 5) Manila, 6) Singapore, or 7) Batavia?");
|
||||||
quitButton.setVisible(false);
|
|
||||||
numberInput.setVisible(false);
|
|
||||||
shopScene = true;
|
|
||||||
}
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
textOut.setText(" " + "Sorry, " + getName() + " could you say that again?");
|
||||||
|
}
|
||||||
|
if (hasTraveled) {
|
||||||
|
continueButton.setVisible(true);
|
||||||
|
quitButton.setVisible(false);
|
||||||
|
numberInput.setVisible(false);
|
||||||
|
shopScene = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (player.getCargoSpace() < (player.getOpiumHeld()+ (player.getGuns()*10)+player.getSilkHeld() + player.getArmsHeld() + player.getGeneralHeld())){
|
}
|
||||||
textOut.setText(" "+player.getName() + " the cargo is too heavy! We can't set sail!");
|
else if (getCargoSpace() < (getOpiumHeld()+ (getGuns()*10)+getSilkHeld() + getArmsHeld() + getGeneralHeld())){
|
||||||
}
|
textOut.setText(" "+getName() + " the cargo is too heavy! We can't set sail!");
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
firm.setAlignment(Pos.CENTER);
|
firm.setAlignment(Pos.CENTER);
|
||||||
@@ -338,34 +336,34 @@ public class TravelGUI{
|
|||||||
switch (locationOfTravel) {
|
switch (locationOfTravel) {
|
||||||
case 1:
|
case 1:
|
||||||
if(!peasantShipScene && !stormScene) textOut.setText( textOut.getText() + "\n " + "Arriving at Hong Kong");
|
if(!peasantShipScene && !stormScene) textOut.setText( textOut.getText() + "\n " + "Arriving at Hong Kong");
|
||||||
player.setLocation(1);
|
setLocation(1);
|
||||||
return true;
|
return true;
|
||||||
case 2:
|
case 2:
|
||||||
if(!peasantShipScene && !stormScene) textOut.setText( textOut.getText() + "\n " + "Arriving at Shanghai");
|
if(!peasantShipScene && !stormScene) textOut.setText( textOut.getText() + "\n " + "Arriving at Shanghai");
|
||||||
player.setLocation(2);
|
setLocation(2);
|
||||||
return true;
|
return true;
|
||||||
case 3:
|
case 3:
|
||||||
if(!peasantShipScene && !stormScene) textOut.setText( textOut.getText() + "\n " + "Arriving at Nagasaki");
|
if(!peasantShipScene && !stormScene) textOut.setText( textOut.getText() + "\n " + "Arriving at Nagasaki");
|
||||||
player.setLocation(3);
|
setLocation(3);
|
||||||
return true;
|
return true;
|
||||||
case 4:
|
case 4:
|
||||||
if(!peasantShipScene && !stormScene) textOut.setText( textOut.getText() + "\n " + "Arriving at Saigon");
|
if(!peasantShipScene && !stormScene) textOut.setText( textOut.getText() + "\n " + "Arriving at Saigon");
|
||||||
player.setLocation(4);
|
setLocation(4);
|
||||||
return true;
|
return true;
|
||||||
case 5:
|
case 5:
|
||||||
if(!peasantShipScene && !stormScene) textOut.setText( textOut.getText() + "\n " + "Arriving at Manila");
|
if(!peasantShipScene && !stormScene) textOut.setText( textOut.getText() + "\n " + "Arriving at Manila");
|
||||||
player.setLocation(5);
|
setLocation(5);
|
||||||
return true;
|
return true;
|
||||||
case 6:
|
case 6:
|
||||||
if(!peasantShipScene && !stormScene) textOut.setText( textOut.getText() + "\n " + "Arriving at Singapore");
|
if(!peasantShipScene && !stormScene) textOut.setText( textOut.getText() + "\n " + "Arriving at Singapore");
|
||||||
player.setLocation(6);
|
setLocation(6);
|
||||||
return true;
|
return true;
|
||||||
case 7:
|
case 7:
|
||||||
if(!peasantShipScene && !stormScene) textOut.setText( textOut.getText() + "\n " + "Arriving at Batavia");
|
if(!peasantShipScene && !stormScene) textOut.setText( textOut.getText() + "\n " + "Arriving at Batavia");
|
||||||
player.setLocation(7);
|
setLocation(7);
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
textOut.setText(" " + "Sorry but could you say that again " + player.getName() + "?");
|
textOut.setText(" " + "Sorry but could you say that again " + getName() + "?");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -383,7 +381,7 @@ public class TravelGUI{
|
|||||||
continueButton.setVisible(true);
|
continueButton.setVisible(true);
|
||||||
quitButton.setVisible(false);
|
quitButton.setVisible(false);
|
||||||
numberInput.setVisible(false);
|
numberInput.setVisible(false);
|
||||||
textOut.setText(" We see a ship on the horizon " + player.getName() + "; Prepare for combat!");
|
textOut.setText(" We see a ship on the horizon " + getName() + "; Prepare for combat!");
|
||||||
peasantShipScene = true;
|
peasantShipScene = true;
|
||||||
}else if (randGenNum == 2) {
|
}else if (randGenNum == 2) {
|
||||||
disaster(locationOfTravel);
|
disaster(locationOfTravel);
|
||||||
@@ -400,14 +398,14 @@ public class TravelGUI{
|
|||||||
**/
|
**/
|
||||||
private void disaster(int locationOfTravel) {
|
private void disaster(int locationOfTravel) {
|
||||||
//Tells player that there is a storm approaching.
|
//Tells player that there is a storm approaching.
|
||||||
textOut.setText(" " + "Storm " + player.getName() + "! ");
|
textOut.setText(" " + "Storm " + 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
|
//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).
|
//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) {
|
||||||
textOut.setText(textOut.getText() + "\n " + "We got through the storm " + player.getName() + "!");
|
textOut.setText(textOut.getText() + "\n " + "We got through the storm " + getName() + "!");
|
||||||
}else {
|
}else {
|
||||||
while (randGenNum == locationOfTravel) {
|
while (randGenNum == locationOfTravel) {
|
||||||
randGenNum = rand.nextInt(7) + 1;
|
randGenNum = rand.nextInt(7) + 1;
|
||||||
@@ -426,7 +424,7 @@ public class TravelGUI{
|
|||||||
*/
|
*/
|
||||||
public String getStringLocation(){
|
public String getStringLocation(){
|
||||||
String location;
|
String location;
|
||||||
switch(player.getLocation()){
|
switch(getLocation()){
|
||||||
case 1: location = "Hong Kong"; break;
|
case 1: location = "Hong Kong"; break;
|
||||||
case 2: location = "Shanghai"; break;
|
case 2: location = "Shanghai"; break;
|
||||||
case 3: location = "Nagasaki"; break;
|
case 3: location = "Nagasaki"; break;
|
||||||
@@ -446,7 +444,7 @@ public class TravelGUI{
|
|||||||
*/
|
*/
|
||||||
public String shipStatusString(){
|
public String shipStatusString(){
|
||||||
String shipStatus;
|
String shipStatus;
|
||||||
switch(player.getHP()/10){
|
switch(getHP()/10){
|
||||||
case 10: shipStatus = "Mint Condition"; break;
|
case 10: shipStatus = "Mint Condition"; break;
|
||||||
case 9: shipStatus = "Near Perfect"; break;
|
case 9: shipStatus = "Near Perfect"; break;
|
||||||
case 8: shipStatus = "Great"; break;
|
case 8: shipStatus = "Great"; break;
|
||||||
@@ -467,21 +465,21 @@ public class TravelGUI{
|
|||||||
* updates the text associated with the user's inventory.
|
* updates the text associated with the user's inventory.
|
||||||
*/
|
*/
|
||||||
public void updateStage(){
|
public void updateStage(){
|
||||||
firm.setText(String.format("Firm: %s, %s", player.getName(), getStringLocation()));
|
firm.setText(String.format("Firm: %s, %s", getName(), getStringLocation()));
|
||||||
wItemsText.setText(String.format("\n %d\n %d\n %d\n %d", player.getwOpium(), player.getwSilk(), player.getwArms(), player.getwGeneral()));
|
wItemsText.setText(String.format("\n %d\n %d\n %d\n %d", getwOpium(), getwSilk(), getwArms(), getwGeneral()));
|
||||||
int itemsInWarehouse = player.getwOpium()+player.getwGeneral()+player.getwArms()+player.getwSilk();
|
int itemsInWarehouse = getwOpium()+getwGeneral()+getwArms()+getwSilk();
|
||||||
wItemSpaceText.setText(String.format("\n\t\tIn use:\n\t\t %d \n\t\tVacant:\n\t\t %d", itemsInWarehouse, (10000-itemsInWarehouse)));
|
wItemSpaceText.setText(String.format("\n\t\tIn use:\n\t\t %d \n\t\tVacant:\n\t\t %d", itemsInWarehouse, (10000-itemsInWarehouse)));
|
||||||
locationText.setText(String.format("Location\n%s", getStringLocation()));
|
locationText.setText(String.format("Location\n%s", getStringLocation()));
|
||||||
int itemsInInventory = player.getCargoSpace()-player.getSilkHeld()-player.getOpiumHeld()-player.getGeneralHeld()-player.getArmsHeld()-10*player.getGuns();
|
int itemsInInventory = getCargoSpace()-getSilkHeld()-getOpiumHeld()-getGeneralHeld()-getArmsHeld()-10*getGuns();
|
||||||
if(itemsInInventory < 0){
|
if(itemsInInventory < 0){
|
||||||
inventoryText.setText(" Overloaded\n\t Opium\n\t Silk\n\t Arms\n\t General");
|
inventoryText.setText(" Overloaded\n\t Opium\n\t Silk\n\t Arms\n\t General");
|
||||||
}else{
|
}else{
|
||||||
inventoryText.setText(String.format(" Hold %d\n\t Opium\n\t Silk\n\t Arms\n\t General", itemsInInventory));
|
inventoryText.setText(String.format(" Hold %d\n\t Opium\n\t Silk\n\t Arms\n\t General", itemsInInventory));
|
||||||
}
|
}
|
||||||
gunsText.setText(String.format("Guns %d\n\n\n\n ", player.getGuns()));
|
gunsText.setText(String.format("Guns %d\n\n\n\n ", getGuns()));
|
||||||
inventoryHeldText.setText(String.format("\n %d\n %d\n %d\n %d", player.getOpiumHeld(), player.getSilkHeld(), player.getArmsHeld(), player.getGeneralHeld()));
|
inventoryHeldText.setText(String.format("\n %d\n %d\n %d\n %d", getOpiumHeld(), getSilkHeld(), getArmsHeld(), getGeneralHeld()));
|
||||||
shipStatusText.setText(String.format("\tDebt\n\t%d\n\n\tShip status\n\t%s: %d", player.getDebt(), shipStatusString(), player.getHP()));
|
shipStatusText.setText(String.format("\tDebt\n\t%d\n\n\tShip status\n\t%s: %d", getDebt(), shipStatusString(), getHP()));
|
||||||
cashText.setText(String.format(" Cash: $%,d", player.getMoney()));
|
cashText.setText(String.format(" Cash: $%,d", getMoney()));
|
||||||
bankText.setText(String.format("Bank: %d", player.getBank()));
|
bankText.setText(String.format("Bank: %d", getBank()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,14 +10,12 @@ import javafx.scene.text.Text;
|
|||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 2019-03-10
|
* 2019-03-10
|
||||||
* Authors: Harkamal, Vikram, Haris, Siddhant, Nathan
|
* Authors: Harkamal, Vikram, Haris, Siddhant, Nathan
|
||||||
* WarehouseGUI class, Initializes and displays the graphical interface for the warehouse in Taipan
|
* WarehouseGUI class, Initializes and displays the graphical interface for the warehouse in Taipan
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class WarehouseGUI {
|
public class WarehouseGUI extends Player{
|
||||||
|
|
||||||
private Player player;
|
|
||||||
|
|
||||||
private Text title;
|
private Text title;
|
||||||
private HBox hBox;
|
private HBox hBox;
|
||||||
@@ -56,27 +54,7 @@ public class WarehouseGUI {
|
|||||||
*/
|
*/
|
||||||
public WarehouseGUI(Player player) {
|
public WarehouseGUI(Player player) {
|
||||||
Player playerDummy = new Player(player);
|
Player playerDummy = new Player(player);
|
||||||
this.player = playerDummy;
|
setPlayer(playerDummy);
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Setter method for the Player object, player
|
|
||||||
*
|
|
||||||
* @param player an object of type Player
|
|
||||||
*/
|
|
||||||
public void setPlayer(Player player) {
|
|
||||||
Player playerDummy = new Player(player);
|
|
||||||
this.player = playerDummy;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Getter method for the Player object, player.
|
|
||||||
*
|
|
||||||
* @return returns a copy of the Player object, player
|
|
||||||
*/
|
|
||||||
public Player getPlayer() {
|
|
||||||
Player playerDummy = new Player(player);
|
|
||||||
return playerDummy;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -179,33 +157,33 @@ public class WarehouseGUI {
|
|||||||
int withdraw = Integer.parseInt(textIn.getText());
|
int withdraw = Integer.parseInt(textIn.getText());
|
||||||
updateLabels();
|
updateLabels();
|
||||||
if (opium.isSelected()) {
|
if (opium.isSelected()) {
|
||||||
if (player.getwOpium() >= withdraw) {
|
if (getwOpium() >= withdraw) {
|
||||||
player.setwOpium(player.getwOpium() - withdraw);
|
setwOpium(getwOpium() - withdraw);
|
||||||
player.setOpiumHeld(player.getOpiumHeld() + withdraw);
|
setOpiumHeld(getOpiumHeld() + withdraw);
|
||||||
} else {
|
} else {
|
||||||
title.setText("You don't have that much opium stored in the warehouse!");
|
title.setText("You don't have that much opium stored in the warehouse!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (silk.isSelected()) {
|
if (silk.isSelected()) {
|
||||||
if (player.getwSilk() >= withdraw) {
|
if (getwSilk() >= withdraw) {
|
||||||
player.setwSilk(player.getwSilk() - withdraw);
|
setwSilk(getwSilk() - withdraw);
|
||||||
player.setSilkHeld(player.getSilkHeld() + withdraw);
|
setSilkHeld(getSilkHeld() + withdraw);
|
||||||
} else {
|
} else {
|
||||||
title.setText("You don't have that much silk stored in the warehouse!");
|
title.setText("You don't have that much silk stored in the warehouse!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (arms.isSelected()) {
|
if (arms.isSelected()) {
|
||||||
if (player.getwArms() >= withdraw) {
|
if (getwArms() >= withdraw) {
|
||||||
player.setwArms(player.getwArms() - withdraw);
|
setwArms(getwArms() - withdraw);
|
||||||
player.setArmsHeld(player.getArmsHeld() + withdraw);
|
setArmsHeld(getArmsHeld() + withdraw);
|
||||||
} else {
|
} else {
|
||||||
title.setText("You don't have that much arms stored in the warehouse!");
|
title.setText("You don't have that much arms stored in the warehouse!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (general.isSelected()) {
|
if (general.isSelected()) {
|
||||||
if (player.getwGeneral() >= withdraw) {
|
if (getwGeneral() >= withdraw) {
|
||||||
player.setwGeneral(player.getwGeneral() - withdraw);
|
setwGeneral(getwGeneral() - withdraw);
|
||||||
player.setGeneralHeld(player.getGeneralHeld() + withdraw);
|
setGeneralHeld(getGeneralHeld() + withdraw);
|
||||||
} else {
|
} else {
|
||||||
title.setText("You don't have that much general stored in the warehouse!");
|
title.setText("You don't have that much general stored in the warehouse!");
|
||||||
}
|
}
|
||||||
@@ -225,33 +203,33 @@ public class WarehouseGUI {
|
|||||||
updateLabels();
|
updateLabels();
|
||||||
int deposit = Integer.parseInt(textIn.getText());
|
int deposit = Integer.parseInt(textIn.getText());
|
||||||
if (opium.isSelected()) {
|
if (opium.isSelected()) {
|
||||||
if (player.getOpiumHeld() >= deposit) {
|
if (getOpiumHeld() >= deposit) {
|
||||||
player.setwOpium(player.getwOpium() + deposit);
|
setwOpium(getwOpium() + deposit);
|
||||||
player.setOpiumHeld(player.getOpiumHeld() - deposit);
|
setOpiumHeld(getOpiumHeld() - deposit);
|
||||||
} else {
|
} else {
|
||||||
title.setText("You don't have that much opium stored in the ship!");
|
title.setText("You don't have that much opium stored in the ship!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (silk.isSelected()) {
|
if (silk.isSelected()) {
|
||||||
if (player.getwSilk() >= deposit) {
|
if (getwSilk() >= deposit) {
|
||||||
player.setwSilk(player.getwSilk() + deposit);
|
setwSilk(getwSilk() + deposit);
|
||||||
player.setSilkHeld(player.getSilkHeld() - deposit);
|
setSilkHeld(getSilkHeld() - deposit);
|
||||||
} else {
|
} else {
|
||||||
title.setText("You don't have that much silk stored in the ship!");
|
title.setText("You don't have that much silk stored in the ship!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (arms.isSelected()) {
|
if (arms.isSelected()) {
|
||||||
if (player.getwArms() >= deposit) {
|
if (getwArms() >= deposit) {
|
||||||
player.setwArms(player.getwArms() + deposit);
|
setwArms(getwArms() + deposit);
|
||||||
player.setArmsHeld(player.getArmsHeld() - deposit);
|
setArmsHeld(getArmsHeld() - deposit);
|
||||||
} else {
|
} else {
|
||||||
title.setText("You don't have that much arms stored in the ship!");
|
title.setText("You don't have that much arms stored in the ship!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (general.isSelected()) {
|
if (general.isSelected()) {
|
||||||
if (player.getwGeneral() >= deposit) {
|
if (getwGeneral() >= deposit) {
|
||||||
player.setwGeneral(player.getwGeneral() + deposit);
|
setwGeneral(getwGeneral() + deposit);
|
||||||
player.setGeneralHeld(player.getGeneralHeld() - deposit);
|
setGeneralHeld(getGeneralHeld() - deposit);
|
||||||
} else {
|
} else {
|
||||||
title.setText("You don't have that much general stored in the ship!");
|
title.setText("You don't have that much general stored in the ship!");
|
||||||
}
|
}
|
||||||
@@ -618,7 +596,7 @@ public class WarehouseGUI {
|
|||||||
* @param primaryStage object of type Stage
|
* @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(getPlayer());
|
||||||
warehouseGUI.initializeWarehouse(primaryStage);
|
warehouseGUI.initializeWarehouse(primaryStage);
|
||||||
primaryStage.show();
|
primaryStage.show();
|
||||||
}
|
}
|
||||||
@@ -628,14 +606,14 @@ public class WarehouseGUI {
|
|||||||
* can be safely stored without holing space on the ship!
|
* can be safely stored without holing space on the ship!
|
||||||
*/
|
*/
|
||||||
public void updateLabels() {
|
public void updateLabels() {
|
||||||
generalPlayer.setText("General: " + player.getGeneralHeld());
|
generalPlayer.setText("General: " + getGeneralHeld());
|
||||||
armsPlayer.setText("Arms: " + player.getArmsHeld());
|
armsPlayer.setText("Arms: " + getArmsHeld());
|
||||||
silkPlayer.setText("Silk: " + player.getSilkHeld());
|
silkPlayer.setText("Silk: " + getSilkHeld());
|
||||||
opiumPlayer.setText("Opium: " + player.getOpiumHeld());
|
opiumPlayer.setText("Opium: " + getOpiumHeld());
|
||||||
|
|
||||||
generalWarehouse.setText("General: " + player.getwGeneral());
|
generalWarehouse.setText("General: " + getwGeneral());
|
||||||
armsWarehouse.setText("Arms: " + player.getwArms());
|
armsWarehouse.setText("Arms: " + getwArms());
|
||||||
silkWarehouse.setText("Silk: " + player.getwSilk());
|
silkWarehouse.setText("Silk: " + getwSilk());
|
||||||
opiumWarehouse.setText("Opium: " + player.getwOpium());
|
opiumWarehouse.setText("Opium: " + getwOpium());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user