Merge remote-tracking branch 'origin/master'

This commit is contained in:
2019-03-10 20:13:33 -06:00
4 changed files with 188 additions and 93 deletions

215
.idea/workspace.xml generated
View File

@@ -1,7 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<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$/src/TravelGUI.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TravelGUI.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/" />
@@ -14,10 +17,10 @@
<component name="FileEditorManager">
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/ShipWarfare.java">
<entry file="file://$PROJECT_DIR$/src/ShipWarfareGUI.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="255">
<caret line="17" column="35" selection-start-line="17" selection-start-column="35" selection-end-line="17" selection-end-column="35" />
<state relative-caret-position="218">
<caret line="386" column="35" selection-start-line="386" selection-start-column="35" selection-end-line="386" selection-end-column="35" />
<folding>
<element signature="imports" expanded="true" />
</folding>
@@ -25,43 +28,29 @@
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/TaipanShopGUI.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="320">
<caret line="805" column="49" lean-forward="true" selection-start-line="805" selection-end-line="806" />
</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="378">
<caret line="55" column="28" selection-start-line="53" selection-start-column="7" selection-end-line="55" selection-end-column="28" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/src/ShipWarfareGUI.java">
<entry file="file://$PROJECT_DIR$/src/TravelGUI.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="5531">
<caret line="703" column="1" selection-start-line="703" selection-start-column="1" selection-end-line="703" selection-end-column="1" />
<folding>
<element signature="imports" expanded="true" />
<element signature="e#18236#18237#0" expanded="true" />
<element signature="e#18274#18275#0" expanded="true" />
</folding>
</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="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/Player.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="120">
<caret line="8" column="29" selection-start-line="8" selection-start-column="29" selection-end-line="8" selection-end-column="29" />
<state relative-caret-position="6570">
<caret line="455" column="42" selection-start-line="455" selection-start-column="42" selection-end-line="455" selection-end-column="42" />
</state>
</provider>
</entry>
@@ -77,13 +66,6 @@
</component>
<component name="FindInProjectRecents">
<findStrings>
<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>
@@ -107,6 +89,13 @@
<find>runFromShips()</find>
<find>dang it!</find>
<find>dang it</find>
<find>destroy</find>
<find>destroyPeas</find>
<find>cash</find>
<find>op</find>
<find>continue</find>
<find>cashTex</find>
<find>cashTe</find>
</findStrings>
<replaceStrings>
<replace>HP</replace>
@@ -133,6 +122,8 @@
<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/TaipanShopGUI.java" />
<option value="$PROJECT_DIR$/src/TravelGUI.java" />
</list>
</option>
</component>
@@ -172,7 +163,7 @@
<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="1552200809349" />
<property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1552270131392" />
<property name="extract.method.default.visibility" value="private" />
<property name="last_opened_file_path" value="$PROJECT_DIR$/../GitHub/Cpsc233" />
<property name="project.structure.last.edited" value="Project" />
@@ -192,7 +183,7 @@
</list>
</option>
</component>
<component name="RunManager" selected="Application.ShipWarfareGUI">
<component name="RunManager" selected="Application.MainGUI">
<configuration name="Game" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="Game" />
<module name="TaipanClone" />
@@ -200,8 +191,8 @@
<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" />
<configuration name="MainGUI" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="MainGUI" />
<module name="TaipanClone" />
<method v="2">
<option name="Make" enabled="true" />
@@ -229,19 +220,19 @@
</method>
</configuration>
<list>
<item itemvalue="Application.ShipWarfare" />
<item itemvalue="Application.TaipanShop" />
<item itemvalue="Application.Game" />
<item itemvalue="Application.main" />
<item itemvalue="Application.ShipWarfareGUI" />
<item itemvalue="Application.MainGUI" />
</list>
<recent_temporary>
<list>
<item itemvalue="Application.MainGUI" />
<item itemvalue="Application.ShipWarfareGUI" />
<item itemvalue="Application.main" />
<item itemvalue="Application.TaipanShop" />
<item itemvalue="Application.Game" />
<item itemvalue="Application.ShipWarfare" />
</list>
</recent_temporary>
</component>
@@ -285,6 +276,8 @@
<workItem from="1552210170594" duration="72000" />
<workItem from="1552238757321" duration="742000" />
<workItem from="1552240770629" duration="40000" />
<workItem from="1552241394045" duration="178000" />
<workItem from="1552254283748" duration="7208000" />
</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>
@@ -475,17 +468,52 @@
<option name="project" value="LOCAL" />
<updated>1552240801199</updated>
</task>
<option name="localTasksCounter" value="28" />
<task id="LOCAL-00028" summary="Fined minor bugs in shipwarfareGUI including the &quot;gun frustration&quot; variable">
<created>1552241433802</created>
<option name="number" value="00028" />
<option name="presentableId" value="LOCAL-00028" />
<option name="project" value="LOCAL" />
<updated>1552241433802</updated>
</task>
<task id="LOCAL-00029" summary="Just checking">
<created>1552254331758</created>
<option name="number" value="00029" />
<option name="presentableId" value="LOCAL-00029" />
<option name="project" value="LOCAL" />
<updated>1552254331759</updated>
</task>
<task id="LOCAL-00030" summary="A lot of errors but easily fixable SHipwarfareGUI">
<created>1552268490741</created>
<option name="number" value="00030" />
<option name="presentableId" value="LOCAL-00030" />
<option name="project" value="LOCAL" />
<updated>1552268490741</updated>
</task>
<task id="LOCAL-00031" summary="Completed SHipWarfareGUI">
<created>1552269636545</created>
<option name="number" value="00031" />
<option name="presentableId" value="LOCAL-00031" />
<option name="project" value="LOCAL" />
<updated>1552269636545</updated>
</task>
<task id="LOCAL-00032" summary="Completed ShipWarfareGUI">
<created>1552269681200</created>
<option name="number" value="00032" />
<option name="presentableId" value="LOCAL-00032" />
<option name="project" value="LOCAL" />
<updated>1552269681200</updated>
</task>
<option name="localTasksCounter" value="33" />
<servers />
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="63422000" />
<option name="totallyTimeSpent" value="70808000" />
</component>
<component name="ToolWindowManager">
<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.2667829" />
<window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.2755013" />
<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" />
@@ -582,12 +610,6 @@
<ignored-roots>
<path value="$PROJECT_DIR$" />
</ignored-roots>
<MESSAGE value="Fixed the setters to be greater than 0" />
<MESSAGE value="Created Player class" />
<MESSAGE value="Added some stuff for the Travel Class" />
<MESSAGE value="Added disasters as well as removing a bug from the flee method in Haris's code" />
<MESSAGE value="Fixed a bunch of stuff inside of Travel, but also discovered a MASSIVE problem with our code" />
<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="Added time stuff to Shipwarfare GUI" />
@@ -607,7 +629,13 @@
<MESSAGE value="Completely ruined shipWarfare with a previous edit, fixed it and added a better loot feature for peasant ships" />
<MESSAGE value="Basic functionality of buttons completed, think all I have to do now is to find a way to break the code when the user wins, loses or runs away." />
<MESSAGE value="Fixed probability of ships running away" />
<option name="LAST_COMMIT_MESSAGE" value="Fixed probability of ships running away" />
<MESSAGE value="Fined minor bugs in shipwarfareGUI" />
<MESSAGE value="Fined minor bugs in shipwarfareGUI including the &quot;gun frustration&quot; variable" />
<MESSAGE value="Just checking" />
<MESSAGE value="A lot of errors but easily fixable SHipwarfareGUI" />
<MESSAGE value="Completed SHipWarfareGUI" />
<MESSAGE value="Completed ShipWarfareGUI" />
<option name="LAST_COMMIT_MESSAGE" value="Completed ShipWarfareGUI" />
</component>
<component name="editorHistoryManager">
<entry file="uml://JAVA/ShipWarfare">
@@ -670,23 +698,6 @@
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/ShopGUI" />
<entry file="file://$PROJECT_DIR$/src/ShipWarfare.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="255">
<caret line="17" column="35" selection-start-line="17" selection-start-column="35" selection-end-line="17" selection-end-column="35" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="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="15">
@@ -701,18 +712,54 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/ShipWarfareGUI.java">
<entry file="file://$PROJECT_DIR$/src/main.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="5531">
<caret line="703" column="1" selection-start-line="703" selection-start-column="1" selection-end-line="703" selection-end-column="1" />
<state relative-caret-position="195">
<caret line="13" column="5" lean-forward="true" selection-start-line="13" selection-start-column="5" selection-end-line="13" selection-end-column="5" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/ShipWarfare.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-1074">
<caret line="17" column="35" selection-start-line="17" selection-start-column="35" selection-end-line="17" selection-end-column="35" />
<folding>
<element signature="imports" expanded="true" />
<element signature="e#18236#18237#0" expanded="true" />
<element signature="e#18274#18275#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/MainGUI.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="378">
<caret line="55" column="28" selection-start-line="53" selection-start-column="7" selection-end-line="55" selection-end-column="28" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/ShipWarfareGUI.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="218">
<caret line="386" column="35" selection-start-line="386" selection-start-column="35" selection-end-line="386" selection-end-column="35" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/TaipanShopGUI.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="320">
<caret line="805" column="49" lean-forward="true" selection-start-line="805" selection-end-line="806" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/TravelGUI.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="6570">
<caret line="455" column="42" selection-start-line="455" selection-start-column="42" selection-end-line="455" selection-end-column="42" />
</state>
</provider>
</entry>
</component>
<component name="masterDetails">
<states>

