public class MarketPlace
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
(package private) java.lang.Exception |
eMoney |
(package private) java.lang.Exception |
eStockBuy |
private float |
marketEnergyBuyPrice |
private float |
marketEnergySellPrice |
private int |
marketEnergyStock |
private int |
marketFoodStock |
private float |
marketOreBuyPrice |
private float |
marketOreSellPrice |
private int |
marketOreStock |
private int |
marketRoboticonSellPrice |
private int |
marketRoboticonStock |
private int |
prevEnergyStock |
private int |
prevOreStock |
private Pub |
pub |
Constructor and Description |
---|
MarketPlace() |
Modifier and Type | Method and Description |
---|---|
void |
buyEnergy(Player player,
int quantity)
This method is used for a player to buy energy.
|
void |
buyOre(Player player,
int quantity)
This method is used for a player to buy ore.
|
void |
buyRoboticon(Player player,
int quantity)
This method is used for a player to buy roboticons.
|
float |
getMarketEnergyBuyPrice()
Getter for the purchase price of the market's energy
|
float |
getMarketEnergySellPrice()
Getter for the selling price of the market's energy
|
int |
getMarketEnergyStock()
Getter for the stock of the market's energy
|
int |
getMarketFoodStock()
Getter for the stock of the market's food
|
float |
getMarketOreBuyPrice()
Getter for the purchase price of the market's ore
|
float |
getMarketOreSellPrice()
Getter for the selling price of the market's ore
|
int |
getMarketOreStock()
Getter for the stock of the market's ore
|
int |
getMarketRoboticonSellPrice()
Getter for the selling price of the market's Roboticons
|
int |
getMarketRoboticonStock()
Getter for the stock of the market's Roboticons
|
Pub |
getPub()
Getter for access the pub for this market
|
void |
Lottery(Player player,
int num1,
int num2,
int num3) |
int[] |
OneArmBandit(Player player) |
void |
produceRoboticon()
This function should be called at the end of each round to regenerate the Roboticon stock based on the amount of ore the market has
|
void |
scratchCard(Player player) |
void |
sellEnergy(Player player,
int quantity)
This method is used for a player to sell energy.
|
void |
sellOre(Player player,
int quantity)
This method is used for a player to sell ore.
|
void |
setMarketEnergyBuyPrice(float marketEnergyBuyPrice)
Setter for the purchase price of the market's energy
|
void |
setMarketEnergySellPrice(float marketEnergySellPrice)
Setter for the selling price of the market's energy
|
void |
setMarketEnergyStock(int marketEnergyStock)
Setter for the stock of the market's energy
|
void |
setMarketFoodStock(int marketFoodStock)
Setter for the stock of the market's food
|
void |
setMarketOreBuyPrice(float marketOreBuyPrice)
Setter for the purchase price of the market's ore
|
void |
setMarketOreSellPrice(float marketOreSellPrice)
Setter for the selling price of the market's ore
|
void |
setMarketOreStock(int marketOreStock)
Setter for the stock of the market's ore
|
void |
setMarketRoboticonSellPrice(int marketRoboticonSellPrice)
Setter for the selling price of the market's roboticons
|
void |
setMarketRoboticonStock(int marketRoboticonsStock)
Setter for the stock of the market's roboticons
|
void |
setPrices() |
private int marketOreStock
private int marketFoodStock
private int marketEnergyStock
private int marketRoboticonStock
private int prevOreStock
private int prevEnergyStock
private float marketOreBuyPrice
private float marketEnergyBuyPrice
private float marketOreSellPrice
private float marketEnergySellPrice
private int marketRoboticonSellPrice
private Pub pub
java.lang.Exception eMoney
java.lang.Exception eStockBuy
public void buyOre(Player player, int quantity) throws java.lang.Exception
player
- - Imports the player from the Player class. This allows resources to interact with the player's assets.quantity
- - A defined quantity with input from the userjava.lang.Exception
- - Exception thrown if the Market is out of stock or if the player doesn't have sufficient fundspublic void buyEnergy(Player player, int quantity) throws java.lang.Exception
player
- - Imports the player from the Player class. This allows resources to interact with the player's assets.quantity
- - A defined quantity with input from the userjava.lang.Exception
- - Exception thrown if the Market is out of stock or if the player doesn't have sufficient fundspublic void buyRoboticon(Player player, int quantity) throws java.lang.Exception
player
- - Imports the player from the Player class. This allows resources to interact with the player's assets.quantity
- - A defined quantity with input from the userjava.lang.Exception
- - Exception thrown if the Market is out of stock or if the player doesn't have sufficient fundspublic void sellOre(Player player, int quantity) throws java.lang.Exception
player
- - Imports the player from the Player class. This allows resources to interact with the player's assets.quantity
- - A defined quantity with input from the userjava.lang.Exception
- If the quantity they want to sell is greater than the ore they actually havepublic void sellEnergy(Player player, int quantity) throws java.lang.Exception
player
- - Imports the player from the Player class. This allows resources to interact with the player's assets.quantity
- - A defined quantity with input from the userjava.lang.Exception
- If the quantity they want to sell is greater than the ore they actually havepublic void setPrices()
public void produceRoboticon()
public void scratchCard(Player player) throws java.lang.Exception
player
- -- takes the player that wants to play as inputjava.lang.Exception
- -- throws exeption if the player doesnt have enough manypublic void Lottery(Player player, int num1, int num2, int num3) throws java.lang.Exception
player
- -- takes the player that wants to play as inputnum1
- -- first lottery numbernum2
- -- second lottery numbernum3
- -- third lottery numberjava.lang.Exception
- -- if the player doesnt have enough moneypublic int[] OneArmBandit(Player player) throws java.lang.Exception
player
- -- takes the player that wants to play as inputjava.lang.Exception
- -- if the player doesnt have enough moneypublic int getMarketOreStock()
public void setMarketOreStock(int marketOreStock)
marketOreStock
- -- set ore stockpublic int getMarketFoodStock()
public void setMarketFoodStock(int marketFoodStock)
marketFoodStock
- -- set market food stockpublic int getMarketEnergyStock()
public void setMarketEnergyStock(int marketEnergyStock)
marketEnergyStock
- -- set market energy stockpublic int getMarketRoboticonStock()
public void setMarketRoboticonStock(int marketRoboticonsStock)
marketRoboticonsStock
- -- set the roboticon market stockpublic float getMarketOreBuyPrice()
public void setMarketOreBuyPrice(float marketOreBuyPrice)
marketOreBuyPrice
- -- sets the markey ore buy pricepublic float getMarketEnergyBuyPrice()
public void setMarketEnergyBuyPrice(float marketEnergyBuyPrice)
marketEnergyBuyPrice
- -- sets the market energy buy pricepublic float getMarketOreSellPrice()
public void setMarketOreSellPrice(float marketOreSellPrice)
marketOreSellPrice
- -- sets the market ore sell pricepublic float getMarketEnergySellPrice()
public void setMarketEnergySellPrice(float marketEnergySellPrice)
marketEnergySellPrice
- -- sets the market ore sell pricepublic int getMarketRoboticonSellPrice()
public void setMarketRoboticonSellPrice(int marketRoboticonSellPrice)
marketRoboticonSellPrice
- -- sets the market roboticon sell pricepublic Pub getPub()