Fixed: various

This commit is contained in:
rubenpirreram
2026-05-15 16:27:23 +02:00
parent df1b41b666
commit 374247f984
4 changed files with 19 additions and 58 deletions
@@ -86,11 +86,7 @@ public class ClientController {
}
else
{
try {
client.drawUpperTribeCard(playerUsername, pos);
} catch (RemoteException e) {
throw new RuntimeException(e);
}
client.drawUpperTribeCard(playerUsername, pos);
}
}
@@ -105,11 +101,7 @@ public class ClientController {
if(!Objects.equals(playerUsername, miniModel.currentState.getCurrentPlayer().getUserName()))
view.showError("It's not your turn!");
else
try {
client.drawLowerTribeCard(playerUsername, pos);
} catch (RemoteException e) {
throw new RuntimeException(e);
}
client.drawLowerTribeCard(playerUsername, pos);
}
@@ -123,11 +115,7 @@ public class ClientController {
if(!Objects.equals(playerUsername, miniModel.currentState.getCurrentPlayer().getUserName()))
view.showError("It's not your turn!");
else {
try {
client.drawUpperBuildingCard(playerUsername,pos);
} catch (RemoteException e) {
throw new RuntimeException(e);
}
client.drawUpperBuildingCard(playerUsername,pos);
}
}
@@ -143,11 +131,7 @@ public class ClientController {
if(!Objects.equals(playerUsername,miniModel.currentState.getCurrentPlayer().getUserName()))
view.showError("It's not your turn!");
else {
try {
client.drawLowerBuildingCard(playerUsername,pos);
} catch (RemoteException e) {
throw new RuntimeException(e);
}
client.drawLowerBuildingCard(playerUsername,pos);
}
}
@@ -161,11 +145,7 @@ public class ClientController {
if(!Objects.equals(playerUsername,miniModel.currentState.getCurrentPlayer().getUserName()))
view.showError("It's not your turn!");
else {
try {
client.skipTurn(playerUsername);
} catch (RemoteException e) {
throw new RuntimeException(e);
}
client.skipTurn(playerUsername);
}
}
@@ -182,11 +162,7 @@ public class ClientController {
if(!Objects.equals(playerUsername,miniModel.currentState.getCurrentPlayer().getUserName()))
view.showError("It's not your turn!");
else {
try {
client.pickOptionalTribeCard(playerUsername,pos);
} catch (RemoteException e) {
throw new RuntimeException(e);
}
client.pickOptionalTribeCard(playerUsername,pos);
}
}
@@ -201,11 +177,7 @@ public class ClientController {
if(!Objects.equals(playerUsername, miniModel.currentState.getCurrentPlayer().getUserName()))
view.showError("It's not your turn!");
else {
try {
client.pickOptionalBuildingCard(playerUsername,pos);
} catch (RemoteException e) {
throw new RuntimeException(e);
}
client.pickOptionalBuildingCard(playerUsername,pos);
}
}
@@ -219,11 +191,7 @@ public class ClientController {
if(!Objects.equals(playerUsername, miniModel.currentState.getCurrentPlayer().getUserName()))
view.showError("It's not your turn!");
else {
try {
client.noOptionalCard(playerUsername);
} catch (RemoteException e) {
throw new RuntimeException(e);
}
client.noOptionalCard(playerUsername);
}
}
@@ -237,11 +205,7 @@ public class ClientController {
if(!Objects.equals(playerUsername, miniModel.currentState.getCurrentPlayer().getUserName()))
view.showError("It's not your turn!");
else {
try {
client.slotChoice(playerUsername,pos);
} catch (RemoteException e) {
throw new RuntimeException(e);
}
client.slotChoice(playerUsername,pos);
}
}
@@ -250,11 +214,7 @@ public class ClientController {
if(!Objects.equals(playerUsername, miniModel.currentState.getCurrentPlayer().getUserName()))
view.showError("It's not your turn!");
else {
try {
client.totemChoice(playerUsername, String.valueOf(miniModel.availableTotems.get(pos)));
} catch (RemoteException e) {
throw new RuntimeException(e);
}
client.totemChoice(playerUsername, String.valueOf(miniModel.availableTotems.get(pos)));
}
}
@@ -70,9 +70,12 @@ public abstract class OrderLogicCard implements Serializable {
playerList=new ArrayList<>();
}
if(players.stream().anyMatch(x->x.getUserName().equals(player.getUserName())))
{
return;
}
playerList.removeIf(x->player.getUserName().equals(x.player.getUserName()));
playerList.add(new OrderPlayer(player,false));
players.removeIf(x->player.getUserName().equals(x.getUserName()));
players.add(player);
}
@@ -17,7 +17,7 @@ public interface IClient {
public void drawLowerBuildingCard(String playerUsername,int pos) ;
public void skipTurn(String playerUsername) throws RemoteException;
public void skipTurn(String playerUsername);
@@ -158,14 +158,13 @@ public class TUI implements IView {
public void renderTotems() {
clearTerminal();
var table = new AsciiTable(BorderStyle.ROUNDED, model.availableTotems.size());
List<String> lines = model.availableTotems.stream().map(Totems::toString).toList();
int i=0;
for(String line : lines)
List<String> lines =new ArrayList<>();
for(int i=0;i<model.availableTotems.size();i++)
{
line = (i++) +". "+ line;
lines.add(i+"."+model.availableTotems.get(i));
}
table.addRow(lines);
System.out.println(model.currentState+"\nTOTEMS AVAILABLE:\n"+table.build());
System.out.println(model.currentState+"\nTOTEMS AVAILABLE:\n"+table.build()+"\nPress 9 and then write the position");
}
/**
@@ -228,7 +227,6 @@ public class TUI implements IView {
table.addRow(List.of("6-PickOptionalBuilding(pos)", ""));
table.addRow(List.of("7-NoOptional", ""));
table.addRow(List.of("8-SkipTurn", ""));
table.addRow(List.of("9-TotemChoice(pos)", ""));
return table.build();
}