public class Trade
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
int |
energyAmount |
int |
foodAmount |
int |
oreAmount |
private int |
price |
private Player |
sender |
private Player |
targetPlayer |
Constructor and Description |
---|
Trade(int oreAmount,
int energyAmount,
int foodAmount,
int price,
Player sender,
Player targetPlayer)
constructor for a trade
|
Modifier and Type | Method and Description |
---|---|
boolean |
execute()
execute will first test if the players have enough resources and money to execute the trade
if they do it will vary the resources and money in their inventories by the appropriate amount
|
int |
getPrice() |
Player |
getSender() |
Player |
getTargetPlayer() |
void |
setPrice(int newPrice) |
public final int oreAmount
public final int energyAmount
public final int foodAmount
private int price
private Player sender
private Player targetPlayer
public Trade(int oreAmount, int energyAmount, int foodAmount, int price, Player sender, Player targetPlayer)
oreAmount
- - amount of ore for saleenergyAmount
- - amount of energy for salefoodAmount
- - amount of food for saleprice
- - price of the salesender
- - player sending the tradetargetPlayer
- - player receiving the tradepublic int getPrice()
public void setPrice(int newPrice)
public Player getTargetPlayer()
public Player getSender()
public boolean execute()