dynamically set players in ChoosePatner

This commit is contained in:
Johannes Schmelz
2024-11-26 20:00:50 +01:00
parent 174958c6b1
commit 9107a08011
2 changed files with 134 additions and 14 deletions

View File

@@ -12,13 +12,13 @@ import java.util.List;
public class TradeHandler {
private final Player sender;
private final Player receiver;
private final int offeredAmount;
private final List<PropertyField> offeredProperties;
private final int offeredJailCards;
private final int requestedAmount;
private final List<PropertyField> requestedProperties;
private final int requestedJailCards;
private Player receiver;
private int offeredAmount;
private List<PropertyField> offeredProperties;
private int offeredJailCards;
private int requestedAmount;
private List<PropertyField> requestedProperties;
private int requestedJailCards;
private Boolean status = null;
/**
@@ -45,6 +45,22 @@ public class TradeHandler {
this.requestedJailCards = requestedJailCards;
}
/**
* Constructs a TradeHandler for a single trade instance.
*
* @param sender the Player initiating the trade
* @param receiver the Player receiving the trade offer
* @param offeredAmount the amount of money offered by the sender
* @param offeredProperties the properties offered by the sender
* @param offeredJailCards the jail cards offered by the sender
* @param requestedAmount the amount of money requested from the receiver
* @param requestedProperties the properties requested from the receiver
* @param requestedJailCards the jail cards requested from the receiver
*/
public TradeHandler(Player sender) {
this.sender = sender;
}
public int getOfferedAmount() {
return offeredAmount;
}
@@ -209,4 +225,32 @@ public class TradeHandler {
}
System.out.println(numCards + " jail card(s) transferred from " + from.getName() + " to " + to.getName());
}
public void setOfferedAmount(int offeredAmount) {
this.offeredAmount = offeredAmount;
}
public void setOfferedJailCards(int offeredJailCards) {
this.offeredJailCards = offeredJailCards;
}
public void setOfferedProperties(List<PropertyField> offeredProperties) {
this.offeredProperties = offeredProperties;
}
public void setReceiver(Player receiver) {
this.receiver = receiver;
}
public void setRequestedAmount(int requestedAmount) {
this.requestedAmount = requestedAmount;
}
public void setRequestedJailCards(int requestedJailCards) {
this.requestedJailCards = requestedJailCards;
}
public void setRequestedProperties(List<PropertyField> requestedProperties) {
this.requestedProperties = requestedProperties;
}
}