View File

@@ -29,13 +29,16 @@ public class ShipWarfareGUI {
private Label gunsLeftOrTaken;
private Label continueToFight;
private int counter1;
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.
*/
/**
* 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;
@@ -175,6 +178,8 @@ public class ShipWarfareGUI {
HPLeft.setVisible(true);
gunsLeftOrTaken.setVisible(true);
continueToFight.setVisible(true);
continueButton.setVisible(false);
runAwayOrLeft.setText("No ships ran away");
@@ -270,12 +275,14 @@ public class ShipWarfareGUI {
calculateLoot = (startingPeasantShips *100) + randomValue.nextInt(startingPeasantShips) *200;
player.setMoney(player.getMoney() + calculateLoot);
report.setText(String.format("Our firm has earned $%,d in loot! ", calculateLoot));
continueButton.setVisible(true);
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());
continueButton.setVisible(true);
return true;
}
return false;
@@ -302,6 +309,10 @@ public class ShipWarfareGUI {
HPLeft = new Label();
gunsLeftOrTaken = new Label();
continueToFight = new Label();
continueButton = new Button();
continueButton.setVisible(false);
BorderPane.setPrefHeight(400.0);
@@ -317,6 +328,9 @@ public class ShipWarfareGUI {
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));
continueButton.setMnemonicParsing(false);
continueButton.setText("Continue?");
fightButton.setAlignment(javafx.geometry.Pos.CENTER);
fightButton.setContentDisplay(javafx.scene.control.ContentDisplay.CENTER);
fightButton.setId("Button1");
@@ -353,6 +367,8 @@ public class ShipWarfareGUI {
vBox.getChildren().add(HPLeft);
vBox.getChildren().add(gunsLeftOrTaken);
vBox.getChildren().add(continueToFight);
vBox.getChildren().add(continueButton);
//Fight
fightButton.setOnAction(new EventHandler<ActionEvent>() {
@@ -361,7 +377,22 @@ public class ShipWarfareGUI {
counter++;
chooseFightOrRun.setText("Ohh, Fight ehh?");
try {
destroyPeasantShipsOrEscape();
if (destroyPeasantShipsOrEscape()){
completeWipe();
continueButton.setVisible(true);
fightButton.setVisible(false);
runButton.setVisible(false);
continueButton.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
TaipanShopGUI shop = new TaipanShopGUI(player);
shop.initializeShop(stage);
stage.show();
}
});
}
} catch (Exception e) {
}
@@ -384,12 +415,29 @@ public class ShipWarfareGUI {
chooseFightOrRun.setVisible(false);
report.setText(("Couldn't run away"));
try {
destroyPeasantShipsOrEscape();
if(destroyPeasantShipsOrEscape()==true){
completeWipe();
continueButton.setVisible(true);
fightButton.setVisible(false);
runButton.setVisible(false);
continueButton.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
TaipanShopGUI shop = new TaipanShopGUI(player);
shop.initializeShop(stage);
stage.show();
}
});
}
} catch (Exception e) {
}
} else {
completeWipe();
report.setText("Phew! Got away safely");
TaipanShopGUI shop = new TaipanShopGUI(player);
shop.initializeShop(stage);
stage.show();
}

View File

@@ -803,7 +803,7 @@ public class TaipanShopGUI {
gunsText.setText(String.format("Guns %d\n\n\n\n ", player.getGuns()));
inventoryHeldText.setText(String.format("\n %d\n %d\n %d\n %d", player.getOpiumHeld(), player.getSilkHeld(), player.getArmsHeld(), player.getGeneralHeld()));
shipStatusText.setText(String.format("\tDebt\n\t%d\n\n\tShip status\n\t%s: %d", player.getDebt(), shipStatusString(), player.getHP()));
cashText.setText(String.format(" Cash: %d", player.getMoney()));
cashText.setText(String.format(" Cash: $%,d", player.getMoney()));
bankText.setText(String.format("Bank: %d", player.getBank()));
}

View File

@@ -452,7 +452,7 @@ public class TravelGUI{
gunsText.setText(String.format("Guns %d\n\n\n\n ", player.getGuns()));
inventoryHeldText.setText(String.format("\n %d\n %d\n %d\n %d", player.getOpiumHeld(), player.getSilkHeld(), player.getArmsHeld(), player.getGeneralHeld()));
shipStatusText.setText(String.format("\tDebt\n\t%d\n\n\tShip status\n\t%s: %d", player.getDebt(), shipStatusString(), player.getHP()));
cashText.setText(String.format(" Cash: %d", player.getMoney()));
cashText.setText(String.format(" Cash: $%,d", player.getMoney()));
bankText.setText(String.format("Bank: %d", player.getBank()));
}