Refactor: removed dead code and standarized to camelCase
This commit is contained in:
@@ -11,8 +11,11 @@
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<junit.version>5.12.1</junit.version>
|
||||
<javafx.version>23</javafx.version>
|
||||
<junit.version>5.14.4</junit.version>
|
||||
<javafx.version>26</javafx.version>
|
||||
<gson.version>2.14.0</gson.version>
|
||||
<controlsfx.version>11.2.3</controlsfx.version>
|
||||
<jline.version>3.30.13</jline.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
@@ -34,7 +37,7 @@
|
||||
<dependency>
|
||||
<groupId>org.controlsfx</groupId>
|
||||
<artifactId>controlsfx</artifactId>
|
||||
<version>11.2.1</version>
|
||||
<version>${controlsfx.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
@@ -48,36 +51,30 @@
|
||||
<version>${junit.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.code.gson</groupId>
|
||||
<artifactId>gson</artifactId>
|
||||
<version>2.10.1</version>
|
||||
<version>${gson.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jline</groupId>
|
||||
<artifactId>jline-terminal</artifactId>
|
||||
<version>3.26.3</version>
|
||||
<version>${jline.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jline</groupId>
|
||||
<artifactId>jline-reader</artifactId>
|
||||
<version>3.26.3</version>
|
||||
<version>${jline.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jline</groupId>
|
||||
<artifactId>jline-builtins</artifactId>
|
||||
<version>3.26.3</version>
|
||||
<version>${jline.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jline</groupId>
|
||||
<artifactId>jline-terminal-jansi</artifactId>
|
||||
<version>3.26.3</version>
|
||||
<version>${jline.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
@@ -86,7 +83,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.13.0</version>
|
||||
<version>3.15.0</version>
|
||||
<configuration>
|
||||
<release>25</release>
|
||||
<compilerArgs>
|
||||
@@ -97,7 +94,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>3.2.5</version>
|
||||
<version>3.5.6</version>
|
||||
<configuration>
|
||||
<argLine>--enable-preview</argLine>
|
||||
</configuration>
|
||||
@@ -129,7 +126,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.5.2</version>
|
||||
<version>3.6.2</version>
|
||||
<executions>
|
||||
|
||||
<!-- SERVER -->
|
||||
|
||||
@@ -169,7 +169,9 @@ public class ClientLauncherTUI {
|
||||
RMIClient client = new RMIClient(controller, ip, NetworkConfig.RMI_PORT, myIP);
|
||||
ErrorType err = client.connect(username, nPlayers);
|
||||
if (err != null) {
|
||||
view.showError(err, err.toString());
|
||||
terminal.writer().print("\033[H\033[2J");
|
||||
terminal.writer().flush();
|
||||
System.out.println("Errore: " + err);
|
||||
return false;
|
||||
}
|
||||
System.out.println("Connected via RMI.");
|
||||
@@ -179,7 +181,9 @@ public class ClientLauncherTUI {
|
||||
TCPClient client = new TCPClient(controller, ip, NetworkConfig.TCP_PORT, NetworkConfig.HEARTBEAT_PORT);
|
||||
ErrorType err = client.connect(username, nPlayers);
|
||||
if (err != null) {
|
||||
view.showError(err, err.toString());
|
||||
terminal.writer().print("\033[H\033[2J");
|
||||
terminal.writer().flush();
|
||||
System.out.println("Errore: " + err);
|
||||
return false;
|
||||
}
|
||||
System.out.println("Connected via TCP.");
|
||||
|
||||
@@ -4,7 +4,6 @@ import it.polimi.ingsw.gc14.Model.MiniModel;
|
||||
import it.polimi.ingsw.gc14.Network.IClient;
|
||||
import it.polimi.ingsw.gc14.View.IView;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Controller responsible for coordinating the client-side components,
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
package it.polimi.ingsw.gc14;
|
||||
|
||||
import javafx.application.Application;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* JavaFX application entry point used to start the graphical interface.
|
||||
*/
|
||||
public class HelloApplication extends Application {
|
||||
|
||||
/**
|
||||
* Starts the JavaFX application and loads the initial FXML view.
|
||||
*
|
||||
* @param stage the primary stage of the application.
|
||||
* @throws IOException if the FXML file cannot be loaded.
|
||||
*/
|
||||
@Override
|
||||
public void start(Stage stage) throws IOException {
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(HelloApplication.class.getResource("hello-view.fxml"));
|
||||
Scene scene = new Scene(fxmlLoader.load(), 320, 240);
|
||||
stage.setTitle("Hello!");
|
||||
stage.setScene(scene);
|
||||
stage.show();
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
package it.polimi.ingsw.gc14;
|
||||
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.Label;
|
||||
|
||||
/**
|
||||
* Controller for the initial JavaFX view.
|
||||
*/
|
||||
public class HelloController {
|
||||
@FXML
|
||||
private Label welcomeText;
|
||||
|
||||
/**
|
||||
* Handles the click on the hello button.
|
||||
*/
|
||||
@FXML
|
||||
protected void onHelloButtonClick() {
|
||||
welcomeText.setText("Welcome to JavaFX Application!");
|
||||
}
|
||||
}
|
||||
@@ -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:
|
||||
|
||||
@@ -5,6 +5,8 @@ import java.util.Enumeration;
|
||||
|
||||
/** Utility class for resolving the local network interface to use when connecting to a server. */
|
||||
public class InterfaceResolver {
|
||||
private InterfaceResolver() {}
|
||||
|
||||
/**
|
||||
* Returns the local IPv4 address that can reach the given server IP.
|
||||
*
|
||||
|
||||
@@ -5,14 +5,11 @@ import it.polimi.ingsw.gc14.ErrorType;
|
||||
import it.polimi.ingsw.gc14.Model.MiniModel;
|
||||
import it.polimi.ingsw.gc14.Network.EventType;
|
||||
import it.polimi.ingsw.gc14.Network.NetworkEvent;
|
||||
import it.polimi.ingsw.gc14.View.IView;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* NetworkEvent to add a player.
|
||||
*/
|
||||
public class AddPlayer extends NetworkEvent implements Serializable {
|
||||
public class AddPlayer extends NetworkEvent {
|
||||
/** Number of proposed players to add to the match */
|
||||
private int proposedNPlayer;
|
||||
/**
|
||||
|
||||
@@ -11,9 +11,7 @@ import it.polimi.ingsw.gc14.Model.Player;
|
||||
import it.polimi.ingsw.gc14.Model.Slot;
|
||||
import it.polimi.ingsw.gc14.Network.EventType;
|
||||
import it.polimi.ingsw.gc14.Network.NetworkEvent;
|
||||
import it.polimi.ingsw.gc14.View.IView;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -21,7 +19,7 @@ import java.util.Map;
|
||||
/**
|
||||
* NetworkEvent to draw a tribe card from the lower card list.
|
||||
*/
|
||||
public class ApplyNextRound extends NetworkEvent implements Serializable{
|
||||
public class ApplyNextRound extends NetworkEvent{
|
||||
|
||||
List<Player> players;
|
||||
ArrayList<TribeCard> upperListTribeCards;
|
||||
|
||||
@@ -5,14 +5,12 @@ import it.polimi.ingsw.gc14.ErrorType;
|
||||
import it.polimi.ingsw.gc14.Model.MiniModel;
|
||||
import it.polimi.ingsw.gc14.Network.EventType;
|
||||
import it.polimi.ingsw.gc14.Network.NetworkEvent;
|
||||
import it.polimi.ingsw.gc14.View.IView;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* NetworkEvent to draw a building card from the lower card list.
|
||||
*/
|
||||
public class DrawLowerBuildingCard extends NetworkEvent implements Serializable{
|
||||
public class DrawLowerBuildingCard extends NetworkEvent{
|
||||
/** Index of the card to draw */
|
||||
private int pos;
|
||||
|
||||
|
||||
@@ -5,14 +5,12 @@ import it.polimi.ingsw.gc14.ErrorType;
|
||||
import it.polimi.ingsw.gc14.Model.MiniModel;
|
||||
import it.polimi.ingsw.gc14.Network.EventType;
|
||||
import it.polimi.ingsw.gc14.Network.NetworkEvent;
|
||||
import it.polimi.ingsw.gc14.View.IView;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* NetworkEvent to draw a tribe card from the lower card list.
|
||||
*/
|
||||
public class DrawLowerTribeCard extends NetworkEvent implements Serializable{
|
||||
public class DrawLowerTribeCard extends NetworkEvent{
|
||||
|
||||
/** Index of the card to draw */
|
||||
private int pos;
|
||||
|
||||
@@ -5,14 +5,12 @@ import it.polimi.ingsw.gc14.ErrorType;
|
||||
import it.polimi.ingsw.gc14.Model.MiniModel;
|
||||
import it.polimi.ingsw.gc14.Network.EventType;
|
||||
import it.polimi.ingsw.gc14.Network.NetworkEvent;
|
||||
import it.polimi.ingsw.gc14.View.IView;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* NetworkEvent to draw a building card from the upper card list.
|
||||
*/
|
||||
public class DrawUpperBuildingCard extends NetworkEvent implements Serializable{
|
||||
public class DrawUpperBuildingCard extends NetworkEvent{
|
||||
|
||||
/** Index of the card to draw */
|
||||
private int pos;
|
||||
|
||||
@@ -5,14 +5,12 @@ import it.polimi.ingsw.gc14.ErrorType;
|
||||
import it.polimi.ingsw.gc14.Model.MiniModel;
|
||||
import it.polimi.ingsw.gc14.Network.EventType;
|
||||
import it.polimi.ingsw.gc14.Network.NetworkEvent;
|
||||
import it.polimi.ingsw.gc14.View.IView;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* NetworkEvent to draw a tribe card from the upper card list.
|
||||
*/
|
||||
public class DrawUpperTribeCard extends NetworkEvent implements Serializable{
|
||||
public class DrawUpperTribeCard extends NetworkEvent{
|
||||
|
||||
/** Index of the card to draw */
|
||||
private int pos;
|
||||
|
||||
@@ -9,9 +9,7 @@ import it.polimi.ingsw.gc14.Model.Player;
|
||||
import it.polimi.ingsw.gc14.Model.Slot;
|
||||
import it.polimi.ingsw.gc14.Network.EventType;
|
||||
import it.polimi.ingsw.gc14.Network.NetworkEvent;
|
||||
import it.polimi.ingsw.gc14.View.IView;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -19,7 +17,7 @@ import java.util.Map;
|
||||
/**
|
||||
* NetworkEvent to draw a tribe card from the lower card list.
|
||||
*/
|
||||
public class EndedGame extends NetworkEvent implements Serializable{
|
||||
public class EndedGame extends NetworkEvent{
|
||||
|
||||
ArrayList<Player> players;
|
||||
|
||||
|
||||
@@ -5,14 +5,12 @@ import it.polimi.ingsw.gc14.ErrorType;
|
||||
import it.polimi.ingsw.gc14.Model.MiniModel;
|
||||
import it.polimi.ingsw.gc14.Network.EventType;
|
||||
import it.polimi.ingsw.gc14.Network.NetworkEvent;
|
||||
import it.polimi.ingsw.gc14.View.IView;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* NetworkEvent to select a slot where to place the player totem.
|
||||
*/
|
||||
public class SlotChoice extends NetworkEvent implements Serializable {
|
||||
public class SlotChoice extends NetworkEvent {
|
||||
|
||||
/** Index of the card to draw */
|
||||
private int pos;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package it.polimi.ingsw.gc14.Network.RMI.Client;
|
||||
|
||||
import it.polimi.ingsw.gc14.Controller.ClientController;
|
||||
import it.polimi.ingsw.gc14.Model.Game;
|
||||
import it.polimi.ingsw.gc14.Model.MiniModel;
|
||||
import it.polimi.ingsw.gc14.Network.NetworkEvent;
|
||||
import it.polimi.ingsw.gc14.Network.RMI.Common.IClientCallback;
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
package it.polimi.ingsw.gc14.Network.RMI.Common;
|
||||
|
||||
import it.polimi.ingsw.gc14.Model.*;
|
||||
import it.polimi.ingsw.gc14.Model.GamePackage.Board;
|
||||
import it.polimi.ingsw.gc14.Model.GamePackage.CurrentState;
|
||||
import it.polimi.ingsw.gc14.Network.NetworkEvent;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@@ -2,13 +2,11 @@ package it.polimi.ingsw.gc14.Network.TCP.Client;
|
||||
|
||||
import it.polimi.ingsw.gc14.Controller.ClientController;
|
||||
import it.polimi.ingsw.gc14.ErrorType;
|
||||
import it.polimi.ingsw.gc14.Model.Game;
|
||||
import it.polimi.ingsw.gc14.Model.MiniModel;
|
||||
import it.polimi.ingsw.gc14.Network.IClient;
|
||||
import it.polimi.ingsw.gc14.Network.NetworkEvent;
|
||||
import it.polimi.ingsw.gc14.Network.NetworkConfig;
|
||||
import it.polimi.ingsw.gc14.Network.NetworkEvents.*;
|
||||
import javafx.application.Platform;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
package it.polimi.ingsw.gc14.View;
|
||||
|
||||
import it.polimi.ingsw.gc14.ErrorType;
|
||||
import it.polimi.ingsw.gc14.Model.Game;
|
||||
import it.polimi.ingsw.gc14.Model.MiniModel;
|
||||
import it.polimi.ingsw.gc14.Network.NetworkEvent;
|
||||
|
||||
/** View interface implemented by both the TUI and GUI. */
|
||||
public interface IView {
|
||||
|
||||
@@ -12,24 +12,24 @@ public enum BorderStyle {
|
||||
/**
|
||||
* Unicode box-drawing border style.
|
||||
*/
|
||||
UNICODE("╔","╗","╚","╝","═","║","╠","╣","╦","╩","╬","├","┤","─","┼"),
|
||||
UNICODE("╔","╗","╚","╝","═","║","╠","╣","╦","╩","╬","├","┤","┼"),
|
||||
|
||||
/**
|
||||
* Plain ASCII border style.
|
||||
*/
|
||||
ASCII ("+","+","+","+","-","|","+","+","+","+","+","+","+","-","+"),
|
||||
ASCII ("+","+","+","+","-","|","+","+","+","+","+","+","+","+"),
|
||||
|
||||
/**
|
||||
* Rounded Unicode border style.
|
||||
*/
|
||||
ROUNDED("╭","╮","╰","╯","─","│","├","┤","┬","┴","┼","├","┤","─","┼");
|
||||
ROUNDED("╭","╮","╰","╯","─","│","├","┤","┬","┴","┼","├","┤","┼");
|
||||
|
||||
private final String tl,tr,bl,br,h,v,ml,mr,mt,mb,x,sl,sr,sh,sx;
|
||||
private final String tl,tr,bl,br,h,v,ml,mr,mt,mb,x,sl,sr,sx;
|
||||
|
||||
BorderStyle(String tl,String tr,String bl,String br,
|
||||
String h, String v, String ml,String mr,
|
||||
String mt,String mb,String x,
|
||||
String sl,String sr,String sh,String sx) {
|
||||
String sl,String sr,String sx) {
|
||||
this.tl = tl; this.tr = tr;
|
||||
this.bl = bl; this.br = br;
|
||||
this.h = h; this.v = v;
|
||||
@@ -37,7 +37,7 @@ public enum BorderStyle {
|
||||
this.mt = mt; this.mb = mb;
|
||||
this.x = x;
|
||||
this.sl = sl; this.sr = sr;
|
||||
this.sh = sh; this.sx = sx;
|
||||
this.sx = sx;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -105,11 +105,6 @@ public enum BorderStyle {
|
||||
*/
|
||||
public String sr() { return sr; }
|
||||
|
||||
/**
|
||||
* @return the separator horizontal line character.
|
||||
*/
|
||||
public String sh() { return sh; }
|
||||
|
||||
/**
|
||||
* @return the separator center junction character.
|
||||
*/
|
||||
|
||||
@@ -2,7 +2,6 @@ package it.polimi.ingsw.gc14.View.TUI;
|
||||
import it.polimi.ingsw.gc14.ErrorType;
|
||||
import it.polimi.ingsw.gc14.Model.*;
|
||||
import it.polimi.ingsw.gc14.Model.GamePackage.GameStages;
|
||||
import it.polimi.ingsw.gc14.Network.NetworkEvent;
|
||||
import it.polimi.ingsw.gc14.View.IView;
|
||||
|
||||
import org.jline.reader.LineReader;
|
||||
@@ -128,7 +127,7 @@ public class TUI implements IView {
|
||||
* hands arranged in a responsive grid.
|
||||
*/
|
||||
private String buildBoardContent() {
|
||||
List<String> left = List.of(BoardStamp().split("\n"));
|
||||
List<String> left = List.of(boardStamp().split("\n"));
|
||||
List<String> right = List.of(buildAllHandsContent().split("\n"));
|
||||
return AsciiTable.sideBySide(left, right, 3);
|
||||
}
|
||||
@@ -259,33 +258,13 @@ public class TUI implements IView {
|
||||
|
||||
// ── Board / players stamp helpers ─────────────────────────────────────────
|
||||
|
||||
/**
|
||||
* Returns all players rendered side-by-side in pairs.
|
||||
*
|
||||
* @return multi-line string with all player panels.
|
||||
*/
|
||||
public String PlayersStamp() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
ArrayList<Player> list = new ArrayList<>(model.players.values());
|
||||
for (int i = 0; i < list.size() / 2; i++) {
|
||||
sb.append(AsciiTable.sideBySide(
|
||||
List.of(list.get(i * 2).toString().split("\n")),
|
||||
List.of(list.get(i * 2 + 1).toString().split("\n")), 2));
|
||||
}
|
||||
sb.append("\n");
|
||||
if (list.size() % 2 != 0) {
|
||||
sb.append(list.get(list.size() - 1)).append("\n");
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the board state as a multi-line string: turn order, upper cards,
|
||||
* offer track, lower cards.
|
||||
*
|
||||
* @return multi-line board string.
|
||||
*/
|
||||
public String BoardStamp() {
|
||||
public String boardStamp() {
|
||||
var offerTrack = new AsciiTable(BorderStyle.ROUNDED, model.slotPlayerMap.size());
|
||||
List<String> slotNames = new ArrayList<>();
|
||||
List<String> slotPlayers = new ArrayList<>();
|
||||
@@ -296,33 +275,33 @@ public class TUI implements IView {
|
||||
slotPlayers.add(entry.getValue() != null ? entry.getValue().getUserName() : " ");
|
||||
}
|
||||
|
||||
var UpperCards = new AsciiTable(BorderStyle.ROUNDED, 2);
|
||||
var LowerCards = new AsciiTable(BorderStyle.ROUNDED, 2);
|
||||
UpperCards.addHeader("Char/Events", "Building");
|
||||
LowerCards.addHeader("Char/Events", "Building");
|
||||
var upperCards = new AsciiTable(BorderStyle.ROUNDED, 2);
|
||||
var lowerCards = new AsciiTable(BorderStyle.ROUNDED, 2);
|
||||
upperCards.addHeader("Char/Events", "Building");
|
||||
lowerCards.addHeader("Char/Events", "Building");
|
||||
|
||||
int maxU = Math.max(model.upperListTribeCards.size(), model.upperListBuildingCards.size());
|
||||
for (int i = 0; i < maxU; i++) {
|
||||
String t = i < model.upperListTribeCards.size() ? i + model.upperListTribeCards.get(i).toStringBoard() : "";
|
||||
String b = i < model.upperListBuildingCards.size() ? i + model.upperListBuildingCards.get(i).toString() : "";
|
||||
UpperCards.addRow(t, b);
|
||||
upperCards.addRow(t, b);
|
||||
}
|
||||
|
||||
int maxL = Math.max(model.lowerListTribeCards.size(), model.lowerListBuildingCards.size());
|
||||
for (int i = 0; i < maxL; i++) {
|
||||
String t = i < model.lowerListTribeCards.size() ? i + model.lowerListTribeCards.get(i).toStringBoard() : "";
|
||||
String b = i < model.lowerListBuildingCards.size() ? i + model.lowerListBuildingCards.get(i).toString() : "";
|
||||
LowerCards.addRow(t, b);
|
||||
lowerCards.addRow(t, b);
|
||||
}
|
||||
|
||||
offerTrack.addRow(slotPlayers);
|
||||
offerTrack.addRow(slotNames);
|
||||
|
||||
String upperSection = UpperCards.build();
|
||||
String upperSection = upperCards.build();
|
||||
|
||||
String middleSection = model.orderLogicCard.toString() + offerTrack.build();
|
||||
|
||||
String lowerSection = LowerCards.build();
|
||||
String lowerSection = lowerCards.build();
|
||||
|
||||
return model.currentState + "\n"
|
||||
+ upperSection + "\n"
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.geometry.Insets?>
|
||||
<?import javafx.scene.control.Label?>
|
||||
<?import javafx.scene.layout.VBox?>
|
||||
|
||||
<?import javafx.scene.control.Button?>
|
||||
<VBox alignment="CENTER" spacing="20.0" xmlns:fx="http://javafx.com/fxml"
|
||||
fx:controller="it.polimi.ingsw.gc14.HelloController">
|
||||
<padding>
|
||||
<Insets bottom="20.0" left="20.0" right="20.0" top="20.0"/>
|
||||
</padding>
|
||||
|
||||
<Label fx:id="welcomeText"/>
|
||||
<Button text="Hello!" onAction="#onHelloButtonClick"/>
|
||||
</VBox>
|
||||
@@ -71,7 +71,7 @@ class GameControllerTest {
|
||||
|
||||
private int firstNonEventIndex(List<TribeCard> cards) {
|
||||
for (int i = 0; i < cards.size(); i++) {
|
||||
if (!cards.get(i).IsEventCard()) {
|
||||
if (!cards.get(i).isEventCard()) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
@@ -82,7 +82,7 @@ class GameControllerTest {
|
||||
|
||||
private int firstEventIndexOrMinusOne(List<TribeCard> cards) {
|
||||
for (int i = 0; i < cards.size(); i++) {
|
||||
if (cards.get(i).IsEventCard()) {
|
||||
if (cards.get(i).isEventCard()) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
@@ -92,7 +92,7 @@ class GameControllerTest {
|
||||
|
||||
private int firstNonEventIndexOrMinusOne(List<TribeCard> cards) {
|
||||
for (int i = 0; i < cards.size(); i++) {
|
||||
if (!cards.get(i).IsEventCard()) {
|
||||
if (!cards.get(i).isEventCard()) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
@@ -148,7 +148,7 @@ class GameControllerTest {
|
||||
}
|
||||
|
||||
if (game.getCurrentState().getNUpper() == 0
|
||||
|| game.getUpperListTribeCards().stream().allMatch(TribeCard::IsEventCard)) {
|
||||
|| game.getUpperListTribeCards().stream().allMatch(TribeCard::isEventCard)) {
|
||||
assertTrue(controller.skipTurn(username));
|
||||
return;
|
||||
}
|
||||
@@ -171,7 +171,7 @@ class GameControllerTest {
|
||||
}
|
||||
|
||||
if (game.getCurrentState().getNLower() == 0
|
||||
|| game.getLowerListTribeCards().stream().allMatch(TribeCard::IsEventCard)) {
|
||||
|| game.getLowerListTribeCards().stream().allMatch(TribeCard::isEventCard)) {
|
||||
assertTrue(controller.skipTurn(username));
|
||||
return;
|
||||
}
|
||||
|
||||
+4
-4
@@ -56,7 +56,7 @@ class ArtistTest {
|
||||
assertEquals(1, a.getEra());
|
||||
assertEquals(CharacterType.ARTIST, a.getType());
|
||||
assertEquals(0, a.getNMin());
|
||||
assertFalse(a.IsEventCard());
|
||||
assertFalse(a.isEventCard());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -66,7 +66,7 @@ class ArtistTest {
|
||||
assertEquals(1, a.getEra());
|
||||
assertEquals(CharacterType.ARTIST, a.getType());
|
||||
assertEquals(3, a.getNMin());
|
||||
assertFalse(a.IsEventCard());
|
||||
assertFalse(a.isEventCard());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -77,7 +77,7 @@ class ArtistTest {
|
||||
assertEquals(1, a.getEra());
|
||||
assertEquals(CharacterType.ARTIST, a.getType());
|
||||
assertEquals(0, a.getNMin());
|
||||
assertFalse(a.IsEventCard());
|
||||
assertFalse(a.isEventCard());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -88,6 +88,6 @@ class ArtistTest {
|
||||
assertEquals(1, a.getEra());
|
||||
assertEquals(CharacterType.ARTIST, a.getType());
|
||||
assertEquals(3, a.getNMin());
|
||||
assertFalse(a.IsEventCard());
|
||||
assertFalse(a.isEventCard());
|
||||
}
|
||||
}
|
||||
+4
-4
@@ -77,7 +77,7 @@ class BuilderTest {
|
||||
assertEquals(2, b.getReductionValue());
|
||||
assertEquals(3, b.getPrestigeValue());
|
||||
assertEquals(0, b.getNMin());
|
||||
assertFalse(b.IsEventCard());
|
||||
assertFalse(b.isEventCard());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -89,7 +89,7 @@ class BuilderTest {
|
||||
assertEquals(2, b.getReductionValue());
|
||||
assertEquals(3, b.getPrestigeValue());
|
||||
assertEquals(4, b.getNMin());
|
||||
assertFalse(b.IsEventCard());
|
||||
assertFalse(b.isEventCard());
|
||||
|
||||
assertThrows(IllegalArgumentException.class, () ->
|
||||
new Builder(1, -1, 3, 4)
|
||||
@@ -124,7 +124,7 @@ class BuilderTest {
|
||||
assertEquals(2, b.getReductionValue());
|
||||
assertEquals(3, b.getPrestigeValue());
|
||||
assertEquals(0, b.getNMin());
|
||||
assertFalse(b.IsEventCard());
|
||||
assertFalse(b.isEventCard());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -137,7 +137,7 @@ class BuilderTest {
|
||||
assertEquals(2, b.getReductionValue());
|
||||
assertEquals(3, b.getPrestigeValue());
|
||||
assertEquals(4, b.getNMin());
|
||||
assertFalse(b.IsEventCard());
|
||||
assertFalse(b.isEventCard());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
+4
-4
@@ -57,7 +57,7 @@ class GathererTest {
|
||||
assertEquals(1, g.getEra());
|
||||
assertEquals(CharacterType.GATHERER, g.getType());
|
||||
assertEquals(0, g.getNMin());
|
||||
assertFalse(g.IsEventCard());
|
||||
assertFalse(g.isEventCard());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -67,7 +67,7 @@ class GathererTest {
|
||||
assertEquals(1, g.getEra());
|
||||
assertEquals(CharacterType.GATHERER, g.getType());
|
||||
assertEquals(3, g.getNMin());
|
||||
assertFalse(g.IsEventCard());
|
||||
assertFalse(g.isEventCard());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -78,7 +78,7 @@ class GathererTest {
|
||||
assertEquals(1, g.getEra());
|
||||
assertEquals(CharacterType.GATHERER, g.getType());
|
||||
assertEquals(0, g.getNMin());
|
||||
assertFalse(g.IsEventCard());
|
||||
assertFalse(g.isEventCard());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -89,6 +89,6 @@ class GathererTest {
|
||||
assertEquals(1, g.getEra());
|
||||
assertEquals(CharacterType.GATHERER, g.getType());
|
||||
assertEquals(3, g.getNMin());
|
||||
assertFalse(g.IsEventCard());
|
||||
assertFalse(g.isEventCard());
|
||||
}
|
||||
}
|
||||
+4
-4
@@ -114,7 +114,7 @@ class HunterTest {
|
||||
assertEquals(CharacterType.HUNTER, h.getType());
|
||||
assertTrue(h.getIcon());
|
||||
assertEquals(0, h.getNMin());
|
||||
assertFalse(h.IsEventCard());
|
||||
assertFalse(h.isEventCard());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -125,7 +125,7 @@ class HunterTest {
|
||||
assertEquals(CharacterType.HUNTER, h.getType());
|
||||
assertFalse(h.getIcon());
|
||||
assertEquals(3, h.getNMin());
|
||||
assertFalse(h.IsEventCard());
|
||||
assertFalse(h.isEventCard());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -137,7 +137,7 @@ class HunterTest {
|
||||
assertEquals(CharacterType.HUNTER, h.getType());
|
||||
assertTrue(h.getIcon());
|
||||
assertEquals(0, h.getNMin());
|
||||
assertFalse(h.IsEventCard());
|
||||
assertFalse(h.isEventCard());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -149,6 +149,6 @@ class HunterTest {
|
||||
assertEquals(CharacterType.HUNTER, h.getType());
|
||||
assertFalse(h.getIcon());
|
||||
assertEquals(3, h.getNMin());
|
||||
assertFalse(h.IsEventCard());
|
||||
assertFalse(h.isEventCard());
|
||||
}
|
||||
}
|
||||
+4
-4
@@ -76,7 +76,7 @@ class InventorTest {
|
||||
assertEquals(CharacterType.INVENTOR, i.getType());
|
||||
assertEquals(5, i.Icon());
|
||||
assertEquals(0, i.getNMin());
|
||||
assertFalse(i.IsEventCard());
|
||||
assertFalse(i.isEventCard());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -87,7 +87,7 @@ class InventorTest {
|
||||
assertEquals(CharacterType.INVENTOR, i.getType());
|
||||
assertEquals(5, i.Icon());
|
||||
assertEquals(3, i.getNMin());
|
||||
assertFalse(i.IsEventCard());
|
||||
assertFalse(i.isEventCard());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -99,7 +99,7 @@ class InventorTest {
|
||||
assertEquals(CharacterType.INVENTOR, i.getType());
|
||||
assertEquals(5, i.Icon());
|
||||
assertEquals(0, i.getNMin());
|
||||
assertFalse(i.IsEventCard());
|
||||
assertFalse(i.isEventCard());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -111,7 +111,7 @@ class InventorTest {
|
||||
assertEquals(CharacterType.INVENTOR, i.getType());
|
||||
assertEquals(5, i.Icon());
|
||||
assertEquals(3, i.getNMin());
|
||||
assertFalse(i.IsEventCard());
|
||||
assertFalse(i.isEventCard());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
+4
-4
@@ -76,7 +76,7 @@ class ShamanTest {
|
||||
assertEquals(CharacterType.SHAMAN, s.getType());
|
||||
assertEquals(4, s.getIcon());
|
||||
assertEquals(0, s.getNMin());
|
||||
assertFalse(s.IsEventCard());
|
||||
assertFalse(s.isEventCard());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -87,7 +87,7 @@ class ShamanTest {
|
||||
assertEquals(CharacterType.SHAMAN, s.getType());
|
||||
assertEquals(4, s.getIcon());
|
||||
assertEquals(3, s.getNMin());
|
||||
assertFalse(s.IsEventCard());
|
||||
assertFalse(s.isEventCard());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -99,7 +99,7 @@ class ShamanTest {
|
||||
assertEquals(CharacterType.SHAMAN, s.getType());
|
||||
assertEquals(4, s.getIcon());
|
||||
assertEquals(0, s.getNMin());
|
||||
assertFalse(s.IsEventCard());
|
||||
assertFalse(s.isEventCard());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -111,6 +111,6 @@ class ShamanTest {
|
||||
assertEquals(CharacterType.SHAMAN, s.getType());
|
||||
assertEquals(4, s.getIcon());
|
||||
assertEquals(3, s.getNMin());
|
||||
assertFalse(s.IsEventCard());
|
||||
assertFalse(s.isEventCard());
|
||||
}
|
||||
}
|
||||
@@ -103,7 +103,7 @@ class BoardTest {
|
||||
assertEquals(96 - (numPlayer+4) - (numPlayer+1), bd.getTribeDeckSize()); // Verifica che dal mazzo TribeDeck venga pescato il numero corretto di carte
|
||||
|
||||
assertEquals(numPlayer+1, bd.lowerListTribe.size()); // Verifica che la dimensione della lista inferiore sia corretta
|
||||
assertTrue(bd.lowerListTribe.stream().noneMatch(card -> card.IsEventCard())); // Verifica che non ci siano EventCard dentro alla lista inferiore
|
||||
assertTrue(bd.lowerListTribe.stream().noneMatch(card -> card.isEventCard())); // Verifica che non ci siano EventCard dentro alla lista inferiore
|
||||
|
||||
assertEquals(numPlayer+4, bd.upperListTribe.size()); // Verifica che la dimensione della lista superiore sia corretta
|
||||
|
||||
@@ -117,7 +117,7 @@ class BoardTest {
|
||||
|
||||
Queue<EventCard> eventQueue = new LinkedList<>();
|
||||
for (TribeCard card : bd.lowerListTribe) {
|
||||
if (card.IsEventCard()) {
|
||||
if (card.isEventCard()) {
|
||||
eventQueue.add((EventCard) card);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ class GameTest {
|
||||
|
||||
private int firstNonEventIndex(List<TribeCard> cards) {
|
||||
for (int i = 0; i < cards.size(); i++) {
|
||||
if (!cards.get(i).IsEventCard()) {
|
||||
if (!cards.get(i).isEventCard()) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
@@ -80,7 +80,7 @@ class GameTest {
|
||||
|
||||
private int firstNonEventIndexOrMinusOne(List<TribeCard> cards) {
|
||||
for (int i = 0; i < cards.size(); i++) {
|
||||
if (!cards.get(i).IsEventCard()) {
|
||||
if (!cards.get(i).isEventCard()) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
@@ -117,7 +117,7 @@ class GameTest {
|
||||
return;
|
||||
}
|
||||
|
||||
if(game.getCurrentState().getNUpper() == 0 || game.getUpperListTribeCards().stream().allMatch(TribeCard::IsEventCard))
|
||||
if(game.getCurrentState().getNUpper() == 0 || game.getUpperListTribeCards().stream().allMatch(TribeCard::isEventCard))
|
||||
{
|
||||
assertTrue(game.skipTurn(current));
|
||||
return;
|
||||
@@ -138,7 +138,7 @@ class GameTest {
|
||||
return;
|
||||
}
|
||||
|
||||
if(game.getCurrentState().getNLower() == 0 || game.getLowerListTribeCards().stream().allMatch(TribeCard::IsEventCard))
|
||||
if(game.getCurrentState().getNLower() == 0 || game.getLowerListTribeCards().stream().allMatch(TribeCard::isEventCard))
|
||||
{
|
||||
assertTrue(game.skipTurn(current));
|
||||
return;
|
||||
@@ -675,7 +675,7 @@ class GameTest {
|
||||
|
||||
private int firstEventIndexOrMinusOne(List<TribeCard> cards) {
|
||||
for (int i = 0; i < cards.size(); i++) {
|
||||
if (cards.get(i).IsEventCard()) {
|
||||
if (cards.get(i).isEventCard()) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user