mirror of
https://github.com/correl/mage.git
synced 2024-11-25 03:00:11 +00:00
Merge origin/master
Conflicts: Mage.Client/src/main/java/org/mage/card/arcane/ManaSymbols.java
This commit is contained in:
commit
3f57012c85
5 changed files with 81 additions and 48 deletions
|
@ -24,11 +24,9 @@
|
||||||
* The views and conclusions contained in the software and documentation are those of the
|
* 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
|
* authors and should not be interpreted as representing official policies, either expressed
|
||||||
* or implied, of BetaSteward_at_googlemail.com.
|
* or implied, of BetaSteward_at_googlemail.com.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package mage.client.util;
|
package mage.client.util;
|
||||||
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -42,6 +40,7 @@ import org.apache.log4j.Logger;
|
||||||
*/
|
*/
|
||||||
public class Config {
|
public class Config {
|
||||||
|
|
||||||
|
// TODO: Remove this class completely
|
||||||
private static final Logger logger = Logger.getLogger(Config.class);
|
private static final Logger logger = Logger.getLogger(Config.class);
|
||||||
|
|
||||||
public static final String remoteServer;
|
public static final String remoteServer;
|
||||||
|
@ -65,33 +64,33 @@ public class Config {
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
logger.fatal("Config error ", ex);
|
logger.fatal("Config error ", ex);
|
||||||
}
|
}
|
||||||
serverName = p.getProperty("server-name");
|
// serverName = p.getProperty("server-name");
|
||||||
port = Integer.parseInt(p.getProperty("port"));
|
// port = Integer.parseInt(p.getProperty("port"));
|
||||||
remoteServer = p.getProperty("remote-server");
|
// remoteServer = p.getProperty("remote-server");
|
||||||
cardScalingFactor = Double.valueOf(p.getProperty("card-scaling-factor"));
|
// cardScalingFactor = Double.valueOf(p.getProperty("card-scaling-factor"));
|
||||||
cardScalingFactorEnlarged = Double.valueOf(p.getProperty("card-scaling-factor-enlarged"));
|
// cardScalingFactorEnlarged = Double.valueOf(p.getProperty("card-scaling-factor-enlarged"));
|
||||||
handScalingFactor = Double.valueOf(p.getProperty("hand-scaling-factor"));
|
// 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);
|
|
||||||
// defaultGameType = p.getProperty("default-game-type", "Human");
|
// defaultGameType = p.getProperty("default-game-type", "Human");
|
||||||
// defaultDeckPath = "";
|
// defaultDeckPath = p.getProperty("default-deck-path");
|
||||||
// defaultOtherPlayerIndex = "1";
|
// defaultOtherPlayerIndex = p.getProperty("default-other-player-index");
|
||||||
// defaultComputerName = "Computer";
|
// defaultComputerName = p.getProperty("default-computer-name");
|
||||||
//
|
//
|
||||||
// dimensions = new CardDimensions(cardScalingFactor);
|
// dimensions = new CardDimensions(cardScalingFactor);
|
||||||
// dimensionsEnlarged = new CardDimensions(cardScalingFactorEnlarged);
|
// 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);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,8 +47,8 @@ public class EDTExceptionHandler implements Thread.UncaughtExceptionHandler {
|
||||||
|
|
||||||
public void handle(Throwable throwable) {
|
public void handle(Throwable throwable) {
|
||||||
try {
|
try {
|
||||||
logger.fatal(null, throwable);
|
logger.fatal("MAGE Client UI error", throwable);
|
||||||
JOptionPane.showMessageDialog(MageFrame.getDesktop(), throwable, "MAGE Client UI error", JOptionPane.ERROR_MESSAGE);
|
// JOptionPane.showMessageDialog(MageFrame.getDesktop(), throwable, "MAGE Client UI error", JOptionPane.ERROR_MESSAGE);
|
||||||
} catch (Throwable t) {}
|
} catch (Throwable t) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,9 @@ public class RateCard {
|
||||||
*/
|
*/
|
||||||
public static int rateCard(Card card, List<ColoredManaSymbol> allowedColors) {
|
public static int rateCard(Card card, List<ColoredManaSymbol> allowedColors) {
|
||||||
if (allowedColors == null && rated.containsKey(card.getName())) {
|
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;
|
int type;
|
||||||
if (card.getCardType().contains(CardType.PLANESWALKER)) {
|
if (card.getCardType().contains(CardType.PLANESWALKER)) {
|
||||||
|
@ -136,7 +138,7 @@ public class RateCard {
|
||||||
*/
|
*/
|
||||||
private synchronized static void readRatings() {
|
private synchronized static void readRatings() {
|
||||||
if (ratings == null) {
|
if (ratings == null) {
|
||||||
ratings = new HashMap<String, Integer>();
|
ratings = new HashMap<>();
|
||||||
readFromFile("/m13.csv");
|
readFromFile("/m13.csv");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,16 +1,45 @@
|
||||||
#default levels
|
#default levels
|
||||||
log4j.rootLogger=debug, console, logfile
|
#log4j.rootLogger=info, console, logfile
|
||||||
|
log4j.rootLogger=info, RollingAppender
|
||||||
log4j.logger.com.j256.ormlite=warn
|
log4j.logger.com.j256.ormlite=warn
|
||||||
log4j.logger.mage.player.ai=warn
|
log4j.logger.mage.game=debug
|
||||||
#log4j.logger.mage.player.ai.ComputerPlayer6=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
|
#console log
|
||||||
log4j.appender.console=org.apache.log4j.ConsoleAppender
|
#log4j.appender.console=org.apache.log4j.ConsoleAppender
|
||||||
log4j.appender.console.layout=org.apache.log4j.PatternLayout
|
#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.layout.ConversionPattern=%-5p [%d{yyyy-MM-dd HH:mm [ss:SSS]}] %C{1}[%t]: %m%
|
||||||
log4j.appender.console.Threshold=info
|
#log4j.appender.console.Threshold=info
|
||||||
|
|
||||||
#file log
|
#file log
|
||||||
log4j.appender.logfile=org.apache.log4j.FileAppender
|
#log4j.appender.logfile=org.apache.log4j.FileAppender
|
||||||
log4j.appender.logfile.File=mageserver.log
|
#log4j.appender.logfile.File=mageserver.log
|
||||||
log4j.appender.logfile.layout=org.apache.log4j.PatternLayout
|
#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
|
#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
|
|
@ -97,11 +97,7 @@ class AliFromCairoReplacementEffect extends ReplacementEffectImpl {
|
||||||
&& (controller.getLife() > 0) &&(controller.getLife() - event.getAmount()) < 1
|
&& (controller.getLife() > 0) &&(controller.getLife() - event.getAmount()) < 1
|
||||||
&& event.getPlayerId().equals(controller.getId())
|
&& event.getPlayerId().equals(controller.getId())
|
||||||
) {
|
) {
|
||||||
return true;
|
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 false;
|
return false;
|
||||||
|
@ -110,10 +106,17 @@ class AliFromCairoReplacementEffect extends ReplacementEffectImpl {
|
||||||
@Override
|
@Override
|
||||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
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) {
|
if (controller != null) {
|
||||||
event.setAmount(controller.getLife() - 1);
|
controller.setLife(1, game);
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue