* Some minor adjustements/changes.

This commit is contained in:
LevelX2 2015-05-12 23:00:34 +02:00
parent 28d46e2a95
commit ed501cad21
15 changed files with 44 additions and 16 deletions

View file

@ -1132,6 +1132,8 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
public static void main(final String args[]) {
// Workaround for #451
System.setProperty("java.util.Arrays.useLegacyMergeSort", "true");
logger.info("Starting MAGE client version " + version);
logger.info("Logging level: " + logger.getEffectiveLevel());
startTime = System.currentTimeMillis();
Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {

View file

@ -23,8 +23,8 @@ public class CombatManager {
private static CombatManager combatManager;
private Map<UUID, Integer> combatAttackers = new HashMap<UUID, Integer>();
private Map<UUID, Integer> combatBlockers = new HashMap<UUID, Integer>();
private final Map<UUID, Integer> combatAttackers = new HashMap<>();
private final Map<UUID, Integer> combatBlockers = new HashMap<>();
private int globalBlockersCount; // we need global counter as there are several combat groups
public static CombatManager getInstance() {

View file

@ -192,7 +192,10 @@ public class GuiDisplayUtil {
buffer.append("pt;margin:0px 1px 0px 1px'>");
buffer.append("<table cellspacing=0 cellpadding=0 border=0 width='100%'>");
buffer.append("<tr><td valign='top'><b>");
buffer.append(card.getDisplayName()).append(" [").append(card.getId().toString().substring(0,3)).append("]");
buffer.append(card.getDisplayName());
if (card.isGameObject()) {
buffer.append(" [").append(card.getId().toString().substring(0,3)).append("]");
}
buffer.append("</b></td><td align='right' valign='top' style='width:");
buffer.append(symbolCount * 11 + 1);
buffer.append("px'>");

View file

@ -39,7 +39,7 @@ public class MageVersionException extends MageException {
private final MageVersion serverVersion;
public MageVersionException(MageVersion clientVersion, MageVersion serverVersion) {
super("Wrong client version " + clientVersion + ", expecting version " + serverVersion + ". \r\n\r\nPlease download needed version from http://XMage.info");
super("Wrong client version " + clientVersion + ", expecting version " + serverVersion + ". \r\n\r\nPlease download needed version from http://XMage.info or http://www.slightlymagic.net/forum/viewforum.php?f=70");
this.serverVersion = serverVersion;
}

View file

@ -115,6 +115,7 @@ public class CardView extends SimpleCardView {
protected boolean isChoosable;
protected boolean selected;
protected boolean canAttack;
protected boolean gameObject;
public CardView(Card card) {
this(card, null, null, false);
@ -141,6 +142,8 @@ public class CardView extends SimpleCardView {
super(card.getId(), card.getExpansionSetCode(), card.getCardNumber(), card.getUsesVariousArt(), card.getTokenSetCode());
// no information available for face down cards as long it's not a controlled face down morph card
// TODO: Better handle this in Framework (but currently I'm not sure how to do it there) LevelX2
this.gameObject = game != null;
if (game != null && card.isFaceDown(game)) {
this.fillEmpty(card, controlled);
if (card instanceof Spell) {
@ -733,4 +736,8 @@ public class CardView extends SimpleCardView {
public void setCanAttack(boolean canAttack) {
this.canAttack = canAttack;
}
public boolean isGameObject() {
return gameObject;
}
}

View file

@ -64,6 +64,12 @@ public class CardsView extends LinkedHashMap<UUID, CardView> {
}
}
public CardsView(Game game, Collection<? extends Card> cards) {
for (Card card: cards) {
this.put(card.getId(), new CardView(card, game, null, false));
}
}
public CardsView ( Collection<? extends Ability> abilities, Game game ) {
for ( Ability ability : abilities ) {
MageObject sourceObject = null;

View file

@ -367,6 +367,14 @@ public class ComputerPlayer extends PlayerImpl implements Player {
if (!target.isRequired(sourceId, game)) {
return false;
}
if (target.canTarget(opponentId, null, game)) {
target.add(opponentId, game);
return true;
}
if (target.canTarget(playerId, null, game)) {
target.add(playerId, game);
return true;
}
throw new IllegalStateException("TargetPermanentOrPlayer wasn't handled. class:" + target.getClass().toString());
}
if (target instanceof TargetCardInGraveyard) {

View file

@ -735,7 +735,7 @@ public class GameController implements GameCallback {
@Override
public void execute(UUID playerId) {
if (cards != null) {
getGameSession(playerId).target(question, new CardsView(cards.getCards(game)), targets, required, options);
getGameSession(playerId).target(question, new CardsView(game, cards.getCards(game)), targets, required, options);
} else if (perms != null) {
CardsView permsView = new CardsView();
for (Permanent perm: perms) {

View file

@ -213,7 +213,7 @@ public class GameSessionPlayer extends GameSessionWatcher {
public GameView getGameView() {
Player player = game.getPlayer(playerId);
GameView gameView = new GameView(game.getState(), game, playerId, null);
gameView.setHand(new CardsView(player.getHand().getCards(game)));
gameView.setHand(new CardsView(game, player.getHand().getCards(game)));
if (gameView.getPriorityPlayerName().equals(player.getName())) {
gameView.setCanPlayInHand(player.getPlayableInHand(game));
}

View file

@ -38,7 +38,7 @@ public class Guile extends mage.sets.lorwyn.Guile {
public Guile(UUID ownerId) {
super(ownerId);
this.cardNumber = 14;
this.expansionSetCode = "DD3";
this.expansionSetCode = "DD3D";
}
public Guile(final Guile card) {

View file

@ -38,7 +38,7 @@ public class SoulbrightFlamekin extends mage.sets.lorwyn.SoulbrightFlamekin {
public SoulbrightFlamekin(UUID ownerId) {
super(ownerId);
this.cardNumber = 37;
this.expansionSetCode = "DD3";
this.expansionSetCode = "DD3D";
}
public SoulbrightFlamekin(final SoulbrightFlamekin card) {

View file

@ -30,8 +30,6 @@ package mage.sets.iceage;
import java.util.UUID;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.PutCardIntoGraveFromAnywhereAllTriggeredAbility;
import mage.abilities.common.PutIntoGraveFromBattlefieldAllTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ContinuousEffectImpl;
@ -71,10 +69,14 @@ public class EnduringRenewal extends CardImpl {
// Play with your hand revealed.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new PlayWithHandRevealedEffect()));
// If you would draw a card, reveal the top card of your library instead. If it's a creature card, put it into your graveyard. Otherwise, draw a card.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new EnduringRenewalReplacementEffect()));
// Whenever a creature is put into your graveyard from the battlefield, return it to your hand.
this.addAbility(new PutIntoGraveFromBattlefieldAllTriggeredAbility(new ReturnFromGraveyardToHandTargetEffect(), false, filter, true, true));
Effect effect = new ReturnFromGraveyardToHandTargetEffect();
effect.setText("return it to your hand");
this.addAbility(new PutIntoGraveFromBattlefieldAllTriggeredAbility(effect, false, filter, true, true));
}
public EnduringRenewal(final EnduringRenewal card) {

View file

@ -58,9 +58,9 @@ public enum CardRepository {
private static final String JDBC_URL = "jdbc:h2:file:./db/cards.h2;AUTO_SERVER=TRUE";
private static final String VERSION_ENTITY_NAME = "card";
// raise this if db structure was changed
private static final long CARD_DB_VERSION = 37;
private static final long CARD_DB_VERSION = 38;
// raise this if new cards were added to the server
private static final long CARD_CONTENT_VERSION = 14;
private static final long CARD_CONTENT_VERSION = 15;
private final Random random = new Random();
private Dao<CardInfo, Object> cardDao;

View file

@ -26,8 +26,8 @@ public enum ExpansionRepository {
private static final String JDBC_URL = "jdbc:h2:file:./db/cards.h2;AUTO_SERVER=TRUE";
private static final String VERSION_ENTITY_NAME = "expansion";
private static final long EXPANSION_DB_VERSION = 3;
private static final long EXPANSION_CONTENT_VERSION = 5;
private static final long EXPANSION_DB_VERSION = 4;
private static final long EXPANSION_CONTENT_VERSION = 6;
private Dao<ExpansionInfo, Object> expansionDao;

View file

@ -239,7 +239,7 @@ public class Turn implements Serializable {
game.fireEvent(new GameEvent(GameEvent.EventType.PHASE_CHANGED, activePlayerId, extraPhaseTurnMod.getId(), activePlayerId));
Player activePlayer = game.getPlayer(activePlayerId);
if (activePlayer != null && !game.isSimulation()) {
game.informPlayers(new StringBuilder(activePlayer.getName()).append(" starts an additional ").append(phase.getType().toString()).append(" phase").toString());
game.informPlayers(activePlayer.getLogName() + " starts an additional " + phase.getType().toString() + " phase");
}
phase.play(game, activePlayerId);