Perhaps done basic ship warfare? (still must add Liu yen difficulty, ships running away, and Loot)
This commit is contained in:
94
.idea/workspace.xml
generated
94
.idea/workspace.xml
generated
@@ -1,11 +1,11 @@
|
||||
<?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="Vikram, these are the types of changes Harkey and I meant for you to establish.">
|
||||
<list default="true" id="3114a2b9-4919-4fdf-8fd9-d03b60109ce4" name="Default Changelist" comment="Perhaps done basic ship warfare?">
|
||||
<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/Player.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Player.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/ShipWarfare.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/ShipWarfare.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/TaipanShop.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TaipanShop.java" afterDir="false" />
|
||||
</list>
|
||||
<ignored path="$PROJECT_DIR$/out/" />
|
||||
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
||||
@@ -19,12 +19,14 @@
|
||||
<file pinned="false" current-in-tab="true">
|
||||
<entry file="file://$PROJECT_DIR$/src/ShipWarfare.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="1042">
|
||||
<caret line="145" column="67" selection-start-line="145" selection-start-column="67" selection-end-line="145" selection-end-column="67" />
|
||||
<state relative-caret-position="752">
|
||||
<caret line="178" selection-start-line="178" selection-end-line="178" />
|
||||
<folding>
|
||||
<element signature="imports" expanded="true" />
|
||||
<element signature="e#1434#1435#0" expanded="true" />
|
||||
<element signature="e#1555#1556#0" expanded="true" />
|
||||
<element signature="e#1530#1531#0" expanded="true" />
|
||||
<element signature="e#1570#1571#0" expanded="true" />
|
||||
<element signature="e#1633#1634#0" expanded="true" />
|
||||
<element signature="e#1691#1692#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
@@ -33,8 +35,8 @@
|
||||
<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="1350">
|
||||
<caret line="112" column="28" selection-start-line="112" selection-start-column="28" selection-end-line="112" selection-end-column="28" />
|
||||
<state relative-caret-position="49">
|
||||
<caret line="4" column="33" selection-start-line="4" selection-start-column="33" selection-end-line="4" selection-end-column="33" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
@@ -42,7 +44,7 @@
|
||||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/TaipanShop.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="5985">
|
||||
<state relative-caret-position="1670">
|
||||
<caret line="400" selection-start-line="400" selection-end-line="400" />
|
||||
<folding>
|
||||
<element signature="e#371#372#0" expanded="true" />
|
||||
@@ -84,15 +86,25 @@
|
||||
<find>bank</find>
|
||||
<find>player.getMoney() += num *</find>
|
||||
<find>opiumHeld</find>
|
||||
<find>hp</find>
|
||||
<find>player.</find>
|
||||
<find>ARR</find>
|
||||
<find>ARRG!</find>
|
||||
<find>exit</find>
|
||||
<find>exitValue</find>
|
||||
<find>setG</find>
|
||||
<find>hp</find>
|
||||
<find>o</find>
|
||||
<find>oh no</find>
|
||||
<find>shi</find>
|
||||
<find>ships rem</find>
|
||||
</findStrings>
|
||||
<replaceStrings>
|
||||
<replace>player.getName()</replace>
|
||||
<replace>player.getBank()</replace>
|
||||
<replace>player.setMoney(player.getMoney() + num*)</replace>
|
||||
<replace>player.getOpiumHeld()</replace>
|
||||
<replace>numOfPeasantShips</replace>
|
||||
<replace>typeOfShip</replace>
|
||||
</replaceStrings>
|
||||
</component>
|
||||
<component name="Git.Settings">
|
||||
@@ -103,8 +115,8 @@
|
||||
<option name="CHANGED_PATHS">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/src/TaipanShop.java" />
|
||||
<option value="$PROJECT_DIR$/src/Player.java" />
|
||||
<option value="$PROJECT_DIR$/src/ShipWarfare.java" />
|
||||
<option value="$PROJECT_DIR$/src/Player.java" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
@@ -223,7 +235,7 @@
|
||||
<workItem from="1550550806467" duration="577000" />
|
||||
<workItem from="1550552635138" duration="118000" />
|
||||
<workItem from="1550553016386" duration="7671000" />
|
||||
<workItem from="1550672213804" duration="1589000" />
|
||||
<workItem from="1550672213804" duration="8964000" />
|
||||
</task>
|
||||
<task id="LOCAL-00001" summary="Added troll comments">
|
||||
<created>1550458807806</created>
|
||||
@@ -267,11 +279,18 @@
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1550673099893</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="7" />
|
||||
<task id="LOCAL-00007" summary="Perhaps done basic ship warfare?">
|
||||
<created>1550674024950</created>
|
||||
<option name="number" value="00007" />
|
||||
<option name="presentableId" value="LOCAL-00007" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1550674024950</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="8" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="TimeTrackingManager">
|
||||
<option name="totallyTimeSpent" value="10414000" />
|
||||
<option name="totallyTimeSpent" value="17789000" />
|
||||
</component>
|
||||
<component name="ToolWindowManager">
|
||||
<frame x="0" y="23" width="1280" height="709" extended-state="0" />
|
||||
@@ -286,7 +305,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" />
|
||||
<window_info active="true" anchor="bottom" id="Run" order="2" visible="true" weight="0.3273906" />
|
||||
<window_info anchor="bottom" id="Run" order="2" weight="0.3273906" />
|
||||
<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" />
|
||||
@@ -321,7 +340,8 @@
|
||||
<MESSAGE value="Vikram, these are the types of changes Harkey and I meant for you to establish." />
|
||||
<MESSAGE value="Added GameOver() Method to Player class, btw System.out.flush just straight up Thanos's the terminal at the time (clears it)." />
|
||||
<MESSAGE value="I think I got the basic battling system down. Would appreciate i some of you guys beta tested it though and let me know the errors if there are any." />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="I think I got the basic battling system down. Would appreciate i some of you guys beta tested it though and let me know the errors if there are any." />
|
||||
<MESSAGE value="Perhaps done basic ship warfare?" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="Perhaps done basic ship warfare?" />
|
||||
</component>
|
||||
<component name="editorHistoryManager">
|
||||
<entry file="file://$PROJECT_DIR$/TaipanClone.iml">
|
||||
@@ -337,28 +357,9 @@
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/ShipWarfare.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="1042">
|
||||
<caret line="145" column="67" selection-start-line="145" selection-start-column="67" selection-end-line="145" selection-end-column="67" />
|
||||
<folding>
|
||||
<element signature="imports" expanded="true" />
|
||||
<element signature="e#1434#1435#0" expanded="true" />
|
||||
<element signature="e#1555#1556#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/Player.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="1350">
|
||||
<caret line="112" column="28" selection-start-line="112" selection-start-column="28" selection-end-line="112" selection-end-column="28" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/TaipanShop.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="5985">
|
||||
<state relative-caret-position="1670">
|
||||
<caret line="400" selection-start-line="400" selection-end-line="400" />
|
||||
<folding>
|
||||
<element signature="e#371#372#0" expanded="true" />
|
||||
@@ -381,6 +382,27 @@
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/Player.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="49">
|
||||
<caret line="4" column="33" selection-start-line="4" selection-start-column="33" selection-end-line="4" selection-end-column="33" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/ShipWarfare.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="752">
|
||||
<caret line="178" selection-start-line="178" selection-end-line="178" />
|
||||
<folding>
|
||||
<element signature="imports" expanded="true" />
|
||||
<element signature="e#1530#1531#0" expanded="true" />
|
||||
<element signature="e#1570#1571#0" expanded="true" />
|
||||
<element signature="e#1633#1634#0" expanded="true" />
|
||||
<element signature="e#1691#1692#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</component>
|
||||
<component name="masterDetails">
|
||||
<states>
|
||||
|
||||
Binary file not shown.
@@ -2,13 +2,13 @@ public class Player {
|
||||
|
||||
private String name = "Taipan";
|
||||
private int bank = 0;
|
||||
private int money = 1000;
|
||||
private int money = 100000000;
|
||||
private int opiumHeld = 0;
|
||||
private int silkHeld = 0;
|
||||
private int generalHeld = 0;
|
||||
private int armsHeld = 0;
|
||||
private int location = 1;
|
||||
private int guns = 3;
|
||||
private int guns = 6;
|
||||
private int HP = 100;
|
||||
|
||||
|
||||
@@ -25,9 +25,9 @@ public class Player {
|
||||
}
|
||||
|
||||
public void setHP(int HP) {
|
||||
if(HP>= 0){
|
||||
|
||||
this.HP = HP;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public int getBank() {
|
||||
@@ -35,7 +35,7 @@ public class Player {
|
||||
}
|
||||
|
||||
public void setBank(int bank) {
|
||||
if(bank>= 0) {
|
||||
if (bank >= 0) {
|
||||
this.bank = bank;
|
||||
}
|
||||
}
|
||||
@@ -45,7 +45,7 @@ public class Player {
|
||||
}
|
||||
|
||||
public void setMoney(int money) {
|
||||
if(money>= 0) {
|
||||
if (money >= 0) {
|
||||
this.money = money;
|
||||
}
|
||||
}
|
||||
@@ -55,7 +55,7 @@ public class Player {
|
||||
}
|
||||
|
||||
public void setOpiumHeld(int opiumHeld) {
|
||||
if(opiumHeld>= 0) {
|
||||
if (opiumHeld >= 0) {
|
||||
this.opiumHeld = opiumHeld;
|
||||
}
|
||||
}
|
||||
@@ -65,7 +65,7 @@ public class Player {
|
||||
}
|
||||
|
||||
public void setSilkHeld(int silkHeld) {
|
||||
if(silkHeld>= 0) {
|
||||
if (silkHeld >= 0) {
|
||||
this.silkHeld = silkHeld;
|
||||
}
|
||||
}
|
||||
@@ -75,7 +75,7 @@ public class Player {
|
||||
}
|
||||
|
||||
public void setGeneralHeld(int generalHeld) {
|
||||
if(generalHeld>= 0) {
|
||||
if (generalHeld >= 0) {
|
||||
this.generalHeld = generalHeld;
|
||||
}
|
||||
}
|
||||
@@ -85,7 +85,7 @@ public class Player {
|
||||
}
|
||||
|
||||
public void setArmsHeld(int armsHeld) {
|
||||
if(armsHeld>= 0) {
|
||||
if (armsHeld >= 0) {
|
||||
this.armsHeld = armsHeld;
|
||||
}
|
||||
}
|
||||
@@ -95,7 +95,7 @@ public class Player {
|
||||
}
|
||||
|
||||
public void setLocation(int location) {
|
||||
if(location>= 0) {
|
||||
if (location >= 0) {
|
||||
this.location = location;
|
||||
}
|
||||
}
|
||||
@@ -105,7 +105,7 @@ public class Player {
|
||||
}
|
||||
|
||||
public void setGuns(int guns) {
|
||||
if(guns>= 0) {
|
||||
if (guns >= 0) {
|
||||
this.guns = guns;
|
||||
}
|
||||
}
|
||||
@@ -115,7 +115,7 @@ public class Player {
|
||||
System.out.println("Game over");
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception{
|
||||
public static void main(String[] args) throws Exception {
|
||||
ShipWarfare littyboi = new ShipWarfare();
|
||||
TaipanShop littyShop = new TaipanShop();
|
||||
littyShop.shop();
|
||||
|
||||
@@ -5,34 +5,31 @@ import java.util.concurrent.TimeUnit;
|
||||
public class ShipWarfare extends Player {
|
||||
|
||||
private int numOfPeasantShips = 0;
|
||||
private boolean userAttacks= true;
|
||||
|
||||
private boolean userAttacks = true;
|
||||
|
||||
|
||||
public void peasantFleetAttack() throws Exception {
|
||||
Scanner userResponse = new Scanner(System.in);
|
||||
setNumOfPeasantShips(numOfShips());
|
||||
System.out.printf("By Golly! We have $%,d \nwe are being attacked by %d ships\n", getMoney(), getNumOfPeasantShips());
|
||||
System.out.println("What do you want to do? Enter \"f\" to fight, and \"r\" to run ");
|
||||
fightOrRunMessage();
|
||||
while (true) {
|
||||
String response = userResponse.nextLine();
|
||||
if (response.equalsIgnoreCase("f")) {
|
||||
userAttacks=true;
|
||||
userAttacks = true;
|
||||
System.out.println("Ohh, fight ehh?");
|
||||
boolean winOrLose= destroyShipsOrEscape(getNumOfPeasantShips());
|
||||
if(winOrLose==true){
|
||||
boolean winOrLose = destroyShipsOrEscape(getNumOfPeasantShips());
|
||||
if (winOrLose == true) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
} else if (response.equalsIgnoreCase("r")) {
|
||||
runFromShips();
|
||||
if(runFromShips()==false) {
|
||||
if (runFromShips() == false) {
|
||||
System.out.println("Couldn't run away!");
|
||||
destroyShipsOrEscape(getNumOfPeasantShips());
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -44,6 +41,11 @@ public class ShipWarfare extends Player {
|
||||
}
|
||||
|
||||
|
||||
public void fightOrRunMessage() {
|
||||
System.out.printf("What do you want to do? Enter \"f\" to fight, and \"r\" to run (we have %d guns)", getGuns());
|
||||
|
||||
}
|
||||
|
||||
public int getNumOfPeasantShips() {
|
||||
return numOfPeasantShips;
|
||||
}
|
||||
@@ -81,7 +83,7 @@ public class ShipWarfare extends Player {
|
||||
}
|
||||
|
||||
public boolean runFromShips() {
|
||||
userAttacks=false;
|
||||
userAttacks = false;
|
||||
Random randomValue = new Random();
|
||||
int runSuccessChance = randomValue.nextInt(2) + 1;
|
||||
if (runSuccessChance == 2) {
|
||||
@@ -95,21 +97,21 @@ public class ShipWarfare extends Player {
|
||||
public boolean destroyShipsOrEscape(int typeOfShip) throws Exception {
|
||||
Scanner userInput = new Scanner(System.in);
|
||||
Random randomValue = new Random();
|
||||
int shipsRemaining = typeOfShip;
|
||||
int exitValue=0;
|
||||
int counter=0;
|
||||
numOfPeasantShips = typeOfShip;
|
||||
int exitValue = 0;
|
||||
|
||||
//Player volley
|
||||
if (exitValue == 0) {
|
||||
while (exitValue == 0) {
|
||||
counter++;
|
||||
for (int i = 0; i < shipsRemaining; i++) {
|
||||
if (userAttacks==true) {
|
||||
for (int i = 0; i < numOfPeasantShips; i++) {
|
||||
|
||||
for (int j = 0; j < getGuns(); j++) {
|
||||
if (userAttacks == true) {
|
||||
int hitOrMiss = randomValue.nextInt(2) + 1;
|
||||
if (hitOrMiss == 2) {
|
||||
shipsRemaining--;
|
||||
if (shipsRemaining <= 0) {
|
||||
exitValue= 1;
|
||||
numOfPeasantShips--;
|
||||
if (numOfPeasantShips <= 0) {
|
||||
exitValue = 1;
|
||||
break;
|
||||
}
|
||||
System.out.println("Got eem");
|
||||
@@ -120,30 +122,39 @@ public class ShipWarfare extends Player {
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (shipsRemaining <= 0) {
|
||||
|
||||
if (numOfPeasantShips <= 0) {
|
||||
exitValue = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
System.out.printf("%d ships remaining\n", shipsRemaining);
|
||||
System.out.printf("%d ships remaining\n", getNumOfPeasantShips());
|
||||
System.out.println("Oh no, they are taking the offensive!");
|
||||
delayForASecond();
|
||||
//Computer volley
|
||||
setHP(getHP() - (1+ randomValue.nextInt(10)));
|
||||
int takeGunChance = randomValue.nextInt(4) + 1;
|
||||
if (takeGunChance == 1 && getGuns() > 0) {
|
||||
setGuns(getGuns() - 1);
|
||||
System.out.println("Dang it! They destroyed one of our guns");
|
||||
} else {
|
||||
setHP(getHP() - (1 + randomValue.nextInt(10)));
|
||||
}
|
||||
if (getHP() <= 0) {
|
||||
exitValue = 2;
|
||||
break;
|
||||
}
|
||||
System.out.printf("EEK, we have %d health left\n", getHP());
|
||||
delayForASecond();
|
||||
if(userAttacks==false){
|
||||
userAttacks=true;
|
||||
if (userAttacks == false) {
|
||||
userAttacks = true;
|
||||
}
|
||||
|
||||
System.out.println("Shall we continue to fight? Enter \"f\" to fight, and \"r\" to run");
|
||||
System.out.printf("Shall we continue to fight? Enter \"f\" to fight, and \"r\" to run (We have %d guns left)", getGuns());
|
||||
|
||||
String response = userInput.nextLine();
|
||||
if (response.equalsIgnoreCase("r")) {
|
||||
@@ -162,6 +173,7 @@ public class ShipWarfare extends Player {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (exitValue == 1) {
|
||||
System.out.printf("\nGot eem\nVictory!\nIt appears we have defeated the enemy fleet and made it out at %d health\n", getHP());
|
||||
return true;
|
||||
@@ -179,10 +191,11 @@ public class ShipWarfare extends Player {
|
||||
//Type of ship implied to be Liu Yen fleet
|
||||
|
||||
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
ShipWarfare littyObject = new ShipWarfare();
|
||||
littyObject.peasantFleetAttack();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user