Update: Game Implementation
This commit is contained in:
@@ -26,11 +26,12 @@ public class Game {
|
||||
private List<BuildingCard> upperListBuilding;
|
||||
private List<BuildingCard> lowerListBuilding;
|
||||
private ArrayList<Player> playersList;
|
||||
private OrderLogicCard orderLogicCard;
|
||||
|
||||
private CurrentState currentState;
|
||||
private HashMap<Slot,Player> slotMap ;
|
||||
private HashMap<Slot,Player> slotMap;
|
||||
private int nPlayers;
|
||||
private OrderLogicCard orderLogicCard;
|
||||
|
||||
|
||||
public Game(int nPlayers) {
|
||||
this.nPlayers = nPlayers;
|
||||
@@ -54,8 +55,7 @@ public class Game {
|
||||
lowerListBuilding = new ArrayList<>();
|
||||
playersList = new ArrayList<>();
|
||||
}
|
||||
public void init()
|
||||
{
|
||||
public void init() {
|
||||
switch (nPlayers) {
|
||||
case 2:
|
||||
orderLogicCard=new Order2(playersList);
|
||||
@@ -92,8 +92,8 @@ public class Game {
|
||||
currentState.GameStageUpdate(GameStages.SLOT_CHOICE);
|
||||
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)
|
||||
{
|
||||
return false;
|
||||
@@ -126,22 +126,56 @@ public class Game {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public boolean DrawTribeCard(Player player,TribeCard tribeCard)
|
||||
{
|
||||
//region Drawing Methods
|
||||
public boolean DrawUpperTribeCard(Player player,TribeCard tribeCard) {
|
||||
if(currentState.getGameStage()!= GameStages.RESOLVING_ACTIONS)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if(player.equals(currentPlayer))
|
||||
if(player.equals(currentState.getCurrentPlayer()))
|
||||
{
|
||||
|
||||
}
|
||||
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)
|
||||
{
|
||||
return false;
|
||||
@@ -165,8 +199,10 @@ public class Game {
|
||||
return false;
|
||||
}
|
||||
|
||||
private void nextPlayerSetup()
|
||||
{
|
||||
//endregion
|
||||
|
||||
private void EraUpdate(){}
|
||||
private void nextPlayerSetup() {
|
||||
if(GameStages.RESOLVING_ACTIONS==currentState.getGameStage()) {
|
||||
orderLogicCard.push(currentState.getCurrentPlayer());
|
||||
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)
|
||||
{
|
||||
@@ -213,14 +247,15 @@ public class Game {
|
||||
|
||||
|
||||
}
|
||||
private void nextRound()
|
||||
{
|
||||
private void nextRound() {
|
||||
|
||||
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));
|
||||
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));
|
||||
@@ -236,8 +271,9 @@ public class Game {
|
||||
return tribeDeck_temp;
|
||||
}
|
||||
|
||||
public boolean addPlayer(Player player)
|
||||
{
|
||||
|
||||
|
||||
public boolean addPlayer(Player player) {
|
||||
if(currentState.getGameStage()!= GameStages.WAITING)
|
||||
return false;
|
||||
playersList.add(player);
|
||||
|
||||
Reference in New Issue
Block a user