7 Commits
4.0 ... master

Author SHA1 Message Date
340a118ef4 Fixed shipwarfare 2019-04-12 14:08:16 -06:00
8c5f0b1f95 Merge branch 'master' of C:\Users\Harkamal Randhawa\IdeaProjects\TaipanClone with conflicts. 2019-04-12 10:45:19 -06:00
Vikramb987
49a62c4a4d Update TaipanShopLogic.java
little fix
2019-04-12 09:06:08 -06:00
Vikramb987
f0416db9c2 Update README.md
fixed formatting
2019-04-12 08:59:41 -06:00
Vikramb987
2d4a1add07 Update README.md
fixed some things + added windows instructions as well
2019-04-12 08:56:21 -06:00
Vikramb987
984beaabf9 Update TaipanShopGUI.java
minor formatting
2019-04-12 08:42:15 -06:00
Vikramb987
b697978614 Update TaipanShopGUI.java
removed the comment "//quitButton.setDefaultButton(true);", not sure who commented that in but doesn't seem necessary
2019-04-12 08:41:35 -06:00
5 changed files with 22 additions and 12 deletions

2
.idea/misc.xml generated
View File

@@ -9,7 +9,7 @@
<component name="ProjectKey">
<option name="state" value="project://63537948-39a4-48a0-9c97-34259a0fa913" />
</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" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
<component name="SvnBranchConfigurationManager">

View File

@@ -10,27 +10,39 @@ Then, run MainGUI.java.
# To play the game
If you are using the command line, extract "TaipanClone-master.zip", and open the "TaipanClone-master" folder. Open your terminal and change its directory to the "src" folder within "TaipanClone-master" folder.
Then, type in
Then, if you are using Linux, type in
```
"javac -cp .:junit-4.12.jar:hamcrest-core-1.3.jar:jfxrt.jar gui/*.java text/*.java logic/*.java tests/*.java"
```
Otherwise, if you are using Windows, type in
```
"javac -cp .;junit-4.12.jar;hamcrest-core-1.3.jar;jfxrt.jar gui/*.java text/*.java logic/*.java tests/*.java"
```
This compiles all the necessary files. Now, to play the GUI version run MainGUI.java using
```
java gui.MainGUI
```
To play the command-line version run
To play the text-based version run MainText.java using
```
java gui.MainText
java text.MainText
```
# To run the test file PlayerTest.java, type in
# To run the test file PlayerTest.java for Linux type in:
```
javac -cp .:junit-4.12.jar:hamcrest-core-1.3.jar:jfxrt.jar gui/*.java text/*.java logic/*.java tests/*.java
```
This compiles all the necessary files. Now, run PlayerTest.java using
This compiles all the necessary files. Now, run PlayerTest.java by typing in
```
java -cp .:junit-4.12.jar:hamcrest-core-1.3.jar org.junit.runner.JUnitCore tests.PlayerTest
```
# To run the test file PlayerTest.java for Windows, type in:
```
javac -cp .;junit-4.12.jar;hamcrest-core-1.3.jar;jfxrt.jar gui/*.java text/*.java logic/*.java tests/*.java
```
This compiles all the necessary files. Now, run PlayerTest.java by typing in
```
java -cp .;junit-4.12.jar;hamcrest-core-1.3.jar org.junit.runner.JUnitCore tests.PlayerTest
```
Additional information:
You lose if your HP reaches 0. You can win if you "retire" in Hong Kong while having a net worth of over $1 million.

View File

@@ -239,7 +239,7 @@ public class ShipWarfareGUI extends Player {
if (exitValue == 1) {
wipe();
calculateLoot = logic.calculateLoot();
super.setMoney(logic.getMoney());
setMoney(calculateLoot+ getPlayer().getMoney());
report.setText(String.format("Our firm has earned $%,d in loot! ", calculateLoot));
continueButton.setVisible(true);
completeWipe();

View File

@@ -1,8 +1,9 @@
package gui; /**
/**
* TaipanShopGUI deals with setting the stage for shop.
*
* Author: Vikram Bawa
*/
package gui;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.geometry.Insets;
@@ -115,7 +116,6 @@ public class TaipanShopGUI extends Player {
loanButton.setVisible(false);
armsButton.setVisible(false);
quitButton.setVisible(true);
//quitButton.setDefaultButton(true);
opiumButton.setVisible(false);
silkButton.setVisible(false);
numberInput.setVisible(false);
@@ -129,7 +129,6 @@ public class TaipanShopGUI extends Player {
cargoButton.setVisible(true);
loanButton.setVisible(true);
quitButton.setVisible(true);
//quitButton.setDefaultButton(true);
opiumButton.setVisible(false);
silkButton.setVisible(false);
numberInput.setVisible(false);
@@ -144,7 +143,6 @@ public class TaipanShopGUI extends Player {
loanButton.setVisible(true);
numberInput.setVisible(false);
quitButton.setVisible(true);
//quitButton.setDefaultButton(true);
opiumButton.setVisible(false);
silkButton.setVisible(false);
generalButton.setVisible(false);

View File

@@ -24,7 +24,7 @@ public class TaipanShopLogic extends Player {
public String updatePrices() {
String s = "\t" + getName() + ", the price of ";
String a = "";
double value = 0 * Math.random();
double value = 80 * Math.random();
Random rand = new Random();
setOpiumPrice((rand.nextInt(201) + 60) * 100);
setSilkPrice((rand.nextInt(201) + 60) * 10);