Server: removed unnecessary logs, extra comments

This commit is contained in:
Oleg Agafonov 2020-07-25 19:06:38 +04:00
parent 848c5b6052
commit 3abe5e796a
5 changed files with 12 additions and 6 deletions

View file

@ -232,7 +232,7 @@ public class Session {
if (reconnect) { // must be connected to receive the message if (reconnect) { // must be connected to receive the message
Optional<GamesRoom> room = GamesRoomManager.instance.getRoom(GamesRoomManager.instance.getMainRoomId()); Optional<GamesRoom> room = GamesRoomManager.instance.getRoom(GamesRoomManager.instance.getMainRoomId());
if (!room.isPresent()) { if (!room.isPresent()) {
logger.error("main room not found"); logger.warn("main room not found"); // after server restart users try to use old rooms on reconnect
return null; return null;
} }
ChatManager.instance.joinChat(room.get().getChatId(), userId); ChatManager.instance.joinChat(room.get().getChatId(), userId);

View file

@ -43,7 +43,7 @@ public enum GamesRoomManager {
if (rooms.containsKey(roomId)) { if (rooms.containsKey(roomId)) {
return Optional.of(rooms.get(roomId)); return Optional.of(rooms.get(roomId));
} }
logger.error("room not found : " + roomId); logger.warn("room not found : " + roomId); // after server restart users try to use old rooms on reconnect
return Optional.empty(); return Optional.empty();
} }

View file

@ -86,9 +86,6 @@ class BringToLightEffect extends OneShotEffect {
Boolean cardWasCast = controller.cast(controller.chooseAbilityForCast(card, game, true), Boolean cardWasCast = controller.cast(controller.chooseAbilityForCast(card, game, true),
game, true, new MageObjectReference(source.getSourceObject(game), game)); game, true, new MageObjectReference(source.getSourceObject(game), game));
game.getState().setValue("PlayFromNotOwnHandZone" + card.getId(), null); game.getState().setValue("PlayFromNotOwnHandZone" + card.getId(), null);
if (!cardWasCast) {
Logger.getLogger(BringToLightEffect.class).error("Bring to Light: spellAbility == null " + card.getName());
}
} }
} }
return true; return true;

View file

@ -31,7 +31,7 @@ public class WatchersFromDelayedTriggeredAbilitiesTest extends CardTestPlayerBas
// can play until end step // can play until end step
checkPlayableAbility("can play bolt on 1", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cast Lightning Bolt", true); checkPlayableAbility("can play bolt on 1", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cast Lightning Bolt", true);
checkPlayableAbility("can play bolt on 2", 2, PhaseStep.PRECOMBAT_MAIN, playerA, "Cast Lightning Bolt", false); checkPlayableAbility("can't play bolt on 2", 2, PhaseStep.PRECOMBAT_MAIN, playerA, "Cast Lightning Bolt", false);
setStrictChooseMode(true); setStrictChooseMode(true);
setStopAt(2, PhaseStep.END_TURN); setStopAt(2, PhaseStep.END_TURN);

View file

@ -55,6 +55,15 @@ public class Deck implements Serializable {
return currentDeck; return currentDeck;
} }
/**
* Warning, AI can't play Mock cards, so call it with extra params in real games or tests
*
* @param deckCardLists cards to load
* @param ignoreErrors - do not raise exception error on wrong deck
* @param mockCards - use it for GUI only code, real game cards must be real
* @return
* @throws GameException
*/
public static Deck load(DeckCardLists deckCardLists, boolean ignoreErrors, boolean mockCards) throws GameException { public static Deck load(DeckCardLists deckCardLists, boolean ignoreErrors, boolean mockCards) throws GameException {
Deck deck = new Deck(); Deck deck = new Deck();
deck.setName(deckCardLists.getName()); deck.setName(deckCardLists.getName());