mirror of
https://github.com/correl/mage.git
synced 2024-11-25 03:00:11 +00:00
replaced enum comparison from equals to ==
This commit is contained in:
parent
1c4bf298eb
commit
ac8962cb29
31 changed files with 264 additions and 318 deletions
|
@ -44,6 +44,7 @@ import java.util.concurrent.TimeUnit;
|
|||
import javax.swing.*;
|
||||
import javax.swing.Timer;
|
||||
import javax.swing.filechooser.FileFilter;
|
||||
|
||||
import mage.cards.Card;
|
||||
import mage.cards.Sets;
|
||||
import mage.cards.decks.Deck;
|
||||
|
@ -73,7 +74,6 @@ import mage.view.SimpleCardView;
|
|||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class DeckEditorPanel extends javax.swing.JPanel {
|
||||
|
@ -288,7 +288,7 @@ public class DeckEditorPanel extends javax.swing.JPanel {
|
|||
this.deckArea.clearDeckEventListeners();
|
||||
this.deckArea.addDeckEventListener(
|
||||
(Listener<Event>) event -> {
|
||||
if (mode.equals(DeckEditorMode.FREE_BUILDING)) {
|
||||
if (mode == DeckEditorMode.FREE_BUILDING){
|
||||
switch (event.getEventName()) {
|
||||
case "double-click": {
|
||||
SimpleCardView cardView = (SimpleCardView) event.getSource();
|
||||
|
@ -376,7 +376,7 @@ public class DeckEditorPanel extends javax.swing.JPanel {
|
|||
this.deckArea.clearSideboardEventListeners();
|
||||
this.deckArea.addSideboardEventListener(
|
||||
(Listener<Event>) event -> {
|
||||
if (mode.equals(DeckEditorMode.FREE_BUILDING)) {
|
||||
if (mode == DeckEditorMode.FREE_BUILDING) {
|
||||
// normal edit mode
|
||||
switch (event.getEventName()) {
|
||||
case "double-click":
|
||||
|
|
|
@ -72,7 +72,7 @@ public class AddLandDialog extends MageDialog {
|
|||
public void showDialog(Deck deck, DeckEditorMode mode) {
|
||||
this.deck = deck;
|
||||
SortedSet<String> landSetNames = new TreeSet<>();
|
||||
if (!mode.equals(DeckEditorMode.FREE_BUILDING)) {
|
||||
if (mode!=DeckEditorMode.FREE_BUILDING) {
|
||||
// decide from which sets basic lands are taken from
|
||||
for (String setCode : deck.getExpansionSetCodes()) {
|
||||
ExpansionInfo expansionInfo = ExpansionRepository.instance.getSetByCode(setCode);
|
||||
|
|
|
@ -22,6 +22,7 @@ import javax.swing.JPopupMenu;
|
|||
import javax.swing.Popup;
|
||||
import javax.swing.PopupFactory;
|
||||
import javax.swing.SwingUtilities;
|
||||
|
||||
import mage.cards.MageCard;
|
||||
import mage.cards.action.ActionCallback;
|
||||
import mage.cards.action.TransferData;
|
||||
|
@ -78,6 +79,7 @@ public class MageActionCallback implements ActionCallback {
|
|||
|
||||
CLOSED, NORMAL, ROTATED
|
||||
}
|
||||
|
||||
private Date enlargeredViewOpened;
|
||||
private volatile EnlargedWindowState enlargedWindowState = EnlargedWindowState.CLOSED;
|
||||
//private volatile boolean enlargedImageWindowOpen = false;
|
||||
|
@ -156,7 +158,7 @@ public class MageActionCallback implements ActionCallback {
|
|||
|| !tooltipCard.equals(data.card)
|
||||
|| SessionHandler.getSession() == null
|
||||
|| !popupTextWindowOpen
|
||||
|| !enlargedWindowState.equals(EnlargedWindowState.CLOSED)) {
|
||||
|| enlargedWindowState != EnlargedWindowState.CLOSED) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -177,7 +179,7 @@ public class MageActionCallback implements ActionCallback {
|
|||
final Component c = MageFrame.getUI().getComponent(MageComponents.DESKTOP_PANE);
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
if (!popupTextWindowOpen
|
||||
|| !enlargedWindowState.equals(EnlargedWindowState.CLOSED)) {
|
||||
|| enlargedWindowState != EnlargedWindowState.CLOSED) {
|
||||
return;
|
||||
}
|
||||
if (data.locationOnScreen == null) {
|
||||
|
@ -402,7 +404,7 @@ public class MageActionCallback implements ActionCallback {
|
|||
} else {
|
||||
popupTextWindowOpen = true;
|
||||
}
|
||||
if (!enlargedWindowState.equals(EnlargedWindowState.CLOSED)) {
|
||||
if (enlargedWindowState != EnlargedWindowState.CLOSED) {
|
||||
cancelTimeout();
|
||||
displayEnlargedCard(mageCard.getOriginal(), transferData);
|
||||
}
|
||||
|
@ -417,7 +419,6 @@ public class MageActionCallback implements ActionCallback {
|
|||
|
||||
/**
|
||||
* Hides the text popup window
|
||||
*
|
||||
*/
|
||||
public void hideTooltipPopup() {
|
||||
this.tooltipCard = null;
|
||||
|
@ -461,13 +462,13 @@ public class MageActionCallback implements ActionCallback {
|
|||
@Override
|
||||
public void mouseWheelMoved(MouseWheelEvent e, TransferData transferData) {
|
||||
int notches = e.getWheelRotation();
|
||||
if (!enlargedWindowState.equals(EnlargedWindowState.CLOSED)) {
|
||||
if (enlargedWindowState != EnlargedWindowState.CLOSED) {
|
||||
// same move direction will be ignored, opposite direction closes the enlarged window
|
||||
if (new Date().getTime() - enlargeredViewOpened.getTime() > 1000) {
|
||||
// if the opening is back more than 1 seconds close anyway
|
||||
hideEnlargedCard();
|
||||
handleOverNewView(transferData);
|
||||
} else if (enlargeMode.equals(EnlargeMode.NORMAL)) {
|
||||
} else if (enlargeMode == EnlargeMode.NORMAL) {
|
||||
if (notches > 0) {
|
||||
hideEnlargedCard();
|
||||
handleOverNewView(transferData);
|
||||
|
@ -494,7 +495,7 @@ public class MageActionCallback implements ActionCallback {
|
|||
* card) or the opposite side of a transformable card will be shown
|
||||
*/
|
||||
public void enlargeCard(EnlargeMode showAlternative) {
|
||||
if (enlargedWindowState.equals(EnlargedWindowState.CLOSED)) {
|
||||
if (enlargedWindowState == EnlargedWindowState.CLOSED) {
|
||||
this.enlargeMode = showAlternative;
|
||||
CardView cardView = null;
|
||||
if (popupData != null) {
|
||||
|
@ -515,7 +516,7 @@ public class MageActionCallback implements ActionCallback {
|
|||
}
|
||||
|
||||
public void hideEnlargedCard() {
|
||||
if (!enlargedWindowState.equals(EnlargedWindowState.CLOSED)) {
|
||||
if (enlargedWindowState != EnlargedWindowState.CLOSED) {
|
||||
enlargedWindowState = EnlargedWindowState.CLOSED;
|
||||
try {
|
||||
Component cardPreviewContainer = MageFrame.getUI().getComponent(MageComponents.CARD_PREVIEW_CONTAINER);
|
||||
|
@ -535,21 +536,21 @@ public class MageActionCallback implements ActionCallback {
|
|||
return;
|
||||
}
|
||||
try {
|
||||
if (enlargedWindowState.equals(EnlargedWindowState.CLOSED)) {
|
||||
if (enlargedWindowState == EnlargedWindowState.CLOSED) {
|
||||
return;
|
||||
}
|
||||
|
||||
MageComponents mageComponentCardPreviewContainer;
|
||||
MageComponents mageComponentCardPreviewPane;
|
||||
if (cardView.isToRotate()) {
|
||||
if (enlargedWindowState.equals(EnlargedWindowState.NORMAL)) {
|
||||
if (enlargedWindowState == EnlargedWindowState.NORMAL) {
|
||||
hideEnlargedCard();
|
||||
enlargedWindowState = EnlargedWindowState.ROTATED;
|
||||
}
|
||||
mageComponentCardPreviewContainer = MageComponents.CARD_PREVIEW_CONTAINER_ROTATED;
|
||||
mageComponentCardPreviewPane = MageComponents.CARD_PREVIEW_PANE_ROTATED;
|
||||
} else {
|
||||
if (enlargedWindowState.equals(EnlargedWindowState.ROTATED)) {
|
||||
if (enlargedWindowState == EnlargedWindowState.ROTATED) {
|
||||
hideEnlargedCard();
|
||||
enlargedWindowState = EnlargedWindowState.NORMAL;
|
||||
}
|
||||
|
@ -608,7 +609,7 @@ public class MageActionCallback implements ActionCallback {
|
|||
// XXX: scaled to fit width
|
||||
bigCard.setCard(mageCard.getOriginal().getId(), enlargeMode, image, mageCard.getOriginal().getRules(), mageCard.getOriginal().isToRotate());
|
||||
// if it's an ability, show only the ability text as overlay
|
||||
if (mageCard.getOriginal().isAbility() && enlargeMode.equals(EnlargeMode.NORMAL)) {
|
||||
if (mageCard.getOriginal().isAbility() && enlargeMode == EnlargeMode.NORMAL) {
|
||||
bigCard.showTextComponent();
|
||||
} else {
|
||||
bigCard.hideTextComponent();
|
||||
|
|
|
@ -244,7 +244,7 @@ public class CardView extends SimpleCardView {
|
|||
Zone cardZone = game.getState().getZone(card.getId());
|
||||
if (card.isFaceDown(game)) {
|
||||
showFaceUp = false;
|
||||
if (!Zone.BATTLEFIELD.equals(cardZone)) {
|
||||
if (Zone.BATTLEFIELD!=cardZone) {
|
||||
if (showFaceDownCard) {
|
||||
showFaceUp = true;
|
||||
}
|
||||
|
@ -458,7 +458,7 @@ public class CardView extends SimpleCardView {
|
|||
this.rarity = Rarity.NA;
|
||||
this.rules = new ArrayList<>();
|
||||
this.rules.add(stackAbility.getRule());
|
||||
if (stackAbility.getZone().equals(Zone.COMMAND)) {
|
||||
if (stackAbility.getZone()==Zone.COMMAND) {
|
||||
this.expansionSetCode = stackAbility.getExpansionSetCode();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -82,11 +82,11 @@ public class ChatMessage implements Serializable {
|
|||
}
|
||||
|
||||
public boolean isUserMessage() {
|
||||
return color != null && (color.equals(MessageColor.BLUE) || color.equals(MessageColor.YELLOW));
|
||||
return color != null && (color==MessageColor.BLUE || color==MessageColor.YELLOW);
|
||||
}
|
||||
|
||||
public boolean isStatusMessage() {
|
||||
return color != null && color.equals(MessageColor.ORANGE);
|
||||
return color != null && color== MessageColor.ORANGE;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
|
|
|
@ -33,6 +33,7 @@ import java.util.ArrayList;
|
|||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.constants.SkillLevel;
|
||||
import mage.constants.TableState;
|
||||
import mage.game.Game;
|
||||
|
@ -43,7 +44,6 @@ import mage.game.match.MatchPlayer;
|
|||
import mage.game.tournament.TournamentPlayer;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class TableView implements Serializable {
|
||||
|
@ -77,9 +77,9 @@ public class TableView implements Serializable {
|
|||
}
|
||||
this.controllerName = table.getControllerName();
|
||||
this.tableState = table.getState();
|
||||
if (table.getState().equals(TableState.WAITING) ||
|
||||
table.getState().equals(TableState.READY_TO_START) ||
|
||||
table.getState().equals(TableState.STARTING) ) {
|
||||
if (table.getState() == TableState.WAITING ||
|
||||
table.getState() == TableState.READY_TO_START ||
|
||||
table.getState() == TableState.STARTING) {
|
||||
this.createTime = table.getCreateTime();
|
||||
} else {
|
||||
if (table.isTournament()) {
|
||||
|
@ -94,7 +94,7 @@ public class TableView implements Serializable {
|
|||
}
|
||||
if (!table.isTournament()) {
|
||||
// MATCH
|
||||
if (table.getState().equals(TableState.WAITING) || table.getState().equals(TableState.READY_TO_START)) {
|
||||
if (table.getState()==TableState.WAITING || table.getState()==TableState.READY_TO_START) {
|
||||
tableStateText = table.getState().toString() + " (" + table.getMatch().getPlayers().size() + "/" + table.getSeats().length + ")";
|
||||
} else {
|
||||
tableStateText = table.getState().toString();
|
||||
|
@ -226,6 +226,7 @@ public class TableView implements Serializable {
|
|||
public boolean isTournament() {
|
||||
return this.isTournament;
|
||||
}
|
||||
|
||||
public String getAdditionalInfo() {
|
||||
return this.additionalInfo;
|
||||
}
|
||||
|
|
|
@ -35,6 +35,7 @@ import java.util.UUID;
|
|||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import mage.cards.repository.CardInfo;
|
||||
import mage.cards.repository.CardRepository;
|
||||
import mage.server.util.SystemUtil;
|
||||
|
@ -44,7 +45,6 @@ import mage.view.ChatMessage.SoundToPlay;
|
|||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class ChatManager {
|
||||
|
@ -132,7 +132,7 @@ public class ChatManager {
|
|||
}
|
||||
}
|
||||
|
||||
if (!messageType.equals(MessageType.GAME)) {
|
||||
if (messageType != MessageType.GAME) {
|
||||
User user = UserManager.getInstance().getUserByName(userName);
|
||||
if (message != null && userName != null && !userName.equals("")) {
|
||||
|
||||
|
@ -177,7 +177,7 @@ public class ChatManager {
|
|||
}
|
||||
}
|
||||
|
||||
if (messageType.equals(MessageType.TALK)) {
|
||||
if (messageType == MessageType.TALK) {
|
||||
if (user != null) {
|
||||
if (user.getChatLockedUntil() != null) {
|
||||
if (user.getChatLockedUntil().compareTo(Calendar.getInstance().getTime()) > 0) {
|
||||
|
@ -249,7 +249,6 @@ public class ChatManager {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* use mainly for announcing that a user connection was lost or that a user
|
||||
* has reconnected
|
||||
*
|
||||
|
|
|
@ -27,12 +27,6 @@
|
|||
*/
|
||||
package mage.server;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import mage.interfaces.callback.ClientCallback;
|
||||
import mage.view.ChatMessage;
|
||||
import mage.view.ChatMessage.MessageColor;
|
||||
|
@ -40,8 +34,14 @@ import mage.view.ChatMessage.MessageType;
|
|||
import mage.view.ChatMessage.SoundToPlay;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class ChatSession {
|
||||
|
@ -79,7 +79,7 @@ public class ChatSession {
|
|||
}
|
||||
if (userId != null && clients.containsKey(userId)) {
|
||||
String userName = clients.get(userId);
|
||||
if (!reason.equals(DisconnectReason.LostConnection)) { // for lost connection the user will be reconnected or session expire so no remove of chat yet
|
||||
if (reason != DisconnectReason.LostConnection) { // for lost connection the user will be reconnected or session expire so no remove of chat yet
|
||||
clients.remove(userId);
|
||||
logger.debug(userName + "(" + reason.toString() + ")" + " removed from chatId " + chatId);
|
||||
}
|
||||
|
|
|
@ -580,7 +580,7 @@ public class MageServerImpl implements MageServer {
|
|||
@Override
|
||||
public boolean leaveTable(final String sessionId, final UUID roomId, final UUID tableId) throws MageException {
|
||||
TableState tableState = TableManager.getInstance().getController(tableId).getTableState();
|
||||
if (!tableState.equals(TableState.WAITING) && !tableState.equals(TableState.READY_TO_START)) {
|
||||
if (tableState!=TableState.WAITING && tableState!=TableState.READY_TO_START) {
|
||||
// table was already started, so player can't leave anymore now
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -30,13 +30,13 @@ package mage.server;
|
|||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import mage.MageException;
|
||||
import mage.players.net.UserData;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.jboss.remoting.callback.InvokerCallbackHandler;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class SessionManager {
|
||||
|
@ -47,6 +47,7 @@ public class SessionManager {
|
|||
public static SessionManager getInstance() {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
private final ConcurrentHashMap<String, Session> sessions = new ConcurrentHashMap<>();
|
||||
|
||||
public Session getSession(String sessionId) {
|
||||
|
@ -127,7 +128,7 @@ public class SessionManager {
|
|||
public void disconnect(String sessionId, DisconnectReason reason) {
|
||||
Session session = sessions.get(sessionId);
|
||||
if (session != null) {
|
||||
if (!reason.equals(DisconnectReason.AdminDisconnect)) {
|
||||
if (reason != DisconnectReason.AdminDisconnect) {
|
||||
if (!sessions.containsKey(sessionId)) {
|
||||
// session was removed meanwhile by another thread so we can return
|
||||
return;
|
||||
|
|
|
@ -34,6 +34,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import mage.MageException;
|
||||
import mage.cards.decks.Deck;
|
||||
import mage.cards.decks.DeckCardLists;
|
||||
|
@ -72,7 +73,6 @@ import mage.view.ChatMessage;
|
|||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class TableController {
|
||||
|
@ -412,7 +412,7 @@ public class TableController {
|
|||
} else {
|
||||
logger.fatal("Tournament == null table: " + table.getId() + " userId: " + userId);
|
||||
}
|
||||
} else if (TableState.SIDEBOARDING.equals(table.getState())) {
|
||||
} else if (TableState.SIDEBOARDING == table.getState()) {
|
||||
match.updateDeck(playerId, deck);
|
||||
} else {
|
||||
// deck was meanwhile submitted so the autoupdate can be ignored
|
||||
|
@ -476,8 +476,8 @@ public class TableController {
|
|||
}
|
||||
if (table != null
|
||||
&& this.userId != null && this.userId.equals(userId) // tourn. sub tables have no creator user
|
||||
&& (table.getState().equals(TableState.WAITING)
|
||||
|| table.getState().equals(TableState.READY_TO_START))) {
|
||||
&& (table.getState() == TableState.WAITING
|
||||
|| table.getState() == TableState.READY_TO_START)) {
|
||||
// table not started yet and user is the owner, remove the table
|
||||
TableManager.getInstance().removeTable(table.getId());
|
||||
} else {
|
||||
|
@ -500,7 +500,7 @@ public class TableController {
|
|||
logger.debug("User not found - userId: " + userId + " tableId:" + table.getId());
|
||||
}
|
||||
userPlayerMap.remove(userId);
|
||||
} else if (!table.getState().equals(TableState.FINISHED)) {
|
||||
} else if (table.getState() != TableState.FINISHED) {
|
||||
if (table.isTournament()) {
|
||||
logger.debug("Quit tournament sub tables for userId: " + userId);
|
||||
TableManager.getInstance().userQuitTournamentSubTables(tournament.getId(), userId);
|
||||
|
@ -517,7 +517,7 @@ public class TableController {
|
|||
}
|
||||
match.quitMatch(playerId);
|
||||
} else {
|
||||
if (table.getState().equals(TableState.SIDEBOARDING)) {
|
||||
if (table.getState() == TableState.SIDEBOARDING) {
|
||||
if (!matchPlayer.isDoneSideboarding()) {
|
||||
// submit deck to finish sideboarding and trigger match start / end
|
||||
matchPlayer.submitDeck(matchPlayer.getDeck());
|
||||
|
@ -546,7 +546,7 @@ public class TableController {
|
|||
}
|
||||
|
||||
public synchronized void startMatch() {
|
||||
if (table.getState().equals(TableState.STARTING)) {
|
||||
if (table.getState() == TableState.STARTING) {
|
||||
try {
|
||||
if (table.isTournamentSubTable()) {
|
||||
logger.info("Tourn. match started id:" + match.getId() + " tournId: " + table.getTournament().getId());
|
||||
|
@ -630,7 +630,7 @@ public class TableController {
|
|||
|
||||
public synchronized void startTournament(UUID userId) {
|
||||
try {
|
||||
if (userId.equals(this.userId) && table.getState().equals(TableState.STARTING)) {
|
||||
if (userId.equals(this.userId) && table.getState() == TableState.STARTING) {
|
||||
tournament.setStartTime();
|
||||
TournamentManager.getInstance().createTournamentSession(tournament, userPlayerMap, table.getId());
|
||||
for (Entry<UUID, UUID> entry : userPlayerMap.entrySet()) {
|
||||
|
@ -762,7 +762,6 @@ public class TableController {
|
|||
/**
|
||||
* Tables of normal matches or tournament sub tables are no longer needed,
|
||||
* if the match ends.
|
||||
*
|
||||
*/
|
||||
private void closeTable() {
|
||||
this.matchEnd();
|
||||
|
@ -778,7 +777,7 @@ public class TableController {
|
|||
if (!matchPlayer.hasQuit()) {
|
||||
User user = UserManager.getInstance().getUser(entry.getKey());
|
||||
if (user != null) {
|
||||
if (table.getState().equals(TableState.SIDEBOARDING)) {
|
||||
if (table.getState()==TableState.SIDEBOARDING) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (table.isTournamentSubTable()) {
|
||||
sb.append("Your tournament match of round ");
|
||||
|
@ -843,7 +842,7 @@ public class TableController {
|
|||
}
|
||||
|
||||
public void swapSeats(int seatNum1, int seatNum2) {
|
||||
if (table.getState().equals(TableState.READY_TO_START)) {
|
||||
if (table.getState()==TableState.READY_TO_START) {
|
||||
if (seatNum1 >= 0 && seatNum2 >= 0 && seatNum1 < table.getSeats().length && seatNum2 < table.getSeats().length) {
|
||||
Player swapPlayer = table.getSeats()[seatNum1].getPlayer();
|
||||
String swapType = table.getSeats()[seatNum1].getPlayerType();
|
||||
|
@ -876,7 +875,7 @@ public class TableController {
|
|||
|
||||
public boolean isTournamentStillValid() {
|
||||
if (table.getTournament() != null) {
|
||||
if (!table.getState().equals(TableState.WAITING) && !table.getState().equals(TableState.READY_TO_START) && !table.getState().equals(TableState.STARTING)) {
|
||||
if (table.getState() != TableState.WAITING && table.getState() != TableState.READY_TO_START && table.getState() != TableState.STARTING) {
|
||||
TournamentController tournamentController = TournamentManager.getInstance().getTournamentController(table.getTournament().getId());
|
||||
if (tournamentController != null) {
|
||||
return tournamentController.isTournamentStillValid(table.getState());
|
||||
|
@ -923,7 +922,7 @@ public class TableController {
|
|||
int humanPlayers = 0;
|
||||
int aiPlayers = 0;
|
||||
int validHumanPlayers = 0;
|
||||
if (!(table.getState().equals(TableState.WAITING) || table.getState().equals(TableState.STARTING) || table.getState().equals(TableState.READY_TO_START))) {
|
||||
if (!(table.getState() == TableState.WAITING || table.getState() == TableState.STARTING || table.getState() == TableState.READY_TO_START)) {
|
||||
if (match == null) {
|
||||
logger.debug("- Match table with no match:");
|
||||
logger.debug("-- matchId:" + match.getId() + " [" + match.getName() + "]");
|
||||
|
@ -947,9 +946,9 @@ public class TableController {
|
|||
}
|
||||
if (matchPlayer.getPlayer().isHuman()) {
|
||||
humanPlayers++;
|
||||
if ((table.getState().equals(TableState.WAITING)
|
||||
|| table.getState().equals(TableState.STARTING)
|
||||
|| table.getState().equals(TableState.READY_TO_START))
|
||||
if ((table.getState() == TableState.WAITING
|
||||
|| table.getState() == TableState.STARTING
|
||||
|| table.getState() == TableState.READY_TO_START)
|
||||
|| !match.isDoneSideboarding()
|
||||
|| (!matchPlayer.hasQuit() && match.getGame() != null && matchPlayer.getPlayer().isInGame())) {
|
||||
User user = UserManager.getInstance().getUser(userPlayerEntry.getKey());
|
||||
|
@ -990,7 +989,7 @@ public class TableController {
|
|||
}
|
||||
|
||||
public synchronized boolean changeTableStateToStarting() {
|
||||
if (!getTable().getState().equals(TableState.READY_TO_START)) {
|
||||
if (getTable().getState() != TableState.READY_TO_START) {
|
||||
// tournament is not ready, can't start
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -344,7 +344,7 @@ public class TableManager {
|
|||
}
|
||||
|
||||
// If table is not finished, the table has to be removed completly because it's not a normal state (if finished it will be removed in GamesRoomImpl.Update())
|
||||
if (!table.getState().equals(TableState.FINISHED)) {
|
||||
if (table.getState()!=TableState.FINISHED) {
|
||||
if (game != null) {
|
||||
GameManager.getInstance().removeGame(game.getId());
|
||||
}
|
||||
|
@ -395,7 +395,7 @@ public class TableManager {
|
|||
tableCopy.addAll(tables.values());
|
||||
for (Table table : tableCopy) {
|
||||
try {
|
||||
if (!table.getState().equals(TableState.FINISHED)) {
|
||||
if (table.getState()!=TableState.FINISHED) {
|
||||
// remove tables and games not valid anymore
|
||||
logger.debug(table.getId() + " [" + table.getName()+ "] " + formatter.format(table.getStartTime() == null ? table.getCreateTime() : table.getCreateTime()) +" (" + table.getState().toString() + ") " + (table.isTournament() ? "- Tournament":""));
|
||||
TableController tableController = getController(table.getId());
|
||||
|
|
|
@ -37,6 +37,7 @@ import java.util.Map.Entry;
|
|||
import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import mage.cards.decks.Deck;
|
||||
import mage.constants.ManaType;
|
||||
import mage.constants.TableState;
|
||||
|
@ -61,7 +62,6 @@ import mage.view.TableClientMessage;
|
|||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class User {
|
||||
|
@ -208,7 +208,7 @@ public class User {
|
|||
}
|
||||
|
||||
public boolean isConnected() {
|
||||
return userState.equals(UserState.Connected) || userState.equals(UserState.Reconnected);
|
||||
return userState == UserState.Connected || userState == UserState.Reconnected;
|
||||
}
|
||||
|
||||
public String getDisconnectDuration() {
|
||||
|
@ -762,7 +762,7 @@ public class User {
|
|||
public int getNumberOfNotStartedTables() {
|
||||
int number = 0;
|
||||
for (Table table : tables.values()) {
|
||||
if (table.getState().equals(TableState.WAITING) || table.getState().equals(TableState.STARTING)) {
|
||||
if (table.getState() == TableState.WAITING || table.getState() == TableState.STARTING) {
|
||||
number++;
|
||||
}
|
||||
}
|
||||
|
@ -772,7 +772,7 @@ public class User {
|
|||
public int getNumberOfNotFinishedTables() {
|
||||
int number = 0;
|
||||
for (Table table : tables.values()) {
|
||||
if (table.getState().equals(TableState.FINISHED)) {
|
||||
if (table.getState() == TableState.FINISHED) {
|
||||
number++;
|
||||
} else {
|
||||
TableController tableController = TableManager.getInstance().getController(table.getId());
|
||||
|
|
|
@ -37,6 +37,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import mage.MageException;
|
||||
import mage.cards.decks.DeckCardLists;
|
||||
import mage.constants.TableState;
|
||||
|
@ -58,7 +59,6 @@ import mage.view.UsersView;
|
|||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class GamesRoomImpl extends RoomImpl implements GamesRoom, Serializable {
|
||||
|
@ -232,11 +232,11 @@ class TableListSorter implements Comparator<Table> {
|
|||
@Override
|
||||
public int compare(Table one, Table two) {
|
||||
if (one.getState() != null && two.getState() != null) {
|
||||
if (!TableState.SIDEBOARDING.equals(one.getState()) && !TableState.DUELING.equals(one.getState())) {
|
||||
if (TableState.SIDEBOARDING != one.getState() && TableState.DUELING != one.getState()) {
|
||||
if (one.getState().compareTo(two.getState()) != 0) {
|
||||
return one.getState().compareTo(two.getState());
|
||||
}
|
||||
} else if (!TableState.SIDEBOARDING.equals(two.getState()) && !TableState.DUELING.equals(two.getState())) {
|
||||
} else if (TableState.SIDEBOARDING != two.getState() && TableState.DUELING != two.getState()) {
|
||||
if (one.getState().compareTo(two.getState()) != 0) {
|
||||
return one.getState().compareTo(two.getState());
|
||||
}
|
||||
|
|
|
@ -302,7 +302,7 @@ public class TournamentController {
|
|||
}
|
||||
|
||||
private void initTournament() {
|
||||
if (!TableManager.getInstance().getTable(tableId).getState().equals(TableState.DUELING)) {
|
||||
if (TableManager.getInstance().getTable(tableId).getState()!=TableState.DUELING) {
|
||||
TableManager.getInstance().initTournament(tableId);
|
||||
}
|
||||
}
|
||||
|
@ -385,7 +385,7 @@ public class TournamentController {
|
|||
// quit active matches of that tournament
|
||||
TableManager.getInstance().userQuitTournamentSubTables(tournament.getId(), userId);
|
||||
status = TourneyQuitStatus.DURING_ROUND;
|
||||
} else if (tournamentPlayer.getState().equals(TournamentPlayerState.DRAFTING)) {
|
||||
} else if (tournamentPlayer.getState()==TournamentPlayerState.DRAFTING) {
|
||||
info = "during Draft phase";
|
||||
if (!checkToReplaceDraftPlayerByAi(userId, tournamentPlayer)) {
|
||||
this.abortDraftTournament();
|
||||
|
@ -399,7 +399,7 @@ public class TournamentController {
|
|||
}
|
||||
}
|
||||
status = TourneyQuitStatus.DURING_DRAFTING;
|
||||
} else if (tournamentPlayer.getState().equals(TournamentPlayerState.CONSTRUCTING)) {
|
||||
} else if (tournamentPlayer.getState()==TournamentPlayerState.CONSTRUCTING) {
|
||||
info = "during Construction phase";
|
||||
status = TourneyQuitStatus.DURING_CONSTRUCTION;
|
||||
} else {
|
||||
|
@ -523,7 +523,7 @@ public class TournamentController {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (activePlayers < 2 && !tableState.equals(TableState.WAITING)) {
|
||||
if (activePlayers < 2 && tableState!=TableState.WAITING) {
|
||||
logger.debug("Tournament has less than 2 active players - tournamentId: " + tournament.getId() + " state: " + tableState.toString());
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -1,16 +1,5 @@
|
|||
package mage.server.util;
|
||||
|
||||
import java.io.File;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Scanner;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.repository.CardInfo;
|
||||
import mage.cards.repository.CardRepository;
|
||||
|
@ -19,6 +8,14 @@ import mage.game.Game;
|
|||
import mage.players.Player;
|
||||
import mage.util.RandomUtil;
|
||||
|
||||
import java.io.File;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* @author nantuko
|
||||
*/
|
||||
|
@ -129,13 +126,16 @@ public class SystemUtil {
|
|||
// Put the card in Exile to start. Otherwise the game doesn't know where to remove the card from.
|
||||
game.getExile().getPermanentExile().add(card);
|
||||
game.setZone(card.getId(), Zone.EXILED);
|
||||
if (zone.equals(Zone.BATTLEFIELD)) {
|
||||
switch (zone) {
|
||||
case BATTLEFIELD:
|
||||
card.putOntoBattlefield(game, Zone.EXILED, null, player.getId());
|
||||
} else if (zone.equals(Zone.LIBRARY)) {
|
||||
break;
|
||||
case LIBRARY:
|
||||
card.setZone(Zone.LIBRARY, game);
|
||||
game.getExile().getPermanentExile().remove(card);
|
||||
player.getLibrary().putOnTop(card, game);
|
||||
} else {
|
||||
break;
|
||||
default:
|
||||
card.moveToZone(zone, null, game, false);
|
||||
}
|
||||
logger.info("Added card to player's " + zone.toString() + ": " + card.getName() + ", player = " + player.getName());
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
package mage.cards.e;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.PutCardIntoGraveFromAnywhereAllTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
|
@ -43,7 +44,6 @@ import mage.game.Game;
|
|||
import mage.game.events.GameEvent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Plopman
|
||||
*/
|
||||
public class EnergyField extends CardImpl {
|
||||
|
@ -100,7 +100,7 @@ class EnergyFieldEffect extends PreventionEffectImpl {
|
|||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (event.getType().equals(GameEvent.EventType.DAMAGE_PLAYER)) {
|
||||
if (event.getType() == GameEvent.EventType.DAMAGE_PLAYER) {
|
||||
if (event.getTargetId().equals(source.getControllerId()) && game.getControllerId(event.getSourceId()) != source.getControllerId()) {
|
||||
return super.applies(event, source, game);
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
package mage.cards.f;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Zone;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
|
@ -39,7 +40,6 @@ import mage.game.events.GameEvent;
|
|||
import mage.game.permanent.Permanent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author North
|
||||
*/
|
||||
public class FarsightMask extends CardImpl {
|
||||
|
@ -78,7 +78,7 @@ class FarsightMaskTriggeredAbility extends TriggeredAbilityImpl {
|
|||
|
||||
@Override
|
||||
public boolean checkEventType(GameEvent event, Game game) {
|
||||
return event.getType().equals(GameEvent.EventType.DAMAGED_PLAYER);
|
||||
return event.getType() == GameEvent.EventType.DAMAGED_PLAYER;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
package mage.cards.f;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.effects.Effect;
|
||||
|
@ -51,7 +52,6 @@ import mage.target.TargetPermanent;
|
|||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class FrenziedFugue extends CardImpl {
|
||||
|
@ -98,13 +98,13 @@ class FrenziedFugueTriggeredAbility extends TriggeredAbilityImpl {
|
|||
|
||||
@Override
|
||||
public boolean checkEventType(GameEvent event, Game game) {
|
||||
return event.getType().equals(EventType.ENTERS_THE_BATTLEFIELD) || event.getType().equals(EventType.UPKEEP_STEP_PRE);
|
||||
return event.getType() == EventType.ENTERS_THE_BATTLEFIELD || event.getType() == EventType.UPKEEP_STEP_PRE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
boolean result;
|
||||
if (event.getType().equals(EventType.ENTERS_THE_BATTLEFIELD)) {
|
||||
if (event.getType()==EventType.ENTERS_THE_BATTLEFIELD) {
|
||||
result = event.getTargetId().equals(this.getSourceId());
|
||||
} else {
|
||||
result = event.getPlayerId().equals(this.getControllerId());
|
||||
|
|
|
@ -135,7 +135,7 @@ class MetallicMimicReplacementEffect extends ReplacementEffectImpl {
|
|||
return enteringCreature != null && sourcePermanent != null
|
||||
&& enteringCreature.getControllerId().equals(source.getControllerId())
|
||||
&& enteringCreature.getCardType().contains(CardType.CREATURE)
|
||||
&& enteringCreature.getSubtype(game).contains((String) game.getState().getValue(sourcePermanent.getId() + "_type"))
|
||||
&& enteringCreature.getSubtype(game).contains(game.getState().getValue(sourcePermanent.getId() + "_type"))
|
||||
&& !event.getTargetId().equals(source.getSourceId());
|
||||
}
|
||||
|
||||
|
|
|
@ -174,8 +174,8 @@ public class CascadeTest extends CardTestPlayerBase {
|
|||
// Choose one - You draw five cards and you lose 5 life;
|
||||
// or put an X/X black Demon creature token with flying onto the battlefield, where X is the number of cards in your hand as the token enters the battlefield.
|
||||
// Entwine {4} (Choose both if you pay the entwine cost.)
|
||||
//addCard(Zone.LIBRARY, playerA, "Promise of Power", 10);
|
||||
addCard(Zone.LIBRARY, playerA, "Silvercoat Lion", 2);
|
||||
addCard(Zone.LIBRARY, playerA, "Promise of Power", 1);
|
||||
// addCard(Zone.LIBRARY, playerA, "Silvercoat Lion", 2);
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Plains", 3);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Forest", 3);
|
||||
|
|
|
@ -30,6 +30,7 @@ package mage.abilities;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.MageObject;
|
||||
import mage.MageObjectReference;
|
||||
import mage.Mana;
|
||||
|
@ -76,7 +77,6 @@ import mage.watchers.Watcher;
|
|||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public abstract class AbilityImpl implements Ability {
|
||||
|
@ -197,7 +197,7 @@ public abstract class AbilityImpl implements Ability {
|
|||
boolean effectResult = effect.apply(game, this);
|
||||
result &= effectResult;
|
||||
if (logger.isDebugEnabled()) {
|
||||
if (!this.getAbilityType().equals(AbilityType.MANA)) {
|
||||
if (this.getAbilityType() != AbilityType.MANA) {
|
||||
if (!effectResult) {
|
||||
if (this.getSourceId() != null) {
|
||||
MageObject mageObject = game.getObject(this.getSourceId());
|
||||
|
@ -267,7 +267,7 @@ public abstract class AbilityImpl implements Ability {
|
|||
* If the player wishes to splice any cards onto the spell (see rule 702.45), he
|
||||
* or she reveals those cards in his or her hand.
|
||||
*/
|
||||
if (this.abilityType.equals(AbilityType.SPELL)) {
|
||||
if (this.abilityType == AbilityType.SPELL) {
|
||||
game.getContinuousEffects().applySpliceEffects(this, game);
|
||||
}
|
||||
|
||||
|
@ -290,8 +290,8 @@ public abstract class AbilityImpl implements Ability {
|
|||
// or her intentions to pay any or all of those costs (see rule 601.2e).
|
||||
// A player can't apply two alternative methods of casting or two alternative costs to a single spell.
|
||||
if (!activateAlternateOrAdditionalCosts(sourceObject, noMana, controller, game)) {
|
||||
if (getAbilityType().equals(AbilityType.SPELL)
|
||||
&& ((SpellAbility) this).getSpellAbilityType().equals(SpellAbilityType.FACE_DOWN_CREATURE)) {
|
||||
if (getAbilityType() == AbilityType.SPELL
|
||||
&& ((SpellAbility) this).getSpellAbilityType() == SpellAbilityType.FACE_DOWN_CREATURE) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -302,7 +302,7 @@ public abstract class AbilityImpl implements Ability {
|
|||
VariableManaCost variableManaCost = handleManaXCosts(game, noMana, controller);
|
||||
String announceString = handleOtherXCosts(game, controller);
|
||||
// For effects from cards like Void Winnower x costs have to be set
|
||||
if (this.getAbilityType().equals(AbilityType.SPELL)
|
||||
if (this.getAbilityType() == AbilityType.SPELL
|
||||
&& game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.CAST_SPELL_LATE, getId(), getSourceId(), getControllerId()), this)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -325,7 +325,7 @@ public abstract class AbilityImpl implements Ability {
|
|||
// and/or zones become the target of a spell trigger at this point; they'll wait to be put on
|
||||
// the stack until the spell has finished being cast.)
|
||||
|
||||
if (sourceObject != null && !this.getAbilityType().equals(AbilityType.TRIGGERED)) { // triggered abilities check this already in playerImpl.triggerAbility
|
||||
if (sourceObject != null && this.getAbilityType() != AbilityType.TRIGGERED) { // triggered abilities check this already in playerImpl.triggerAbility
|
||||
sourceObject.adjustTargets(this, game);
|
||||
}
|
||||
// Flashback abilities haven't made the choices the underlying spell might need for targeting.
|
||||
|
@ -408,7 +408,7 @@ public abstract class AbilityImpl implements Ability {
|
|||
}
|
||||
activated = true;
|
||||
// fire if tapped for mana (may only fire now because else costs of ability itself can be payed with mana of abilities that trigger for that event
|
||||
if (this.getAbilityType().equals(AbilityType.MANA)) {
|
||||
if (this.getAbilityType() == AbilityType.MANA) {
|
||||
for (Cost cost : costs) {
|
||||
if (cost instanceof TapSourceCost) {
|
||||
Mana mana = null;
|
||||
|
@ -466,10 +466,10 @@ public abstract class AbilityImpl implements Ability {
|
|||
}
|
||||
// controller specific alternate spell costs
|
||||
if (!noMana && !alternativeCostisUsed) {
|
||||
if (this.getAbilityType().equals(AbilityType.SPELL)
|
||||
if (this.getAbilityType() == AbilityType.SPELL
|
||||
// 117.9a Only one alternative cost can be applied to any one spell as it’s being cast.
|
||||
// So an alternate spell ability can't be paid with Omniscience
|
||||
&& !((SpellAbility) this).getSpellAbilityType().equals(SpellAbilityType.BASE_ALTERNATE)) {
|
||||
&& ((SpellAbility) this).getSpellAbilityType() != SpellAbilityType.BASE_ALTERNATE) {
|
||||
for (AlternativeSourceCosts alternativeSourceCosts : controller.getAlternativeSourceCosts()) {
|
||||
if (alternativeSourceCosts.isAvailable(this, game)) {
|
||||
if (alternativeSourceCosts.askToActivateAlternativeCosts(this, game)) {
|
||||
|
@ -489,10 +489,8 @@ public abstract class AbilityImpl implements Ability {
|
|||
* Handles the setting of non mana X costs
|
||||
*
|
||||
* @param controller
|
||||
*
|
||||
* @param game
|
||||
* @return announce message
|
||||
*
|
||||
*/
|
||||
protected String handleOtherXCosts(Game game, Player controller) {
|
||||
String announceString = null;
|
||||
|
@ -873,7 +871,6 @@ public abstract class AbilityImpl implements Ability {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param game
|
||||
* @param source
|
||||
* @return
|
||||
|
@ -883,7 +880,7 @@ public abstract class AbilityImpl implements Ability {
|
|||
if (!this.hasSourceObjectAbility(game, source, event)) {
|
||||
return false;
|
||||
}
|
||||
if (zone.equals(Zone.COMMAND)) {
|
||||
if (zone == Zone.COMMAND) {
|
||||
if (this.getSourceId() == null) { // commander effects
|
||||
return true;
|
||||
}
|
||||
|
@ -1027,7 +1024,7 @@ public abstract class AbilityImpl implements Ability {
|
|||
sb.append("unknown");
|
||||
}
|
||||
if (object instanceof Spell && ((Spell) object).getSpellAbilities().size() > 1) {
|
||||
if (((Spell) object).getSpellAbility().getSpellAbilityType().equals(SpellAbilityType.SPLIT_FUSED)) {
|
||||
if (((Spell) object).getSpellAbility().getSpellAbilityType() == SpellAbilityType.SPLIT_FUSED) {
|
||||
Spell spell = (Spell) object;
|
||||
int i = 0;
|
||||
for (SpellAbility spellAbility : spell.getSpellAbilities()) {
|
||||
|
|
|
@ -37,7 +37,6 @@ import mage.game.permanent.Permanent;
|
|||
import mage.game.permanent.PermanentToken;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class DiesTriggeredAbility extends ZoneChangeTriggeredAbility {
|
||||
|
@ -69,7 +68,7 @@ public class DiesTriggeredAbility extends ZoneChangeTriggeredAbility {
|
|||
@Override
|
||||
public boolean checkEventType(GameEvent event, Game game) {
|
||||
if (super.checkEventType(event, game)) {
|
||||
return ((ZoneChangeEvent) event).getFromZone().equals(Zone.BATTLEFIELD) && ((ZoneChangeEvent) event).getToZone().equals(Zone.GRAVEYARD);
|
||||
return ((ZoneChangeEvent) event).getFromZone() == Zone.BATTLEFIELD && ((ZoneChangeEvent) event).getToZone() == Zone.GRAVEYARD;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -36,7 +36,6 @@ import mage.game.events.GameEvent.EventType;
|
|||
import mage.game.events.ZoneChangeEvent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class EntersBattlefieldOrLeavesSourceTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
@ -68,7 +67,7 @@ public class EntersBattlefieldOrLeavesSourceTriggeredAbility extends TriggeredAb
|
|||
}
|
||||
if (event.getType() == EventType.ZONE_CHANGE && event.getTargetId().equals(this.getSourceId())) {
|
||||
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
|
||||
if (zEvent.getFromZone().equals(Zone.BATTLEFIELD)) {
|
||||
if (zEvent.getFromZone() == Zone.BATTLEFIELD) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ public abstract class ManaEffect extends OneShotEffect {
|
|||
* @param source
|
||||
*/
|
||||
public void checkToFirePossibleEvents(Mana mana, Game game, Ability source) {
|
||||
if (source.getAbilityType().equals(AbilityType.MANA)) {
|
||||
if (source.getAbilityType()==AbilityType.MANA) {
|
||||
for (Cost cost: source.getCosts()) {
|
||||
if (cost instanceof TapSourceCost) {
|
||||
ManaEvent event = new ManaEvent(GameEvent.EventType.TAPPED_FOR_MANA, source.getSourceId(), source.getSourceId(), source.getControllerId(), mana);
|
||||
|
|
|
@ -88,7 +88,7 @@ public class PreventDamageToControllerEffect extends PreventionEffectImpl {
|
|||
sb.append("combat ");
|
||||
}
|
||||
sb.append("damage that would be dealt to you");
|
||||
if (duration.equals(Duration.EndOfTurn)) {
|
||||
if (duration == Duration.EndOfTurn) {
|
||||
sb.append(" this turn");
|
||||
}
|
||||
return sb.toString();
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
package mage.abilities.keyword;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.Mana;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.SpecialAction;
|
||||
|
@ -30,7 +31,6 @@ import mage.target.Target;
|
|||
import mage.target.common.TargetControlledPermanent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class ImproviseAbility extends SimpleStaticAbility implements AlternateManaPaymentAbility {
|
||||
|
@ -59,7 +59,7 @@ public class ImproviseAbility extends SimpleStaticAbility implements AlternateMa
|
|||
public void addSpecialAction(Ability source, Game game, ManaCost unpaid) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null && game.getBattlefield().contains(filterUntapped, controller.getId(), 1, game)) {
|
||||
if (source.getAbilityType().equals(AbilityType.SPELL) && unpaid.getMana().getGeneric() > 0) {
|
||||
if (source.getAbilityType() == AbilityType.SPELL && unpaid.getMana().getGeneric() > 0) {
|
||||
SpecialAction specialAction = new ImproviseSpecialAction(unpaid);
|
||||
specialAction.setControllerId(source.getControllerId());
|
||||
specialAction.setSourceId(source.getSourceId());
|
||||
|
|
|
@ -107,7 +107,7 @@ public abstract class Phase implements Serializable {
|
|||
if (game.isPaused() || game.gameOver(null)) {
|
||||
return false;
|
||||
}
|
||||
if (game.getTurn().isEndTurnRequested() && !step.getType().equals(PhaseStep.CLEANUP)) {
|
||||
if (game.getTurn().isEndTurnRequested() && step.getType()!=PhaseStep.CLEANUP) {
|
||||
continue;
|
||||
}
|
||||
currentStep = step;
|
||||
|
|
|
@ -27,55 +27,20 @@
|
|||
*/
|
||||
package mage.players;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import mage.ConditionalMana;
|
||||
import mage.MageObject;
|
||||
import mage.Mana;
|
||||
import mage.abilities.Abilities;
|
||||
import mage.abilities.AbilitiesImpl;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.ActivatedAbility;
|
||||
import mage.abilities.DelayedTriggeredAbility;
|
||||
import mage.abilities.Mode;
|
||||
import mage.abilities.PlayLandAbility;
|
||||
import mage.abilities.SpecialAction;
|
||||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.TriggeredAbility;
|
||||
import mage.abilities.*;
|
||||
import mage.abilities.common.PassAbility;
|
||||
import mage.abilities.common.delayed.AtTheEndOfTurnStepPostDelayedTriggeredAbility;
|
||||
import mage.abilities.costs.AdjustingSourceCosts;
|
||||
import mage.abilities.costs.AlternativeCostSourceAbility;
|
||||
import mage.abilities.costs.AlternativeSourceCosts;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.Costs;
|
||||
import mage.abilities.costs.OptionalAdditionalSourceCosts;
|
||||
import mage.abilities.costs.*;
|
||||
import mage.abilities.costs.mana.ManaCost;
|
||||
import mage.abilities.costs.mana.ManaCosts;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.effects.RestrictionEffect;
|
||||
import mage.abilities.effects.RestrictionUntapNotMoreThanEffect;
|
||||
import mage.abilities.effects.common.LoseControlOnOtherPlayersControllerEffect;
|
||||
import mage.abilities.keyword.ConvokeAbility;
|
||||
import mage.abilities.keyword.FlashbackAbility;
|
||||
import mage.abilities.keyword.HexproofAbility;
|
||||
import mage.abilities.keyword.InfectAbility;
|
||||
import mage.abilities.keyword.LifelinkAbility;
|
||||
import mage.abilities.keyword.ProtectionAbility;
|
||||
import mage.abilities.keyword.ShroudAbility;
|
||||
import mage.abilities.keyword.*;
|
||||
import mage.abilities.mana.ActivatedManaAbilityImpl;
|
||||
import mage.abilities.mana.ManaOptions;
|
||||
import mage.actions.MageDrawAction;
|
||||
|
@ -84,17 +49,7 @@ import mage.cards.Cards;
|
|||
import mage.cards.CardsImpl;
|
||||
import mage.cards.SplitCard;
|
||||
import mage.cards.decks.Deck;
|
||||
import mage.constants.AbilityType;
|
||||
import mage.constants.AsThoughEffectType;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.ManaType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.PlayerAction;
|
||||
import mage.constants.RangeOfInfluence;
|
||||
import mage.constants.SpellAbilityType;
|
||||
import mage.constants.TimingRule;
|
||||
import mage.constants.Zone;
|
||||
import mage.constants.*;
|
||||
import mage.counters.Counter;
|
||||
import mage.counters.CounterType;
|
||||
import mage.counters.Counters;
|
||||
|
@ -105,12 +60,7 @@ import mage.filter.common.FilterCreatureForCombat;
|
|||
import mage.filter.common.FilterCreatureForCombatBlock;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.filter.predicate.permanent.PermanentIdPredicate;
|
||||
import mage.game.ExileZone;
|
||||
import mage.game.Game;
|
||||
import mage.game.Graveyard;
|
||||
import mage.game.Table;
|
||||
import mage.game.ZoneChangeInfo;
|
||||
import mage.game.ZonesHandler;
|
||||
import mage.game.*;
|
||||
import mage.game.combat.CombatGroup;
|
||||
import mage.game.command.CommandObject;
|
||||
import mage.game.events.DamagePlayerEvent;
|
||||
|
@ -137,6 +87,11 @@ import mage.util.GameLog;
|
|||
import mage.util.RandomUtil;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
public abstract class PlayerImpl implements Player, Serializable {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(PlayerImpl.class);
|
||||
|
@ -472,7 +427,6 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
|
||||
/**
|
||||
* called before apply effects
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public void reset() {
|
||||
|
@ -701,7 +655,6 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param amount
|
||||
* @param source
|
||||
* @param game
|
||||
|
@ -998,7 +951,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
if (game == null || ability == null) {
|
||||
return false;
|
||||
}
|
||||
if (!ability.getSpellAbilityType().equals(SpellAbilityType.BASE)) {
|
||||
if (ability.getSpellAbilityType() != SpellAbilityType.BASE) {
|
||||
ability = chooseSpellAbilityForCast(ability, game, noMana);
|
||||
}
|
||||
//20091005 - 601.2a
|
||||
|
@ -1221,7 +1174,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
//if player has taken an action then reset all player passed flags
|
||||
justActivatedType = null;
|
||||
if (result) {
|
||||
if (isHuman() && (ability.getAbilityType().equals(AbilityType.SPELL) || ability.getAbilityType().equals(AbilityType.ACTIVATED))) {
|
||||
if (isHuman() && (ability.getAbilityType() == AbilityType.SPELL || ability.getAbilityType() == AbilityType.ACTIVATED)) {
|
||||
if (ability.isUsesStack()) { // if the ability does not use the stack (e.g. Suspend) auto pass would go to next phase unintended
|
||||
setJustActivatedType(ability.getAbilityType());
|
||||
}
|
||||
|
@ -1269,8 +1222,8 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
LinkedHashMap<UUID, ActivatedAbility> useable = new LinkedHashMap<>();
|
||||
for (Ability ability : object.getAbilities()) {
|
||||
if (ability instanceof SpellAbility) {
|
||||
if (((SpellAbility) ability).getSpellAbilityType().equals(SpellAbilityType.SPLIT_FUSED)) {
|
||||
if (zone.equals(Zone.HAND)) {
|
||||
if (((SpellAbility) ability).getSpellAbilityType() == SpellAbilityType.SPLIT_FUSED) {
|
||||
if (zone == Zone.HAND) {
|
||||
// Fix so you don't need to choose Fuse twice
|
||||
useable.clear();
|
||||
useable.put(ability.getId(), (SpellAbility) ability);
|
||||
|
@ -1280,7 +1233,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
continue;
|
||||
}
|
||||
}
|
||||
if (((SpellAbility) ability).getSpellAbilityType().equals(SpellAbilityType.SPLIT)) {
|
||||
if (((SpellAbility) ability).getSpellAbilityType() == SpellAbilityType.SPLIT) {
|
||||
continue;
|
||||
}
|
||||
useable.put(ability.getId(), (SpellAbility) ability);
|
||||
|
@ -1297,7 +1250,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
// ManaOptions availableMana = getManaAvailable(game); // can only be activated if mana calculation works flawless otherwise player can't play spells they could play if calculation would work correctly
|
||||
// availableMana.addMana(manaPool.getMana());
|
||||
for (Ability ability : object.getAbilities()) {
|
||||
if (canUse || ability.getAbilityType().equals(AbilityType.SPECIAL_ACTION)) {
|
||||
if (canUse || ability.getAbilityType() == AbilityType.SPECIAL_ACTION) {
|
||||
if (ability.getZone().match(zone)) {
|
||||
if (ability instanceof ActivatedAbility) {
|
||||
if (ability instanceof ActivatedManaAbilityImpl) {
|
||||
|
@ -1320,9 +1273,9 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
}
|
||||
}
|
||||
if (zone != Zone.HAND) {
|
||||
if (Zone.GRAVEYARD.equals(zone) && canPlayCardsFromGraveyard()) {
|
||||
if (Zone.GRAVEYARD == zone && canPlayCardsFromGraveyard()) {
|
||||
for (ActivatedAbility ability : object.getAbilities().getPlayableAbilities(Zone.HAND)) {
|
||||
if (canUse || ability.getAbilityType().equals(AbilityType.SPECIAL_ACTION)) {
|
||||
if (canUse || ability.getAbilityType() == AbilityType.SPECIAL_ACTION) {
|
||||
if (ability.getManaCosts().isEmpty() && ability.getCosts().isEmpty() && ability instanceof SpellAbility) {
|
||||
continue; // You can't play spells from graveyard that have no costs
|
||||
}
|
||||
|
@ -1334,7 +1287,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
}
|
||||
if (zone != Zone.BATTLEFIELD && game.getContinuousEffects().asThough(object.getId(), AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, this.getId(), game)) {
|
||||
for (Ability ability : object.getAbilities()) {
|
||||
if (canUse || ability.getAbilityType().equals(AbilityType.SPECIAL_ACTION)) {
|
||||
if (canUse || ability.getAbilityType() == AbilityType.SPECIAL_ACTION) {
|
||||
if (ability.getManaCosts().isEmpty() && ability.getCosts().isEmpty() && ability instanceof SpellAbility && !(ability.getSourceId() == getCastSourceIdWithAlternateMana())) {
|
||||
continue; // You can't play spells that have no costs, unless you can play them without paying their mana costs
|
||||
}
|
||||
|
@ -1358,7 +1311,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
if (otherAbilities != null) {
|
||||
boolean canUse = !(object instanceof Permanent) || ((Permanent) object).canUseActivatedAbilities(game);
|
||||
for (ActivatedAbility ability : otherAbilities) {
|
||||
if (canUse || ability.getAbilityType().equals(AbilityType.SPECIAL_ACTION)) {
|
||||
if (canUse || ability.getAbilityType() == AbilityType.SPECIAL_ACTION) {
|
||||
Card card = game.getCard(ability.getSourceId());
|
||||
if (card.isSplitCard() && ability instanceof FlashbackAbility) {
|
||||
FlashbackAbility flashbackAbility;
|
||||
|
@ -1401,7 +1354,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
LinkedHashMap<UUID, ActivatedManaAbilityImpl> useable = new LinkedHashMap<>();
|
||||
boolean canUse = !(object instanceof Permanent) || ((Permanent) object).canUseActivatedAbilities(game);
|
||||
for (ActivatedManaAbilityImpl ability : object.getAbilities().getActivatedManaAbilities(zone)) {
|
||||
if (canUse || ability.getAbilityType().equals(AbilityType.SPECIAL_ACTION)) {
|
||||
if (canUse || ability.getAbilityType() == AbilityType.SPECIAL_ACTION) {
|
||||
if (ability.canActivate(playerId, game)) {
|
||||
useable.put(ability.getId(), ability);
|
||||
}
|
||||
|
@ -2057,7 +2010,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
passedUntilEndOfTurn = true;
|
||||
passedUntilStackResolved = false;
|
||||
passedUntilEndStepBeforeMyTurn = false;
|
||||
skippedAtLeastOnce = !PhaseStep.END_TURN.equals(game.getTurn().getStepType());
|
||||
skippedAtLeastOnce = PhaseStep.END_TURN != game.getTurn().getStepType();
|
||||
this.skip();
|
||||
break;
|
||||
case PASS_PRIORITY_UNTIL_NEXT_TURN: // F4
|
||||
|
@ -2088,7 +2041,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
passedUntilNextMain = true;
|
||||
passedUntilStackResolved = false;
|
||||
passedUntilEndStepBeforeMyTurn = false;
|
||||
skippedAtLeastOnce = !(game.getTurn().getStepType().equals(PhaseStep.POSTCOMBAT_MAIN) || game.getTurn().getStepType().equals(PhaseStep.PRECOMBAT_MAIN));
|
||||
skippedAtLeastOnce = !(game.getTurn().getStepType() == PhaseStep.POSTCOMBAT_MAIN || game.getTurn().getStepType() == PhaseStep.PRECOMBAT_MAIN);
|
||||
this.skip();
|
||||
break;
|
||||
case PASS_PRIORITY_UNTIL_STACK_RESOLVED: //F8
|
||||
|
@ -2333,7 +2286,6 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
/**
|
||||
* @param game
|
||||
* @param appliedEffects
|
||||
*
|
||||
* @return true if player won the toss
|
||||
*/
|
||||
@Override
|
||||
|
@ -2470,7 +2422,6 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param ability
|
||||
* @param available if null, it won't be checked if enough mana is available
|
||||
* @param sourceObject
|
||||
|
@ -2608,7 +2559,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
if (!(sourceObject instanceof Permanent)) {
|
||||
Ability sourceAbility = null;
|
||||
for (Ability landAbility : sourceObject.getAbilities()) {
|
||||
if (landAbility.getAbilityType().equals(AbilityType.PLAY_LAND)) {
|
||||
if (landAbility.getAbilityType() == AbilityType.PLAY_LAND) {
|
||||
sourceAbility = landAbility;
|
||||
break;
|
||||
}
|
||||
|
@ -2779,10 +2730,8 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
* Creates a list of card ids that are currently playable.<br>
|
||||
* Used to mark the playable cards in GameView
|
||||
*
|
||||
* @return A Set of cardIds that are playable
|
||||
*
|
||||
* @param game
|
||||
*
|
||||
* @return A Set of cardIds that are playable
|
||||
*/
|
||||
@Override
|
||||
public Set<UUID> getPlayableInHand(Game game
|
||||
|
@ -3189,8 +3138,8 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
case HAND:
|
||||
for (Card card : cards) {
|
||||
fromZone = game.getState().getZone(card.getId());
|
||||
boolean hideCard = fromZone.equals(Zone.LIBRARY)
|
||||
|| (card.isFaceDown(game) && !fromZone.equals(Zone.STACK) && !fromZone.equals(Zone.BATTLEFIELD));
|
||||
boolean hideCard = fromZone == Zone.LIBRARY
|
||||
|| (card.isFaceDown(game) && fromZone != Zone.STACK && fromZone != Zone.BATTLEFIELD);
|
||||
if (moveCardToHandWithInfo(card, source == null ? null : source.getSourceId(), game, !hideCard)) {
|
||||
successfulMovedCards.add(card);
|
||||
}
|
||||
|
@ -3199,7 +3148,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
case EXILED:
|
||||
for (Card card : cards) {
|
||||
fromZone = game.getState().getZone(card.getId());
|
||||
boolean withName = (fromZone.equals(Zone.BATTLEFIELD) || fromZone.equals(Zone.STACK)) || !card.isFaceDown(game);
|
||||
boolean withName = (fromZone == Zone.BATTLEFIELD || fromZone == Zone.STACK) || !card.isFaceDown(game);
|
||||
if (moveCardToExileWithInfo(card, null, "", source == null ? null : source.getSourceId(), game, fromZone, withName)) {
|
||||
successfulMovedCards.add(card);
|
||||
}
|
||||
|
@ -3212,7 +3161,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
} else {
|
||||
fromZone = game.getState().getZone(card.getId());
|
||||
}
|
||||
boolean hideCard = fromZone.equals(Zone.HAND) || fromZone.equals(Zone.LIBRARY);
|
||||
boolean hideCard = fromZone == Zone.HAND || fromZone == Zone.LIBRARY;
|
||||
if (moveCardToLibraryWithInfo(card, source == null ? null : source.getSourceId(), game, fromZone, true, !hideCard)) {
|
||||
successfulMovedCards.add(card);
|
||||
}
|
||||
|
@ -3253,7 +3202,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
public boolean moveCardToHandWithInfo(Card card, UUID sourceId, Game game, boolean withName) {
|
||||
boolean result = false;
|
||||
Zone fromZone = game.getState().getZone(card.getId());
|
||||
if (fromZone.equals(Zone.BATTLEFIELD) && !(card instanceof Permanent)) {
|
||||
if (fromZone == Zone.BATTLEFIELD && !(card instanceof Permanent)) {
|
||||
card = game.getPermanent(card.getId());
|
||||
}
|
||||
if (card.moveToZone(Zone.HAND, sourceId, game, false)) {
|
||||
|
@ -3343,7 +3292,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
public boolean moveCardToGraveyardWithInfo(Card card, UUID sourceId, Game game, Zone fromZone) {
|
||||
boolean result = false;
|
||||
// Zone fromZone = game.getState().getZone(card.getId());
|
||||
if (card.moveToZone(Zone.GRAVEYARD, sourceId, game, fromZone != null ? fromZone.equals(Zone.BATTLEFIELD) : false)) {
|
||||
if (card.moveToZone(Zone.GRAVEYARD, sourceId, game, fromZone != null ? fromZone == Zone.BATTLEFIELD : false)) {
|
||||
if (!game.isSimulation()) {
|
||||
if (card instanceof PermanentCard && game.getCard(card.getId()) != null) {
|
||||
card = game.getCard(card.getId());
|
||||
|
|
|
@ -36,6 +36,7 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.cards.Card;
|
||||
|
@ -49,7 +50,6 @@ import mage.players.Player;
|
|||
import mage.util.RandomUtil;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public abstract class TargetImpl implements Target {
|
||||
|
@ -184,7 +184,7 @@ public abstract class TargetImpl implements Target {
|
|||
|
||||
@Override
|
||||
public boolean isRequired(Ability ability) {
|
||||
return ability == null || ability.isActivated() || !(ability.getAbilityType().equals(AbilityType.SPELL) || ability.getAbilityType().equals(AbilityType.ACTIVATED));
|
||||
return ability == null || ability.isActivated() || !(ability.getAbilityType() == AbilityType.SPELL || ability.getAbilityType() == AbilityType.ACTIVATED);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -33,6 +33,7 @@ import java.util.Map;
|
|||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.MageObjectReference;
|
||||
import mage.constants.WatcherScope;
|
||||
import mage.constants.Zone;
|
||||
|
@ -80,7 +81,7 @@ public class CardsPutIntoGraveyardWatcher extends Watcher {
|
|||
++amount;
|
||||
}
|
||||
amountOfCardsThisTurn.put(playerId, amount);
|
||||
if (((ZoneChangeEvent) event).getFromZone().equals(Zone.BATTLEFIELD)) {
|
||||
if (((ZoneChangeEvent) event).getFromZone() == Zone.BATTLEFIELD) {
|
||||
cardsPutToGraveyardFromBattlefield.add(new MageObjectReference(event.getTargetId(), game));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue