Fixed numOfShips method for ShipWarfareGUI

This commit is contained in:
KahootChampion
2019-03-10 01:14:37 -07:00
parent e5807a46af
commit 36aa789590
4 changed files with 89 additions and 60 deletions

2
.idea/misc.xml generated
View File

@@ -9,7 +9,7 @@
<component name="ProjectKey"> <component name="ProjectKey">
<option name="state" value="project://63537948-39a4-48a0-9c97-34259a0fa913" /> <option name="state" value="project://63537948-39a4-48a0-9c97-34259a0fa913" />
</component> </component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8.0_141" project-jdk-type="JavaSDK"> <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8.0_201" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" /> <output url="file://$PROJECT_DIR$/out" />
</component> </component>
<component name="SvnBranchConfigurationManager"> <component name="SvnBranchConfigurationManager">

132
.idea/workspace.xml generated
View File

@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="3114a2b9-4919-4fdf-8fd9-d03b60109ce4" name="Default Changelist" comment=""> <list default="true" id="3114a2b9-4919-4fdf-8fd9-d03b60109ce4" name="Default Changelist" comment="Shipwarfare fight button GUI almost complete">
<change beforePath="$PROJECT_DIR$/.idea/misc.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/misc.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/Player.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Player.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/ShipWarfareGUI.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/ShipWarfareGUI.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/ShipWarfareGUI.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/ShipWarfareGUI.java" afterDir="false" />
</list> </list>
<ignored path="$PROJECT_DIR$/out/" /> <ignored path="$PROJECT_DIR$/out/" />
@@ -19,8 +21,8 @@
<file pinned="false" current-in-tab="false"> <file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/ShipWarfare.java"> <entry file="file://$PROJECT_DIR$/src/ShipWarfare.java">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="5025"> <state relative-caret-position="199">
<caret line="353" column="100" selection-end-line="503" /> <caret line="331" lean-forward="true" selection-start-line="331" selection-end-line="331" />
<folding> <folding>
<element signature="imports" expanded="true" /> <element signature="imports" expanded="true" />
</folding> </folding>
@@ -31,12 +33,15 @@
<file pinned="false" current-in-tab="true"> <file pinned="false" current-in-tab="true">
<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="608"> <state relative-caret-position="310">
<caret line="47" lean-forward="true" selection-start-line="47" selection-end-line="47" /> <caret line="216" column="5" lean-forward="true" selection-start-line="216" selection-start-column="5" selection-end-line="216" selection-end-column="5" />
<folding> <folding>
<element signature="imports" expanded="true" /> <element signature="imports" expanded="true" />
<element signature="e#17426#17427#0" expanded="true" /> <element signature="e#762#793#0" expanded="true" />
<element signature="e#17464#17465#0" expanded="true" /> <element signature="e#1354#1355#0" expanded="true" />
<element signature="e#1382#1383#0" expanded="true" />
<element signature="e#17505#17506#0" expanded="true" />
<element signature="e#17543#17544#0" expanded="true" />
</folding> </folding>
</state> </state>
</provider> </provider>
@@ -60,16 +65,11 @@
</provider> </provider>
</entry> </entry>
</file> </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"> <file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/Player.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="135"> <state relative-caret-position="89">
<caret line="9" column="32" selection-start-line="9" selection-start-column="32" selection-end-line="9" selection-end-column="32" /> <caret line="8" column="29" lean-forward="true" selection-start-line="8" selection-start-column="29" selection-end-line="8" selection-end-column="29" />
</state> </state>
</provider> </provider>
</entry> </entry>
@@ -85,15 +85,6 @@
</component> </component>
<component name="FindInProjectRecents"> <component name="FindInProjectRecents">
<findStrings> <findStrings>
<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>numOfpeasantShips</find>
<find>startingPeasantShips</find> <find>startingPeasantShips</find>
<find>startingLittyShips</find> <find>startingLittyShips</find>
@@ -112,9 +103,18 @@
<find>destr</find> <find>destr</find>
<find>destro</find> <find>destro</find>
<find>hitco</find> <find>hitco</find>
<find>setNum</find>
<find>game</find> <find>game</find>
<find>numOf</find> <find>numOf</find>
<find>mis</find>
<find>exitValue</find>
<find>getGuns</find>
<find>frustRat</find>
<find>counter++</find>
<find>setMone</find>
<find>setNum</find>
<find>We survive</find>
<find>total of</find>
<find>int numOfShips</find>
</findStrings> </findStrings>
<replaceStrings> <replaceStrings>
<replace>HP</replace> <replace>HP</replace>
@@ -138,8 +138,8 @@
<option value="$PROJECT_DIR$/src/TaipanShop.java" /> <option value="$PROJECT_DIR$/src/TaipanShop.java" />
<option value="$PROJECT_DIR$/src/main.java" /> <option value="$PROJECT_DIR$/src/main.java" />
<option value="$PROJECT_DIR$/src/Travel.java" /> <option value="$PROJECT_DIR$/src/Travel.java" />
<option value="$PROJECT_DIR$/src/Player.java" />
<option value="$PROJECT_DIR$/src/ShipWarfare.java" /> <option value="$PROJECT_DIR$/src/ShipWarfare.java" />
<option value="$PROJECT_DIR$/src/Player.java" />
<option value="$PROJECT_DIR$/src/ShipWarfareGUI.java" /> <option value="$PROJECT_DIR$/src/ShipWarfareGUI.java" />
</list> </list>
</option> </option>
@@ -156,8 +156,6 @@
<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>
@@ -174,13 +172,15 @@
<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="1552196488451" /> <property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1552200809349" />
<property name="extract.method.default.visibility" value="private" /> <property name="extract.method.default.visibility" value="private" />
<property name="last_opened_file_path" value="$PROJECT_DIR$/../GitHub/Cpsc233" /> <property name="last_opened_file_path" value="$PROJECT_DIR$/../GitHub/Cpsc233" />
<property name="project.structure.last.edited" value="Project" /> <property name="project.structure.last.edited" value="Project" />
@@ -284,6 +284,11 @@
<workItem from="1552195875453" duration="55000" /> <workItem from="1552195875453" duration="55000" />
<workItem from="1552195941602" duration="33000" /> <workItem from="1552195941602" duration="33000" />
<workItem from="1552195980542" duration="513000" /> <workItem from="1552195980542" duration="513000" />
<workItem from="1552197114688" duration="110000" />
<workItem from="1552198897279" duration="7000" />
<workItem from="1552199842131" duration="998000" />
<workItem from="1552201459117" duration="275000" />
<workItem from="1552203562938" duration="2064000" />
</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>
@@ -418,17 +423,38 @@
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1552195966566</updated> <updated>1552195966566</updated>
</task> </task>
<option name="localTasksCounter" value="20" /> <task id="LOCAL-00020" summary="Forces you to fight in ShipWarfareGUI unfortunately">
<created>1552197150577</created>
<option name="number" value="00020" />
<option name="presentableId" value="LOCAL-00020" />
<option name="project" value="LOCAL" />
<updated>1552197150577</updated>
</task>
<task id="LOCAL-00021" summary="ShipWarfare fight button coming along nicely">
<created>1552200771732</created>
<option name="number" value="00021" />
<option name="presentableId" value="LOCAL-00021" />
<option name="project" value="LOCAL" />
<updated>1552200771732</updated>
</task>
<task id="LOCAL-00022" summary="Shipwarfare fight button GUI almost complete">
<created>1552203599900</created>
<option name="number" value="00022" />
<option name="presentableId" value="LOCAL-00022" />
<option name="project" value="LOCAL" />
<updated>1552203599900</updated>
</task>
<option name="localTasksCounter" value="23" />
<servers /> <servers />
</component> </component>
<component name="TimeTrackingManager"> <component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="58950000" /> <option name="totallyTimeSpent" value="62404000" />
</component> </component>
<component name="ToolWindowManager"> <component name="ToolWindowManager">
<frame x="48" y="23" width="1189" height="652" extended-state="0" /> <frame x="48" y="23" width="1189" height="652" extended-state="0" />
<editor active="true" /> <editor active="true" />
<layout> <layout>
<window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.23016565" /> <window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.24934612" />
<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" />
@@ -545,7 +571,10 @@
<MESSAGE value="Messed up player by setting money to 1000" /> <MESSAGE value="Messed up player by setting money to 1000" />
<MESSAGE value="Please find error" /> <MESSAGE value="Please find error" />
<MESSAGE value="Super broken but fight button is in progress for shipwarfare" /> <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" /> <MESSAGE value="Forces you to fight in ShipWarfareGUI unfortunately" />
<MESSAGE value="ShipWarfare fight button coming along nicely" />
<MESSAGE value="Shipwarfare fight button GUI almost complete" />
<option name="LAST_COMMIT_MESSAGE" value="Shipwarfare fight button GUI almost complete" />
</component> </component>
<component name="editorHistoryManager"> <component name="editorHistoryManager">
<entry file="uml://JAVA/ShipWarfare"> <entry file="uml://JAVA/ShipWarfare">
@@ -607,16 +636,7 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/src/ShipWarfare.java"> <entry file="file://$PROJECT_DIR$/src/ShopGUI" />
<provider selected="true" editor-type-id="text-editor">
<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="file://$PROJECT_DIR$/src/main.java"> <entry file="file://$PROJECT_DIR$/src/main.java">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="135"> <state relative-caret-position="135">
@@ -631,24 +651,34 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/src/ShopGUI"> <entry file="file://$PROJECT_DIR$/src/ShipWarfare.java">
<provider selected="true" editor-type-id="text-editor" /> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="199">
<caret line="331" lean-forward="true" selection-start-line="331" selection-end-line="331" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/src/Player.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="135"> <state relative-caret-position="89">
<caret line="9" column="32" selection-start-line="9" selection-start-column="32" selection-end-line="9" selection-end-column="32" /> <caret line="8" column="29" lean-forward="true" selection-start-line="8" selection-start-column="29" selection-end-line="8" selection-end-column="29" />
</state> </state>
</provider> </provider>
</entry> </entry>
<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="608"> <state relative-caret-position="310">
<caret line="47" lean-forward="true" selection-start-line="47" selection-end-line="47" /> <caret line="216" column="5" lean-forward="true" selection-start-line="216" selection-start-column="5" selection-end-line="216" selection-end-column="5" />
<folding> <folding>
<element signature="imports" expanded="true" /> <element signature="imports" expanded="true" />
<element signature="e#17426#17427#0" expanded="true" /> <element signature="e#762#793#0" expanded="true" />
<element signature="e#17464#17465#0" expanded="true" /> <element signature="e#1354#1355#0" expanded="true" />
<element signature="e#1382#1383#0" expanded="true" />
<element signature="e#17505#17506#0" expanded="true" />
<element signature="e#17543#17544#0" expanded="true" />
</folding> </folding>
</state> </state>
</provider> </provider>
@@ -693,7 +723,7 @@
</state> </state>
<state key="JdkListConfigurable.UI"> <state key="JdkListConfigurable.UI">
<settings> <settings>
<last-edited>1.8</last-edited> <last-edited>1.8.0_201</last-edited>
<splitter-proportions> <splitter-proportions>
<option name="proportions"> <option name="proportions">
<list> <list>

View File

@@ -4,13 +4,13 @@ public class Player {
private String name = "Taipan"; private String name = "Taipan";
private int bank = 0; private int bank = 0;
private int money = 0; private int money = 1000000;
private int opiumHeld = 0; private int opiumHeld = 0;
private int silkHeld = 0; private int silkHeld = 0;
private int generalHeld = 0; private int generalHeld = 0;
private int armsHeld = 0; private int armsHeld = 0;
private int location = 1; private int location = 1;
private int guns = 0; private int guns = 5;
private int HP = 100; private int HP = 100;
private int debt = 0; private int debt = 0;
private int wOpium = 0; private int wOpium = 0;

View File

@@ -1,4 +1,3 @@
import javafx.animation.PathTransition; import javafx.animation.PathTransition;
import javafx.animation.Timeline; import javafx.animation.Timeline;
import javafx.application.Application; import javafx.application.Application;
@@ -204,13 +203,13 @@ public class ShipWarfareGUI extends Application {
numOfShipsAttacking = randomValue.nextInt(20) + 1; numOfShipsAttacking = randomValue.nextInt(20) + 1;
} else if (player.getMoney() <= 200000) { } else if (player.getMoney() <= 200000) {
//Minimum 30 Ships will attack, maximum 70 //Minimum 30 Ships will attack, maximum 70
numOfShipsAttacking = randomValue.nextInt(40) + 30; numOfShipsAttacking = randomValue.nextInt(40) + 31;
} else if (player.getMoney() <= 500000) { } else if (player.getMoney() <= 500000) {
//Minimum 50 ships will attack, maximum 140 //Minimum 50 ships will attack, maximum 140
numOfShipsAttacking = randomValue.nextInt(90) + 50; numOfShipsAttacking = randomValue.nextInt(90) + 51;
} else if (player.getMoney() > 1000000) { } else if (player.getMoney() >= 1000000) {
//Minimum 100 ships will attack, maximum 300 ships //Minimum 100 ships will attack, maximum 300 ships
numOfShipsAttacking = randomValue.nextInt(3) + 100; numOfShipsAttacking = randomValue.nextInt(200) + 101;
} }
return numOfShipsAttacking; return numOfShipsAttacking;