mirror of
https://github.com/magefree/mage.git
synced 2025-12-23 03:51:58 -08:00
Merge branch 'master' of https://github.com/magefree/mage.git
This commit is contained in:
commit
e7458aec80
7 changed files with 28 additions and 11 deletions
|
|
@ -81,7 +81,10 @@ public class TableView implements Serializable {
|
|||
StringBuilder sb = new StringBuilder();
|
||||
StringBuilder sbScore = new StringBuilder();
|
||||
for(MatchPlayer matchPlayer: table.getMatch().getPlayers()) {
|
||||
if (!matchPlayer.getPlayer().getName().equals(table.getControllerName())) {
|
||||
if (matchPlayer.getPlayer() == null) {
|
||||
sb.append(", ").append("[unknown]");
|
||||
sbScore.append("-").append(matchPlayer.getWins());
|
||||
} else if (!matchPlayer.getPlayer().getName().equals(table.getControllerName())) {
|
||||
sb.append(", ").append(matchPlayer.getPlayer().getName());
|
||||
sbScore.append("-").append(matchPlayer.getWins());
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -701,7 +701,11 @@ public class HumanPlayer extends PlayerImpl<HumanPlayer> {
|
|||
updateGameStatePriority("getAmount", game);
|
||||
game.fireGetAmountEvent(playerId, message, min, max);
|
||||
waitForIntegerResponse(game);
|
||||
return response.getInteger();
|
||||
if (response != null) {
|
||||
return response.getInteger();
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -109,7 +109,12 @@ public class TableController {
|
|||
tournament = TournamentFactory.getInstance().createTournament(options.getTournamentType(), options);
|
||||
if (userId != null) {
|
||||
User user = UserManager.getInstance().getUser(userId);
|
||||
controllerName = user.getName();
|
||||
if (user == null) {
|
||||
logger.fatal(new StringBuilder("User for userId ").append(userId).append(" could not be retrieved from UserManager").toString());
|
||||
controllerName = "[unknown]";
|
||||
} else {
|
||||
controllerName = user.getName();
|
||||
}
|
||||
}
|
||||
else {
|
||||
controllerName = "System";
|
||||
|
|
@ -177,6 +182,9 @@ public class TableController {
|
|||
}
|
||||
|
||||
Player player = createPlayer(name, seat.getPlayerType(), skill);
|
||||
if (player == null) {
|
||||
throw new GameException(new StringBuilder("Could not create player ").append(name).append(" of type ").append(seat.getPlayerType().toString()).toString());
|
||||
}
|
||||
match.addPlayer(player, deck);
|
||||
table.joinTable(player, seat);
|
||||
User user = UserManager.getInstance().getUser(userId);
|
||||
|
|
@ -456,7 +464,7 @@ public class TableController {
|
|||
public void endGame() {
|
||||
// get player that chooses who goes first
|
||||
UUID choosingPlayerId = match.getChooser();
|
||||
|
||||
logger.warn("endGame() " + match.getPlayers().toString());
|
||||
match.endGame();
|
||||
table.endGame();
|
||||
// Saving of games caused memory leaks - so save is deactivated
|
||||
|
|
|
|||
|
|
@ -48,9 +48,11 @@ public class ReplayManager {
|
|||
private ConcurrentHashMap<String, ReplaySession> replaySessions = new ConcurrentHashMap<String, ReplaySession>();
|
||||
|
||||
public void replayGame(UUID gameId, UUID userId) {
|
||||
ReplaySession replaySession = new ReplaySession(gameId, userId);
|
||||
replaySessions.put(gameId.toString() + userId.toString(), replaySession);
|
||||
UserManager.getInstance().getUser(userId).replayGame(gameId);
|
||||
if (1 == 2) { // deactivated because replay causes memor leaks
|
||||
ReplaySession replaySession = new ReplaySession(gameId, userId);
|
||||
replaySessions.put(gameId.toString() + userId.toString(), replaySession);
|
||||
UserManager.getInstance().getUser(userId).replayGame(gameId);
|
||||
}
|
||||
}
|
||||
|
||||
public void startReplay(UUID gameId, UUID userId) {
|
||||
|
|
|
|||
|
|
@ -98,7 +98,6 @@ class DeadbridgeChantEffect extends OneShotEffect<DeadbridgeChantEffect> {
|
|||
if (player != null && !player.getGraveyard().isEmpty()) {
|
||||
Card card = player.getGraveyard().getRandom(game);
|
||||
if (card != null) {
|
||||
Card sourceCard = game.getCard(source.getId());
|
||||
Zone targetZone = Zone.HAND;
|
||||
String text = " put into hand of ";
|
||||
if (card.getCardType().contains(CardType.CREATURE)) {
|
||||
|
|
@ -106,7 +105,7 @@ class DeadbridgeChantEffect extends OneShotEffect<DeadbridgeChantEffect> {
|
|||
text = " put onto battlefield for ";
|
||||
}
|
||||
card.moveToZone(targetZone, source.getId(), game, false);
|
||||
game.informPlayers(new StringBuilder(sourceCard.getName()).append(": ").append(card.getName()).append(text).append(player.getName()).toString());
|
||||
game.informPlayers(new StringBuilder("Deadbridge Chant: ").append(card.getName()).append(text).append(player.getName()).toString());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -168,7 +168,7 @@ public class DevourEffect extends ReplacementEffectImpl<DevourEffect> {
|
|||
if (object != null) {
|
||||
return (List<ArrayList<String>>) object;
|
||||
}
|
||||
return null;
|
||||
return new ArrayList<ArrayList<String>>();
|
||||
}
|
||||
|
||||
public int getDevouredCreaturesAmount(Game game, UUID permanentId) {
|
||||
|
|
|
|||
|
|
@ -32,8 +32,8 @@ import java.io.Serializable;
|
|||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.constants.TableState;
|
||||
import mage.cards.decks.DeckValidator;
|
||||
import mage.constants.TableState;
|
||||
import mage.game.events.Listener;
|
||||
import mage.game.events.TableEvent;
|
||||
import mage.game.events.TableEventSource;
|
||||
|
|
@ -56,6 +56,7 @@ public class Table implements Serializable {
|
|||
private Seat[] seats;
|
||||
private int numSeats;
|
||||
private boolean isTournament;
|
||||
private boolean isTournamentSubTable;
|
||||
private DeckValidator validator;
|
||||
private TableState state = TableState.WAITING;
|
||||
private Match match;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue