diff --git a/Mage.Client/src/main/java/mage/client/util/Config.java b/Mage.Client/src/main/java/mage/client/util/Config.java index 395879d1b8..678c8fdb6e 100644 --- a/Mage.Client/src/main/java/mage/client/util/Config.java +++ b/Mage.Client/src/main/java/mage/client/util/Config.java @@ -24,11 +24,9 @@ * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of BetaSteward_at_googlemail.com. -*/ - + */ package mage.client.util; - import java.io.File; import java.io.FileInputStream; import java.io.IOException; @@ -42,6 +40,7 @@ import org.apache.log4j.Logger; */ public class Config { + // TODO: Remove this class completely private static final Logger logger = Logger.getLogger(Config.class); public static final String remoteServer; @@ -65,33 +64,33 @@ public class Config { } catch (IOException ex) { logger.fatal("Config error ", ex); } - serverName = p.getProperty("server-name"); - port = Integer.parseInt(p.getProperty("port")); - remoteServer = p.getProperty("remote-server"); - cardScalingFactor = Double.valueOf(p.getProperty("card-scaling-factor")); - cardScalingFactorEnlarged = Double.valueOf(p.getProperty("card-scaling-factor-enlarged")); - handScalingFactor = Double.valueOf(p.getProperty("hand-scaling-factor")); - defaultGameType = p.getProperty("default-game-type", "Human"); - defaultDeckPath = p.getProperty("default-deck-path"); - defaultOtherPlayerIndex = p.getProperty("default-other-player-index"); - defaultComputerName = p.getProperty("default-computer-name"); - - dimensions = new CardDimensions(cardScalingFactor); - dimensionsEnlarged = new CardDimensions(cardScalingFactorEnlarged); -// activate instead this part, to run the UI editor for some panels without error -// serverName = "localhost"; -// port = 17171; -// remoteServer = "mage-server"; -// cardScalingFactor = Double.valueOf(0.4); -// cardScalingFactorEnlarged = Double.valueOf(0.5); -// handScalingFactor = Double.valueOf(1.3); +// serverName = p.getProperty("server-name"); +// port = Integer.parseInt(p.getProperty("port")); +// remoteServer = p.getProperty("remote-server"); +// cardScalingFactor = Double.valueOf(p.getProperty("card-scaling-factor")); +// cardScalingFactorEnlarged = Double.valueOf(p.getProperty("card-scaling-factor-enlarged")); +// handScalingFactor = Double.valueOf(p.getProperty("hand-scaling-factor")); // defaultGameType = p.getProperty("default-game-type", "Human"); -// defaultDeckPath = ""; -// defaultOtherPlayerIndex = "1"; -// defaultComputerName = "Computer"; +// defaultDeckPath = p.getProperty("default-deck-path"); +// defaultOtherPlayerIndex = p.getProperty("default-other-player-index"); +// defaultComputerName = p.getProperty("default-computer-name"); // // dimensions = new CardDimensions(cardScalingFactor); // dimensionsEnlarged = new CardDimensions(cardScalingFactorEnlarged); +// activate instead this part, to run the UI editor for some panels without error + serverName = "localhost"; + port = 17171; + remoteServer = "mage-server"; + cardScalingFactor = 0.4; + cardScalingFactorEnlarged = 0.5; + handScalingFactor = 1.3; + defaultGameType = p.getProperty("default-game-type", "Human"); + defaultDeckPath = ""; + defaultOtherPlayerIndex = "1"; + defaultComputerName = "Computer"; + + dimensions = new CardDimensions(cardScalingFactor); + dimensionsEnlarged = new CardDimensions(cardScalingFactorEnlarged); } diff --git a/Mage.Client/src/main/java/mage/client/util/EDTExceptionHandler.java b/Mage.Client/src/main/java/mage/client/util/EDTExceptionHandler.java index c119d39a2b..8e78c928b5 100644 --- a/Mage.Client/src/main/java/mage/client/util/EDTExceptionHandler.java +++ b/Mage.Client/src/main/java/mage/client/util/EDTExceptionHandler.java @@ -47,8 +47,8 @@ public class EDTExceptionHandler implements Thread.UncaughtExceptionHandler { public void handle(Throwable throwable) { try { - logger.fatal(null, throwable); - JOptionPane.showMessageDialog(MageFrame.getDesktop(), throwable, "MAGE Client UI error", JOptionPane.ERROR_MESSAGE); + logger.fatal("MAGE Client UI error", throwable); + // JOptionPane.showMessageDialog(MageFrame.getDesktop(), throwable, "MAGE Client UI error", JOptionPane.ERROR_MESSAGE); } catch (Throwable t) {} } diff --git a/Mage.Server.Plugins/Mage.Player.AI/src/main/java/mage/player/ai/utils/RateCard.java b/Mage.Server.Plugins/Mage.Player.AI/src/main/java/mage/player/ai/utils/RateCard.java index b3a64aac02..0a58ae7601 100644 --- a/Mage.Server.Plugins/Mage.Player.AI/src/main/java/mage/player/ai/utils/RateCard.java +++ b/Mage.Server.Plugins/Mage.Player.AI/src/main/java/mage/player/ai/utils/RateCard.java @@ -52,7 +52,9 @@ public class RateCard { */ public static int rateCard(Card card, List allowedColors) { if (allowedColors == null && rated.containsKey(card.getName())) { - return rated.get(card.getName()); + int rate = rated.get(card.getName()); +// log.info(card.getName() + " rate: " + rate); + return rate; } int type; if (card.getCardType().contains(CardType.PLANESWALKER)) { @@ -136,7 +138,7 @@ public class RateCard { */ private synchronized static void readRatings() { if (ratings == null) { - ratings = new HashMap(); + ratings = new HashMap<>(); readFromFile("/m13.csv"); } } diff --git a/Mage.Server/config/log4j.properties b/Mage.Server/config/log4j.properties index 513f439d84..2bfdbce343 100644 --- a/Mage.Server/config/log4j.properties +++ b/Mage.Server/config/log4j.properties @@ -1,16 +1,45 @@ #default levels -log4j.rootLogger=debug, console, logfile +#log4j.rootLogger=info, console, logfile +log4j.rootLogger=info, RollingAppender log4j.logger.com.j256.ormlite=warn -log4j.logger.mage.player.ai=warn -#log4j.logger.mage.player.ai.ComputerPlayer6=debug +log4j.logger.mage.game=debug +log4j.logger.mage.game.GameImpl=debug +log4j.logger.mage.players.PlayerImpl=debug +log4j.logger.mage.server=debug +#log4j.logger.mage.server.UserManager=debug +#log4j.logger.mage.server.User=debug +#log4j.logger.mage.server.ChatSession=debug +#log4j.logger.mage.server.ChatManager=debug +#log4j.logger.mage.server.TableController=debug +#log4j.logger.mage.server.TableManager=debug +#log4j.logger.mage.server.tournament.TournamentManager=debug +#log4j.logger.mage.server.game.GameSession=debug +log4j.logger.mage.abilities.AbilityImpl=debug +log4j.logger.mage.cards.decks=debug +log4j.logger.mage.abilities.effects.common.continious.CommanderManaReplacementEffect=debug + #console log -log4j.appender.console=org.apache.log4j.ConsoleAppender -log4j.appender.console.layout=org.apache.log4j.PatternLayout -log4j.appender.console.layout.ConversionPattern=%-5p %d{yyyy-MM-dd HH:mm:ss,SSS} %-90m =>[%t] %C{1}.%M%n -log4j.appender.console.Threshold=info +#log4j.appender.console=org.apache.log4j.ConsoleAppender +#log4j.appender.console.layout=org.apache.log4j.PatternLayout +#log4j.appender.console.layout.ConversionPattern=%-5p [%d{yyyy-MM-dd HH:mm [ss:SSS]}] %C{1}[%t]: %m% +#log4j.appender.console.Threshold=info #file log -log4j.appender.logfile=org.apache.log4j.FileAppender -log4j.appender.logfile.File=mageserver.log -log4j.appender.logfile.layout=org.apache.log4j.PatternLayout -log4j.appender.logfile.layout.ConversionPattern=%-5p %d{yyyy-MM-dd HH:mm:ss,SSS} %-90m =>[%t] %C{1}.%M%n \ No newline at end of file +#log4j.appender.logfile=org.apache.log4j.FileAppender +#log4j.appender.logfile.File=mageserver.log +#log4j.appender.logfile.layout=org.apache.log4j.PatternLayout +#log4j.appender.logfile.layout.ConversionPattern=%-5p [%d{yyyy-MM-dd HH:mm [ss:SSS]}] %C{1}[%t]: %m%n + +log4j.appender.RollingAppender=org.apache.log4j.DailyRollingFileAppender +log4j.appender.RollingAppender.File=mageserver.log +log4j.appender.RollingAppender.DatePattern='.'yyyy-MM-dd +log4j.appender.RollingAppender.layout=org.apache.log4j.PatternLayout +log4j.appender.RollingAppender.layout.ConversionPattern=[%p] %d %c %M - %m%n +log4j.appender.RollingAppender.layout.ConversionPattern=%-5p %d{yyyy-MM-dd HH:mm:ss,SSS} %-90m =>[%t] %C{1}.%M%n +#diagnostic log for game core classes +#log4j.category.mage.server.game = INFO, diagfile +#log4j.additivity.mage.server.game = false +#log4j.appender.diagfile=org.apache.log4j.FileAppender +#log4j.appender.diagfile.File=magediag.log +#log4j.appender.diagfile.layout=org.apache.log4j.PatternLayout +#log4j.appender.diagfile.layout.ConversionPattern=%-5p [%d{yyyy-MM-dd HH:mm [ss:SSS]}] %C{1}[%t]: %m%n \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/arabiannights/AliFromCairo.java b/Mage.Sets/src/mage/sets/arabiannights/AliFromCairo.java index 076d03c794..5cc37d20a0 100644 --- a/Mage.Sets/src/mage/sets/arabiannights/AliFromCairo.java +++ b/Mage.Sets/src/mage/sets/arabiannights/AliFromCairo.java @@ -97,11 +97,7 @@ class AliFromCairoReplacementEffect extends ReplacementEffectImpl { && (controller.getLife() > 0) &&(controller.getLife() - event.getAmount()) < 1 && event.getPlayerId().equals(controller.getId()) ) { - return true; - //unsure how to make this comply with - // 10/1/2008: The ability doesn't change how much damage is dealt; - // it just changes how much life that damage makes you lose. - // An effect such as Spirit Link will see the full amount of damage being dealt. + return true; } } return false; @@ -110,10 +106,17 @@ class AliFromCairoReplacementEffect extends ReplacementEffectImpl { @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { Player controller = game.getPlayer(source.getControllerId()); + + // 10/1/2008: The ability doesn't change how much damage is dealt; + // it just changes how much life that damage makes you lose. + // An effect such as Spirit Link will see the full amount of damage being dealt. + game.fireEvent(event); + if (controller != null) { - event.setAmount(controller.getLife() - 1); + controller.setLife(1, game); } - return false; + + return true; } }