Refactor: removed dead code and standarized to camelCase
This commit is contained in:
@@ -5,7 +5,6 @@ import it.polimi.ingsw.gc14.Model.Cards.BuildingCard;
|
||||
import it.polimi.ingsw.gc14.Model.Cards.TribeCards.CharacterType;
|
||||
import it.polimi.ingsw.gc14.Model.Player;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* At the end of the game, the player gains 6 Prestige Points
|
||||
@@ -69,8 +68,6 @@ public class Building10 extends BuildingCard {
|
||||
public void applyEffect(Player player) throws IllegalArgumentException {
|
||||
if(!player.getBuildingCards().contains(this))
|
||||
throw new IllegalArgumentException();
|
||||
HashMap<CharacterType,Integer> map = new HashMap<CharacterType,Integer>();
|
||||
|
||||
int numSet=player.getNType(CharacterType.INVENTOR);
|
||||
for(CharacterType type : CharacterType.values())
|
||||
{
|
||||
|
||||
@@ -26,14 +26,14 @@ public class Building11 extends BuildingCard {
|
||||
*/
|
||||
public CharacterType getIcon() {return icon;}
|
||||
|
||||
private int PrestigeMul;
|
||||
private int prestigeMul;
|
||||
|
||||
/**
|
||||
* Returns the prestige multiplier associated with this building card effect.
|
||||
*
|
||||
* @return the prestige multiplier associated with this building card effect.
|
||||
*/
|
||||
public int getPrestigeMul() {return PrestigeMul;}
|
||||
public int getprestigeMul() {return prestigeMul;}
|
||||
|
||||
/**
|
||||
* Creates a Building11 card with the specified era, price, prestige value,
|
||||
@@ -50,7 +50,7 @@ public class Building11 extends BuildingCard {
|
||||
effectType = EffectType.FINAL;
|
||||
effectId = 11;
|
||||
this.icon = icon;
|
||||
this.PrestigeMul = prestigeMul;
|
||||
this.prestigeMul = prestigeMul;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -69,7 +69,7 @@ public class Building11 extends BuildingCard {
|
||||
effectType = EffectType.FINAL;
|
||||
effectId = 11;
|
||||
this.icon = icon;
|
||||
this.PrestigeMul = prestigeMul;
|
||||
this.prestigeMul = prestigeMul;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -79,7 +79,7 @@ public class Building11 extends BuildingCard {
|
||||
*/
|
||||
@Override
|
||||
public BuildingCard clone() {
|
||||
return new Building11(getIdIMG(),getEra(),getPrice(),getPrestigeValue(), getIcon(), getPrestigeMul());
|
||||
return new Building11(getIdIMG(),getEra(),getPrice(),getPrestigeValue(), getIcon(), getprestigeMul());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -94,7 +94,7 @@ public class Building11 extends BuildingCard {
|
||||
public void applyEffect(Player player) throws IllegalArgumentException {
|
||||
if(!player.getBuildingCards().contains(this))
|
||||
throw new IllegalArgumentException();
|
||||
player.addPrestige(player.getNType(getIcon()) * this.getPrestigeMul());
|
||||
player.addPrestige(player.getNType(getIcon()) * this.getprestigeMul());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -105,11 +105,11 @@ public class Building11 extends BuildingCard {
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
return super.toString() + "+" + this.icon.toString().substring(0, 3) + "×" + this.PrestigeMul;
|
||||
return super.toString() + "+" + this.icon.toString().substring(0, 3) + "×" + this.prestigeMul;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toStringPlayer() {
|
||||
return super.toStringPlayer() + " (\uD83C\uDFC5:" + this.icon.toString().substring(0, 3) + "×" + this.PrestigeMul + ")";
|
||||
return super.toStringPlayer() + " (\uD83C\uDFC5:" + this.icon.toString().substring(0, 3) + "×" + this.prestigeMul + ")";
|
||||
}
|
||||
}
|
||||
@@ -22,7 +22,7 @@ public abstract class TribeCard extends PlayableCard implements Serializable {
|
||||
*
|
||||
* @return {@code true} if this card is an event card, {@code false} otherwise.
|
||||
*/
|
||||
public boolean IsEventCard() {
|
||||
public boolean isEventCard() {
|
||||
return isEventCard;
|
||||
}
|
||||
|
||||
|
||||
@@ -76,17 +76,6 @@ public abstract class Character extends TribeCard implements Cloneable {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the string representation of this character card.
|
||||
*
|
||||
* @return the string representation of this character card.
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
return super.toString();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns a string representation of this {@code Character}. This specific variation is used in the {@code Game}'s
|
||||
* toString to provide a more detailed version.
|
||||
|
||||
@@ -53,16 +53,6 @@ public class Artist extends Character {
|
||||
super(idIMG,Era, CharacterType.ARTIST,nMin);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the string representation of this Artist card.
|
||||
*
|
||||
* @return the string representation of this Artist card.
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
return super.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and returns a copy of this Artist card.
|
||||
*
|
||||
|
||||
@@ -53,16 +53,6 @@ public class Gatherer extends Character {
|
||||
super(idIMG,Era, CharacterType.GATHERER,nMin);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the string representation of this Gatherer card.
|
||||
*
|
||||
* @return the string representation of this Gatherer card.
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
return super.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and returns a copy of this Gatherer card.
|
||||
*
|
||||
@@ -79,6 +69,7 @@ public class Gatherer extends Character {
|
||||
*
|
||||
* @param player the player who receives the card.
|
||||
*/
|
||||
@Override
|
||||
public void insert(Player player) {
|
||||
player.getGatherers().add(this);
|
||||
player.getBuildingCards().stream().filter(x->x.getEffectId()==0).forEach(x->x.applyEffect(player));
|
||||
|
||||
@@ -4,7 +4,6 @@ import it.polimi.ingsw.gc14.Model.Cards.TribeCard;
|
||||
import it.polimi.ingsw.gc14.Model.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.lang.reflect.Array;
|
||||
|
||||
/**
|
||||
* Abstract base class for all event cards.
|
||||
|
||||
+30
-30
@@ -21,31 +21,31 @@ public class CavePaintings extends EventCard {
|
||||
* The minimum number of Artist cards required to avoid the prestige penalty.
|
||||
* Also, the bottom number on the card.
|
||||
*/
|
||||
private int NLower;
|
||||
private int nLower;
|
||||
|
||||
/**
|
||||
* The amount of Prestige removed if the player has fewer Artist cards than {@code NLower}.
|
||||
* The amount of Prestige removed if the player has fewer Artist cards than {@code nLower}.
|
||||
*/
|
||||
private int NPrestigeRem; // NPrestigeLower
|
||||
private int nPrestigeRem; // NPrestigeLower
|
||||
|
||||
/**
|
||||
* The Prestige multiplier applied if the player has at least {@code NLower} Artist cards.
|
||||
* The Prestige multiplier applied if the player has at least {@code nLower} Artist cards.
|
||||
*/
|
||||
private int NPrestigeMul; // NPrestigeUpper
|
||||
private int nPrestigeMul; // NPrestigeUpper
|
||||
|
||||
/**
|
||||
* Creates a CavePaintings event card with the specified era and effect parameters.
|
||||
*
|
||||
* @param Era the era of the event card.
|
||||
* @param NLower the minimum number of Artist cards required to avoid the prestige penalty.
|
||||
* @param NPrestigeRem the amount of Prestige removed if the player has fewer Artist cards than {@code NLower}.
|
||||
* @param NPrestigeMul the Prestige multiplier applied if the player has at least {@code NLower} Artist cards.
|
||||
* @param nLower the minimum number of Artist cards required to avoid the prestige penalty.
|
||||
* @param nPrestigeRem the amount of Prestige removed if the player has fewer Artist cards than {@code nLower}.
|
||||
* @param nPrestigeMul the Prestige multiplier applied if the player has at least {@code nLower} Artist cards.
|
||||
*/
|
||||
public CavePaintings(int Era, int NLower, int NPrestigeRem, int NPrestigeMul) {
|
||||
public CavePaintings(int Era, int nLower, int nPrestigeRem, int nPrestigeMul) {
|
||||
super(Era, EventType.CAVE_PAINTINGS);
|
||||
this.NLower = NLower;
|
||||
this.NPrestigeRem = NPrestigeRem;
|
||||
this.NPrestigeMul = NPrestigeMul;
|
||||
this.nLower = nLower;
|
||||
this.nPrestigeRem = nPrestigeRem;
|
||||
this.nPrestigeMul = nPrestigeMul;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -53,15 +53,15 @@ public class CavePaintings extends EventCard {
|
||||
*
|
||||
* @param idIMG the image identifier of the CavePaintings event card.
|
||||
* @param Era the era of the event card.
|
||||
* @param NLower the minimum number of Artist cards required to avoid the prestige penalty.
|
||||
* @param NPrestigeRem the amount of Prestige removed if the player has fewer Artist cards than {@code NLower}.
|
||||
* @param NPrestigeMul the Prestige multiplier applied if the player has at least {@code NLower} Artist cards.
|
||||
* @param nLower the minimum number of Artist cards required to avoid the prestige penalty.
|
||||
* @param nPrestigeRem the amount of Prestige removed if the player has fewer Artist cards than {@code nLower}.
|
||||
* @param nPrestigeMul the Prestige multiplier applied if the player has at least {@code nLower} Artist cards.
|
||||
*/
|
||||
public CavePaintings(String idIMG,int Era, int NLower, int NPrestigeRem, int NPrestigeMul) {
|
||||
public CavePaintings(String idIMG,int Era, int nLower, int nPrestigeRem, int nPrestigeMul) {
|
||||
super(idIMG,Era, EventType.CAVE_PAINTINGS);
|
||||
this.NLower = NLower;
|
||||
this.NPrestigeRem = NPrestigeRem;
|
||||
this.NPrestigeMul = NPrestigeMul;
|
||||
this.nLower = nLower;
|
||||
this.nPrestigeRem = nPrestigeRem;
|
||||
this.nPrestigeMul = nPrestigeMul;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -69,8 +69,8 @@ public class CavePaintings extends EventCard {
|
||||
* For each player, the number of Artist cards is computed together with the number
|
||||
* of owned building cards having effect id equal to 9.
|
||||
* The player gains Food equal to the number of such buildings multiplied by the number of Artist cards.
|
||||
* If the player has fewer Artist cards than {@code NLower}, the player loses {@code NPrestigeRem} Prestige.
|
||||
* Otherwise, the player gains Prestige equal to {@code NPrestigeMul} multiplied by the number of Artist cards.
|
||||
* If the player has fewer Artist cards than {@code nLower}, the player loses {@code nPrestigeRem} Prestige.
|
||||
* Otherwise, the player gains Prestige equal to {@code nPrestigeMul} multiplied by the number of Artist cards.
|
||||
*
|
||||
* @param playerList the list of players affected by the event.
|
||||
*/
|
||||
@@ -87,11 +87,11 @@ public class CavePaintings extends EventCard {
|
||||
}
|
||||
}
|
||||
player.addFood(NBuildings * NArtists);
|
||||
if (NArtists < NLower){
|
||||
player.removePrestige(NPrestigeRem);
|
||||
if (NArtists < nLower){
|
||||
player.removePrestige(nPrestigeRem);
|
||||
}
|
||||
else{
|
||||
player.addPrestige(NPrestigeMul * NArtists);
|
||||
player.addPrestige(nPrestigeMul * NArtists);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -104,20 +104,20 @@ public class CavePaintings extends EventCard {
|
||||
@Override
|
||||
public EventCard clone()
|
||||
{
|
||||
return new CavePaintings(getIdIMG(),getEra(), NLower, NPrestigeRem, NPrestigeMul) ;
|
||||
return new CavePaintings(getIdIMG(),getEra(), nLower, nPrestigeRem, nPrestigeMul) ;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints a string representation of this {@code TribeCard}. This specific variation is used in the {@code Game}'s
|
||||
* toString to print a more detailed version.
|
||||
* <p>NOTE: {@code NUpper} is not a real attribute used in calculations (only {@code NLower} is needed),
|
||||
* <p>NOTE: {@code NUpper} is not a real attribute used in calculations (only {@code nLower} is needed),
|
||||
* however it's a parameter on the cards' design.
|
||||
* </p>
|
||||
* <p>Includes:
|
||||
* <li>{@link #NLower}
|
||||
* <li>{@link #nLower}
|
||||
* <li>{@code NUpper}
|
||||
* <li>{@link #NPrestigeRem}
|
||||
* <li>{@link #NPrestigeMul}
|
||||
* <li>{@link #nPrestigeRem}
|
||||
* <li>{@link #nPrestigeMul}
|
||||
* </p>
|
||||
* @return {@code String} - a string representation of this {@code TribeCard}.
|
||||
* @see it.polimi.ingsw.gc14.Model.Cards.TribeCard TribeCard
|
||||
@@ -126,6 +126,6 @@ public class CavePaintings extends EventCard {
|
||||
*/
|
||||
@Override
|
||||
public String toStringBoard() {
|
||||
return super.toStringBoard()+" 0-"+(NLower-1)+":"+NPrestigeRem+" "+NLower+"+:"+NPrestigeMul;
|
||||
return super.toStringBoard()+" 0-"+(nLower-1)+":"+nPrestigeRem+" "+nLower+"+:"+nPrestigeMul;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,26 +21,26 @@ public class Sustenance extends EventCard {
|
||||
/**
|
||||
* The prestige penalty multiplier applied for each unpaid Food unit.
|
||||
*/
|
||||
private int PrestigeDebt;
|
||||
private int prestigeDebt;
|
||||
|
||||
/**
|
||||
* Returns the prestige penalty multiplier associated with this Sustenance event.
|
||||
*
|
||||
* @return the prestige penalty multiplier associated with this Sustenance event.
|
||||
*/
|
||||
public int getPrestigeDebt() {
|
||||
return PrestigeDebt;
|
||||
public int getprestigeDebt() {
|
||||
return prestigeDebt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a Sustenance event card with the specified era and prestige debt value.
|
||||
*
|
||||
* @param Era the era of the event card.
|
||||
* @param PrestigeDebt the prestige penalty multiplier for unpaid Food units.
|
||||
* @param prestigeDebt the prestige penalty multiplier for unpaid Food units.
|
||||
*/
|
||||
public Sustenance(int Era, int PrestigeDebt) {
|
||||
public Sustenance(int Era, int prestigeDebt) {
|
||||
super(Era, EventType.SUSTENANCE);
|
||||
this.PrestigeDebt = PrestigeDebt;
|
||||
this.prestigeDebt = prestigeDebt;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -48,11 +48,11 @@ public class Sustenance extends EventCard {
|
||||
*
|
||||
* @param idIMG the image identifier of the Sustenance event card.
|
||||
* @param Era the era of the event card.
|
||||
* @param PrestigeDebt the prestige penalty multiplier for unpaid Food units.
|
||||
* @param prestigeDebt the prestige penalty multiplier for unpaid Food units.
|
||||
*/
|
||||
public Sustenance(String idIMG,int Era, int PrestigeDebt) {
|
||||
public Sustenance(String idIMG,int Era, int prestigeDebt) {
|
||||
super(idIMG,Era, EventType.SUSTENANCE);
|
||||
this.PrestigeDebt = PrestigeDebt;
|
||||
this.prestigeDebt = prestigeDebt;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -62,7 +62,7 @@ public class Sustenance extends EventCard {
|
||||
* granted by owned building cards with effect id equal to 1.
|
||||
* If the resulting Food debt is positive, the player must pay it with available Food.
|
||||
* If the player does not have enough Food, all remaining Food is removed and the player
|
||||
* loses Prestige equal to the unpaid Food debt multiplied by {@code PrestigeDebt}.
|
||||
* loses Prestige equal to the unpaid Food debt multiplied by {@code prestigeDebt}.
|
||||
* <b>This event is intended to be executed last among event effects.</b>
|
||||
*
|
||||
* @param playerList the list of players affected by the event.
|
||||
@@ -94,7 +94,7 @@ public class Sustenance extends EventCard {
|
||||
else{
|
||||
FoodDebt -= player.getFoodValue();
|
||||
player.removeFood(player.getFoodValue()); // player.getFoodValue() == 0
|
||||
player.removePrestige(FoodDebt * PrestigeDebt);
|
||||
player.removePrestige(FoodDebt * prestigeDebt);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -106,14 +106,14 @@ public class Sustenance extends EventCard {
|
||||
*/
|
||||
@Override
|
||||
public EventCard clone() {
|
||||
return new Sustenance(getIdIMG(),getEra(), PrestigeDebt);
|
||||
return new Sustenance(getIdIMG(),getEra(), prestigeDebt);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints a string representation of this {@code TribeCard}. This specific variation is used in the {@code Game}'s
|
||||
* toString to print a more detailed version.
|
||||
* <p>Includes:
|
||||
* <li>{@link #PrestigeDebt}
|
||||
* <li>{@link #prestigeDebt}
|
||||
* </p>
|
||||
* @return {@code String} - a string representation of this {@code TribeCard}.
|
||||
* @see it.polimi.ingsw.gc14.Model.Cards.TribeCard TribeCard
|
||||
@@ -122,6 +122,6 @@ public class Sustenance extends EventCard {
|
||||
*/
|
||||
@Override
|
||||
public String toStringBoard() {
|
||||
return super.toStringBoard()+" -1\uD83C\uDF56/-"+PrestigeDebt+"\uD83C\uDFC5";
|
||||
return super.toStringBoard()+" -1\uD83C\uDF56/-"+prestigeDebt+"\uD83C\uDFC5";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,8 @@ import java.util.*;
|
||||
*/
|
||||
public class DecksCreator {
|
||||
|
||||
private DecksCreator() {}
|
||||
|
||||
/**
|
||||
* Loads the tribe card deck for the specified era from the corresponding JSON resource file.
|
||||
*
|
||||
@@ -133,7 +135,6 @@ public class DecksCreator {
|
||||
*/
|
||||
private static TribeCard createCard(TribeCardDefinition def) {
|
||||
int era = def.era;
|
||||
String id = def.id;
|
||||
int[] p = def.params.stream().mapToInt(d -> ((Double) d).intValue()).toArray();
|
||||
if(def.isEvent)
|
||||
{
|
||||
|
||||
@@ -321,12 +321,12 @@ public class Game implements Serializable {
|
||||
/**
|
||||
* Returns the player with the specified username, if present.
|
||||
*
|
||||
* @param Username the username of the player to search for.
|
||||
* @param username the username of the player to search for.
|
||||
* @return the player with the specified username, or {@code null} if no such player exists.
|
||||
* @throws IndexOutOfBoundsException if an index access error occurs.
|
||||
*/
|
||||
public Player getPlayerByUsername(String Username) throws IndexOutOfBoundsException {
|
||||
return playersList.stream().filter(x->x.getUserName().equals(Username)).findFirst().orElse(null);
|
||||
public Player getPlayerByUsername(String username) throws IndexOutOfBoundsException {
|
||||
return playersList.stream().filter(x->x.getUserName().equals(username)).findFirst().orElse(null);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -493,7 +493,7 @@ public class Game implements Serializable {
|
||||
if(currentState.getNUpper() <1 && currentState.getGameStage()==GameStages.RES_ACTIONS)
|
||||
return false;
|
||||
TribeCard tribeCard = board.upperListTribe.get(cardIndex);
|
||||
if(tribeCard.IsEventCard())
|
||||
if(tribeCard.isEventCard())
|
||||
return false;
|
||||
|
||||
Character tempCard = (Character) tribeCard;
|
||||
@@ -578,7 +578,7 @@ public class Game implements Serializable {
|
||||
if(currentState.getNLower() <1)
|
||||
return false;
|
||||
TribeCard tribeCard = board.lowerListTribe.get(cardIndex);
|
||||
if(tribeCard.IsEventCard())
|
||||
if(tribeCard.isEventCard())
|
||||
return false;
|
||||
|
||||
Character tempCard = (Character) tribeCard;
|
||||
@@ -868,7 +868,7 @@ public class Game implements Serializable {
|
||||
*/
|
||||
private boolean hasDrawableUp()
|
||||
{
|
||||
return getUpperListTribeCards().stream().anyMatch(x -> !x.IsEventCard());
|
||||
return getUpperListTribeCards().stream().anyMatch(x -> !x.isEventCard());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -879,7 +879,7 @@ public class Game implements Serializable {
|
||||
*/
|
||||
private boolean hasDrawableDown()
|
||||
{
|
||||
return getLowerListTribeCards().stream().anyMatch(x -> !x.IsEventCard());
|
||||
return getLowerListTribeCards().stream().anyMatch(x -> !x.isEventCard());
|
||||
}
|
||||
/**
|
||||
* Resolves all pending event cards if the current game stage is {@code RESOLVING_EVENT}.
|
||||
@@ -915,13 +915,6 @@ public class Game implements Serializable {
|
||||
private void nextRound() {
|
||||
|
||||
EventResolution();
|
||||
if(currentState.getRound()==10)
|
||||
{
|
||||
currentState.GameStageUpdate(GameStages.ENDING);
|
||||
endGame();
|
||||
return;
|
||||
}
|
||||
|
||||
if(currentState.getEra()!= board.nextRound()) {
|
||||
currentState.EraUpdate();
|
||||
}
|
||||
@@ -936,7 +929,7 @@ public class Game implements Serializable {
|
||||
*/
|
||||
private void endGame() {
|
||||
Queue<EventCard> events;
|
||||
events=Stream.concat(board.lowerListTribe.stream().filter(TribeCard::IsEventCard),board.upperListTribe.stream().filter(TribeCard::IsEventCard)).map(x->((EventCard)x)).collect(Collectors.toCollection(LinkedList::new));
|
||||
events=Stream.concat(board.lowerListTribe.stream().filter(TribeCard::isEventCard),board.upperListTribe.stream().filter(TribeCard::isEventCard)).map(x->((EventCard)x)).collect(Collectors.toCollection(LinkedList::new));
|
||||
ArrayList<EventCard>sustenance=events.stream().filter(x->x.getType().equals(EventType.SUSTENANCE)).collect(Collectors.toCollection(ArrayList::new));
|
||||
events.removeAll(sustenance);
|
||||
events.forEach(event->event.activateEvent(playersList));
|
||||
|
||||
@@ -97,7 +97,7 @@ public class Board implements Serializable {
|
||||
for(int i=0;i<nTotem+1;i++)
|
||||
{
|
||||
TribeCard tempCard = tribeDeck.remove();
|
||||
if(tempCard.IsEventCard())
|
||||
if(tempCard.isEventCard())
|
||||
{
|
||||
upperListTribe.add(tempCard);
|
||||
i--;
|
||||
@@ -186,7 +186,7 @@ public class Board implements Serializable {
|
||||
|
||||
/** @return the queue of events cards from the lower list that need to be activated */
|
||||
public Queue<EventCard> getPendingEvents(){
|
||||
return lowerListTribe.stream().filter(TribeCard::IsEventCard).map(x->(EventCard)x).collect(Collectors.toCollection(LinkedList::new));
|
||||
return lowerListTribe.stream().filter(TribeCard::isEventCard).map(x->(EventCard)x).collect(Collectors.toCollection(LinkedList::new));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -267,8 +267,6 @@ public class Board implements Serializable {
|
||||
lowerListBuilding.addAll(upperListBuilding);
|
||||
upperListBuilding.clear();
|
||||
|
||||
ArrayList<BuildingCard> buildingCards= new ArrayList<>(DecksCreator.loadBuildingDeckByEra(era));
|
||||
Collections.shuffle(buildingCards);
|
||||
if(era==2)
|
||||
{
|
||||
upperListBuilding.addAll(buildingCardsAllEras.get(1));
|
||||
|
||||
@@ -77,7 +77,7 @@ public class CurrentState implements Serializable {
|
||||
/**
|
||||
* The number of upper cards currently available.
|
||||
*/
|
||||
private int NUpper;
|
||||
private int nUpper;
|
||||
|
||||
/**
|
||||
* Returns the number of upper cards currently available.
|
||||
@@ -85,13 +85,13 @@ public class CurrentState implements Serializable {
|
||||
* @return the number of upper cards currently available.
|
||||
*/
|
||||
public int getNUpper(){
|
||||
return NUpper;
|
||||
return nUpper;
|
||||
}
|
||||
|
||||
/**
|
||||
* The number of lower cards currently available.
|
||||
*/
|
||||
private int NLower;
|
||||
private int nLower;
|
||||
|
||||
/**
|
||||
* Returns the number of lower cards currently available.
|
||||
@@ -99,7 +99,7 @@ public class CurrentState implements Serializable {
|
||||
* @return the number of lower cards currently available.
|
||||
*/
|
||||
public int getNLower(){
|
||||
return NLower;
|
||||
return nLower;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -138,14 +138,14 @@ public class CurrentState implements Serializable {
|
||||
* Decrements the number of upper cards by 1.
|
||||
*/
|
||||
public void UpperDrawn(){
|
||||
NUpper--;
|
||||
nUpper--;
|
||||
}
|
||||
|
||||
/**
|
||||
* Decrements the number of lower cards by 1.
|
||||
*/
|
||||
public void LowerDrawn(){
|
||||
NLower--;
|
||||
nLower--;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -170,8 +170,8 @@ public class CurrentState implements Serializable {
|
||||
this.slot = null;
|
||||
this.Era = 1;
|
||||
this.round = 1;
|
||||
this.NUpper = 0;
|
||||
this.NLower = 0;
|
||||
this.nUpper = 0;
|
||||
this.nLower = 0;
|
||||
this.GameStage = GameStages.WAITING;
|
||||
}
|
||||
// endregion constructors
|
||||
@@ -190,12 +190,12 @@ public class CurrentState implements Serializable {
|
||||
this.player = player;
|
||||
this.slot = slot;
|
||||
if(slot == null){
|
||||
this.NUpper = 0;
|
||||
this.NLower = 0;
|
||||
this.nUpper = 0;
|
||||
this.nLower = 0;
|
||||
}
|
||||
else{
|
||||
this.NUpper = slot.getNUpper();
|
||||
this.NLower = slot.getNLower();
|
||||
this.nUpper = slot.getNUpper();
|
||||
this.nLower = slot.getNLower();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,11 +1,5 @@
|
||||
package it.polimi.ingsw.gc14.Model;
|
||||
|
||||
//import it.polimi.ingsw.gc14.Controller.GameController;
|
||||
import it.polimi.ingsw.gc14.Model.Cards.BuildingCard;
|
||||
import it.polimi.ingsw.gc14.Model.Cards.TribeCard;
|
||||
import it.polimi.ingsw.gc14.Model.Cards.TribeCards.Characters.Inventor;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/** Standalone entry point used for local model testing. */
|
||||
public class Main {
|
||||
|
||||
@@ -2,7 +2,6 @@ package it.polimi.ingsw.gc14.Model.Orders;
|
||||
|
||||
import it.polimi.ingsw.gc14.Model.OrderLogicCard;
|
||||
import it.polimi.ingsw.gc14.Model.Player;
|
||||
import it.polimi.ingsw.gc14.Model.Totems;
|
||||
import it.polimi.ingsw.gc14.View.TUI.AsciiTable;
|
||||
import it.polimi.ingsw.gc14.View.TUI.BorderStyle;
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@ package it.polimi.ingsw.gc14.Model.Orders;
|
||||
|
||||
import it.polimi.ingsw.gc14.Model.OrderLogicCard;
|
||||
import it.polimi.ingsw.gc14.Model.Player;
|
||||
import it.polimi.ingsw.gc14.Model.Totems;
|
||||
import it.polimi.ingsw.gc14.View.TUI.AsciiTable;
|
||||
import it.polimi.ingsw.gc14.View.TUI.BorderStyle;
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@ package it.polimi.ingsw.gc14.Model.Orders;
|
||||
|
||||
import it.polimi.ingsw.gc14.Model.OrderLogicCard;
|
||||
import it.polimi.ingsw.gc14.Model.Player;
|
||||
import it.polimi.ingsw.gc14.Model.Totems;
|
||||
import it.polimi.ingsw.gc14.View.TUI.AsciiTable;
|
||||
import it.polimi.ingsw.gc14.View.TUI.BorderStyle;
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@ package it.polimi.ingsw.gc14.Model.Orders;
|
||||
|
||||
import it.polimi.ingsw.gc14.Model.OrderLogicCard;
|
||||
import it.polimi.ingsw.gc14.Model.Player;
|
||||
import it.polimi.ingsw.gc14.Model.Totems;
|
||||
import it.polimi.ingsw.gc14.View.TUI.AsciiTable;
|
||||
import it.polimi.ingsw.gc14.View.TUI.BorderStyle;
|
||||
|
||||
|
||||
@@ -26,14 +26,14 @@ public class Slot implements Serializable {
|
||||
/**
|
||||
* The number of upper cards associated with this slot.
|
||||
*/
|
||||
private int NUpper;
|
||||
private int nUpper;
|
||||
/**
|
||||
* Returns the number of upper cards associated with this slot.
|
||||
*
|
||||
* @return the number of upper cards associated with this slot.
|
||||
*/
|
||||
public int getNUpper(){
|
||||
return NUpper;
|
||||
return nUpper;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -54,7 +54,7 @@ public class Slot implements Serializable {
|
||||
/**
|
||||
* The number of lower cards associated with this slot.
|
||||
*/
|
||||
private int NLower;
|
||||
private int nLower;
|
||||
|
||||
/**
|
||||
* Returns the number of lower cards associated with this slot.
|
||||
@@ -62,13 +62,13 @@ public class Slot implements Serializable {
|
||||
* @return the number of lower cards associated with this slot.
|
||||
*/
|
||||
public int getNLower(){
|
||||
return NLower;
|
||||
return nLower;
|
||||
}
|
||||
|
||||
/**
|
||||
* The amount of Food associated with this slot.
|
||||
*/
|
||||
private int Food;
|
||||
private int food;
|
||||
|
||||
/**
|
||||
* Returns the amount of Food associated with this slot.
|
||||
@@ -76,7 +76,7 @@ public class Slot implements Serializable {
|
||||
* @return the amount of Food associated with this slot.
|
||||
*/
|
||||
public int getFood(){
|
||||
return Food;
|
||||
return food;
|
||||
}
|
||||
// End getters
|
||||
|
||||
@@ -100,41 +100,41 @@ public class Slot implements Serializable {
|
||||
switch(slotId)
|
||||
{
|
||||
case 'A':
|
||||
this.Food = 3;
|
||||
this.NLower = 0;
|
||||
this.NUpper = 0;
|
||||
this.food = 3;
|
||||
this.nLower = 0;
|
||||
this.nUpper = 0;
|
||||
this.nMinPlayer=5;
|
||||
break;
|
||||
case 'B':
|
||||
this.Food = 0;
|
||||
this.NLower = 1;
|
||||
this.NUpper = 0;
|
||||
this.food = 0;
|
||||
this.nLower = 1;
|
||||
this.nUpper = 0;
|
||||
break;
|
||||
case 'C':
|
||||
this.Food = 0;
|
||||
this.NLower = 0;
|
||||
this.NUpper = 1;
|
||||
this.food = 0;
|
||||
this.nLower = 0;
|
||||
this.nUpper = 1;
|
||||
break;
|
||||
case 'D':
|
||||
this.Food = 0;
|
||||
this.NLower = 2;
|
||||
this.NUpper = 0;
|
||||
this.food = 0;
|
||||
this.nLower = 2;
|
||||
this.nUpper = 0;
|
||||
this.nMinPlayer = 3;
|
||||
break;
|
||||
case 'E':
|
||||
this.Food = 0;
|
||||
this.NLower = 1;
|
||||
this.NUpper = 1;
|
||||
this.food = 0;
|
||||
this.nLower = 1;
|
||||
this.nUpper = 1;
|
||||
break;
|
||||
case 'F':
|
||||
this.Food = 0;
|
||||
this.NLower = 0;
|
||||
this.NUpper = 2;
|
||||
this.food = 0;
|
||||
this.nLower = 0;
|
||||
this.nUpper = 2;
|
||||
break;
|
||||
case 'G':
|
||||
this.Food = 0;
|
||||
this.NLower = 1;
|
||||
this.NUpper = 2;
|
||||
this.food = 0;
|
||||
this.nLower = 1;
|
||||
this.nUpper = 2;
|
||||
this.nMinPlayer = 4;
|
||||
break;
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user