@@ -4,6 +4,9 @@ import it.polimi.ingsw.gc14.Model.Cards.Building.EffectType;
|
|||||||
import it.polimi.ingsw.gc14.Model.Cards.BuildingCard;
|
import it.polimi.ingsw.gc14.Model.Cards.BuildingCard;
|
||||||
import it.polimi.ingsw.gc14.Model.Cards.TribeCard;
|
import it.polimi.ingsw.gc14.Model.Cards.TribeCard;
|
||||||
import it.polimi.ingsw.gc14.Model.Cards.TribeCards.Character;
|
import it.polimi.ingsw.gc14.Model.Cards.TribeCards.Character;
|
||||||
|
import it.polimi.ingsw.gc14.Model.Cards.TribeCards.CharacterType;
|
||||||
|
import it.polimi.ingsw.gc14.Model.Cards.TribeCards.Characters.Builder;
|
||||||
|
import it.polimi.ingsw.gc14.Model.Cards.TribeCards.Characters.Inventor;
|
||||||
import it.polimi.ingsw.gc14.Model.Cards.TribeCards.EventCard;
|
import it.polimi.ingsw.gc14.Model.Cards.TribeCards.EventCard;
|
||||||
import it.polimi.ingsw.gc14.Model.Cards.TribeCards.EventType;
|
import it.polimi.ingsw.gc14.Model.Cards.TribeCards.EventType;
|
||||||
import it.polimi.ingsw.gc14.Model.GamePackage.Board;
|
import it.polimi.ingsw.gc14.Model.GamePackage.Board;
|
||||||
@@ -17,6 +20,8 @@ import it.polimi.ingsw.gc14.Model.GamePackage.GameStages;
|
|||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
import it.polimi.ingsw.gc14.Network.Observer;
|
import it.polimi.ingsw.gc14.Network.Observer;
|
||||||
import it.polimi.ingsw.gc14.View.TUI.AsciiTable;
|
import it.polimi.ingsw.gc14.View.TUI.AsciiTable;
|
||||||
import it.polimi.ingsw.gc14.View.TUI.BorderStyle;
|
import it.polimi.ingsw.gc14.View.TUI.BorderStyle;
|
||||||
@@ -691,7 +696,6 @@ public class Game implements Serializable {
|
|||||||
currentState.PlayerUpdate(orderLogicCard.pull(), null);
|
currentState.PlayerUpdate(orderLogicCard.pull(), null);
|
||||||
currentState.GameStageUpdate(GameStages.SLOT_CHOICE);
|
currentState.GameStageUpdate(GameStages.SLOT_CHOICE);
|
||||||
} else {
|
} else {
|
||||||
EventResolution();
|
|
||||||
currentState.GameStageUpdate(GameStages.ENDING);
|
currentState.GameStageUpdate(GameStages.ENDING);
|
||||||
endGame();
|
endGame();
|
||||||
}
|
}
|
||||||
@@ -715,7 +719,6 @@ public class Game implements Serializable {
|
|||||||
currentState.PlayerUpdate(orderLogicCard.pull(), null);
|
currentState.PlayerUpdate(orderLogicCard.pull(), null);
|
||||||
currentState.GameStageUpdate(GameStages.SLOT_CHOICE);
|
currentState.GameStageUpdate(GameStages.SLOT_CHOICE);
|
||||||
} else {
|
} else {
|
||||||
EventResolution();
|
|
||||||
currentState.GameStageUpdate(GameStages.ENDING);
|
currentState.GameStageUpdate(GameStages.ENDING);
|
||||||
endGame();
|
endGame();
|
||||||
}
|
}
|
||||||
@@ -808,6 +811,34 @@ public class Game implements Serializable {
|
|||||||
* and updating the game stage to {@code ENDED}.
|
* and updating the game stage to {@code ENDED}.
|
||||||
*/
|
*/
|
||||||
private void endGame() {
|
private void endGame() {
|
||||||
|
Queue<EventCard> events;
|
||||||
|
events=Stream.concat(board.lowerListTribe.stream().filter(x->!x.IsEventCard()),board.upperListTribe.stream().filter(x->!x.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);
|
||||||
|
for(EventCard event:events)
|
||||||
|
{
|
||||||
|
event.activateEvent(playersList);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(EventCard e : sustenance)
|
||||||
|
{
|
||||||
|
e.activateEvent(playersList);
|
||||||
|
}
|
||||||
|
playersList.forEach(p->{
|
||||||
|
int temp= p.builders.stream().mapToInt(Builder::getPrestigeValue).sum();
|
||||||
|
p.addPrestige(temp);
|
||||||
|
});
|
||||||
|
playersList.forEach(p->{
|
||||||
|
int temp=(int) p.inventors.stream().mapToInt(Inventor::Icon).distinct().count();
|
||||||
|
p.addPrestige(temp*p.getNType(CharacterType.INVENTOR));
|
||||||
|
});
|
||||||
|
playersList.forEach(p->{
|
||||||
|
p.addPrestige(10 * (p.getNType(CharacterType.ARTIST)/2));
|
||||||
|
});
|
||||||
|
playersList.forEach(p->{
|
||||||
|
int temp= p.buildingCards.stream().mapToInt(BuildingCard::getPrestigeValue).sum();
|
||||||
|
p.addPrestige(temp);
|
||||||
|
});
|
||||||
playersList.forEach(
|
playersList.forEach(
|
||||||
p -> p.buildingCards.stream().filter(x -> x.getEffectType() == EffectType.FINAL).
|
p -> p.buildingCards.stream().filter(x -> x.getEffectType() == EffectType.FINAL).
|
||||||
forEach(x -> x.applyEffect(p))
|
forEach(x -> x.applyEffect(p))
|
||||||
|
|||||||
Reference in New Issue
Block a user