Fixed: various
This commit is contained in:
@@ -86,11 +86,7 @@ public class ClientController {
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
try {
|
client.drawUpperTribeCard(playerUsername, pos);
|
||||||
client.drawUpperTribeCard(playerUsername, pos);
|
|
||||||
} catch (RemoteException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -105,11 +101,7 @@ public class ClientController {
|
|||||||
if(!Objects.equals(playerUsername, miniModel.currentState.getCurrentPlayer().getUserName()))
|
if(!Objects.equals(playerUsername, miniModel.currentState.getCurrentPlayer().getUserName()))
|
||||||
view.showError("It's not your turn!");
|
view.showError("It's not your turn!");
|
||||||
else
|
else
|
||||||
try {
|
client.drawLowerTribeCard(playerUsername, pos);
|
||||||
client.drawLowerTribeCard(playerUsername, pos);
|
|
||||||
} catch (RemoteException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -123,11 +115,7 @@ public class ClientController {
|
|||||||
if(!Objects.equals(playerUsername, miniModel.currentState.getCurrentPlayer().getUserName()))
|
if(!Objects.equals(playerUsername, miniModel.currentState.getCurrentPlayer().getUserName()))
|
||||||
view.showError("It's not your turn!");
|
view.showError("It's not your turn!");
|
||||||
else {
|
else {
|
||||||
try {
|
client.drawUpperBuildingCard(playerUsername,pos);
|
||||||
client.drawUpperBuildingCard(playerUsername,pos);
|
|
||||||
} catch (RemoteException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -143,11 +131,7 @@ public class ClientController {
|
|||||||
if(!Objects.equals(playerUsername,miniModel.currentState.getCurrentPlayer().getUserName()))
|
if(!Objects.equals(playerUsername,miniModel.currentState.getCurrentPlayer().getUserName()))
|
||||||
view.showError("It's not your turn!");
|
view.showError("It's not your turn!");
|
||||||
else {
|
else {
|
||||||
try {
|
client.drawLowerBuildingCard(playerUsername,pos);
|
||||||
client.drawLowerBuildingCard(playerUsername,pos);
|
|
||||||
} catch (RemoteException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -161,11 +145,7 @@ public class ClientController {
|
|||||||
if(!Objects.equals(playerUsername,miniModel.currentState.getCurrentPlayer().getUserName()))
|
if(!Objects.equals(playerUsername,miniModel.currentState.getCurrentPlayer().getUserName()))
|
||||||
view.showError("It's not your turn!");
|
view.showError("It's not your turn!");
|
||||||
else {
|
else {
|
||||||
try {
|
client.skipTurn(playerUsername);
|
||||||
client.skipTurn(playerUsername);
|
|
||||||
} catch (RemoteException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -182,11 +162,7 @@ public class ClientController {
|
|||||||
if(!Objects.equals(playerUsername,miniModel.currentState.getCurrentPlayer().getUserName()))
|
if(!Objects.equals(playerUsername,miniModel.currentState.getCurrentPlayer().getUserName()))
|
||||||
view.showError("It's not your turn!");
|
view.showError("It's not your turn!");
|
||||||
else {
|
else {
|
||||||
try {
|
client.pickOptionalTribeCard(playerUsername,pos);
|
||||||
client.pickOptionalTribeCard(playerUsername,pos);
|
|
||||||
} catch (RemoteException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -201,11 +177,7 @@ public class ClientController {
|
|||||||
if(!Objects.equals(playerUsername, miniModel.currentState.getCurrentPlayer().getUserName()))
|
if(!Objects.equals(playerUsername, miniModel.currentState.getCurrentPlayer().getUserName()))
|
||||||
view.showError("It's not your turn!");
|
view.showError("It's not your turn!");
|
||||||
else {
|
else {
|
||||||
try {
|
client.pickOptionalBuildingCard(playerUsername,pos);
|
||||||
client.pickOptionalBuildingCard(playerUsername,pos);
|
|
||||||
} catch (RemoteException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -219,11 +191,7 @@ public class ClientController {
|
|||||||
if(!Objects.equals(playerUsername, miniModel.currentState.getCurrentPlayer().getUserName()))
|
if(!Objects.equals(playerUsername, miniModel.currentState.getCurrentPlayer().getUserName()))
|
||||||
view.showError("It's not your turn!");
|
view.showError("It's not your turn!");
|
||||||
else {
|
else {
|
||||||
try {
|
client.noOptionalCard(playerUsername);
|
||||||
client.noOptionalCard(playerUsername);
|
|
||||||
} catch (RemoteException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -237,11 +205,7 @@ public class ClientController {
|
|||||||
if(!Objects.equals(playerUsername, miniModel.currentState.getCurrentPlayer().getUserName()))
|
if(!Objects.equals(playerUsername, miniModel.currentState.getCurrentPlayer().getUserName()))
|
||||||
view.showError("It's not your turn!");
|
view.showError("It's not your turn!");
|
||||||
else {
|
else {
|
||||||
try {
|
client.slotChoice(playerUsername,pos);
|
||||||
client.slotChoice(playerUsername,pos);
|
|
||||||
} catch (RemoteException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -250,11 +214,7 @@ public class ClientController {
|
|||||||
if(!Objects.equals(playerUsername, miniModel.currentState.getCurrentPlayer().getUserName()))
|
if(!Objects.equals(playerUsername, miniModel.currentState.getCurrentPlayer().getUserName()))
|
||||||
view.showError("It's not your turn!");
|
view.showError("It's not your turn!");
|
||||||
else {
|
else {
|
||||||
try {
|
client.totemChoice(playerUsername, String.valueOf(miniModel.availableTotems.get(pos)));
|
||||||
client.totemChoice(playerUsername, String.valueOf(miniModel.availableTotems.get(pos)));
|
|
||||||
} catch (RemoteException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -70,9 +70,12 @@ public abstract class OrderLogicCard implements Serializable {
|
|||||||
playerList=new ArrayList<>();
|
playerList=new ArrayList<>();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
if(players.stream().anyMatch(x->x.getUserName().equals(player.getUserName())))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
playerList.removeIf(x->player.getUserName().equals(x.player.getUserName()));
|
playerList.removeIf(x->player.getUserName().equals(x.player.getUserName()));
|
||||||
playerList.add(new OrderPlayer(player,false));
|
playerList.add(new OrderPlayer(player,false));
|
||||||
players.removeIf(x->player.getUserName().equals(x.getUserName()));
|
|
||||||
players.add(player);
|
players.add(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ public interface IClient {
|
|||||||
|
|
||||||
public void drawLowerBuildingCard(String playerUsername,int pos) ;
|
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() {
|
public void renderTotems() {
|
||||||
clearTerminal();
|
clearTerminal();
|
||||||
var table = new AsciiTable(BorderStyle.ROUNDED, model.availableTotems.size());
|
var table = new AsciiTable(BorderStyle.ROUNDED, model.availableTotems.size());
|
||||||
List<String> lines = model.availableTotems.stream().map(Totems::toString).toList();
|
List<String> lines =new ArrayList<>();
|
||||||
int i=0;
|
for(int i=0;i<model.availableTotems.size();i++)
|
||||||
for(String line : lines)
|
|
||||||
{
|
{
|
||||||
line = (i++) +". "+ line;
|
lines.add(i+"."+model.availableTotems.get(i));
|
||||||
}
|
}
|
||||||
table.addRow(lines);
|
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("6-PickOptionalBuilding(pos)", ""));
|
||||||
table.addRow(List.of("7-NoOptional", ""));
|
table.addRow(List.of("7-NoOptional", ""));
|
||||||
table.addRow(List.of("8-SkipTurn", ""));
|
table.addRow(List.of("8-SkipTurn", ""));
|
||||||
table.addRow(List.of("9-TotemChoice(pos)", ""));
|
|
||||||
return table.build();
|
return table.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user