public void roundStart(RoundEvent e) {
}
public void roundEnd(RoundEvent e) {
Zone z;
Player winner = null;
Card52 winnersCard = null;
boolean equality = false;
Collection<Card> cardcol = new ArrayList<Card>();
for (Player p : e.getGame().getPlayers()) {
z = p.getZones().get("current");
if (z.getCardCount() > 0) {
Card c = z.getSortedList().get(z.getSortedList().size() - 1);
if (c instanceof Card52) {
if (winnersCard == null) {
winnersCard = ((Card52) c);
winner = p;
} else {
if (((Card52) c).getValue() > winnersCard.getValue()) {
winnersCard = ((Card52) c);
winner = p;
equality = false;
} else if (((Card52) c).getValue() == winnersCard
.getValue()) {
equality = true;
}
}
}
}
}
if (winner == null)
throw new RuntimeException("There is no player ?!");
if (!equality) {
for (Player p : e.getGame().getPlayers()) {
z = p.getZones().get("current");
if (z.getCardCount() > 0) {
for (Card c : z.getSortedList()) {
cardcol.add(c);
z.deleteCard(c);
}
}
}
Zone dest = winner.getZones().get("won");
for (Card c : cardcol)
dest.addCard(c);
} else {
Zone from, to;
for (Player p : e.getGame().getPlayers()) {