Update: Game Implementation
This commit is contained in:
@@ -26,11 +26,12 @@ public class Game {
|
|||||||
private List<BuildingCard> upperListBuilding;
|
private List<BuildingCard> upperListBuilding;
|
||||||
private List<BuildingCard> lowerListBuilding;
|
private List<BuildingCard> lowerListBuilding;
|
||||||
private ArrayList<Player> playersList;
|
private ArrayList<Player> playersList;
|
||||||
|
private OrderLogicCard orderLogicCard;
|
||||||
|
|
||||||
private CurrentState currentState;
|
private CurrentState currentState;
|
||||||
private HashMap<Slot,Player> slotMap;
|
private HashMap<Slot,Player> slotMap;
|
||||||
private int nPlayers;
|
private int nPlayers;
|
||||||
private OrderLogicCard orderLogicCard;
|
|
||||||
|
|
||||||
public Game(int nPlayers) {
|
public Game(int nPlayers) {
|
||||||
this.nPlayers = nPlayers;
|
this.nPlayers = nPlayers;
|
||||||
@@ -54,8 +55,7 @@ public class Game {
|
|||||||
lowerListBuilding = new ArrayList<>();
|
lowerListBuilding = new ArrayList<>();
|
||||||
playersList = new ArrayList<>();
|
playersList = new ArrayList<>();
|
||||||
}
|
}
|
||||||
public void init()
|
public void init() {
|
||||||
{
|
|
||||||
switch (nPlayers) {
|
switch (nPlayers) {
|
||||||
case 2:
|
case 2:
|
||||||
orderLogicCard=new Order2(playersList);
|
orderLogicCard=new Order2(playersList);
|
||||||
@@ -92,8 +92,8 @@ public class Game {
|
|||||||
currentState.GameStageUpdate(GameStages.SLOT_CHOICE);
|
currentState.GameStageUpdate(GameStages.SLOT_CHOICE);
|
||||||
currentState.PlayerUpdate(orderLogicCard.pull(),null);
|
currentState.PlayerUpdate(orderLogicCard.pull(),null);
|
||||||
}
|
}
|
||||||
public boolean SlotChoice(Player player, Slot slot)
|
|
||||||
{
|
public boolean SlotChoice(Player player, Slot slot) {
|
||||||
if(currentState.getGameStage()!= GameStages.SLOT_CHOICE)
|
if(currentState.getGameStage()!= GameStages.SLOT_CHOICE)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@@ -126,22 +126,56 @@ public class Game {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//region Drawing Methods
|
||||||
public boolean DrawTribeCard(Player player,TribeCard tribeCard)
|
public boolean DrawUpperTribeCard(Player player,TribeCard tribeCard) {
|
||||||
{
|
|
||||||
if(currentState.getGameStage()!= GameStages.RESOLVING_ACTIONS)
|
if(currentState.getGameStage()!= GameStages.RESOLVING_ACTIONS)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if(player.equals(currentPlayer))
|
if(player.equals(currentState.getCurrentPlayer()))
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
public boolean DrawUpperBuildingCard(Player player,BuildingCard buildingCard)
|
public boolean DrawLowerTribeCard(Player player,TribeCard tribeCard) {
|
||||||
|
if(currentState.getGameStage()!= GameStages.RESOLVING_ACTIONS)
|
||||||
{
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(player.equals(currentState.getCurrentPlayer()))
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean DrawUpperBuildingCard(Player player,BuildingCard buildingCard) {
|
||||||
|
if(currentState.getGameStage()!= GameStages.RESOLVING_ACTIONS)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(!player.equals(currentState.getCurrentPlayer()))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(!upperListBuilding.contains(buildingCard))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(buildingCard.buy(player))
|
||||||
|
currentState.UpperDrawn();
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
if(currentState.getNUpper()==currentState.getSlot().getNUpper()&& currentState.getNLower()==currentState.getSlot().getNLower())
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
public boolean DrawLowerBuildingCard(Player player,BuildingCard buildingCard) {
|
||||||
if(currentState.getGameStage()!= GameStages.RESOLVING_ACTIONS)
|
if(currentState.getGameStage()!= GameStages.RESOLVING_ACTIONS)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@@ -165,8 +199,10 @@ public class Game {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void nextPlayerSetup()
|
//endregion
|
||||||
{
|
|
||||||
|
private void EraUpdate(){}
|
||||||
|
private void nextPlayerSetup() {
|
||||||
if(GameStages.RESOLVING_ACTIONS==currentState.getGameStage()) {
|
if(GameStages.RESOLVING_ACTIONS==currentState.getGameStage()) {
|
||||||
orderLogicCard.push(currentState.getCurrentPlayer());
|
orderLogicCard.push(currentState.getCurrentPlayer());
|
||||||
slotMap.put(currentState.getSlot(), null);
|
slotMap.put(currentState.getSlot(), null);
|
||||||
@@ -184,12 +220,10 @@ public class Game {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void BuildingEffect12(List<Player> playerList)
|
private void BuildingEffect12(List<Player> playerList){
|
||||||
{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
private void EventResolution()
|
|
||||||
{
|
private void EventResolution() {
|
||||||
|
|
||||||
if(currentState.getGameStage()!= GameStages.RESOLVING_EVENT)
|
if(currentState.getGameStage()!= GameStages.RESOLVING_EVENT)
|
||||||
{
|
{
|
||||||
@@ -213,14 +247,15 @@ public class Game {
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
private void nextRound()
|
private void nextRound() {
|
||||||
{
|
|
||||||
|
|
||||||
EventResolution();
|
EventResolution();
|
||||||
|
|
||||||
}
|
}
|
||||||
private Queue<TribeCard> getTribeDeck(int nPlayers)
|
private void endGame() {
|
||||||
{
|
|
||||||
|
}
|
||||||
|
private Queue<TribeCard> getTribeDeck(int nPlayers) {
|
||||||
ArrayList<TribeCard> era1= DecksCreator.loadTribeDeckByEra(1).stream().filter(x->x.getNMin()<=nPlayers).collect(Collectors.toCollection(ArrayList::new));
|
ArrayList<TribeCard> era1= DecksCreator.loadTribeDeckByEra(1).stream().filter(x->x.getNMin()<=nPlayers).collect(Collectors.toCollection(ArrayList::new));
|
||||||
List<TribeCard> era2= DecksCreator.loadTribeDeckByEra(2).stream().filter(x->x.getNMin()<=nPlayers).collect(Collectors.toCollection(ArrayList::new));
|
List<TribeCard> era2= DecksCreator.loadTribeDeckByEra(2).stream().filter(x->x.getNMin()<=nPlayers).collect(Collectors.toCollection(ArrayList::new));
|
||||||
List<TribeCard> era3= DecksCreator.loadTribeDeckByEra(3).stream().filter(x->x.getNMin()<=nPlayers).collect(Collectors.toCollection(ArrayList::new));
|
List<TribeCard> era3= DecksCreator.loadTribeDeckByEra(3).stream().filter(x->x.getNMin()<=nPlayers).collect(Collectors.toCollection(ArrayList::new));
|
||||||
@@ -236,8 +271,9 @@ public class Game {
|
|||||||
return tribeDeck_temp;
|
return tribeDeck_temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean addPlayer(Player player)
|
|
||||||
{
|
|
||||||
|
public boolean addPlayer(Player player) {
|
||||||
if(currentState.getGameStage()!= GameStages.WAITING)
|
if(currentState.getGameStage()!= GameStages.WAITING)
|
||||||
return false;
|
return false;
|
||||||
playersList.add(player);
|
playersList.add(player);
|
||||||
|
|||||||
Reference in New Issue
Block a user