bunch of revisions, still in progress
This commit is contained in:
164
.idea/workspace.xml
generated
164
.idea/workspace.xml
generated
@@ -4,6 +4,11 @@
|
||||
<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/Bank.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Bank.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/Player.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Player.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/Start.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Start.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/Warehouse.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Warehouse.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main.java" afterDir="false" />
|
||||
</list>
|
||||
<ignored path="$PROJECT_DIR$/out/" />
|
||||
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
||||
@@ -28,11 +33,11 @@
|
||||
</component>
|
||||
<component name="FileEditorManager">
|
||||
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
|
||||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/Start.java">
|
||||
<file pinned="false" current-in-tab="true">
|
||||
<entry file="file://$PROJECT_DIR$/src/main.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 relative-caret-position="437">
|
||||
<caret line="23" column="10" selection-start-line="23" selection-start-column="10" selection-end-line="23" selection-end-column="10" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
@@ -40,46 +45,52 @@
|
||||
<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="1725">
|
||||
<caret line="139" column="4" selection-start-line="139" selection-start-column="4" selection-end-line="139" selection-end-column="4" />
|
||||
<folding>
|
||||
<element signature="e#2556#2557#0" expanded="true" />
|
||||
<element signature="e#2583#2584#0" expanded="true" />
|
||||
</folding>
|
||||
<state relative-caret-position="57">
|
||||
<caret line="3" column="25" lean-forward="true" selection-start-line="3" selection-start-column="25" selection-end-line="3" selection-end-column="25" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/main.java">
|
||||
<entry file="file://$PROJECT_DIR$/src/Warehouse.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="255">
|
||||
<caret line="17" column="18" selection-start-line="17" selection-start-column="18" selection-end-line="17" selection-end-column="18" />
|
||||
<state relative-caret-position="2736">
|
||||
<caret line="144" column="48" selection-start-line="144" selection-start-column="48" selection-end-line="144" selection-end-column="48" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/Travel.java">
|
||||
<entry file="file://$PROJECT_DIR$/src/TaipanShop.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="150">
|
||||
<state relative-caret-position="-2375">
|
||||
<caret line="11" selection-start-line="11" selection-end-line="11" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file pinned="false" current-in-tab="true">
|
||||
<entry file="file://$PROJECT_DIR$/src/ShipWarfare.java">
|
||||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/Bank.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="-5040">
|
||||
<caret line="18" column="5" lean-forward="true" selection-start-line="18" selection-start-column="5" selection-end-line="18" selection-end-column="5" />
|
||||
<state relative-caret-position="704">
|
||||
<caret line="49" column="53" selection-start-line="49" selection-start-column="53" selection-end-line="49" selection-end-column="53" />
|
||||
<folding>
|
||||
<element signature="imports" expanded="true" />
|
||||
<element signature="e#1027#1028#0" expanded="true" />
|
||||
<element signature="e#1075#1076#0" 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="456">
|
||||
<caret line="24" column="38" lean-forward="true" selection-start-line="24" selection-start-column="38" selection-end-line="24" selection-end-column="38" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
</leaf>
|
||||
</component>
|
||||
<component name="FileTemplateManagerImpl">
|
||||
@@ -138,22 +149,24 @@
|
||||
</replaceStrings>
|
||||
</component>
|
||||
<component name="Git.Settings">
|
||||
<option name="UPDATE_TYPE" value="REBASE" />
|
||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
||||
</component>
|
||||
<component name="IdeDocumentHistory">
|
||||
<option name="CHANGED_PATHS">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/src/Test.java" />
|
||||
<option value="$PROJECT_DIR$/src/TaipanShop.java" />
|
||||
<option value="$PROJECT_DIR$/src/Player.java" />
|
||||
<option value="$PROJECT_DIR$/src/main.java" />
|
||||
<option value="$PROJECT_DIR$/src/Travel.java" />
|
||||
<option value="$PROJECT_DIR$/src/ShipWarfare.java" />
|
||||
<option value="$PROJECT_DIR$/src/TaipanShop.java" />
|
||||
<option value="$PROJECT_DIR$/src/Warehouse.java" />
|
||||
<option value="$PROJECT_DIR$/src/Bank.java" />
|
||||
<option value="$PROJECT_DIR$/src/Player.java" />
|
||||
<option value="$PROJECT_DIR$/src/Start.java" />
|
||||
<option value="$PROJECT_DIR$/src/main.java" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectFrameBounds">
|
||||
<component name="ProjectFrameBounds" extendedState="6">
|
||||
<option name="y" value="23" />
|
||||
<option name="width" value="1280" />
|
||||
<option name="height" value="709" />
|
||||
@@ -165,6 +178,7 @@
|
||||
</navigator>
|
||||
<panes>
|
||||
<pane id="Scope" />
|
||||
<pane id="PackagesPane" />
|
||||
<pane id="ProjectPane">
|
||||
<subPane>
|
||||
<expand>
|
||||
@@ -181,13 +195,12 @@
|
||||
<select />
|
||||
</subPane>
|
||||
</pane>
|
||||
<pane id="PackagesPane" />
|
||||
</panes>
|
||||
</component>
|
||||
<component name="PropertiesComponent">
|
||||
<property name="WebServerToolWindowFactoryState" value="false" />
|
||||
<property name="aspect.path.notification.shown" value="true" />
|
||||
<property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1550892173887" />
|
||||
<property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1551049063627" />
|
||||
<property name="extract.method.default.visibility" value="public" />
|
||||
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
|
||||
<property name="project.structure.last.edited" value="Project" />
|
||||
@@ -248,8 +261,8 @@
|
||||
</configuration>
|
||||
<list>
|
||||
<item itemvalue="Application.Main" />
|
||||
<item itemvalue="Application.ShipWarfare" />
|
||||
<item itemvalue="Application.Player" />
|
||||
<item itemvalue="Application.ShipWarfare" />
|
||||
<item itemvalue="Application.Test" />
|
||||
<item itemvalue="Application.main" />
|
||||
</list>
|
||||
@@ -382,10 +395,10 @@
|
||||
<option name="totallyTimeSpent" value="40547000" />
|
||||
</component>
|
||||
<component name="ToolWindowManager">
|
||||
<frame x="0" y="23" width="1280" height="709" extended-state="0" />
|
||||
<frame x="-8" y="-8" width="1936" height="1056" extended-state="6" />
|
||||
<editor active="true" />
|
||||
<layout>
|
||||
<window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.30048466" />
|
||||
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.25799572" />
|
||||
<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" />
|
||||
@@ -394,7 +407,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 anchor="bottom" id="Run" order="2" weight="0.3273906" />
|
||||
<window_info anchor="bottom" id="Run" order="2" sideWeight="0.49946696" weight="0.32719395" />
|
||||
<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" />
|
||||
@@ -403,8 +416,8 @@
|
||||
<window_info anchor="bottom" id="Version Control" order="8" sideWeight="0.49946696" weight="0.32901135" />
|
||||
<window_info anchor="bottom" id="Database Changes" order="9" />
|
||||
<window_info anchor="bottom" id="Terminal" order="10" weight="0.32936078" />
|
||||
<window_info anchor="bottom" id="Event Log" order="11" sideWeight="0.50053304" side_tool="true" weight="0.32901135" />
|
||||
<window_info anchor="bottom" id="Messages" order="12" weight="0.60777956" />
|
||||
<window_info anchor="bottom" id="Event Log" order="11" sideWeight="0.50053304" side_tool="true" weight="0.32719395" />
|
||||
<window_info anchor="bottom" id="Messages" order="12" weight="0.6067172" />
|
||||
<window_info anchor="bottom" id="Duplicate detector" order="13" weight="0.32901135" />
|
||||
<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" />
|
||||
@@ -446,45 +459,6 @@
|
||||
<provider selected="true" editor-type-id="text-editor" />
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/Test.java" />
|
||||
<entry file="file://$PROJECT_DIR$/src/TaipanShop.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="-4525">
|
||||
<caret line="71" column="19" selection-start-line="71" selection-start-column="16" selection-end-line="71" selection-end-column="19" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/Bank.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="30">
|
||||
<caret line="2" column="13" selection-start-line="2" selection-start-column="13" selection-end-line="2" selection-end-column="13" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<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>
|
||||
<entry file="file://$PROJECT_DIR$/src/Player.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="1725">
|
||||
<caret line="139" column="4" selection-start-line="139" selection-start-column="4" selection-end-line="139" selection-end-column="4" />
|
||||
<folding>
|
||||
<element signature="e#2556#2557#0" expanded="true" />
|
||||
<element signature="e#2583#2584#0" 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="255">
|
||||
<caret line="17" column="18" selection-start-line="17" selection-start-column="18" selection-end-line="17" selection-end-column="18" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/Travel.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="150">
|
||||
@@ -502,6 +476,52 @@
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/TaipanShop.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="-2375">
|
||||
<caret line="11" selection-start-line="11" selection-end-line="11" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/Bank.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="704">
|
||||
<caret line="49" column="53" selection-start-line="49" selection-start-column="53" selection-end-line="49" selection-end-column="53" />
|
||||
<folding>
|
||||
<element signature="e#1027#1028#0" expanded="true" />
|
||||
<element signature="e#1075#1076#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="57">
|
||||
<caret line="3" column="25" lean-forward="true" selection-start-line="3" selection-start-column="25" selection-end-line="3" selection-end-column="25" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/Start.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="456">
|
||||
<caret line="24" column="38" lean-forward="true" selection-start-line="24" selection-start-column="38" selection-end-line="24" selection-end-column="38" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/Warehouse.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="2736">
|
||||
<caret line="144" column="48" selection-start-line="144" selection-start-column="48" selection-end-line="144" selection-end-column="48" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/main.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="437">
|
||||
<caret line="23" column="10" selection-start-line="23" selection-start-column="10" selection-end-line="23" selection-end-column="10" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</component>
|
||||
<component name="masterDetails">
|
||||
<states>
|
||||
|
||||
Binary file not shown.
104
src/Bank.java
104
src/Bank.java
@@ -1,52 +1,52 @@
|
||||
import java.util.Scanner;
|
||||
|
||||
public class Bank{
|
||||
|
||||
private Player player;
|
||||
public void setPlayer(Player player) {
|
||||
Player playerDummy = new Player(player);
|
||||
this.player = playerDummy;
|
||||
}
|
||||
|
||||
public Player getPlayer(){
|
||||
Player playerDummy = new Player(player);
|
||||
return playerDummy;
|
||||
}
|
||||
|
||||
public Bank(Player player){
|
||||
Player playerDummy = new Player(player);
|
||||
this.player = playerDummy;
|
||||
}
|
||||
|
||||
public int promtMoney() {
|
||||
int addVal = 0;
|
||||
int retVal = 0;
|
||||
System.out.println("Please enter an amount");
|
||||
Scanner keyboard = new Scanner(System.in);
|
||||
addVal = keyboard.nextInt();
|
||||
if(addVal >= 0) {
|
||||
retVal = addVal;
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
|
||||
public void addMoney() {
|
||||
int addMon = promtMoney();
|
||||
if(addMon >= 0) {
|
||||
player.setBank(promtMoney() + player.getMoney());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void removeMoney() {
|
||||
int subMon = promtMoney();
|
||||
if(subMon <= player.getMoney()) {
|
||||
player.setBank(subMon - player.getMoney());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void addInterest() {
|
||||
setBank((int)((player.getBank() * 1.05)));
|
||||
}
|
||||
}
|
||||
import java.util.Scanner;
|
||||
|
||||
public class Bank{
|
||||
|
||||
private Player player;
|
||||
public void setPlayer(Player player) {
|
||||
Player playerDummy = new Player(player);
|
||||
this.player = playerDummy;
|
||||
}
|
||||
|
||||
public Player getPlayer(){
|
||||
Player playerDummy = new Player(player);
|
||||
return playerDummy;
|
||||
}
|
||||
|
||||
public Bank(Player player){
|
||||
Player playerDummy = new Player(player);
|
||||
this.player = playerDummy;
|
||||
}
|
||||
|
||||
public int promtMoney() {
|
||||
int addVal = 0;
|
||||
int retVal = 0;
|
||||
System.out.println("Please enter an amount");
|
||||
Scanner keyboard = new Scanner(System.in);
|
||||
addVal = keyboard.nextInt();
|
||||
if(addVal >= 0) {
|
||||
retVal = addVal;
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
|
||||
public void addMoney() {
|
||||
int addMon = promtMoney();
|
||||
if(addMon >= 0) {
|
||||
player.setBank(promtMoney() + player.getMoney());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void removeMoney() {
|
||||
int subMon = promtMoney();
|
||||
if(subMon <= player.getMoney()) {
|
||||
player.setBank(subMon - player.getMoney());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void addInterest() {
|
||||
player.setBank((int)((player.getBank() * 1.01)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,22 +29,6 @@ public class Player {
|
||||
this.debt = player.debt;
|
||||
}
|
||||
|
||||
public Player(){
|
||||
|
||||
}
|
||||
|
||||
public Player(Player player){
|
||||
this.bank = player.bank;
|
||||
this.money = player.money;
|
||||
this.opiumHeld = player.opiumHeld;
|
||||
this.silkHeld = player.silkHeld;
|
||||
this.generalHeld = player.generalHeld;
|
||||
this.armsHeld = player.armsHeld;
|
||||
this.location = player.location;
|
||||
this.guns = player.guns;
|
||||
this.HP = player.HP;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@@ -1,45 +1,46 @@
|
||||
import java.util.Scanner;
|
||||
public class Start
|
||||
{
|
||||
private Player player;
|
||||
|
||||
public Player getPlayer() {
|
||||
Player playerTemp = new Player(player);
|
||||
return playerTemp;
|
||||
}
|
||||
|
||||
public void setPlayer(Player player) {
|
||||
Player playerTemp = new Player(player);
|
||||
this.player = playerTemp;
|
||||
}
|
||||
|
||||
public void setFirm (String name) {
|
||||
System.out.println("Taipan, \nWhat will you name your \nFirm: ");
|
||||
if (name.length() <= 22) {
|
||||
player.setName(name);
|
||||
}
|
||||
}
|
||||
public void main(String[] args)
|
||||
{
|
||||
System.out.println("Do you want to start . . .\n1) With cash (and a debt)\n>> or <<\n" +
|
||||
"With five guns and no cash (But no debt!)\n? ");
|
||||
Scanner userInput = new Scanner(System.in);
|
||||
if (userInput.nextInt() == 1)
|
||||
{
|
||||
player.setMoney(400);
|
||||
player.setDebt(5000);
|
||||
|
||||
}
|
||||
if (userInput.nextInt() == 2)
|
||||
{
|
||||
player.setGuns(5);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public Start(Player player)
|
||||
{
|
||||
Player playerTemp = new Player(player);
|
||||
this.player = playerTemp;
|
||||
}
|
||||
}
|
||||
import java.util.Scanner;
|
||||
public class Start
|
||||
{
|
||||
private Player player;
|
||||
|
||||
public Player getPlayer() {
|
||||
Player playerTemp = new Player(player);
|
||||
return playerTemp;
|
||||
}
|
||||
|
||||
public void setPlayer(Player player) {
|
||||
Player playerTemp = new Player(player);
|
||||
this.player = playerTemp;
|
||||
}
|
||||
|
||||
public void setFirm (String name) {
|
||||
if (name.length() <= 22) {
|
||||
player.setName(name);
|
||||
}
|
||||
}
|
||||
public void intialize()
|
||||
{
|
||||
Scanner userInput = new Scanner(System.in);
|
||||
System.out.println("Taipan, \nWhat will you name your \nFirm: ");
|
||||
setFirm(userInput.nextLine());
|
||||
System.out.println("Do you want to start . . .\n1) With cash (and a debt)\n>> or <<\n" +
|
||||
"With five guns and no cash (But no debt!)\n? ");
|
||||
if (userInput.nextInt() == 1)
|
||||
{
|
||||
player.setMoney(400);
|
||||
player.setDebt(5000);
|
||||
|
||||
}
|
||||
if (userInput.nextInt() == 2)
|
||||
{
|
||||
player.setGuns(5);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public Start(Player player)
|
||||
{
|
||||
Player playerTemp = new Player(player);
|
||||
this.player = playerTemp;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,154 +1,154 @@
|
||||
import java.util.Scanner;
|
||||
|
||||
public class Warehouse {
|
||||
private int wOpium = 25;
|
||||
private int wSilk = 0;
|
||||
private int wGeneral = 0;
|
||||
private int wArms = 0;
|
||||
private String good = "";
|
||||
private int finalAmount = 0;
|
||||
private Player player;
|
||||
|
||||
|
||||
public void setPlayer(Player player) {
|
||||
Player playerDumy = new Player(player);
|
||||
this.player= playerDumy;
|
||||
}
|
||||
|
||||
public Player getPlayer(){
|
||||
Player playerDummy = new Player(player);
|
||||
return playerDummy;
|
||||
}
|
||||
|
||||
public Warehouse(Player player){
|
||||
Player playerDummy = new Player(player);
|
||||
this.player = playerDummy;
|
||||
}
|
||||
|
||||
|
||||
public void addAmount(String good, int amount) {
|
||||
int held = 0;
|
||||
if (amount > 0) {
|
||||
if (this.good.equalsIgnoreCase("O")) {
|
||||
this.wOpium += amount;
|
||||
held = player.getOpiumHeld();
|
||||
player.setOpiumHeld(held - amount);
|
||||
System.out.println(player.getOpiumHeld());
|
||||
}
|
||||
else if(this.good.equalsIgnoreCase("S")) {
|
||||
this.wSilk += amount;
|
||||
held = player.getSilkHeld();
|
||||
player.setSilkHeld(held - amount);
|
||||
}
|
||||
else if(this.good.equalsIgnoreCase("G")) {
|
||||
this.wGeneral += amount;
|
||||
held = player.getGeneralHeld();
|
||||
player.setGeneralHeld(held - amount);
|
||||
}
|
||||
else if(this.good.equalsIgnoreCase("A")) {
|
||||
this.wArms += amount;
|
||||
held = player.getArmsHeld();
|
||||
player.setArmsHeld(held - amount);
|
||||
}
|
||||
}
|
||||
else {
|
||||
System.out.println("Sorry this transfer cannot be made");
|
||||
}
|
||||
}
|
||||
public void removeAmount(String good, int amount) {
|
||||
int held = 0;
|
||||
if (amount > 0) {
|
||||
if (this.good.equalsIgnoreCase("O")) {
|
||||
this.wOpium -= amount;
|
||||
held = player.getOpiumHeld();
|
||||
player.setOpiumHeld(held + amount);
|
||||
}
|
||||
else if(this.good.equalsIgnoreCase("S")) {
|
||||
this.wSilk -= amount;
|
||||
held = player.getSilkHeld();
|
||||
player.setSilkHeld(held + amount);
|
||||
}
|
||||
else if(this.good.equalsIgnoreCase("G")) {
|
||||
this.wGeneral -= amount;
|
||||
held = player.getGeneralHeld();
|
||||
player.setGeneralHeld(held + amount);
|
||||
}
|
||||
else if(this.good.equalsIgnoreCase("A")) {
|
||||
this.wArms -= amount;
|
||||
held = player.getArmsHeld();
|
||||
player.setArmsHeld(held + amount);
|
||||
}
|
||||
}
|
||||
else {
|
||||
System.out.println("Sorry this transfer cannot be made");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void showWarehouse() {
|
||||
System.out.println("Opium : " + this.wOpium);
|
||||
System.out.println("Silk : " + this.wSilk);
|
||||
System.out.println("General : " + this.wGeneral);
|
||||
System.out.println("Arms : " + this.wArms);
|
||||
}
|
||||
|
||||
private void askGood() {
|
||||
String aGood = "k";
|
||||
System.out.println("Please enter a good to transfer O, S, G, A :");
|
||||
Scanner keyboard = new Scanner(System.in);
|
||||
aGood = keyboard.nextLine();
|
||||
aGood = aGood.toUpperCase();
|
||||
this.good = aGood;
|
||||
}
|
||||
|
||||
public void askAddAmount() {
|
||||
askGood();
|
||||
int amount = 0;
|
||||
System.out.println("Please enter the amount of the good you would like to transfer, put negative amount to remove");
|
||||
Scanner keyboard = new Scanner(System.in);
|
||||
amount = keyboard.nextInt();
|
||||
if(this.good.equalsIgnoreCase("O") && amount <= player.getOpiumHeld()) {
|
||||
finalAmount = amount;
|
||||
}
|
||||
else if(this.good.equalsIgnoreCase("S") && amount <= player.getSilkHeld()) {
|
||||
finalAmount = amount;
|
||||
}
|
||||
else if(this.good.equalsIgnoreCase("G") && amount <= player.getGeneralHeld()) {
|
||||
finalAmount = amount;
|
||||
}
|
||||
else if(this.good.equalsIgnoreCase("A") && amount <= player.getArmsHeld()) {
|
||||
finalAmount = amount;
|
||||
}
|
||||
}
|
||||
|
||||
public void askRemoveAmount() {
|
||||
askGood();
|
||||
int amount = 0;
|
||||
System.out.println("Please enter the amount of the good you would like to remove");
|
||||
Scanner keyboard = new Scanner(System.in);
|
||||
amount = keyboard.nextInt();
|
||||
if(this.good.equalsIgnoreCase("O") && amount <= this.wOpium) {
|
||||
finalAmount = amount;
|
||||
}
|
||||
else if(this.good.equalsIgnoreCase("S") && amount <= this.wSilk) {
|
||||
finalAmount = amount;
|
||||
}
|
||||
else if(this.good.equalsIgnoreCase("G") && amount <= this.wGeneral) {
|
||||
finalAmount = amount;
|
||||
}
|
||||
else if(this.good.equalsIgnoreCase("A") && amount <= this.wArms) {
|
||||
finalAmount = amount;
|
||||
}
|
||||
|
||||
}
|
||||
public static void main(String[] args){
|
||||
Warehouse hi = new Warehouse();
|
||||
hi.showWarehouse();
|
||||
hi.askRemoveAmount();
|
||||
hi.removeAmount(hi.good, hi.finalAmount);
|
||||
hi.showWarehouse();
|
||||
hi.askAddAmount();
|
||||
hi.addAmount(hi.good, hi.finalAmount);
|
||||
hi.showWarehouse();
|
||||
}
|
||||
}
|
||||
import java.util.Scanner;
|
||||
|
||||
public class Warehouse {
|
||||
private int wOpium = 25;
|
||||
private int wSilk = 0;
|
||||
private int wGeneral = 0;
|
||||
private int wArms = 0;
|
||||
private String good = "";
|
||||
private int finalAmount = 0;
|
||||
private Player player;
|
||||
|
||||
|
||||
public void setPlayer(Player player) {
|
||||
Player playerDumy = new Player(player);
|
||||
this.player= playerDumy;
|
||||
}
|
||||
|
||||
public Player getPlayer(){
|
||||
Player playerDummy = new Player(player);
|
||||
return playerDummy;
|
||||
}
|
||||
|
||||
public Warehouse(Player player){
|
||||
Player playerDummy = new Player(player);
|
||||
this.player = playerDummy;
|
||||
}
|
||||
|
||||
|
||||
public void addAmount(String good, int amount) {
|
||||
int held = 0;
|
||||
if (amount > 0) {
|
||||
if (this.good.equalsIgnoreCase("O")) {
|
||||
this.wOpium += amount;
|
||||
held = player.getOpiumHeld();
|
||||
player.setOpiumHeld(held - amount);
|
||||
System.out.println(player.getOpiumHeld());
|
||||
}
|
||||
else if(this.good.equalsIgnoreCase("S")) {
|
||||
this.wSilk += amount;
|
||||
held = player.getSilkHeld();
|
||||
player.setSilkHeld(held - amount);
|
||||
}
|
||||
else if(this.good.equalsIgnoreCase("G")) {
|
||||
this.wGeneral += amount;
|
||||
held = player.getGeneralHeld();
|
||||
player.setGeneralHeld(held - amount);
|
||||
}
|
||||
else if(this.good.equalsIgnoreCase("A")) {
|
||||
this.wArms += amount;
|
||||
held = player.getArmsHeld();
|
||||
player.setArmsHeld(held - amount);
|
||||
}
|
||||
}
|
||||
else {
|
||||
System.out.println("Sorry this transfer cannot be made");
|
||||
}
|
||||
}
|
||||
public void removeAmount(String good, int amount) {
|
||||
int held = 0;
|
||||
if (amount > 0) {
|
||||
if (this.good.equalsIgnoreCase("O")) {
|
||||
this.wOpium -= amount;
|
||||
held = player.getOpiumHeld();
|
||||
player.setOpiumHeld(held + amount);
|
||||
}
|
||||
else if(this.good.equalsIgnoreCase("S")) {
|
||||
this.wSilk -= amount;
|
||||
held = player.getSilkHeld();
|
||||
player.setSilkHeld(held + amount);
|
||||
}
|
||||
else if(this.good.equalsIgnoreCase("G")) {
|
||||
this.wGeneral -= amount;
|
||||
held = player.getGeneralHeld();
|
||||
player.setGeneralHeld(held + amount);
|
||||
}
|
||||
else if(this.good.equalsIgnoreCase("A")) {
|
||||
this.wArms -= amount;
|
||||
held = player.getArmsHeld();
|
||||
player.setArmsHeld(held + amount);
|
||||
}
|
||||
}
|
||||
else {
|
||||
System.out.println("Sorry this transfer cannot be made");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void showWarehouse() {
|
||||
System.out.println("Opium : " + this.wOpium);
|
||||
System.out.println("Silk : " + this.wSilk);
|
||||
System.out.println("General : " + this.wGeneral);
|
||||
System.out.println("Arms : " + this.wArms);
|
||||
}
|
||||
|
||||
private void askGood() {
|
||||
String aGood = "k";
|
||||
System.out.println("Please enter a good to transfer O, S, G, A :");
|
||||
Scanner keyboard = new Scanner(System.in);
|
||||
aGood = keyboard.nextLine();
|
||||
aGood = aGood.toUpperCase();
|
||||
this.good = aGood;
|
||||
}
|
||||
|
||||
public void askAddAmount() {
|
||||
askGood();
|
||||
int amount = 0;
|
||||
System.out.println("Please enter the amount of the good you would like to transfer, put negative amount to remove");
|
||||
Scanner keyboard = new Scanner(System.in);
|
||||
amount = keyboard.nextInt();
|
||||
if(this.good.equalsIgnoreCase("O") && amount <= player.getOpiumHeld()) {
|
||||
finalAmount = amount;
|
||||
}
|
||||
else if(this.good.equalsIgnoreCase("S") && amount <= player.getSilkHeld()) {
|
||||
finalAmount = amount;
|
||||
}
|
||||
else if(this.good.equalsIgnoreCase("G") && amount <= player.getGeneralHeld()) {
|
||||
finalAmount = amount;
|
||||
}
|
||||
else if(this.good.equalsIgnoreCase("A") && amount <= player.getArmsHeld()) {
|
||||
finalAmount = amount;
|
||||
}
|
||||
}
|
||||
|
||||
public void askRemoveAmount() {
|
||||
askGood();
|
||||
int amount = 0;
|
||||
System.out.println("Please enter the amount of the good you would like to remove");
|
||||
Scanner keyboard = new Scanner(System.in);
|
||||
amount = keyboard.nextInt();
|
||||
if(this.good.equalsIgnoreCase("O") && amount <= this.wOpium) {
|
||||
finalAmount = amount;
|
||||
}
|
||||
else if(this.good.equalsIgnoreCase("S") && amount <= this.wSilk) {
|
||||
finalAmount = amount;
|
||||
}
|
||||
else if(this.good.equalsIgnoreCase("G") && amount <= this.wGeneral) {
|
||||
finalAmount = amount;
|
||||
}
|
||||
else if(this.good.equalsIgnoreCase("A") && amount <= this.wArms) {
|
||||
finalAmount = amount;
|
||||
}
|
||||
|
||||
}
|
||||
public static void main(String[] args){
|
||||
Warehouse hi = new Warehouse(new Player());
|
||||
hi.showWarehouse();
|
||||
hi.askRemoveAmount();
|
||||
hi.removeAmount(hi.good, hi.finalAmount);
|
||||
hi.showWarehouse();
|
||||
hi.askAddAmount();
|
||||
hi.addAmount(hi.good, hi.finalAmount);
|
||||
hi.showWarehouse();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,18 @@ public class main {
|
||||
player = shop.getPlayer();
|
||||
}
|
||||
|
||||
public void start(Start start){
|
||||
start.setPlayer(player);
|
||||
start.intialize();
|
||||
player = start.getPlayer();
|
||||
}
|
||||
|
||||
public void warehouse(Warehouse warehouse){
|
||||
warehouse.setPlayer(player);
|
||||
//warehouse.intialize();
|
||||
player = warehouse.getPlayer();
|
||||
}
|
||||
|
||||
public void peasantFleet(ShipWarfare warfare) throws Exception {
|
||||
warfare.setPlayer(player);
|
||||
warfare.peasantFleetAttack();
|
||||
@@ -23,6 +35,8 @@ public class main {
|
||||
main main = new main();
|
||||
ShipWarfare littyWarfare = new ShipWarfare(main.getPlayer());
|
||||
TaipanShop littyShop = new TaipanShop(main.getPlayer());
|
||||
Start start = new Start(main.getPlayer());
|
||||
|
||||
|
||||
main.shop(littyShop);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user