Merge remote-tracking branch 'origin/master'

# Conflicts:
#	.idea/workspace.xml
This commit is contained in:
2019-03-09 23:27:03 -07:00
2 changed files with 331 additions and 592 deletions

665
.idea/workspace.xml generated
View File

@@ -1,19 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="BookmarkManager">
<bookmark url="file://$PROJECT_DIR$/src/ShipWarfareGUI.java" line="590" />
</component>
<component name="ChangeListManager">
<list default="true" id="3114a2b9-4919-4fdf-8fd9-d03b60109ce4" name="Default Changelist" comment="Added some logic to ShipWarfareGUI">
<change afterPath="$PROJECT_DIR$/src/StartGUI.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/TravelGUI.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/misc.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/misc.xml" afterDir="false" />
<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$/out/production/TaipanClone/ShipWarfare.class" beforeDir="false" afterPath="$PROJECT_DIR$/out/production/TaipanClone/ShipWarfare.class" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/ShopGUI" beforeDir="false" afterPath="$PROJECT_DIR$/src/ShopGUI.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/ShipWarfareGUI.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/ShipWarfareGUI.java" afterDir="false" />
</list>
<ignored path="$PROJECT_DIR$/out/" />
<ignored path="C:\Users\Harkamal Randhawa\IdeaProjects\TaipanClone\.idea\shelf/" />
<ignored path="$PROJECT_DIR$/.idea/shelf/" />
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -23,157 +17,59 @@
<component name="FileEditorManager">
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/ShipWarfareGUI.java">
<entry file="file://$PROJECT_DIR$/src/ShipWarfare.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="279">
<caret line="682" selection-start-line="682" selection-end-line="682" />
<folding>
<element signature="e#763#794#0" expanded="true" />
<element signature="e#1208#1209#0" expanded="true" />
<element signature="e#1236#1237#0" expanded="true" />
<element signature="e#17682#17683#0" expanded="true" />
<element signature="e#17720#17721#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/ShopGUI.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="117">
<caret line="458" selection-start-line="458" selection-end-line="466" selection-end-column="11" />
<state relative-caret-position="5025">
<caret line="353" column="100" selection-end-line="503" />
<folding>
<element signature="imports" expanded="true" />
<element signature="e#1879#2020#0" />
<element signature="e#2026#2140#0" />
<element signature="e#2026#2268#0" />
<element signature="e#2274#2524#0" />
<element signature="e#2274#2657#0" />
<element signature="e#2663#2887#0" />
<element signature="e#2663#3001#0" />
<element signature="e#3007#3133#0" />
<element signature="e#3205#3412#0" />
<element signature="e#3205#3546#0" />
<element signature="e#3552#3676#0" />
<element signature="e#3746#3950#0" />
<element signature="e#3746#4079#0" />
<element signature="e#4022#4073#1" />
<element signature="e#4085#4209#0" />
<element signature="e#4279#4483#0" />
<element signature="e#4279#4612#0" />
<element signature="e#4618#4757#0" />
<element signature="e#4833#5046#0" />
<element signature="e#4833#5190#0" />
<element signature="e#5196#5297#0" />
<element signature="e#5196#7354#0" />
<element signature="e#10976#16179#0" />
<element signature="e#11276#11422#1" />
<element signature="e#11480#11600#1" />
<element signature="e#11645#11797#1" />
<element signature="e#12094#12214#1" />
<element signature="e#12258#12409#1" />
<element signature="e#12704#12824#1" />
<element signature="e#12867#13018#1" />
<element signature="e#13325#13445#1" />
<element signature="e#13704#16173#1" />
<element signature="e#13801#13949#1" />
<element signature="e#14007#14138#1" />
<element signature="e#14183#14336#1" />
<element signature="e#14624#14755#1" />
<element signature="e#14799#14951#1" />
<element signature="e#15237#15368#1" />
<element signature="class#20468:20804" />
<element signature="class#20968:21155" />
<element signature="class#21497:21689" />
<element signature="class#21854:22047" />
<element signature="class#22296:22485" />
<element signature="class#22689:22842" />
<element signature="class#23135:23794" />
<element signature="class#24032:24686" />
<element signature="class#24848:25502" />
<element signature="class#25837:26512" />
<element signature="e#31300#31833#0" />
<element signature="e#31843#32457#0" />
<element signature="e#32467#34046#0" />
</folding>
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/Travel.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1564">
<caret line="95" column="19" selection-start-line="95" selection-start-column="19" selection-end-line="95" selection-end-column="19" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/Start.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="51">
<caret line="3" selection-start-line="3" selection-end-line="35" />
</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="2567">
<caret line="174" column="38" selection-start-line="174" selection-start-column="23" selection-end-line="174" selection-end-column="38" />
<folding>
<element signature="e#1244#1245#0" expanded="true" />
<element signature="e#1272#1273#0" expanded="true" />
<element signature="e#2274#2657#0" />
<element signature="e#2663#3001#0" />
<element signature="e#6546#8362#1" />
<element signature="docComment;method#seaAtlas#0;class#TravelGUI#0" />
<element signature="method#seaAtlas#0;class#TravelGUI#0" />
<element signature="docComment;method#randomEventSea#0;class#TravelGUI#0" />
<element signature="method#randomEventSea#0;class#TravelGUI#0" />
<element signature="docComment;method#disaster#0;class#TravelGUI#0" />
<element signature="e#31300#31833#0" />
<element signature="e#31843#32457#0" />
<element signature="e#32467#34046#0" />
</folding>
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/src/StartGUI.java">
<entry file="file://$PROJECT_DIR$/src/ShipWarfareGUI.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="230">
<caret line="147" column="20" selection-start-line="147" selection-start-column="20" selection-end-line="147" selection-end-column="20" />
<state relative-caret-position="608">
<caret line="47" lean-forward="true" selection-start-line="47" selection-end-line="47" />
<folding>
<element signature="imports" expanded="true" />
<element signature="e#639#640#0" expanded="true" />
<element signature="e#667#668#0" expanded="true" />
<element signature="e#17426#17427#0" expanded="true" />
<element signature="e#17464#17465#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="-1934">
<caret line="56" column="5" selection-start-line="56" selection-start-column="5" selection-end-line="56" selection-end-column="5" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/main.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-421">
<caret line="2" column="41" selection-start-line="2" selection-start-column="41" selection-end-line="2" selection-end-column="41" />
<state relative-caret-position="135">
<caret line="9" column="4" selection-end-line="55" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/Start.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="15">
<caret line="1" column="13" selection-start-line="1" selection-start-column="13" selection-end-line="1" selection-end-column="13" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/ShopGUI">
<provider selected="true" editor-type-id="text-editor" />
</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="135">
<caret line="9" column="32" selection-start-line="9" selection-start-column="32" selection-end-line="9" selection-end-column="32" />
</state>
</provider>
</entry>
@@ -183,55 +79,54 @@
<component name="FileTemplateManagerImpl">
<option name="RECENT_TEMPLATES">
<list>
<option value="JavaFXApplication" />
<option value="Class" />
</list>
</option>
</component>
<component name="FindInProjectRecents">
<findStrings>
<find>setVisible</find>
<find>button</find>
<find>textField</find>
<find>quitButton</find>
<find>initial</find>
<find>Text</find>
<find>TextField</find>
<find>setTe</find>
<find>number</find>
<find>textOut</find>
<find>text</find>
<find>//</find>
<find>defaultTextOut</find>
<find>getText</find>
<find>numberInput</find>
<find>handle</find>
<find>event</find>
<find>System.out.println(</find>
<find>Where</find>
<find>sea</find>
<find>hon</find>
<find>setVis</find>
<find>Tex</find>
<find>VBox</find>
<find>ToggleGroup</find>
<find>field</find>
<find>startButton</find>
<find>visib</find>
<find>random</find>
<find>quit</find>
<find>hBox</find>
<find>&lt;</find>
<find>winO</find>
<find>destroy</find>
<find>get</find>
<find>user</find>
<find>setNumOfP</find>
<find>setUs</find>
<find>starting</find>
<find>numOfpeasantShips</find>
<find>startingPeasantShips</find>
<find>startingLittyShips</find>
<find>howMuchRun</find>
<find>pirateName</find>
<find>player</find>
<find>numOfPeasantShips</find>
<find>peasant</find>
<find>litty</find>
<find>userAttacks</find>
<find>numOfLittyShips</find>
<find>delay</find>
<find>Hp</find>
<find>shipwarfare</find>
<find>destroyPeasa</find>
<find>destr</find>
<find>destro</find>
<find>hitco</find>
<find>setNum</find>
<find>game</find>
<find>numOf</find>
</findStrings>
<replaceStrings>
<replace>HP</replace>
<replace>p1.get</replace>
<replace>p1.set</replace>
<replace>//delayForSeconds</replace>
<replace>textOut.setText(&quot; &quot; +</replace>
<replace>textOut.setText(&quot; &quot; +</replace>
<replace>shipWarfare.getHowMuchRun()</replace>
<replace>shipWarfare.isUserAttacks()</replace>
<replace>shipWarfare.getNumOfPeasantShips()</replace>
</replaceStrings>
</component>
<component name="Git.Settings">
<option name="UPDATE_TYPE" value="MERGE" />
<option name="UPDATE_TYPE" value="REBASE" />
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="IdeDocumentHistory">
@@ -239,36 +134,30 @@
<list>
<option value="$PROJECT_DIR$/src/Core.java" />
<option value="$PROJECT_DIR$/src/Game.java" />
<option value="$PROJECT_DIR$/src/Player.java" />
<option value="$PROJECT_DIR$/src/Start.java" />
<option value="$PROJECT_DIR$/src/TaipanShop.java" />
<option value="$PROJECT_DIR$/src/main.java" />
<option value="$PROJECT_DIR$/src/Travel.java" />
<option value="$PROJECT_DIR$/src/GUI.java" />
<option value="$PROJECT_DIR$/src/fxmlControllers/shipFXML.java" />
<option value="$PROJECT_DIR$/src/ShipWarfareGUI.fxml" />
<option value="$PROJECT_DIR$/src/Player.java" />
<option value="$PROJECT_DIR$/src/ShipWarfare.java" />
<option value="$PROJECT_DIR$/src/ShipWarfareGUI.java" />
<option value="$PROJECT_DIR$/src/main.java" />
<option value="$PROJECT_DIR$/src/Start.java" />
<option value="$PROJECT_DIR$/src/ShopGUI.java" />
<option value="$PROJECT_DIR$/src/TravelGUI.java" />
<option value="$PROJECT_DIR$/src/StartGUI.java" />
</list>
</option>
</component>
<component name="ProjectFrameBounds" extendedState="6">
<option name="x" value="2279" />
<option name="y" value="264" />
<option name="width" value="854" />
<option name="height" value="505" />
</component>
<component name="ProjectLevelVcsManager" settingsEditedManually="true">
<ConfirmationsSetting value="2" id="Add" />
<component name="ProjectFrameBounds">
<option name="x" value="48" />
<option name="y" value="23" />
<option name="width" value="1189" />
<option name="height" value="652" />
</component>
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
<component name="ProjectView">
<navigator proportions="" version="1">
<foldersAlwaysOnTop value="true" />
</navigator>
<panes>
<pane id="PackagesPane" />
<pane id="Scope" />
<pane id="ProjectPane">
<subPane>
<expand>
@@ -285,18 +174,15 @@
<select />
</subPane>
</pane>
<pane id="Scope" />
<pane id="PackagesPane" />
</panes>
</component>
<component name="PropertiesComponent">
<property name="ChangesTree.GroupingKeys" value="" />
<property name="WebServerToolWindowFactoryState" value="false" />
<property name="aspect.path.notification.shown" value="true" />
<property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1552199149371" />
<property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1552196488451" />
<property name="extract.method.default.visibility" value="private" />
<property name="last_opened_file_path" value="$USER_HOME$/Documents/GitHub/Cpsc233" />
<property name="nodejs_package_manager_path" value="npm" />
<property name="last_opened_file_path" value="$PROJECT_DIR$/../GitHub/Cpsc233" />
<property name="project.structure.last.edited" value="Project" />
<property name="project.structure.proportion" value="0.15" />
<property name="project.structure.side.proportion" value="0.2" />
@@ -314,9 +200,16 @@
</list>
</option>
</component>
<component name="RunManager" selected="Application.StartGUI">
<configuration name="GUI" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="GUI" />
<component name="RunManager" selected="Application.ShipWarfareGUI">
<configuration name="Game" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="Game" />
<module name="TaipanClone" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
<configuration name="ShipWarfare" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="ShipWarfare" />
<module name="TaipanClone" />
<method v="2">
<option name="Make" enabled="true" />
@@ -329,41 +222,34 @@
<option name="Make" enabled="true" />
</method>
</configuration>
<configuration name="ShopGUI" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="ShopGUI" />
<configuration name="TaipanShop" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="TaipanShop" />
<module name="TaipanClone" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
<configuration name="StartGUI" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="StartGUI" />
<module name="TaipanClone" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
<configuration name="TravelGUI" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="TravelGUI" />
<configuration name="main" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="main" />
<module name="TaipanClone" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
<list>
<item itemvalue="Application.ShopGUI" />
<item itemvalue="Application.ShipWarfare" />
<item itemvalue="Application.TaipanShop" />
<item itemvalue="Application.Game" />
<item itemvalue="Application.main" />
<item itemvalue="Application.ShipWarfareGUI" />
<item itemvalue="Application.GUI" />
<item itemvalue="Application.TravelGUI" />
<item itemvalue="Application.StartGUI" />
</list>
<recent_temporary>
<list>
<item itemvalue="Application.StartGUI" />
<item itemvalue="Application.TravelGUI" />
<item itemvalue="Application.ShopGUI" />
<item itemvalue="Application.ShipWarfareGUI" />
<item itemvalue="Application.GUI" />
<item itemvalue="Application.main" />
<item itemvalue="Application.TaipanShop" />
<item itemvalue="Application.Game" />
<item itemvalue="Application.ShipWarfare" />
</list>
</recent_temporary>
</component>
@@ -388,11 +274,16 @@
<workItem from="1550810552736" duration="1982000" />
<workItem from="1550878072546" duration="2009000" />
<workItem from="1551065104002" duration="1313000" />
<workItem from="1551158469442" duration="5961000" />
<workItem from="1551516759745" duration="56000" />
<workItem from="1552008296567" duration="595000" />
<workItem from="1552080169924" duration="15810000" />
<workItem from="1552165217689" duration="26528000" />
<workItem from="1551158469442" duration="4822000" />
<workItem from="1552183127375" duration="5000" />
<workItem from="1552183173819" duration="43000" />
<workItem from="1552183247090" duration="42000" />
<workItem from="1552183350012" duration="132000" />
<workItem from="1552183501892" duration="5000" />
<workItem from="1552187010251" duration="1043000" />
<workItem from="1552195875453" duration="55000" />
<workItem from="1552195941602" duration="33000" />
<workItem from="1552195980542" duration="513000" />
</task>
<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>
@@ -471,52 +362,73 @@
<option name="project" value="LOCAL" />
<updated>1551162699319</updated>
</task>
<task id="LOCAL-00012" summary="Fixed some little problems with documenting.">
<created>1551163347576</created>
<task id="LOCAL-00012" summary="Added time stuff to Shipwarfare GUI">
<created>1552168801248</created>
<option name="number" value="00012" />
<option name="presentableId" value="LOCAL-00012" />
<option name="project" value="LOCAL" />
<updated>1551163347576</updated>
<updated>1552168801248</updated>
</task>
<task id="LOCAL-00013" summary="Fixed some little problems with documenting.">
<created>1551163654726</created>
<task id="LOCAL-00013" summary="Notified of getting attacked">
<created>1552172956109</created>
<option name="number" value="00013" />
<option name="presentableId" value="LOCAL-00013" />
<option name="project" value="LOCAL" />
<updated>1551163654726</updated>
<updated>1552172956109</updated>
</task>
<task id="LOCAL-00014" summary="Basic layout for ShipwarefareGUI.">
<created>1552166044309</created>
<task id="LOCAL-00014" summary="Added fight stuff">
<created>1552173216531</created>
<option name="number" value="00014" />
<option name="presentableId" value="LOCAL-00014" />
<option name="project" value="LOCAL" />
<updated>1552166044309</updated>
<updated>1552173216532</updated>
</task>
<task id="LOCAL-00015" summary="Added basic functionality with KahootChampion">
<created>1552166883461</created>
<task id="LOCAL-00015" summary="Made ShipWarfare easier to access by ShipWarfareGUI">
<created>1552181324520</created>
<option name="number" value="00015" />
<option name="presentableId" value="LOCAL-00015" />
<option name="project" value="LOCAL" />
<updated>1552166883461</updated>
<updated>1552181324520</updated>
</task>
<task id="LOCAL-00016" summary="Added some logic to ShipWarfareGUI">
<created>1552167207982</created>
<task id="LOCAL-00016" summary="Missed one statement that I needed to encapsulate">
<created>1552181613507</created>
<option name="number" value="00016" />
<option name="presentableId" value="LOCAL-00016" />
<option name="project" value="LOCAL" />
<updated>1552167207982</updated>
<updated>1552181613507</updated>
</task>
<option name="localTasksCounter" value="17" />
<task id="LOCAL-00017" summary="Messed up player by setting money to 1000">
<created>1552181667375</created>
<option name="number" value="00017" />
<option name="presentableId" value="LOCAL-00017" />
<option name="project" value="LOCAL" />
<updated>1552181667376</updated>
</task>
<task id="LOCAL-00018" summary="Please find error">
<created>1552187032139</created>
<option name="number" value="00018" />
<option name="presentableId" value="LOCAL-00018" />
<option name="project" value="LOCAL" />
<updated>1552187032139</updated>
</task>
<task id="LOCAL-00019" summary="Super broken but fight button is in progress for shipwarfare">
<created>1552195966566</created>
<option name="number" value="00019" />
<option name="presentableId" value="LOCAL-00019" />
<option name="project" value="LOCAL" />
<updated>1552195966566</updated>
</task>
<option name="localTasksCounter" value="20" />
<servers />
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="86614000" />
<option name="totallyTimeSpent" value="58950000" />
</component>
<component name="ToolWindowManager">
<frame x="1672" y="264" width="1376" height="744" extended-state="6" />
<frame x="48" y="23" width="1189" height="652" extended-state="0" />
<editor active="true" />
<layout>
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.16945289" />
<window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.23016565" />
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
<window_info id="Image Layers" order="2" />
<window_info id="Designer" order="3" />
@@ -525,7 +437,7 @@
<window_info id="Favorites" order="6" side_tool="true" />
<window_info anchor="bottom" id="Message" order="0" />
<window_info anchor="bottom" id="Find" order="1" weight="0.32922733" />
<window_info active="true" anchor="bottom" id="Run" order="2" sideWeight="0.49924013" visible="true" weight="0.049099836" />
<window_info anchor="bottom" id="Run" order="2" weight="0.9357143" />
<window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
@@ -534,8 +446,8 @@
<window_info anchor="bottom" id="Version Control" order="8" sideWeight="0.49938875" weight="0.32922733" />
<window_info anchor="bottom" id="Database Changes" order="9" />
<window_info anchor="bottom" id="Terminal" order="10" weight="0.32922733" />
<window_info anchor="bottom" id="Event Log" order="11" sideWeight="0.5007599" side_tool="true" weight="0.54664487" />
<window_info anchor="bottom" id="Messages" order="12" sideWeight="0.49938875" weight="0.32922733" />
<window_info anchor="bottom" id="Event Log" order="11" sideWeight="0.50061125" side_tool="true" weight="0.32922733" />
<window_info anchor="bottom" id="Messages" order="12" sideWeight="0.49938875" weight="0.32857144" />
<window_info anchor="bottom" id="Duplicate detector" order="13" weight="0.32922733" />
<window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
<window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
@@ -593,6 +505,22 @@
</list>
</option>
</component>
<component name="Vcs.Log.Tabs.Properties">
<option name="RECENT_FILTERS">
<map>
<entry key="Branch">
<value>
<list />
</value>
</entry>
<entry key="User">
<value>
<list />
</value>
</entry>
</map>
</option>
</component>
<component name="VcsManagerConfiguration">
<ignored-roots>
<path value="$PROJECT_DIR$" />
@@ -608,11 +536,16 @@
<MESSAGE value="Fixed stupid problem where you can't access methods above yours" />
<MESSAGE value="Brought back Vikram's changes" />
<MESSAGE value="Fixed the commenting on a lot of the code. Also added some stuff to Travel, fixed some bugs." />
<MESSAGE value="Fixed some little problems with documenting." />
<MESSAGE value="Basic layout for ShipwarefareGUI." />
<MESSAGE value="Added basic functionality with KahootChampion" />
<MESSAGE value="Added some logic to ShipWarfareGUI" />
<option name="LAST_COMMIT_MESSAGE" value="Added some logic to ShipWarfareGUI" />
<MESSAGE value="Added time stuff to Shipwarfare GUI" />
<MESSAGE value="Nitified of getting attacked" />
<MESSAGE value="Notified of getting attacked" />
<MESSAGE value="Added fight stuff" />
<MESSAGE value="Made ShipWarfare easier to access by ShipWarfareGUI" />
<MESSAGE value="Missed one statement that I needed to encapsulate" />
<MESSAGE value="Messed up player by setting money to 1000" />
<MESSAGE value="Please find error" />
<MESSAGE value="Super broken but fight button is in progress for shipwarfare" />
<option name="LAST_COMMIT_MESSAGE" value="Super broken but fight button is in progress for shipwarfare" />
</component>
<component name="editorHistoryManager">
<entry file="uml://JAVA/ShipWarfare">
@@ -654,246 +587,68 @@
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/Game.java" />
<entry file="file://$PROJECT_DIR$/.idea/workspace.xml">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/src/Bank.java">
<entry file="file://$PROJECT_DIR$/src/Warehouse.java" />
<entry file="file://$PROJECT_DIR$/src/Bank.java" />
<entry file="file://$PROJECT_DIR$/src/TaipanShop.java" />
<entry file="file://$PROJECT_DIR$/src/Travel.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="17">
<caret line="7" column="6" selection-start-line="7" selection-start-column="6" selection-end-line="7" selection-end-column="6" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/Warehouse.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="34">
<caret line="2" column="3" selection-start-line="2" selection-start-column="3" selection-end-line="2" selection-end-column="3" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/ShipWarfareGUIBase.java" />
<entry file="file://$PROJECT_DIR$/src/TaipanShop.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="525">
<caret line="715" column="22" selection-start-line="715" selection-start-column="12" selection-end-line="715" selection-end-column="22" />
<state relative-caret-position="27">
<caret line="125" column="63" selection-start-line="125" selection-start-column="63" selection-end-line="125" selection-end-column="63" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="jar://C:/Program Files/Java/jdk1.8.0_141/javafx-src.zip!/javafx/application/Application.java">
<entry file="jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/javafx-src.zip!/com/sun/glass/ui/InvokeLaterDispatcher.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="199">
<caret line="253" selection-start-line="253" selection-end-line="253" />
</state>
</provider>
</entry>
<entry file="file://$USER_HOME$/Desktop/Shiv, Alex, Jovan and, Harkamal Final Project/Pandit/src/pandit/Battle.fxml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="221">
<caret line="13" column="54" selection-start-line="13" selection-end-line="14" />
</state>
</provider>
<provider editor-type-id="JavaFX-Scene-Builder" />
</entry>
<entry file="file://$USER_HOME$/Desktop/Shiv, Alex, Jovan and, Harkamal Final Project/Pandit/src/pandit/DialogueJHare.fxml">
<provider selected="true" editor-type-id="text-editor" />
<provider editor-type-id="JavaFX-Scene-Builder" />
</entry>
<entry file="file://$USER_HOME$/Desktop/Shiv, Alex, Jovan and, Harkamal Final Project/Pandit/src/pandit/DialogueLRam.fxml">
<provider selected="true" editor-type-id="text-editor" />
<provider editor-type-id="JavaFX-Scene-Builder" />
</entry>
<entry file="file://$USER_HOME$/Desktop/Shiv, Alex, Jovan and, Harkamal Final Project/Pandit/src/fxmlController/Dialogue0Controller.java">
<provider selected="true" editor-type-id="text-editor">
<state>
<folding>
<element signature="method#handleButtonNext#0;class#Dialogue0Controller#0" />
<element signature="method#dialogue#0;class#Dialogue0Controller#0" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$USER_HOME$/Desktop/Shiv, Alex, Jovan and, Harkamal Final Project/Pandit/src/pandit/DialogueLJi.fxml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="289">
<caret line="17" column="15" lean-forward="true" selection-start-line="17" selection-start-column="15" selection-end-line="17" selection-end-column="15" />
</state>
</provider>
<provider editor-type-id="JavaFX-Scene-Builder" />
</entry>
<entry file="file://$PROJECT_DIR$/src/ShipWarfareGUI.fxml" />
<entry file="file://$PROJECT_DIR$/src/GUI.java" />
<entry file="file://$PROJECT_DIR$/src/fxmlControllers/shopFXML.java" />
<entry file="file://$PROJECT_DIR$/src/fxmlControllers/shipFXML.java" />
<entry file="file://$PROJECT_DIR$/src/ShopGUI.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="5508">
<caret line="324" column="43" selection-start-line="324" selection-start-column="43" selection-end-line="324" selection-end-column="43" />
<state relative-caret-position="140">
<caret line="110" column="19" selection-start-line="110" selection-start-column="19" selection-end-line="110" selection-end-column="19" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/ShipWarfare.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-986">
<caret line="22" column="34" lean-forward="true" selection-start-line="22" selection-start-column="34" selection-end-line="22" selection-end-column="34" />
<state relative-caret-position="5025">
<caret line="353" column="100" selection-end-line="503" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="jar://C:/Program Files/Java/jdk1.8.0_141/javafx-src.zip!/javafx/event/EventHandler.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="357">
<caret line="44" column="9" selection-start-line="44" selection-start-column="9" selection-end-line="44" selection-end-column="9" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-421">
<caret line="2" column="41" selection-start-line="2" selection-start-column="41" selection-end-line="2" selection-end-column="41" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/Player.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-1934">
<caret line="56" column="5" selection-start-line="56" selection-start-column="5" selection-end-line="56" selection-end-column="5" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/ShipWarfareGUI.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="279">
<caret line="682" selection-start-line="682" selection-end-line="682" />
<folding>
<element signature="e#763#794#0" expanded="true" />
<element signature="e#1208#1209#0" expanded="true" />
<element signature="e#1236#1237#0" expanded="true" />
<element signature="e#17682#17683#0" expanded="true" />
<element signature="e#17720#17721#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/ShopGUI.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="117">
<caret line="458" selection-start-line="458" selection-end-line="466" selection-end-column="11" />
<folding>
<element signature="imports" expanded="true" />
<element signature="e#1879#2020#0" />
<element signature="e#2026#2140#0" />
<element signature="e#2026#2268#0" />
<element signature="e#2274#2524#0" />
<element signature="e#2274#2657#0" />
<element signature="e#2663#2887#0" />
<element signature="e#2663#3001#0" />
<element signature="e#3007#3133#0" />
<element signature="e#3205#3412#0" />
<element signature="e#3205#3546#0" />
<element signature="e#3552#3676#0" />
<element signature="e#3746#3950#0" />
<element signature="e#3746#4079#0" />
<element signature="e#4022#4073#1" />
<element signature="e#4085#4209#0" />
<element signature="e#4279#4483#0" />
<element signature="e#4279#4612#0" />
<element signature="e#4618#4757#0" />
<element signature="e#4833#5046#0" />
<element signature="e#4833#5190#0" />
<element signature="e#5196#5297#0" />
<element signature="e#5196#7354#0" />
<element signature="e#10976#16179#0" />
<element signature="e#11276#11422#1" />
<element signature="e#11480#11600#1" />
<element signature="e#11645#11797#1" />
<element signature="e#12094#12214#1" />
<element signature="e#12258#12409#1" />
<element signature="e#12704#12824#1" />
<element signature="e#12867#13018#1" />
<element signature="e#13325#13445#1" />
<element signature="e#13704#16173#1" />
<element signature="e#13801#13949#1" />
<element signature="e#14007#14138#1" />
<element signature="e#14183#14336#1" />
<element signature="e#14624#14755#1" />
<element signature="e#14799#14951#1" />
<element signature="e#15237#15368#1" />
<element signature="class#20468:20804" />
<element signature="class#20968:21155" />
<element signature="class#21497:21689" />
<element signature="class#21854:22047" />
<element signature="class#22296:22485" />
<element signature="class#22689:22842" />
<element signature="class#23135:23794" />
<element signature="class#24032:24686" />
<element signature="class#24848:25502" />
<element signature="class#25837:26512" />
<element signature="e#31300#31833#0" />
<element signature="e#31843#32457#0" />
<element signature="e#32467#34046#0" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/Travel.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1564">
<caret line="95" column="19" selection-start-line="95" selection-start-column="19" selection-end-line="95" selection-end-column="19" />
<folding>
<element signature="imports" expanded="true" />
</folding>
<state relative-caret-position="135">
<caret line="9" column="4" selection-end-line="55" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/Start.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="51">
<caret line="3" selection-start-line="3" selection-end-line="35" />
<state relative-caret-position="15">
<caret line="1" column="13" selection-start-line="1" selection-start-column="13" selection-end-line="1" selection-end-column="13" />
</state>
</provider>
</entry>
<entry file="jar://C:/Program Files/Java/jdk1.8.0_141/javafx-src.zip!/com/sun/glass/ui/View.java">
<entry file="file://$PROJECT_DIR$/src/ShopGUI">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/src/Player.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="4262">
<caret line="554" selection-start-line="554" selection-end-line="554" />
<state relative-caret-position="135">
<caret line="9" column="32" selection-start-line="9" selection-start-column="32" selection-end-line="9" selection-end-column="32" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/TravelGUI.java">
<entry file="file://$PROJECT_DIR$/src/ShipWarfareGUI.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="2567">
<caret line="174" column="38" selection-start-line="174" selection-start-column="23" selection-end-line="174" selection-end-column="38" />
<folding>
<element signature="e#1244#1245#0" expanded="true" />
<element signature="e#1272#1273#0" expanded="true" />
<element signature="e#2274#2657#0" />
<element signature="e#2663#3001#0" />
<element signature="e#6546#8362#1" />
<element signature="docComment;method#seaAtlas#0;class#TravelGUI#0" />
<element signature="method#seaAtlas#0;class#TravelGUI#0" />
<element signature="docComment;method#randomEventSea#0;class#TravelGUI#0" />
<element signature="method#randomEventSea#0;class#TravelGUI#0" />
<element signature="docComment;method#disaster#0;class#TravelGUI#0" />
<element signature="e#31300#31833#0" />
<element signature="e#31843#32457#0" />
<element signature="e#32467#34046#0" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/StartGUI.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="230">
<caret line="147" column="20" selection-start-line="147" selection-start-column="20" selection-end-line="147" selection-end-column="20" />
<state relative-caret-position="608">
<caret line="47" lean-forward="true" selection-start-line="47" selection-end-line="47" />
<folding>
<element signature="imports" expanded="true" />
<element signature="e#639#640#0" expanded="true" />
<element signature="e#667#668#0" expanded="true" />
<element signature="e#17426#17427#0" expanded="true" />
<element signature="e#17464#17465#0" expanded="true" />
</folding>
</state>
</provider>

View File

@@ -29,16 +29,22 @@ import static javafx.application.Application.launch;
public class ShipWarfareGUI extends Application {
private Player player = new Player();
private ShipWarfare shipWarfare = new ShipWarfare(player);
private Player player = new Player();
private ShipWarfare shipWarfare = new ShipWarfare(player);
private HBox hBox;
private Button button1;
private Button button2;
private Button fightButton;
private Button runButton;
private VBox vBox;
private Label label1;
private Label label;
private VBox vBox0;
private Label label0;
private Label title;
private Label chooseFightOrRun;
private Label report;
private Label runAwayOrLeft;
private Label shipsRemaining;
private Label HPLeft;
private Label gunsLeftOrTaken;
private Label continueToFight;
public static void main(String args[]) {
@@ -53,14 +59,6 @@ public class ShipWarfareGUI extends Application {
private int howMuchRun = 0;
private String pirateName = "Liu Yen";
/**
* Class Constructor that takes in a type player as a parameter
* @param player object of the class Player
*/
public ShipWarfareGUI(Player player) {
Player playerDummy = new Player(player);
this.player = playerDummy;
}
/**
* setter method for player
@@ -88,15 +86,13 @@ public class ShipWarfareGUI extends Application {
Scanner userResponse = new Scanner(System.in);
setNumOfPeasantShips(numOfShips());
System.out.printf("By Golly! We have $%,d and are being attacked by %d Merchant ships\nCurrently our ship status is %d%%\n", player.getMoney(), numOfPeasantShips, player.getHP());
title.setText(String.format("By Golly! We have $%,d and are being attacked by %d Merchant ships\nCurrently our ship status is %d%%\n", player.getMoney(), numOfPeasantShips, player.getHP()));
fightOrRunMessage();
while (true) {
String response = userResponse.nextLine();
if (response.equalsIgnoreCase("f")) {
userAttacks = true;
System.out.println("Ohh, fight ehh?");
delayForSeconds(1);
boolean winOrLose = destroyPeasantShipsOrEscape();
if (winOrLose == true) {
break;
@@ -147,7 +143,6 @@ public class ShipWarfareGUI extends Application {
break;
} else {
System.out.println("Phew! Got away safely");
delayForSeconds(2);
break;
}
@@ -263,13 +258,10 @@ public class ShipWarfareGUI extends Application {
break;
}
System.out.println("Got eem");
delayForSeconds(1);
} else if (hitOrMiss == 2) {
System.out.printf("ARRG! We missed %s\n", player.getName());
delayForSeconds(1);
} else {
System.out.println("Darn! Their fleet tanked our attack");
delayForSeconds(1);
}
@@ -279,7 +271,6 @@ public class ShipWarfareGUI extends Application {
}
} else {
System.out.printf("%s! We don't have any GUNS!!!!\n",player.getName());
delayForSeconds(1);
}
@@ -306,7 +297,6 @@ public class ShipWarfareGUI extends Application {
System.out.printf("%d ships remaining\n", numOfLittyShips);
System.out.println("Oh no, they are taking the offensive!");
delayForSeconds(1);
//Computer volley
int takeGunChance = randomValue.nextInt(4) + 1;
if (takeGunChance == 1 && player.getGuns() > 0) {
@@ -320,7 +310,6 @@ public class ShipWarfareGUI extends Application {
break;
}
System.out.printf("EEK, our current ship status is %d%% \n", player.getHP());
delayForSeconds(1);
if (userAttacks == false) {
userAttacks = true;
}
@@ -331,10 +320,8 @@ public class ShipWarfareGUI extends Application {
if (response.equalsIgnoreCase("r")) {
if (runFromShips() == false) {
System.out.println("Couldn't run away");
delayForSeconds(1);
} else {
System.out.println("Phew! Got away safely");
delayForSeconds(2);
break;
}
}
@@ -345,11 +332,9 @@ public class ShipWarfareGUI extends Application {
if (exitValue == 1) {
System.out.printf("\nGot eem\nVictory!\nIt appears we have defeated the enemy fleet and made it out at %d%% ship status\n", player.getHP());
delayForSeconds(1);
calculateLoot = (randomValue.nextInt(startingLittyShips) + startingLittyShips) * 300;
player.setMoney(player.getMoney() + calculateLoot);
System.out.printf("We got $%,d!\n", calculateLoot);
delayForSeconds(2);
return true;
} else if (exitValue == 2) {
player.gameOver();
@@ -357,7 +342,6 @@ public class ShipWarfareGUI extends Application {
return true;
} else if (exitValue == 3) {
System.out.printf("We made it out at %d%% ship status!\n", player.getHP());
delayForSeconds(2);
return true;
}
return false;
@@ -371,11 +355,23 @@ public class ShipWarfareGUI extends Application {
* @throws Exception in case of errors due to the delay
*/
public void wipe(){
title.setVisible(false);
runAwayOrLeft.setVisible(false);
shipsRemaining.setVisible(false);
HPLeft.setVisible(false);
gunsLeftOrTaken.setVisible(false);
continueToFight.setVisible(false);
}
public boolean destroyPeasantShipsOrEscape() throws Exception {
int calculateLoot = 0;
int chanceOfEnemyRun = 0;
int hitCounter=0;
int missCounter=0;
boolean gunFrustration= false;
Scanner userInput = new Scanner(System.in);
@@ -396,10 +392,8 @@ public class ShipWarfareGUI extends Application {
break;
}
hitCounter++;
delayForSeconds(1);
} else {
missCounter++;
delayForSeconds(1);
}
@@ -407,11 +401,10 @@ public class ShipWarfareGUI extends Application {
continue;
}
}
label1.setText(String.format("Report:\nShips we hit: %d\nShots missed: %d", hitCounter,missCounter));
report.setText(String.format("Report: Ships we hit: %d Shots missed: %d", hitCounter,missCounter));
}
else{
label1.setText("We don't have any guns!!!");
delayForSeconds(1);
report.setText("We don't have any guns!!!");
}
@@ -429,23 +422,20 @@ public class ShipWarfareGUI extends Application {
setNumOfPeasantShips(numOfPeasantShips - howMuchRun);
if (userAttacks == true) {
System.out.printf("Ahhh, %d ships ran away %s!\n", howMuchRun, player.getName());
runAwayOrLeft.setText(String.format("Ahhh, %d ships ran away %s! ", howMuchRun, player.getName()));
} else {
System.out.printf("Escaped %d of them!\n", howMuchRun);
runAwayOrLeft.setText(String.format("Escaped %d of them! ", howMuchRun));
}
}
}
}
System.out.printf("%d ships remaining\n", numOfPeasantShips);
delayForSeconds(1);
System.out.println("Oh no, they are taking the offensive!");
delayForSeconds(1);
shipsRemaining.setText(String.format("%d ships remaining and they look angry!", numOfPeasantShips));
//Computer volley
int takeGunChance = randomValue.nextInt(4) + 1;
if (takeGunChance == 1 && player.getGuns() > 0) {
player.setGuns(player.getGuns() - 1);
System.out.println("Dang it! They destroyed one of our guns");
gunFrustration=true;
} else {
player.setHP(player.getHP() - (1 + randomValue.nextInt(10)));
}
@@ -453,42 +443,55 @@ public class ShipWarfareGUI extends Application {
exitValue = 2;
break;
}
System.out.printf("EEK, our current ship status is %d%% \n", player.getHP());
delayForSeconds(1);
if(gunFrustration==true){
gunsLeftOrTaken.setText(String.format("Dang it! We only have %d guns left", player.getGuns()));
}
else{
gunsLeftOrTaken.setText(String.format("We still have %d guns left", player.getGuns()));
}
HPLeft.setText(String.format("EEK, our current ship status is %d%% ", player.getHP()));
if (userAttacks == false) {
userAttacks = true;
}
System.out.printf("Shall we continue to fight? Enter \"f\" to fight, and \"r\" to run (We have %d gun(s) left)\n", player.getGuns());
continueToFight.setText(String.format("Shall we continue to fight? (Click the fight button or the run button)", player.getGuns()));
if (runButton.isPressed()) {
String response = userInput.nextLine();
if (response.equalsIgnoreCase("r")) {
if (runFromShips() == false) {
System.out.println("Couldn't run away");
wipe();
chooseFightOrRun.setText("Couldn't run away");
} else {
exitValue = 3;
break;
}
}
else if(fightButton.isPressed()){
title.setText("AYYYYYYYYYYY");
}
else{
}
}
if (exitValue == 1) {
wipe();
chooseFightOrRun.setText(String.format("Ayy We won! We survived at %d ship status!", player.getHP()));
System.out.printf("\nGot eem\nVictory!\nIt appears we have defeated the enemy fleet and made it out at %d%% ship status\n", player.getHP());
delayForSeconds(1);
calculateLoot = (randomValue.nextInt(startingPeasantShips) + startingPeasantShips) * 100;
player.setMoney(player.getMoney() + calculateLoot);
System.out.printf("We got $%,d!", calculateLoot);
delayForSeconds(2);
report.setText(String.format("We got $%,d! ",calculateLoot));
return true;
} else if (exitValue == 2) {
player.gameOver();
return true;
} else if (exitValue == 3) {
System.out.printf("We made it out at %d%% ship status!\n", player.getHP());
delayForSeconds(2);
return true;
}
return false;
@@ -521,7 +524,7 @@ public class ShipWarfareGUI extends Application {
public void setLabel1(String sysOut) {
label1.setText(sysOut);
report.setText(sysOut);
}
/*
@@ -533,7 +536,7 @@ public class ShipWarfareGUI extends Application {
*/
public void start(Stage stage) throws Exception {
shipWarfare.setNumOfPeasantShips(shipWarfare.numOfShips());
setNumOfPeasantShips(numOfShips());
BorderPane BorderPane = new BorderPane();
@@ -543,13 +546,19 @@ public class ShipWarfareGUI extends Application {
gridPane.setVgap(5.0);
hBox = new HBox();
button1 = new Button();
button2 = new Button();
fightButton = new Button();
runButton = new Button();
vBox = new VBox();
label1 = new Label();
label = new Label();
vBox0 = new VBox();
label0 = new Label();
title = new Label();
chooseFightOrRun = new Label();
report = new Label();
runAwayOrLeft = new Label();
shipsRemaining = new Label();
HPLeft = new Label();
gunsLeftOrTaken = new Label();
continueToFight = new Label();
BorderPane.setPrefHeight(400.0);
BorderPane.setPrefWidth(600.0);
@@ -558,16 +567,22 @@ public class ShipWarfareGUI extends Application {
hBox.setPrefWidth(200.0);
hBox.setSpacing(10.0);
button1.setAlignment(javafx.geometry.Pos.CENTER);
button1.setContentDisplay(javafx.scene.control.ContentDisplay.CENTER);
button1.setId("Button1");
button1.setMnemonicParsing(false);
button1.setText("Fight");
title.setAlignment(javafx.geometry.Pos.TOP_CENTER);
title.setContentDisplay(javafx.scene.control.ContentDisplay.CENTER);
title.setId("Label1");
title.setText(String.format("%d ships attacking. Would you like to Fight or Run?",numOfPeasantShips));
title.setPadding(new Insets(6.0, 0.0, 0.0, 0.0));
button2.setAlignment(javafx.geometry.Pos.CENTER);
button2.setId("Button2");
button2.setMnemonicParsing(false);
button2.setText("Run");
fightButton.setAlignment(javafx.geometry.Pos.CENTER);
fightButton.setContentDisplay(javafx.scene.control.ContentDisplay.CENTER);
fightButton.setId("Button1");
fightButton.setMnemonicParsing(false);
fightButton.setText("Fight");
runButton.setAlignment(javafx.geometry.Pos.CENTER);
runButton.setId("Button2");
runButton.setMnemonicParsing(false);
runButton.setText("Run");
BorderPane.setBottom(hBox);
BorderPane.setAlignment(vBox, javafx.geometry.Pos.CENTER);
@@ -576,76 +591,45 @@ public class ShipWarfareGUI extends Application {
vBox.setPrefWidth(100.0);
vBox.setSpacing(20.0);
label1.setAlignment(javafx.geometry.Pos.TOP_CENTER);
label1.setContentDisplay(javafx.scene.control.ContentDisplay.CENTER);
label1.setId("Label1");
label1.setPadding(new Insets(6.0, 0.0, 0.0, 0.0));
report.setAlignment(javafx.geometry.Pos.TOP_CENTER);
report.setContentDisplay(javafx.scene.control.ContentDisplay.CENTER);
report.setId("Label1");
report.setPadding(new Insets(6.0, 0.0, 0.0, 0.0));
vBox.setPadding(new Insets(0.0, 0.0, 10.0, 0.0));
BorderPane.setTop(vBox);
BorderPane.setPadding(new Insets(6.0, 0.0, 0.0, 0.0));
vBox0.setAlignment(javafx.geometry.Pos.TOP_CENTER);
vBox0.setPrefHeight(200.0);
vBox0.setPrefWidth(100.0);
vBox0.setSpacing(5.0);
hBox.getChildren().add(button1);
hBox.getChildren().add(button2);
vBox.getChildren().add(label1);
vBox.getChildren().add(label);
vBox0.getChildren().add(label0);
vBox.getChildren().add(vBox0);
int calculateLoot = 0;
int chanceOfEnemyRun = 0;
hBox.getChildren().add(fightButton);
hBox.getChildren().add(runButton);
vBox.getChildren().add(title);
vBox.getChildren().add(chooseFightOrRun);
vBox.getChildren().add(report);
vBox.getChildren().add(runAwayOrLeft);
vBox.getChildren().add(shipsRemaining);
vBox.getChildren().add(HPLeft);
vBox.getChildren().add(gunsLeftOrTaken);
vBox.getChildren().add(continueToFight);
//label1.setText(String.format("By Golly! We have $%,d and are being attacked by %d Merchant ships\nCurrently our ship status is %d%%\n", player.getMoney(), shipWarfare.getNumOfPeasantShips(), player.getHP()));
label.setText("What would you like to do?");
//report.setText(String.format("By Golly! We have $%,d and are being attacked by %d Merchant ships\nCurrently our ship status is %d%%\n", player.getMoney(), shipWarfare.getNumOfPeasantShips(), player.getHP()));
//Fight
button1.setOnAction(new EventHandler<ActionEvent>() {
fightButton.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
public void handle(ActionEvent event) {
counter++;
if (counter == 1) {
label.setText("Ohh, Fight ehh?");
chooseFightOrRun.setText("Ohh, Fight ehh?");
try {
destroyPeasantShipsOrEscape();
}
catch(Exception e){
int hitCounter=0;
int missCounter=0;
Random randomValue = new Random();
int exitValue = 0;
while (exitValue == 0) {
if (player.getGuns() > 0) {
for (int j = 0; j < player.getGuns(); j++) {
if (userAttacks == true) {
int hitOrMiss = randomValue.nextInt(2) + 1;
if (hitOrMiss == 2) {
numOfPeasantShips--;
if (numOfPeasantShips <= 0) {
exitValue = 1;
break;
}
hitCounter++;
delayForSeconds(1);
} else {
missCounter++;
delayForSeconds(1);
}
} else {
continue;
}
}
label1.setText(String.format("Report:\nShips we hit: %d\nShots missed: %d", hitCounter, missCounter));
} else {
label1.setText("We don't have any guns!!!");
delayForSeconds(1);
}
}
@@ -653,30 +637,30 @@ public class ShipWarfareGUI extends Application {
}
if (counter == 2) {
System.out.println("You pressed the button twice.");
button1.setVisible(false);
button2.setVisible(false);
button1.setDisable(true);
button2.setDisable(true);
fightButton.setVisible(false);
runButton.setVisible(false);
fightButton.setDisable(true);
runButton.setDisable(true);
}
}
});
//Flee
button2.setOnAction(new EventHandler<ActionEvent>() {
runButton.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
counter++;
if (counter == 1) {
label1.setText("Ohh, Run ehh?");
chooseFightOrRun.setText("Ohh, Run ehh?");
}
if (counter == 2) {
System.out.println("You pressed the button twice.");
button1.setVisible(false);
button2.setVisible(false);
button1.setDisable(true);
button2.setDisable(true);
fightButton.setVisible(false);
runButton.setVisible(false);
fightButton.setDisable(true);
runButton.setDisable(true);
}
}
});