mirror of
https://github.com/correl/mage.git
synced 2024-12-25 11:11:16 +00:00
better use of the CardsImpl constructor
This commit is contained in:
parent
dc112215d4
commit
2cd9e25229
89 changed files with 248 additions and 402 deletions
|
@ -260,13 +260,10 @@ public class MageServerImpl implements MageServer {
|
|||
@Override
|
||||
public void removeTable(final String sessionId, final UUID roomId, final UUID tableId) throws MageException {
|
||||
execute("removeTable", sessionId, () -> {
|
||||
Optional<Session> session = SessionManager.instance.getSession(sessionId);
|
||||
if (!session.isPresent()) {
|
||||
logger.error("Session not found : " + sessionId);
|
||||
} else {
|
||||
UUID userId = session.get().getUserId();
|
||||
SessionManager.instance.getSession(sessionId).ifPresent(session -> {
|
||||
UUID userId = session.getUserId();
|
||||
TableManager.instance.removeTable(userId, tableId);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -277,7 +274,6 @@ public class MageServerImpl implements MageServer {
|
|||
public Boolean execute() throws MageException {
|
||||
Optional<Session> session = SessionManager.instance.getSession(sessionId);
|
||||
if (!session.isPresent()) {
|
||||
logger.error("Session not found : " + sessionId);
|
||||
return false;
|
||||
}
|
||||
UUID userId = session.get().getUserId();
|
||||
|
@ -288,7 +284,6 @@ public class MageServerImpl implements MageServer {
|
|||
}
|
||||
Optional<GamesRoom> room = GamesRoomManager.instance.getRoom(roomId);
|
||||
if (!room.isPresent()) {
|
||||
logger.error("room not found : " + roomId);
|
||||
return false;
|
||||
}
|
||||
return room.get().joinTable(userId, tableId, name, playerType, skill, deckList, password);
|
||||
|
@ -304,7 +299,6 @@ public class MageServerImpl implements MageServer {
|
|||
public Boolean execute() throws MageException {
|
||||
Optional<Session> session = SessionManager.instance.getSession(sessionId);
|
||||
if (!session.isPresent()) {
|
||||
logger.error("Session not found : " + sessionId);
|
||||
return false;
|
||||
}
|
||||
UUID userId = session.get().getUserId();
|
||||
|
@ -333,7 +327,6 @@ public class MageServerImpl implements MageServer {
|
|||
public Boolean execute() throws MageException {
|
||||
Optional<Session> session = SessionManager.instance.getSession(sessionId);
|
||||
if (!session.isPresent()) {
|
||||
logger.error("Session not found : " + sessionId);
|
||||
return false;
|
||||
} else {
|
||||
UUID userId = session.get().getUserId();
|
||||
|
@ -380,12 +373,7 @@ public class MageServerImpl implements MageServer {
|
|||
//FIXME: why no sessionId here???
|
||||
public List<MatchView> getFinishedMatches(UUID roomId) throws MageException {
|
||||
try {
|
||||
Optional<GamesRoom> room = GamesRoomManager.instance.getRoom(roomId);
|
||||
if (room.isPresent()) {
|
||||
return room.get().getFinished();
|
||||
} else {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return GamesRoomManager.instance.getRoom(roomId).map(GamesRoom::getFinished).orElse(new ArrayList<>());
|
||||
} catch (Exception ex) {
|
||||
handleException(ex);
|
||||
}
|
||||
|
@ -515,13 +503,11 @@ public class MageServerImpl implements MageServer {
|
|||
@Override
|
||||
public void joinChat(final UUID chatId, final String sessionId, final String userName) throws MageException {
|
||||
execute("joinChat", sessionId, () -> {
|
||||
Optional<Session> session = SessionManager.instance.getSession(sessionId);
|
||||
if (!session.isPresent()) {
|
||||
logger.error("Session not found : " + sessionId);
|
||||
} else {
|
||||
UUID userId = session.get().getUserId();
|
||||
SessionManager.instance.getSession(sessionId).ifPresent(session -> {
|
||||
|
||||
UUID userId = session.getUserId();
|
||||
ChatManager.instance.joinChat(chatId, userId);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -529,13 +515,10 @@ public class MageServerImpl implements MageServer {
|
|||
public void leaveChat(final UUID chatId, final String sessionId) throws MageException {
|
||||
execute("leaveChat", sessionId, () -> {
|
||||
if (chatId != null) {
|
||||
Optional<Session> session = SessionManager.instance.getSession(sessionId);
|
||||
if (!session.isPresent()) {
|
||||
logger.error("Session not found : " + sessionId);
|
||||
} else {
|
||||
UUID userId = session.get().getUserId();
|
||||
SessionManager.instance.getSession(sessionId).ifPresent(session -> {
|
||||
UUID userId = session.getUserId();
|
||||
ChatManager.instance.leaveChat(chatId, userId);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -574,7 +557,6 @@ public class MageServerImpl implements MageServer {
|
|||
public Boolean execute() {
|
||||
Optional<Session> session = SessionManager.instance.getSession(sessionId);
|
||||
if (!session.isPresent()) {
|
||||
logger.error("Session not found : " + sessionId);
|
||||
return false;
|
||||
} else {
|
||||
UUID userId = session.get().getUserId();
|
||||
|
@ -587,13 +569,10 @@ public class MageServerImpl implements MageServer {
|
|||
@Override
|
||||
public void swapSeats(final String sessionId, final UUID roomId, final UUID tableId, final int seatNum1, final int seatNum2) throws MageException {
|
||||
execute("swapSeats", sessionId, () -> {
|
||||
Optional<Session> session = SessionManager.instance.getSession(sessionId);
|
||||
if (!session.isPresent()) {
|
||||
logger.error("Session not found : " + sessionId);
|
||||
} else {
|
||||
UUID userId = session.get().getUserId();
|
||||
SessionManager.instance.getSession(sessionId).ifPresent(session -> {
|
||||
UUID userId = session.getUserId();
|
||||
TableManager.instance.swapSeats(tableId, userId, seatNum1, seatNum2);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -607,19 +586,12 @@ public class MageServerImpl implements MageServer {
|
|||
return false;
|
||||
}
|
||||
execute("leaveTable", sessionId, () -> {
|
||||
Optional<Session> session = SessionManager.instance.getSession(sessionId);
|
||||
if (!session.isPresent()) {
|
||||
logger.error("Session not found : " + sessionId);
|
||||
} else {
|
||||
UUID userId = session.get().getUserId();
|
||||
Optional<GamesRoom> room = GamesRoomManager.instance.getRoom(roomId);
|
||||
if (!room.isPresent()) {
|
||||
logger.error("room not found : " + roomId);
|
||||
} else {
|
||||
SessionManager.instance.getSession(sessionId).ifPresent(session -> {
|
||||
UUID userId = session.getUserId();
|
||||
GamesRoomManager.instance.getRoom(roomId).ifPresent(room ->
|
||||
room.leaveTable(userId, tableId));
|
||||
|
||||
room.get().leaveTable(userId, tableId);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
} else {
|
||||
// this can happen if a game ends and a player quits XMage or a match nearly at the same time as the game ends
|
||||
|
@ -642,26 +614,20 @@ public class MageServerImpl implements MageServer {
|
|||
@Override
|
||||
public void joinGame(final UUID gameId, final String sessionId) throws MageException {
|
||||
execute("joinGame", sessionId, () -> {
|
||||
Optional<Session> session = SessionManager.instance.getSession(sessionId);
|
||||
if (!session.isPresent()) {
|
||||
logger.error("Session not found : " + sessionId);
|
||||
} else {
|
||||
UUID userId = session.get().getUserId();
|
||||
SessionManager.instance.getSession(sessionId).ifPresent(session -> {
|
||||
UUID userId = session.getUserId();
|
||||
GameManager.instance.joinGame(gameId, userId);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void joinDraft(final UUID draftId, final String sessionId) throws MageException {
|
||||
execute("joinDraft", sessionId, () -> {
|
||||
Optional<Session> session = SessionManager.instance.getSession(sessionId);
|
||||
if (!session.isPresent()) {
|
||||
logger.error("Session not found : " + sessionId);
|
||||
} else {
|
||||
UUID userId = session.get().getUserId();
|
||||
SessionManager.instance.getSession(sessionId).ifPresent(session -> {
|
||||
UUID userId = session.getUserId();
|
||||
DraftManager.instance.joinDraft(draftId, userId);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -769,13 +735,10 @@ public class MageServerImpl implements MageServer {
|
|||
@Override
|
||||
public void sendCardMark(final UUID draftId, final String sessionId, final UUID cardPick) throws MageException {
|
||||
execute("sendCardMark", sessionId, () -> {
|
||||
Optional<Session> session = SessionManager.instance.getSession(sessionId);
|
||||
if (!session.isPresent()) {
|
||||
logger.error("Session not found : " + sessionId);
|
||||
} else {
|
||||
UUID userId = session.get().getUserId();
|
||||
SessionManager.instance.getSession(sessionId).ifPresent(session -> {
|
||||
UUID userId = session.getUserId();
|
||||
DraftManager.instance.sendCardMark(draftId, userId, cardPick);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -785,14 +748,10 @@ public class MageServerImpl implements MageServer {
|
|||
try {
|
||||
callExecutor.execute(
|
||||
() -> {
|
||||
Optional<Session> session = SessionManager.instance.getSession(sessionId);
|
||||
if (!session.isPresent()) {
|
||||
logger.error("Session not found : " + sessionId);
|
||||
} else {
|
||||
UUID userId = session.get().getUserId();
|
||||
SessionManager.instance.getSession(sessionId).ifPresent(session -> {
|
||||
UUID userId = session.getUserId();
|
||||
GameManager.instance.quitMatch(gameId, userId);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
} catch (Exception ex) {
|
||||
|
@ -807,14 +766,11 @@ public class MageServerImpl implements MageServer {
|
|||
try {
|
||||
callExecutor.execute(
|
||||
() -> {
|
||||
Optional<Session> session = SessionManager.instance.getSession(sessionId);
|
||||
if (!session.isPresent()) {
|
||||
logger.error("Session not found : " + sessionId);
|
||||
} else {
|
||||
UUID userId = session.get().getUserId();
|
||||
SessionManager.instance.getSession(sessionId).ifPresent(session -> {
|
||||
UUID userId = session.getUserId();
|
||||
|
||||
TournamentManager.instance.quit(tournamentId, userId);
|
||||
}
|
||||
});
|
||||
}
|
||||
);
|
||||
} catch (Exception ex) {
|
||||
|
@ -830,18 +786,16 @@ public class MageServerImpl implements MageServer {
|
|||
try {
|
||||
callExecutor.execute(
|
||||
() -> {
|
||||
Optional<Session> session = SessionManager.instance.getSession(sessionId);
|
||||
if (!session.isPresent()) {
|
||||
logger.error("Session not found : " + sessionId);
|
||||
} else {
|
||||
UUID userId = session.get().getUserId();
|
||||
UUID tableId = DraftManager.instance.getControllerByDraftId(draftId).getTableId();
|
||||
Table table = TableManager.instance.getTable(tableId);
|
||||
if (table.isTournament()) {
|
||||
UUID tournamentId = table.getTournament().getId();
|
||||
TournamentManager.instance.quit(tournamentId, userId);
|
||||
}
|
||||
}
|
||||
SessionManager.instance.getSession(sessionId).ifPresent(
|
||||
session -> {
|
||||
UUID userId = session.getUserId();
|
||||
UUID tableId = DraftManager.instance.getControllerByDraftId(draftId).getTableId();
|
||||
Table table = TableManager.instance.getTable(tableId);
|
||||
if (table.isTournament()) {
|
||||
UUID tournamentId = table.getTournament().getId();
|
||||
TournamentManager.instance.quit(tournamentId, userId);
|
||||
}
|
||||
});
|
||||
}
|
||||
);
|
||||
} catch (Exception ex) {
|
||||
|
@ -854,13 +808,10 @@ public class MageServerImpl implements MageServer {
|
|||
@Override
|
||||
public void sendPlayerAction(final PlayerAction playerAction, final UUID gameId, final String sessionId, final Object data) throws MageException {
|
||||
execute("sendPlayerAction", sessionId, () -> {
|
||||
Optional<Session> session = SessionManager.instance.getSession(sessionId);
|
||||
if (!session.isPresent()) {
|
||||
logger.error("Session not found : " + sessionId);
|
||||
} else {
|
||||
UUID userId = session.get().getUserId();
|
||||
SessionManager.instance.getSession(sessionId).ifPresent(session -> {
|
||||
UUID userId = session.getUserId();
|
||||
GameManager.instance.sendPlayerAction(playerAction, gameId, userId, data);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -895,14 +846,11 @@ public class MageServerImpl implements MageServer {
|
|||
return executeWithResult("watchGame", sessionId, new ActionWithResult<Boolean>() {
|
||||
@Override
|
||||
public Boolean execute() throws MageException {
|
||||
Optional<Session> session = SessionManager.instance.getSession(sessionId);
|
||||
if (!session.isPresent()) {
|
||||
logger.error("Session not found : " + sessionId);
|
||||
return false;
|
||||
} else {
|
||||
UUID userId = session.get().getUserId();
|
||||
return GameManager.instance.watchGame(gameId, userId);
|
||||
}
|
||||
return SessionManager.instance.getSession(sessionId)
|
||||
.map(session -> {
|
||||
UUID userId = session.getUserId();
|
||||
return GameManager.instance.watchGame(gameId, userId);
|
||||
}).orElse(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -915,16 +863,13 @@ public class MageServerImpl implements MageServer {
|
|||
@Override
|
||||
public void stopWatching(final UUID gameId, final String sessionId) throws MageException {
|
||||
execute("stopWatching", sessionId, () -> {
|
||||
Optional<Session> session = SessionManager.instance.getSession(sessionId);
|
||||
if (!session.isPresent()) {
|
||||
logger.error("Session not found : " + sessionId);
|
||||
} else {
|
||||
UUID userId = session.get().getUserId();
|
||||
SessionManager.instance.getSession(sessionId).ifPresent(session -> {
|
||||
UUID userId = session.getUserId();
|
||||
UserManager.instance.getUser(userId).ifPresent(user -> {
|
||||
GameManager.instance.stopWatching(gameId, userId);
|
||||
user.removeGameWatchInfo(gameId);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
|
@ -932,26 +877,20 @@ public class MageServerImpl implements MageServer {
|
|||
@Override
|
||||
public void replayGame(final UUID gameId, final String sessionId) throws MageException {
|
||||
execute("replayGame", sessionId, () -> {
|
||||
Optional<Session> session = SessionManager.instance.getSession(sessionId);
|
||||
if (!session.isPresent()) {
|
||||
logger.error("Session not found : " + sessionId);
|
||||
} else {
|
||||
UUID userId = session.get().getUserId();
|
||||
SessionManager.instance.getSession(sessionId).ifPresent(session -> {
|
||||
UUID userId = session.getUserId();
|
||||
ReplayManager.instance.replayGame(gameId, userId);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startReplay(final UUID gameId, final String sessionId) throws MageException {
|
||||
execute("startReplay", sessionId, () -> {
|
||||
Optional<Session> session = SessionManager.instance.getSession(sessionId);
|
||||
if (!session.isPresent()) {
|
||||
logger.error("Session not found : " + sessionId);
|
||||
} else {
|
||||
UUID userId = session.get().getUserId();
|
||||
SessionManager.instance.getSession(sessionId).ifPresent(session -> {
|
||||
UUID userId = session.getUserId();
|
||||
ReplayManager.instance.startReplay(gameId, userId);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -1032,13 +971,10 @@ public class MageServerImpl implements MageServer {
|
|||
public void cheat(final UUID gameId, final String sessionId, final UUID playerId, final DeckCardLists deckList) throws MageException {
|
||||
execute("cheat", sessionId, () -> {
|
||||
if (testMode) {
|
||||
Optional<Session> session = SessionManager.instance.getSession(sessionId);
|
||||
if (!session.isPresent()) {
|
||||
logger.error("Session not found : " + sessionId);
|
||||
} else {
|
||||
UUID userId = session.get().getUserId();
|
||||
SessionManager.instance.getSession(sessionId).ifPresent(session -> {
|
||||
UUID userId = session.getUserId();
|
||||
GameManager.instance.cheat(gameId, userId, playerId, deckList);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -1327,7 +1263,6 @@ public class MageServerImpl implements MageServer {
|
|||
public Boolean execute() throws MageException {
|
||||
Optional<Session> session = SessionManager.instance.getSession(sessionId);
|
||||
if (!session.isPresent()) {
|
||||
logger.error("Session not found : " + sessionId);
|
||||
return false;
|
||||
} else {
|
||||
UUID userId = session.get().getUserId();
|
||||
|
@ -1378,7 +1313,6 @@ public class MageServerImpl implements MageServer {
|
|||
public TableView execute() throws MageException {
|
||||
Optional<Session> session = SessionManager.instance.getSession(sessionId);
|
||||
if (!session.isPresent()) {
|
||||
logger.error("Session not found : " + sessionId);
|
||||
return null;
|
||||
}
|
||||
UUID userId = session.get().getUserId();
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
package mage.server.game;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
@ -14,6 +16,7 @@ public enum GamesRoomManager {
|
|||
|
||||
private final ConcurrentHashMap<UUID, GamesRoom> rooms = new ConcurrentHashMap<>();
|
||||
private final UUID mainRoomId;
|
||||
private static final Logger logger = Logger.getLogger(GamesRoomManager.class);
|
||||
|
||||
|
||||
GamesRoomManager() {
|
||||
|
@ -36,6 +39,7 @@ public enum GamesRoomManager {
|
|||
if(rooms.containsKey(roomId)) {
|
||||
return Optional.of(rooms.get(roomId));
|
||||
}
|
||||
logger.error("room not found : " + roomId);
|
||||
return Optional.empty();
|
||||
|
||||
}
|
||||
|
|
|
@ -73,10 +73,7 @@ class AetherworksMarvelEffect extends OneShotEffect {
|
|||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
Set<Card> cardsSet = controller.getLibrary().getTopCards(game, 6);
|
||||
Cards cards = new CardsImpl();
|
||||
for (Card card : cardsSet) {
|
||||
cards.add(card);
|
||||
}
|
||||
Cards cards = new CardsImpl(cardsSet);
|
||||
TargetCard target = new TargetCardInLibrary(0, 1, new FilterNonlandCard("card to cast without paying its mana cost"));
|
||||
if (controller.choose(Outcome.PlayForFree, cards, target, game)) {
|
||||
Card card = controller.getLibrary().getCard(target.getFirstTarget(), game);
|
||||
|
|
|
@ -60,8 +60,7 @@ class AnimalMagnetismEffect extends OneShotEffect {
|
|||
Player controller = game.getPlayer(source.getControllerId());
|
||||
MageObject sourceObject = game.getObject(source.getSourceId());
|
||||
if (sourceObject != null && controller != null) {
|
||||
Cards cards = new CardsImpl();
|
||||
cards.addAll(controller.getLibrary().getTopCards(game, 5));
|
||||
Cards cards = new CardsImpl(controller.getLibrary().getTopCards(game, 5));
|
||||
if (!cards.isEmpty()) {
|
||||
controller.revealCards(staticText, cards, game);
|
||||
Card cardToBattlefield;
|
||||
|
|
|
@ -222,8 +222,7 @@ class AshiokNightmareWeaverExileAllEffect extends OneShotEffect {
|
|||
for (UUID opponentId : game.getOpponents(source.getControllerId())) {
|
||||
Player opponent = game.getPlayer(opponentId);
|
||||
if (opponent != null) {
|
||||
Cards cards = new CardsImpl();
|
||||
cards.addAll(opponent.getHand());
|
||||
Cards cards = new CardsImpl(opponent.getHand());
|
||||
for (UUID cardId : cards) {
|
||||
Card card = game.getCard(cardId);
|
||||
if (card != null) {
|
||||
|
|
|
@ -89,8 +89,7 @@ class AvenSoulgazerLookFaceDownEffect extends OneShotEffect {
|
|||
if (faceDownCreature != null) {
|
||||
Permanent copyFaceDown = faceDownCreature.copy();
|
||||
copyFaceDown.setFaceDown(false, game);
|
||||
Cards cards = new CardsImpl();
|
||||
cards.add(copyFaceDown);
|
||||
Cards cards = new CardsImpl(copyFaceDown);
|
||||
player.lookAtCards("face down card - " + mageObject.getName(), cards, game);
|
||||
} else {
|
||||
return false;
|
||||
|
|
|
@ -88,13 +88,13 @@ public final class BanefulOmen extends CardImpl {
|
|||
return false;
|
||||
}
|
||||
Card card = player.getLibrary().getFromTop(game);
|
||||
Cards cards = new CardsImpl();
|
||||
cards.add(card);
|
||||
player.revealCards("Baneful Omen", cards, game);
|
||||
|
||||
if (card == null) {
|
||||
return false;
|
||||
}
|
||||
Cards cards = new CardsImpl(card);
|
||||
player.revealCards("Baneful Omen", cards, game);
|
||||
|
||||
|
||||
int loseLife = card.getConvertedManaCost();
|
||||
Set<UUID> opponents = game.getOpponents(source.getControllerId());
|
||||
for (UUID opponentUuid : opponents) {
|
||||
|
|
|
@ -67,8 +67,7 @@ class BarishiEffect extends OneShotEffect {
|
|||
if (controller == null) {
|
||||
return false;
|
||||
}
|
||||
Cards cards = new CardsImpl();
|
||||
cards.addAll(controller.getGraveyard().getCards(StaticFilters.FILTER_CARD_CREATURE, game));
|
||||
Cards cards = new CardsImpl(controller.getGraveyard().getCards(StaticFilters.FILTER_CARD_CREATURE, game));
|
||||
controller.putCardsOnTopOfLibrary(cards, game, source, false);
|
||||
controller.shuffleLibrary(source, game);
|
||||
return true;
|
||||
|
|
|
@ -63,8 +63,7 @@ class BenefactionOfRhonasEffect extends OneShotEffect {
|
|||
Player controller = game.getPlayer(source.getControllerId());
|
||||
MageObject sourceObject = game.getObject(source.getSourceId());
|
||||
if (sourceObject != null && controller != null) {
|
||||
Cards cards = new CardsImpl();
|
||||
cards.addAll(controller.getLibrary().getTopCards(game, 5));
|
||||
Cards cards = new CardsImpl(controller.getLibrary().getTopCards(game, 5));
|
||||
boolean creatureCardFound = false;
|
||||
boolean enchantmentCardFound = false;
|
||||
for (UUID cardId : cards) {
|
||||
|
|
|
@ -80,10 +80,9 @@ class BorderlandExplorerEffect extends OneShotEffect {
|
|||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
Cards cards = new CardsImpl();
|
||||
Target target = new TargetDiscard(0, 1, new FilterCard(), playerId);
|
||||
Target target = new TargetDiscard(0, 1, new FilterCard(), playerId);
|
||||
player.chooseTarget(outcome, target, source, game);
|
||||
cards.addAll(target.getTargets());
|
||||
Cards cards = new CardsImpl(target.getTargets());
|
||||
cardsToDiscard.put(playerId, cards);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -90,8 +90,7 @@ class CallToTheKindredEffect extends OneShotEffect {
|
|||
return false;
|
||||
}
|
||||
|
||||
Cards cards = new CardsImpl();
|
||||
cards.addAll(controller.getLibrary().getTopCards(game, 5));
|
||||
Cards cards = new CardsImpl(controller.getLibrary().getTopCards(game, 5));
|
||||
controller.lookAtCards(enchantment.getIdName(), cards, game);
|
||||
|
||||
FilterCreatureCard filter = new FilterCreatureCard();
|
||||
|
|
|
@ -212,8 +212,7 @@ class ChandraPyromasterEffect3 extends OneShotEffect {
|
|||
if (controller == null || sourceObject == null) {
|
||||
return false;
|
||||
}
|
||||
Cards cards = new CardsImpl();
|
||||
cards.addAll(controller.getLibrary().getTopCards(game, 10));
|
||||
Cards cards = new CardsImpl(controller.getLibrary().getTopCards(game, 10));
|
||||
controller.moveCardsToExile(cards.getCards(game), source, game, true, source.getSourceId(), sourceObject.getIdName());
|
||||
|
||||
if (!cards.getCards(new FilterInstantOrSorceryCard(), game).isEmpty()) {
|
||||
|
|
|
@ -64,8 +64,7 @@ class CoralFightersEffect extends OneShotEffect {
|
|||
if(controller != null && defendingPlayer != null) {
|
||||
Card card = defendingPlayer.getLibrary().getFromTop(game);
|
||||
if(card != null) {
|
||||
Cards cards = new CardsImpl();
|
||||
cards.add(card);
|
||||
Cards cards = new CardsImpl(card);
|
||||
controller.lookAtCards("Coral Fighters", cards, game);
|
||||
if (controller.chooseUse(outcome, "Do you wish to put card on the bottom of player's library?", source, game)) {
|
||||
controller.moveCardToLibraryWithInfo(card, source.getSourceId(), game, Zone.LIBRARY, false, false);
|
||||
|
|
|
@ -68,8 +68,7 @@ class DeathOrGloryEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
Cards cards = new CardsImpl();
|
||||
cards.addAll(controller.getGraveyard().getCards(new FilterCreatureCard(), game));
|
||||
Cards cards = new CardsImpl(controller.getGraveyard().getCards(new FilterCreatureCard(), game));
|
||||
if (!cards.isEmpty()) {
|
||||
TargetCard targetCards = new TargetCard(0, cards.size(), Zone.EXILED, new FilterCard("cards to put in the first pile"));
|
||||
List<Card> pile1 = new ArrayList<>();
|
||||
|
|
|
@ -76,6 +76,9 @@ class DelverOfSecretsEffect extends OneShotEffect {
|
|||
if (player != null && sourcePermanent != null) {
|
||||
if (player.getLibrary().hasCards()) {
|
||||
Card card = player.getLibrary().getFromTop(game);
|
||||
if(card == null){
|
||||
return false;
|
||||
}
|
||||
Cards cards = new CardsImpl();
|
||||
cards.add(card);
|
||||
player.lookAtCards(sourcePermanent.getName(), cards, game);
|
||||
|
|
|
@ -82,8 +82,7 @@ class EnduringRenewalReplacementEffect extends ReplacementEffectImpl {
|
|||
}
|
||||
Card card = controller.getLibrary().getFromTop(game);
|
||||
if (card != null) {
|
||||
Cards cards = new CardsImpl();
|
||||
cards.add(card);
|
||||
Cards cards = new CardsImpl(card);
|
||||
controller.revealCards("Top card of " + controller.getName() + "'s library", cards, game);
|
||||
if (card.isCreature()) {
|
||||
controller.moveCards(card, Zone.GRAVEYARD, source, game);
|
||||
|
|
|
@ -68,8 +68,7 @@ class EpiphanyAtTheDrownyardEffect extends OneShotEffect {
|
|||
return false;
|
||||
}
|
||||
|
||||
Cards cards = new CardsImpl();
|
||||
cards.addAll(controller.getLibrary().getTopCards(game, source.getManaCostsToPay().getX() + 1));
|
||||
Cards cards = new CardsImpl(controller.getLibrary().getTopCards(game, source.getManaCostsToPay().getX() + 1));
|
||||
controller.revealCards(sourceObject.getIdName(), cards, game);
|
||||
|
||||
Player opponent;
|
||||
|
|
|
@ -69,8 +69,7 @@ class ExplorersScopeEffect extends OneShotEffect {
|
|||
|
||||
Card card = controller.getLibrary().getFromTop(game);
|
||||
if (card != null) {
|
||||
Cards cards = new CardsImpl();
|
||||
cards.add(card);
|
||||
Cards cards = new CardsImpl(card);
|
||||
controller.lookAtCards(sourceObject.getIdName(), cards, game);
|
||||
if (card.isLand()) {
|
||||
String message = "Put " + card.getLogName() + " onto the battlefield tapped?";
|
||||
|
|
|
@ -65,8 +65,7 @@ class FactOrFictionEffect extends OneShotEffect {
|
|||
return false;
|
||||
}
|
||||
|
||||
Cards cards = new CardsImpl();
|
||||
cards.addAll(controller.getLibrary().getTopCards(game, 5));
|
||||
Cards cards = new CardsImpl(controller.getLibrary().getTopCards(game, 5));
|
||||
controller.revealCards(sourceObject.getName(), cards, game);
|
||||
|
||||
Set<UUID> opponents = game.getOpponents(source.getControllerId());
|
||||
|
|
|
@ -78,10 +78,9 @@ class FeralDeceiverEffect extends OneShotEffect {
|
|||
Player controller = game.getPlayer(source.getControllerId());
|
||||
MageObject sourceObject = source.getSourceObject(game);
|
||||
if (controller != null && sourceObject != null) {
|
||||
Cards cards = new CardsImpl();
|
||||
Card card = controller.getLibrary().getFromTop(game);
|
||||
if (card != null) {
|
||||
cards.add(card);
|
||||
Cards cards = new CardsImpl(card);
|
||||
controller.revealCards(sourceObject.getIdName(), cards, game);
|
||||
if (card.isLand()) {
|
||||
game.addEffect(new BoostSourceEffect(2, 2, Duration.EndOfTurn), source);
|
||||
|
|
|
@ -71,8 +71,7 @@ class FertileThicketEffect extends OneShotEffect {
|
|||
Player controller = game.getPlayer(source.getControllerId());
|
||||
MageObject sourceObject = game.getObject(source.getSourceId());
|
||||
if (controller != null && sourceObject != null) {
|
||||
Cards cards = new CardsImpl();
|
||||
cards.addAll(controller.getLibrary().getTopCards(game, 5));
|
||||
Cards cards = new CardsImpl(controller.getLibrary().getTopCards(game, 5));
|
||||
controller.lookAtCards(sourceObject.getIdName(), cards, game);
|
||||
TargetCard target = new TargetCard(0, 1, Zone.LIBRARY, StaticFilters.FILTER_CARD_BASIC_LAND);
|
||||
controller.chooseTarget(outcome, cards, target, source, game);
|
||||
|
|
|
@ -87,8 +87,7 @@ class FlashOfInsightEffect extends OneShotEffect {
|
|||
}
|
||||
}
|
||||
|
||||
Cards cards = new CardsImpl();
|
||||
cards.addAll(controller.getLibrary().getTopCards(game, xValue));
|
||||
Cards cards = new CardsImpl(controller.getLibrary().getTopCards(game, xValue));
|
||||
controller.lookAtCards(sourceObject.getIdName(), cards, game);
|
||||
|
||||
TargetCard target = new TargetCard(Zone.LIBRARY, new FilterCard("card to put into your hand"));
|
||||
|
|
|
@ -64,13 +64,11 @@ class FortunesFavorEffect extends OneShotEffect {
|
|||
Player targetOpponent = game.getPlayer(getTargetPointer().getFirst(game, source));
|
||||
MageObject sourceObject = source.getSourceObject(game);
|
||||
if (controller != null && targetOpponent != null && sourceObject != null) {
|
||||
Cards cards = new CardsImpl();
|
||||
cards.addAll(controller.getLibrary().getTopCards(game, 4));
|
||||
Cards cards = new CardsImpl(controller.getLibrary().getTopCards(game, 4));
|
||||
|
||||
TargetCard target = new TargetCard(0, Integer.MAX_VALUE, Zone.LIBRARY, new FilterCard("cards for the face-down pile"));
|
||||
targetOpponent.choose(outcome, cards, target, game);
|
||||
Cards faceDownPile = new CardsImpl();
|
||||
faceDownPile.addAll(target.getTargets());
|
||||
Cards faceDownPile = new CardsImpl(target.getTargets());
|
||||
cards.removeAll(target.getTargets());
|
||||
controller.revealCards(sourceObject.getIdName() + " - cards in face-up pile", cards, game);
|
||||
game.informPlayers(targetOpponent.getLogName() + " puts " + faceDownPile.size() + " card(s) into the face-down pile");
|
||||
|
|
|
@ -64,10 +64,9 @@ class FriendlyFireEffect extends OneShotEffect {
|
|||
Player controllerOfTargetCreature = game.getPlayer(targetCreature.getControllerId());
|
||||
if (controllerOfTargetCreature != null) {
|
||||
if (!controllerOfTargetCreature.getHand().isEmpty()) {
|
||||
Cards cards = new CardsImpl();
|
||||
Card card = controllerOfTargetCreature.getHand().getRandom(game);
|
||||
if (card != null) {
|
||||
cards.add(card);
|
||||
Cards cards = new CardsImpl(card);
|
||||
controllerOfTargetCreature.revealCards(sourceObject.getName(), cards, game);
|
||||
int damage = card.getConvertedManaCost();
|
||||
targetCreature.damage(damage, source.getSourceId(), game, false, true);
|
||||
|
|
|
@ -61,8 +61,7 @@ class GatherThePackEffect extends OneShotEffect {
|
|||
if (controller == null || sourceObject == null) {
|
||||
return false;
|
||||
}
|
||||
Cards cards = new CardsImpl();
|
||||
cards.addAll(controller.getLibrary().getTopCards(game, 5));
|
||||
Cards cards = new CardsImpl(controller.getLibrary().getTopCards(game, 5));
|
||||
if (!cards.isEmpty()) {
|
||||
controller.revealCards(sourceObject.getIdName(), cards, game);
|
||||
int creatures = cards.count(new FilterCreatureCard(), source.getSourceId(), source.getControllerId(), game);
|
||||
|
|
|
@ -126,10 +126,9 @@ class GoblinGuideEffect extends OneShotEffect {
|
|||
Player defender = game.getPlayer(getTargetPointer().getFirst(game, source));
|
||||
MageObject sourceObject = game.getObject(source.getSourceId());
|
||||
if (sourceObject != null && defender != null) {
|
||||
Cards cards = new CardsImpl();
|
||||
Card card = defender.getLibrary().getFromTop(game);
|
||||
if (card != null) {
|
||||
cards.add(card);
|
||||
Cards cards = new CardsImpl(card);
|
||||
defender.revealCards(sourceObject.getName(), cards, game);
|
||||
if (card.isLand()) {
|
||||
defender.moveCards(card, Zone.HAND, source, game);
|
||||
|
|
|
@ -77,10 +77,9 @@ class HarshDeceiverEffect extends OneShotEffect {
|
|||
Player controller = game.getPlayer(source.getControllerId());
|
||||
MageObject sourceObject = source.getSourceObject(game);
|
||||
if (controller != null && sourceObject != null) {
|
||||
Cards cards = new CardsImpl();
|
||||
Card card = controller.getLibrary().getFromTop(game);
|
||||
if (card != null) {
|
||||
cards.add(card);
|
||||
Cards cards = new CardsImpl(card);
|
||||
controller.revealCards(sourceObject.getIdName(), cards, game);
|
||||
if (card.isLand()) {
|
||||
new UntapSourceEffect().apply(game, source);
|
||||
|
|
|
@ -123,8 +123,7 @@ class HeroesPodiumEffect extends OneShotEffect {
|
|||
return false;
|
||||
}
|
||||
|
||||
Cards cards = new CardsImpl();
|
||||
cards.addAll(controller.getLibrary().getTopCards(game, source.getManaCostsToPay().getX()));
|
||||
Cards cards = new CardsImpl(controller.getLibrary().getTopCards(game, source.getManaCostsToPay().getX()));
|
||||
boolean legendaryIncluded = cards.count(filter, game) > 0;
|
||||
controller.lookAtCards(sourceObject.getIdName(), cards, game);
|
||||
|
||||
|
|
|
@ -82,8 +82,8 @@ class ImpromptuRaidEffect extends OneShotEffect {
|
|||
MageObject sourceObject = game.getObject(source.getSourceId());
|
||||
if (sourceObject != null && controller != null) {
|
||||
Card card = controller.getLibrary().getFromTop(game);
|
||||
Cards cards = new CardsImpl();
|
||||
if (card != null) {
|
||||
Cards cards = new CardsImpl();
|
||||
cards.add(card);
|
||||
controller.revealCards(sourceObject.getName(), cards, game);
|
||||
if (filterPutInGraveyard.match(card, source.getSourceId(), source.getControllerId(), game)) {
|
||||
|
|
|
@ -90,8 +90,7 @@ class JaceTheMindSculptorEffect1 extends OneShotEffect {
|
|||
if (controller != null && player != null) {
|
||||
Card card = player.getLibrary().getFromTop(game);
|
||||
if (card != null) {
|
||||
Cards cards = new CardsImpl();
|
||||
cards.add(card);
|
||||
Cards cards = new CardsImpl(card);
|
||||
controller.lookAtCards("Jace, the Mind Sculptor", cards, game);
|
||||
if (controller.chooseUse(outcome, "Do you wish to put card on the bottom of player's library?", source, game)) {
|
||||
controller.moveCardToLibraryWithInfo(card, source.getSourceId(), game, Zone.LIBRARY, false, false);
|
||||
|
|
|
@ -191,8 +191,7 @@ class KarnLiberatedDelayedEffect extends OneShotEffect {
|
|||
if (exile != null) {
|
||||
// Creatures put onto the battlefield due to Karn's ability will have been under their controller's control continuously
|
||||
// since the beginning of the first turn. They can attack and their activated abilities with {T} in the cost can be activated.
|
||||
Cards cards = new CardsImpl(); // needed because putOntoTheBattlefield removes from exile
|
||||
cards.addAll(exile);
|
||||
Cards cards = new CardsImpl(exile); // needed because putOntoTheBattlefield removes from exile
|
||||
if (!cards.isEmpty()) {
|
||||
controller.moveCards(cards, Zone.BATTLEFIELD, source, game);
|
||||
for (Card card : cards.getCards(game)) {
|
||||
|
|
|
@ -89,8 +89,7 @@ class KarnPlus1Effect extends OneShotEffect {
|
|||
Player controller = game.getPlayer(source.getControllerId());
|
||||
MageObject sourceObject = game.getObject(source.getSourceId());
|
||||
if (sourceObject != null && controller != null) {
|
||||
Cards cards = new CardsImpl();
|
||||
cards.addAll(controller.getLibrary().getTopCards(game, 2));
|
||||
Cards cards = new CardsImpl(controller.getLibrary().getTopCards(game, 2));
|
||||
|
||||
if (!cards.isEmpty()) {
|
||||
controller.revealCards(staticText, cards, game);
|
||||
|
|
|
@ -101,8 +101,7 @@ class KeeperOfTheLensLookFaceDownEffect extends OneShotEffect {
|
|||
if (faceDownCreature != null) {
|
||||
Permanent copyFaceDown = faceDownCreature.copy();
|
||||
copyFaceDown.setFaceDown(false, game);
|
||||
Cards cards = new CardsImpl();
|
||||
cards.add(copyFaceDown);
|
||||
Cards cards = new CardsImpl(copyFaceDown);
|
||||
Player player = game.getPlayer(faceDownCreature.getControllerId());
|
||||
controller.lookAtCards("face down card - " + mageObject.getName(), cards, game);
|
||||
if (player != null) {
|
||||
|
|
|
@ -85,8 +85,7 @@ class KheruLichLordEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
Cards cards = new CardsImpl();
|
||||
cards.addAll(controller.getGraveyard().getCards(new FilterCreatureCard(), source.getSourceId(), source.getControllerId(), game));
|
||||
Cards cards = new CardsImpl(controller.getGraveyard().getCards(new FilterCreatureCard(), source.getSourceId(), source.getControllerId(), game));
|
||||
Card card = cards.getRandom(game);
|
||||
if (card != null) {
|
||||
controller.moveCards(card, Zone.BATTLEFIELD, source, game);
|
||||
|
|
|
@ -124,8 +124,7 @@ class KioraRevealEffect extends OneShotEffect {
|
|||
Player controller = game.getPlayer(source.getControllerId());
|
||||
MageObject sourceObject = game.getObject(source.getSourceId());
|
||||
if (sourceObject != null && controller != null) {
|
||||
Cards cards = new CardsImpl();
|
||||
cards.addAll(controller.getLibrary().getTopCards(game, 4));
|
||||
Cards cards = new CardsImpl(controller.getLibrary().getTopCards(game, 4));
|
||||
boolean creatureCardFound = false;
|
||||
boolean landCardFound = false;
|
||||
for (UUID cardId : cards) {
|
||||
|
|
|
@ -93,8 +93,7 @@ class LensOfClarityLookLibraryEffect extends OneShotEffect {
|
|||
|
||||
Card card = controller.getLibrary().getFromTop(game);
|
||||
if (card != null) {
|
||||
Cards cards = new CardsImpl();
|
||||
cards.add(card);
|
||||
Cards cards = new CardsImpl(card);
|
||||
controller.lookAtCards("top card of library - " + controller.getName(), cards, game);
|
||||
game.informPlayers(controller.getLogName() + " looks at the top card of their library");
|
||||
} else {
|
||||
|
@ -158,8 +157,7 @@ class LensOfClarityLookFaceDownEffect extends OneShotEffect {
|
|||
if (faceDownCreature != null) {
|
||||
Permanent copyFaceDown = faceDownCreature.copy();
|
||||
copyFaceDown.setFaceDown(false, game);
|
||||
Cards cards = new CardsImpl();
|
||||
cards.add(copyFaceDown);
|
||||
Cards cards = new CardsImpl(copyFaceDown);
|
||||
Player player = game.getPlayer(faceDownCreature.getControllerId());
|
||||
controller.lookAtCards("face down card - " + mageObject.getName(), cards, game);
|
||||
if (player != null) {
|
||||
|
|
|
@ -60,8 +60,7 @@ class LevelerExileLibraryEffect extends OneShotEffect {
|
|||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
int count = controller.getLibrary().size();
|
||||
Cards cards = new CardsImpl();
|
||||
cards.addAll(controller.getLibrary().getTopCards(game, count));
|
||||
Cards cards = new CardsImpl(controller.getLibrary().getTopCards(game, count));
|
||||
controller.moveCards(cards, Zone.EXILED, source, game);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -73,9 +73,9 @@ class LlanowarEmpathEffect extends OneShotEffect {
|
|||
if (controller == null || sourceObject == null) {
|
||||
return false;
|
||||
}
|
||||
Cards cards = new CardsImpl();
|
||||
Card card = controller.getLibrary().getFromTop(game);
|
||||
if (card != null) {
|
||||
Cards cards = new CardsImpl();
|
||||
cards.add(card);
|
||||
controller.revealCards(sourceObject.getName(), cards, game);
|
||||
if (card.isCreature()) {
|
||||
|
|
|
@ -74,8 +74,7 @@ class LordOfTheVoidEffect extends OneShotEffect {
|
|||
return false;
|
||||
}
|
||||
|
||||
Cards cards = new CardsImpl();
|
||||
cards.addAll(player.getLibrary().getTopCards(game, 7));
|
||||
Cards cards = new CardsImpl(player.getLibrary().getTopCards(game, 7));
|
||||
controller.moveCards(cards, Zone.EXILED, source, game);
|
||||
if (!cards.getCards(new FilterCreatureCard(), game).isEmpty()) {
|
||||
TargetCard target = new TargetCard(Zone.EXILED, new FilterCreatureCard());
|
||||
|
|
|
@ -57,8 +57,7 @@ class LostInTheWoodsEffect extends OneShotEffect {
|
|||
}
|
||||
if (controller.getLibrary().hasCards()) {
|
||||
Card card = controller.getLibrary().getFromTop(game);
|
||||
Cards cards = new CardsImpl();
|
||||
cards.add(card);
|
||||
Cards cards = new CardsImpl(card);
|
||||
controller.revealCards(sourceObject.getName(), cards, game);
|
||||
|
||||
if (card != null) {
|
||||
|
|
|
@ -93,8 +93,7 @@ class MerchantsDockhandEffect extends OneShotEffect {
|
|||
}
|
||||
}
|
||||
|
||||
Cards cards = new CardsImpl();
|
||||
cards.addAll(controller.getLibrary().getTopCards(game, xValue));
|
||||
Cards cards = new CardsImpl(controller.getLibrary().getTopCards(game, xValue));
|
||||
controller.lookAtCards(sourceObject.getIdName(), cards, game);
|
||||
|
||||
TargetCard target = new TargetCard(Zone.LIBRARY, new FilterCard("card to put into your hand"));
|
||||
|
|
|
@ -69,7 +69,7 @@ class MnemonicBetrayalExileEffect extends OneShotEffect {
|
|||
return false;
|
||||
}
|
||||
Cards cards = new CardsImpl();
|
||||
Map<UUID, Integer> cardMap = new HashMap();
|
||||
Map<UUID, Integer> cardMap = new HashMap<>();
|
||||
game.getOpponents(source.getControllerId()).stream().map((playerId) -> game.getPlayer(playerId)).filter((player) -> (player != null)).forEachOrdered((player) -> {
|
||||
cards.addAll(player.getGraveyard());
|
||||
});
|
||||
|
|
|
@ -64,8 +64,7 @@ class MurmursFromBeyondEffect extends OneShotEffect {
|
|||
Player controller = game.getPlayer(source.getControllerId());
|
||||
MageObject sourceObject = game.getObject(source.getSourceId());
|
||||
if (sourceObject != null && controller != null) {
|
||||
Cards cards = new CardsImpl();
|
||||
cards.addAll(controller.getLibrary().getTopCards(game, 3));
|
||||
Cards cards = new CardsImpl(controller.getLibrary().getTopCards(game, 3));
|
||||
if (!cards.isEmpty()) {
|
||||
controller.revealCards(staticText, cards, game);
|
||||
Card cardToGraveyard;
|
||||
|
|
|
@ -81,8 +81,8 @@ class NessianGameWardenEffect extends OneShotEffect {
|
|||
return false;
|
||||
}
|
||||
|
||||
Cards cards = new CardsImpl();
|
||||
int count = new PermanentsOnBattlefieldCount(filter).calculate(game, source, this);
|
||||
Cards cards = new CardsImpl();
|
||||
cards.addAll(controller.getLibrary().getTopCards(game, count));
|
||||
controller.lookAtCards(sourcePermanent.getIdName(), cards, game);
|
||||
|
||||
|
|
|
@ -101,12 +101,11 @@ class NicolBolasGodPharaohPlusOneEffect extends OneShotEffect {
|
|||
}
|
||||
|
||||
int numberOfCardsToExile = Math.min(2, player.getHand().size());
|
||||
Cards cards = new CardsImpl();
|
||||
|
||||
Target target = new TargetCardInHand(numberOfCardsToExile, new FilterCard());
|
||||
Cards cards = new CardsImpl(target.getTargets());
|
||||
|
||||
player.chooseTarget(Outcome.Exile, target, source, game);
|
||||
cards.addAll(target.getTargets());
|
||||
cardsToExile.put(playerId, cards);
|
||||
}
|
||||
// Exile all choosen cards
|
||||
|
|
|
@ -161,8 +161,7 @@ public final class NightDealings extends CardImpl {
|
|||
card.moveToZone(Zone.HAND, source.getSourceId(), game, false);
|
||||
|
||||
String name = "Reveal";
|
||||
Cards cards = new CardsImpl();
|
||||
cards.add(card);
|
||||
Cards cards = new CardsImpl(card);
|
||||
Card sourceCard = game.getCard(source.getSourceId());
|
||||
if (sourceCard != null) {
|
||||
name = sourceCard.getName();
|
||||
|
|
|
@ -84,8 +84,7 @@ class NissaNaturesArtisanEffect extends OneShotEffect {
|
|||
if (controller == null || sourceObject == null) {
|
||||
return false;
|
||||
}
|
||||
Cards cards = new CardsImpl();
|
||||
cards.addAll(controller.getLibrary().getTopCards(game, 2));
|
||||
Cards cards = new CardsImpl(controller.getLibrary().getTopCards(game, 2));
|
||||
if (!cards.isEmpty()) {
|
||||
controller.revealCards(sourceObject.getIdName(), cards, game);
|
||||
Set<Card> toBattlefield = new LinkedHashSet<>();
|
||||
|
|
|
@ -62,10 +62,10 @@ class NissasRevelationEffect extends OneShotEffect {
|
|||
Player controller = game.getPlayer(source.getControllerId());
|
||||
MageObject sourceObject = source.getSourceObject(game);
|
||||
if (controller != null && sourceObject != null) {
|
||||
Cards cards = new CardsImpl();
|
||||
Card card = controller.getLibrary().getFromTop(game);
|
||||
|
||||
if (card != null) {
|
||||
Cards cards = new CardsImpl();
|
||||
cards.add(card);
|
||||
controller.revealCards(sourceObject.getIdName(), cards, game);
|
||||
if (card.isCreature()) {
|
||||
|
|
|
@ -1,31 +1,27 @@
|
|||
|
||||
package mage.cards.p;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.keyword.InspiredAbility;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.cards.Cards;
|
||||
import mage.cards.CardsImpl;
|
||||
import mage.cards.*;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public final class PainSeer extends CardImpl {
|
||||
|
||||
public PainSeer(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{B}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{B}");
|
||||
this.subtype.add(SubType.HUMAN);
|
||||
this.subtype.add(SubType.WIZARD);
|
||||
|
||||
|
@ -71,14 +67,14 @@ class PainSeerEffect extends OneShotEffect {
|
|||
|
||||
if (player.getLibrary().hasCards()) {
|
||||
Card card = player.getLibrary().getFromTop(game);
|
||||
Cards cards = new CardsImpl();
|
||||
cards.add(card);
|
||||
player.revealCards("Pain Seer", cards, game);
|
||||
|
||||
if (card != null &&
|
||||
card.moveToZone(Zone.HAND, source.getSourceId(), game, false)) {
|
||||
player.loseLife(card.getConvertedManaCost(), game, false);
|
||||
return true;
|
||||
if (card != null) {
|
||||
Cards cards = new CardsImpl(card);
|
||||
player.revealCards("Pain Seer", cards, game);
|
||||
if (card.moveToZone(Zone.HAND, source.getSourceId(), game, false)) {
|
||||
player.loseLife(card.getConvertedManaCost(), game, false);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -55,8 +55,7 @@ class ExileLibraryEffect extends OneShotEffect {
|
|||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
int count = controller.getLibrary().size();
|
||||
Cards cards = new CardsImpl();
|
||||
cards.addAll(controller.getLibrary().getTopCards(game, count));
|
||||
Cards cards = new CardsImpl(controller.getLibrary().getTopCards(game, count));
|
||||
controller.moveCards(cards, Zone.EXILED, source, game);
|
||||
|
||||
for (Card card: controller.getGraveyard().getCards(game)) {
|
||||
|
|
|
@ -91,8 +91,7 @@ class ParoxysmEffect extends OneShotEffect {
|
|||
if (controllerOfCreature != null) {
|
||||
Card revealCardFromTop = controllerOfCreature.getLibrary().getFromTop(game);
|
||||
if (revealCardFromTop != null) {
|
||||
Cards cards = new CardsImpl();
|
||||
cards.add(revealCardFromTop);
|
||||
Cards cards = new CardsImpl(revealCardFromTop);
|
||||
controllerOfCreature.revealCards(source, cards, game);
|
||||
if (revealCardFromTop.isLand()) {
|
||||
creatureAttachedTo.destroy(source.getSourceId(), game, false);
|
||||
|
|
|
@ -61,8 +61,7 @@ class PetalsOfInsightEffect extends OneShotEffect {
|
|||
if (controller == null || sourceObject == null) {
|
||||
return false;
|
||||
}
|
||||
Cards cards = new CardsImpl();
|
||||
cards.addAll(controller.getLibrary().getTopCards(game, 3));
|
||||
Cards cards = new CardsImpl(controller.getLibrary().getTopCards(game, 3));
|
||||
|
||||
controller.lookAtCards(sourceObject.getIdName(), cards, game);
|
||||
if (controller.chooseUse(outcome, "Put the cards on the bottom of your library in any order?", source, game)) {
|
||||
|
|
|
@ -67,10 +67,11 @@ class PhosphorescentFeastEffect extends OneShotEffect {
|
|||
if (player == null) {
|
||||
return false;
|
||||
}
|
||||
Cards cards = new CardsImpl();
|
||||
if (player.getHand().count(new FilterCard(), game) > 0) {
|
||||
TargetCardInHand target = new TargetCardInHand(0, Integer.MAX_VALUE, new FilterCard());
|
||||
if (player.choose(Outcome.Benefit, target, source.getSourceId(), game)) {
|
||||
|
||||
Cards cards = new CardsImpl();
|
||||
for (UUID uuid : target.getTargets()) {
|
||||
cards.add(player.getHand().get(uuid, game));
|
||||
}
|
||||
|
|
|
@ -69,8 +69,7 @@ class PhyrexianPortalEffect extends OneShotEffect {
|
|||
Player opponent = game.getPlayer(source.getFirstTarget());
|
||||
if (controller != null && opponent != null) {
|
||||
if (controller.getLibrary().size() >= 10) {
|
||||
Cards cards = new CardsImpl();
|
||||
cards.addAll(controller.getLibrary().getTopCards(game, 10));
|
||||
Cards cards = new CardsImpl(controller.getLibrary().getTopCards(game, 10));
|
||||
|
||||
TargetCard target = new TargetCard(0, cards.size(), Zone.LIBRARY, new FilterCard("cards to put in the first pile"));
|
||||
List<Card> pile1 = new ArrayList<>();
|
||||
|
|
|
@ -82,8 +82,7 @@ class PlaneswalkersMischiefEffect extends OneShotEffect {
|
|||
if (revealedCard == null) {
|
||||
return false;
|
||||
}
|
||||
Cards cards = new CardsImpl();
|
||||
cards.add(revealedCard);
|
||||
Cards cards = new CardsImpl(revealedCard);
|
||||
opponent.revealCards("Planeswalker's Mischief Reveal", cards, game);
|
||||
if (revealedCard.isInstant()
|
||||
|| revealedCard.isSorcery()) {
|
||||
|
|
|
@ -68,8 +68,7 @@ class PrecognitionEffect extends OneShotEffect {
|
|||
if (controller != null && player != null) {
|
||||
Card card = player.getLibrary().getFromTop(game);
|
||||
if (card != null) {
|
||||
Cards cards = new CardsImpl();
|
||||
cards.add(card);
|
||||
Cards cards = new CardsImpl(card);
|
||||
controller.lookAtCards("Precognition", cards, game);
|
||||
if (controller.chooseUse(outcome, "Do you wish to put card on the bottom of player's library?", source, game)) {
|
||||
controller.moveCardToLibraryWithInfo(card, source.getSourceId(), game, Zone.LIBRARY, false, false);
|
||||
|
|
|
@ -100,8 +100,7 @@ class PriestOfTheWakeningSunEffect extends OneShotEffect {
|
|||
if (controller.chooseUse(outcome, "Reveal a Dinosaur card?", source, game)) {
|
||||
TargetCardInHand target = new TargetCardInHand(0, 1, filter);
|
||||
if (controller.chooseTarget(outcome, target, source, game) && !target.getTargets().isEmpty()) {
|
||||
Cards cards = new CardsImpl();
|
||||
cards.addAll(target.getTargets());
|
||||
Cards cards = new CardsImpl(target.getTargets());
|
||||
controller.revealCards(sourceObject.getIdName(), cards, game);
|
||||
controller.gainLife(2, game, source);
|
||||
return true;
|
||||
|
|
|
@ -75,8 +75,7 @@ class PuresightMerrowEffect extends OneShotEffect {
|
|||
if (controller != null && sourceObject != null) {
|
||||
Card card = controller.getLibrary().getFromTop(game);
|
||||
if (card != null) {
|
||||
Cards cards = new CardsImpl();
|
||||
cards.add(card);
|
||||
Cards cards = new CardsImpl(card);
|
||||
controller.lookAtCards("Puresight Merrow", cards, game);
|
||||
if (controller.chooseUse(Outcome.Removal, "Do you wish to exile the card from the top of your library?", source, game)) {
|
||||
controller.moveCardToExileWithInfo(card, source.getSourceId(), sourceObject.getIdName(), source.getSourceId(), game, Zone.LIBRARY, true);
|
||||
|
|
|
@ -82,8 +82,7 @@ class RevealingWindEffect extends OneShotEffect {
|
|||
if (controller.chooseTarget(outcome, target, source, game)) {
|
||||
Card card = game.getCard(target.getFirstTarget());
|
||||
if (card != null) {
|
||||
Cards cards = new CardsImpl();
|
||||
cards.add(card);
|
||||
Cards cards = new CardsImpl(card);
|
||||
controller.lookAtCards(sourceObject.getName(), cards, game);
|
||||
game.informPlayers(controller.getLogName() + " look at a face-down attacking creature");
|
||||
}
|
||||
|
|
|
@ -60,8 +60,7 @@ class RevivingVaporsEffect extends OneShotEffect {
|
|||
return false;
|
||||
}
|
||||
|
||||
Cards cards = new CardsImpl();
|
||||
cards.addAll(controller.getLibrary().getTopCards(game, 3));
|
||||
Cards cards = new CardsImpl(controller.getLibrary().getTopCards(game, 3));
|
||||
if (!cards.isEmpty()) {
|
||||
controller.revealCards(sourceObject.getName(), cards, game);
|
||||
Card card = null;
|
||||
|
|
|
@ -113,12 +113,11 @@ class FallEffect extends OneShotEffect {
|
|||
Player targetPlayer = game.getPlayer(getTargetPointer().getFirst(game, source));
|
||||
if (targetPlayer != null) {
|
||||
if (!targetPlayer.getHand().isEmpty()) {
|
||||
Cards cards = new CardsImpl();
|
||||
Card card = targetPlayer.getHand().getRandom(game);
|
||||
if (card == null) {
|
||||
return false;
|
||||
}
|
||||
cards.add(card);
|
||||
Cards cards = new CardsImpl(card);
|
||||
if (targetPlayer.getHand().size() > 1) {
|
||||
do {
|
||||
card = targetPlayer.getHand().getRandom(game);
|
||||
|
|
|
@ -65,8 +65,7 @@ class RootingKavuEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
Cards cards = new CardsImpl();
|
||||
cards.addAll(controller.getGraveyard().getCards(StaticFilters.FILTER_CARD_CREATURE, game));
|
||||
Cards cards = new CardsImpl(controller.getGraveyard().getCards(StaticFilters.FILTER_CARD_CREATURE, game));
|
||||
controller.putCardsOnTopOfLibrary(cards, game, source, false);
|
||||
controller.shuffleLibrary(source, game);
|
||||
return true;
|
||||
|
|
|
@ -71,8 +71,7 @@ class SatyrWayfinderEffect extends OneShotEffect {
|
|||
Player controller = game.getPlayer(source.getControllerId());
|
||||
MageObject sourceObject = game.getObject(source.getSourceId());
|
||||
if (controller != null && sourceObject != null) {
|
||||
Cards cards = new CardsImpl();
|
||||
cards.addAll(controller.getLibrary().getTopCards(game, 4));
|
||||
Cards cards = new CardsImpl(controller.getLibrary().getTopCards(game, 4));
|
||||
boolean properCardFound = cards.count(filterPutInHand, source.getControllerId(), source.getSourceId(), game) > 0;
|
||||
if (!cards.isEmpty()) {
|
||||
controller.revealCards(sourceObject.getIdName(), cards, game);
|
||||
|
|
|
@ -82,10 +82,7 @@ class SearchForSurvivorsEffect extends OneShotEffect {
|
|||
controller.getGraveyard().clear();
|
||||
controller.getGraveyard().addAll(Arrays.asList(shuffled));
|
||||
// end of randomize
|
||||
Cards cards = new CardsImpl();
|
||||
controller.getGraveyard().getCards(game).forEach((card) -> {
|
||||
cards.add(card);
|
||||
});
|
||||
Cards cards = new CardsImpl(controller.getGraveyard().getCards(game));
|
||||
if (!cards.isEmpty()) {
|
||||
Card card = cards.getRandom(game);
|
||||
cards.clear();
|
||||
|
|
|
@ -65,10 +65,7 @@ class SerumPowderReplaceEffect extends ReplacementEffectImpl {
|
|||
}
|
||||
int cardsHand = controller.getHand().size();
|
||||
if (cardsHand > 0){
|
||||
Cards cards = new CardsImpl();
|
||||
for (UUID cardId: controller.getHand()) {
|
||||
cards.add(game.getCard(cardId));
|
||||
}
|
||||
Cards cards = new CardsImpl(controller.getHand());
|
||||
for (Card card: cards.getCards(game)) {
|
||||
card.moveToExile(null, null, source.getSourceId(), game);
|
||||
}
|
||||
|
|
|
@ -73,10 +73,10 @@ class SifterWurmEffect extends OneShotEffect {
|
|||
if (controller != null && sourceObject != null) {
|
||||
controller.scry(3, source, game);
|
||||
|
||||
Cards cards = new CardsImpl();
|
||||
Card card = controller.getLibrary().getFromTop(game);
|
||||
|
||||
if (card != null) {
|
||||
Cards cards = new CardsImpl();
|
||||
cards.add(card);
|
||||
controller.revealCards(sourceObject.getIdName(), cards, game);
|
||||
controller.gainLife(card.getConvertedManaCost(), game, source);
|
||||
|
|
|
@ -86,8 +86,7 @@ class SmokeTellerLookFaceDownEffect extends OneShotEffect {
|
|||
if (faceDownCreature != null) {
|
||||
Permanent copyFaceDown = faceDownCreature.copy();
|
||||
copyFaceDown.setFaceDown(false, game);
|
||||
Cards cards = new CardsImpl();
|
||||
cards.add(copyFaceDown);
|
||||
Cards cards = new CardsImpl(copyFaceDown);
|
||||
player.lookAtCards("face down card - " + mageObject.getName(), cards, game);
|
||||
} else {
|
||||
return false;
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
|
||||
package mage.cards.s;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.LoyaltyAbility;
|
||||
import mage.abilities.common.PlaneswalkerEntersWithLoyaltyCountersAbility;
|
||||
|
@ -13,24 +12,17 @@ import mage.abilities.effects.OneShotEffect;
|
|||
import mage.abilities.effects.common.CreateTokenEffect;
|
||||
import mage.abilities.effects.common.DamageTargetEffect;
|
||||
import mage.abilities.effects.common.GainLifeEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.cards.Cards;
|
||||
import mage.cards.CardsImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SuperType;
|
||||
import mage.constants.Zone;
|
||||
import mage.cards.*;
|
||||
import mage.constants.*;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.token.VampireKnightToken;
|
||||
import mage.players.Player;
|
||||
import mage.players.PlayerList;
|
||||
import mage.target.common.TargetCreatureOrPlaneswalker;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author fireshoes
|
||||
*/
|
||||
public final class SorinGrimNemesis extends CardImpl {
|
||||
|
@ -90,90 +82,91 @@ class SorinGrimNemesisRevealEffect extends OneShotEffect {
|
|||
|
||||
if (player.getLibrary().hasCards()) {
|
||||
Card card = player.getLibrary().getFromTop(game);
|
||||
Cards cards = new CardsImpl();
|
||||
cards.add(card);
|
||||
player.revealCards("Sorin, Grim Nemesis", cards, game);
|
||||
if (card != null) {
|
||||
Cards cards = new CardsImpl();
|
||||
cards.add(card);
|
||||
player.revealCards("Sorin, Grim Nemesis", cards, game);
|
||||
|
||||
if (card != null
|
||||
&& card.moveToZone(Zone.HAND, source.getSourceId(), game, false)) {
|
||||
for (UUID playerId : game.getOpponents(source.getControllerId())) {
|
||||
if (card.getConvertedManaCost() > 0) {
|
||||
Player opponent = game.getPlayer(playerId);
|
||||
if (opponent != null) {
|
||||
opponent.loseLife(card.getConvertedManaCost(), game, false);
|
||||
if (card.moveToZone(Zone.HAND, source.getSourceId(), game, false)) {
|
||||
for (UUID playerId : game.getOpponents(source.getControllerId())) {
|
||||
if (card.getConvertedManaCost() > 0) {
|
||||
Player opponent = game.getPlayer(playerId);
|
||||
if (opponent != null) {
|
||||
opponent.loseLife(card.getConvertedManaCost(), game, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
class SorinXValue implements DynamicValue {
|
||||
class SorinXValue implements DynamicValue {
|
||||
|
||||
private static final SorinXValue defaultValue = new SorinXValue();
|
||||
private static final SorinXValue defaultValue = new SorinXValue();
|
||||
|
||||
@Override
|
||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||
for (Cost cost : sourceAbility.getCosts()) {
|
||||
if (cost instanceof PayVariableLoyaltyCost) {
|
||||
return ((PayVariableLoyaltyCost) cost).getAmount();
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DynamicValue copy() {
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "X";
|
||||
}
|
||||
|
||||
public static SorinXValue getDefault() {
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
|
||||
class SorinTokenEffect extends OneShotEffect {
|
||||
|
||||
SorinTokenEffect() {
|
||||
super(Outcome.GainLife);
|
||||
staticText = "Create a number of 1/1 black Vampire Knight creature tokens with lifelink equal to the highest life total among all players";
|
||||
}
|
||||
|
||||
SorinTokenEffect(final SorinTokenEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
int maxLife = 0;
|
||||
PlayerList playerList = game.getState().getPlayersInRange(source.getControllerId(), game);
|
||||
for (UUID pid : playerList) {
|
||||
Player p = game.getPlayer(pid);
|
||||
if (p != null) {
|
||||
if (maxLife < p.getLife()) {
|
||||
maxLife = p.getLife();
|
||||
@Override
|
||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||
for (Cost cost : sourceAbility.getCosts()) {
|
||||
if (cost instanceof PayVariableLoyaltyCost) {
|
||||
return ((PayVariableLoyaltyCost) cost).getAmount();
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DynamicValue copy() {
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "X";
|
||||
}
|
||||
|
||||
public static SorinXValue getDefault() {
|
||||
return defaultValue;
|
||||
}
|
||||
new CreateTokenEffect(new VampireKnightToken(), maxLife).apply(game, source);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SorinTokenEffect copy() {
|
||||
return new SorinTokenEffect(this);
|
||||
class SorinTokenEffect extends OneShotEffect {
|
||||
|
||||
SorinTokenEffect() {
|
||||
super(Outcome.GainLife);
|
||||
staticText = "Create a number of 1/1 black Vampire Knight creature tokens with lifelink equal to the highest life total among all players";
|
||||
}
|
||||
|
||||
SorinTokenEffect(final SorinTokenEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
int maxLife = 0;
|
||||
PlayerList playerList = game.getState().getPlayersInRange(source.getControllerId(), game);
|
||||
for (UUID pid : playerList) {
|
||||
Player p = game.getPlayer(pid);
|
||||
if (p != null) {
|
||||
if (maxLife < p.getLife()) {
|
||||
maxLife = p.getLife();
|
||||
}
|
||||
}
|
||||
}
|
||||
new CreateTokenEffect(new VampireKnightToken(), maxLife).apply(game, source);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SorinTokenEffect copy() {
|
||||
return new SorinTokenEffect(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -94,8 +94,7 @@ class SphinxOfJwarIsleEffect extends OneShotEffect {
|
|||
|
||||
Card card = player.getLibrary().getFromTop(game);
|
||||
if (card != null) {
|
||||
Cards cards = new CardsImpl();
|
||||
cards.add(card);
|
||||
Cards cards = new CardsImpl(card);
|
||||
player.lookAtCards("Sphinx of Jwar Isle", cards, game);
|
||||
} else {
|
||||
return false;
|
||||
|
|
|
@ -116,8 +116,7 @@ class SpyNetworkFaceDownEffect extends OneShotEffect {
|
|||
if (faceDownCreature != null) {
|
||||
Permanent copyFaceDown = faceDownCreature.copy();
|
||||
copyFaceDown.setFaceDown(false, game);
|
||||
Cards cards = new CardsImpl();
|
||||
cards.add(copyFaceDown);
|
||||
Cards cards = new CardsImpl(copyFaceDown);
|
||||
controller.lookAtCards("face down card - " + mageObject.getName(), cards, game);
|
||||
game.informPlayers(controller.getLogName() + " looks at a face down creature controlled by " + player.getLogName());
|
||||
}
|
||||
|
|
|
@ -71,8 +71,7 @@ class SteamAuguryEffect extends OneShotEffect {
|
|||
return false;
|
||||
}
|
||||
|
||||
Cards cards = new CardsImpl();
|
||||
cards.addAll(controller.getLibrary().getTopCards(game, 5));
|
||||
Cards cards = new CardsImpl(controller.getLibrary().getTopCards(game, 5));
|
||||
controller.revealCards(sourceObject.getIdName(), cards, game);
|
||||
|
||||
Player opponent;
|
||||
|
|
|
@ -62,8 +62,7 @@ class StompingSlabsEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
Cards cards = new CardsImpl();
|
||||
cards.addAll(controller.getLibrary().getTopCards(game, 7));
|
||||
Cards cards = new CardsImpl(controller.getLibrary().getTopCards(game, 7));
|
||||
if (!cards.isEmpty()) {
|
||||
controller.revealCards("Stomping Slabs", cards, game);
|
||||
boolean stompingSlabsFound = false;
|
||||
|
|
|
@ -68,9 +68,9 @@ class StrongarmTacticsEffect extends OneShotEffect {
|
|||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
int numberOfCardsToDiscard = Math.min(1, player.getHand().size());
|
||||
Cards cards = new CardsImpl();
|
||||
Target target = new TargetDiscard(numberOfCardsToDiscard, numberOfCardsToDiscard, new FilterCard(), playerId);
|
||||
player.chooseTarget(outcome, target, source, game);
|
||||
Cards cards = new CardsImpl();
|
||||
cards.addAll(target.getTargets());
|
||||
cardsToDiscard.put(playerId, cards);
|
||||
}
|
||||
|
|
|
@ -133,8 +133,7 @@ class SummoningTrapEffect extends OneShotEffect {
|
|||
if (controller == null) {
|
||||
return false;
|
||||
}
|
||||
Cards cards = new CardsImpl();
|
||||
cards.addAll(controller.getLibrary().getTopCards(game, 7));
|
||||
Cards cards = new CardsImpl(controller.getLibrary().getTopCards(game, 7));
|
||||
if (!cards.isEmpty()) {
|
||||
TargetCard target = new TargetCard(Zone.LIBRARY,
|
||||
new FilterCreatureCard(
|
||||
|
|
|
@ -117,8 +117,7 @@ class SunbirdsInvocationEffect extends OneShotEffect {
|
|||
return false;
|
||||
}
|
||||
int xValue = spell.getConvertedManaCost();
|
||||
Cards cards = new CardsImpl();
|
||||
cards.addAll(controller.getLibrary().getTopCards(game, xValue));
|
||||
Cards cards = new CardsImpl(controller.getLibrary().getTopCards(game, xValue));
|
||||
if (!cards.isEmpty()) {
|
||||
controller.revealCards(sourceObject.getIdName(), cards, game);
|
||||
|
||||
|
|
|
@ -75,10 +75,7 @@ class TalentOfTheTelepathEffect extends OneShotEffect {
|
|||
MageObject sourceObject = source.getSourceObject(game);
|
||||
if (targetOpponent != null && sourceObject != null) {
|
||||
Set<Card> allCards = targetOpponent.getLibrary().getTopCards(game, 7);
|
||||
Cards cards = new CardsImpl();
|
||||
for (Card card : allCards) {
|
||||
cards.add(card);
|
||||
}
|
||||
Cards cards = new CardsImpl(allCards);
|
||||
targetOpponent.revealCards(sourceObject.getIdName() + " - " + targetOpponent.getName() + "'s top library cards", cards, game);
|
||||
for (Card card : allCards) {
|
||||
if (filter.match(card, game)) {
|
||||
|
|
|
@ -66,8 +66,7 @@ class TellingTimeEffect extends OneShotEffect {
|
|||
return false;
|
||||
}
|
||||
|
||||
Cards cards = new CardsImpl();
|
||||
cards.addAll(controller.getLibrary().getTopCards(game, 3));
|
||||
Cards cards = new CardsImpl(controller.getLibrary().getTopCards(game, 3));
|
||||
controller.lookAtCards(sourceObject.getIdName(), cards, game);
|
||||
if (cards.isEmpty()) {
|
||||
return true;
|
||||
|
|
|
@ -65,9 +65,8 @@ class TemporalApertureEffect extends OneShotEffect {
|
|||
if (controller != null) {
|
||||
controller.shuffleLibrary(source, game);
|
||||
Card topCard = controller.getLibrary().getFromTop(game);
|
||||
Cards cards = new CardsImpl();
|
||||
if (topCard != null) {
|
||||
cards.add(topCard);
|
||||
Cards cards = new CardsImpl(topCard);
|
||||
controller.revealCards("Top card of " + controller.getName() + "'s library revealed", cards, game);
|
||||
ContinuousEffect effect = new TemporalApertureTopCardCastEffect(topCard);
|
||||
game.addEffect(effect, source);
|
||||
|
|
|
@ -102,8 +102,7 @@ class ThoughtLashExileLibraryEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
Cards cards = new CardsImpl();
|
||||
cards.addAll(controller.getLibrary().getTopCards(game, controller.getLibrary().size()));
|
||||
Cards cards = new CardsImpl(controller.getLibrary().getTopCards(game, controller.getLibrary().size()));
|
||||
controller.moveCards(cards, Zone.EXILED, source, game);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -78,8 +78,7 @@ class ThoughtpickerWitchEffect extends OneShotEffect {
|
|||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Player opponent = game.getPlayer(this.getTargetPointer().getFirst(game, source));
|
||||
if (controller != null && opponent != null) {
|
||||
Cards cards = new CardsImpl();
|
||||
cards.addAll(opponent.getLibrary().getTopCards(game, 2));
|
||||
Cards cards = new CardsImpl(opponent.getLibrary().getTopCards(game, 2));
|
||||
if (!cards.isEmpty()) {
|
||||
TargetCard target = new TargetCardInLibrary(new FilterCard("card to exile"));
|
||||
if (controller.choose(Outcome.Exile, cards, target, game)) {
|
||||
|
|
|
@ -66,8 +66,7 @@ class TruthOrTaleEffect extends OneShotEffect {
|
|||
return false;
|
||||
}
|
||||
|
||||
Cards cards = new CardsImpl();
|
||||
cards.addAll(controller.getLibrary().getTopCards(game, 5));
|
||||
Cards cards = new CardsImpl(controller.getLibrary().getTopCards(game, 5));
|
||||
controller.revealCards(sourceObject.getIdName(), cards, game);
|
||||
|
||||
Player opponent;
|
||||
|
|
|
@ -141,8 +141,7 @@ class UneshCriosphinxSovereignEffect extends OneShotEffect {
|
|||
return false;
|
||||
}
|
||||
|
||||
Cards cards = new CardsImpl();
|
||||
cards.addAll(controller.getLibrary().getTopCards(game, 4));
|
||||
Cards cards = new CardsImpl(controller.getLibrary().getTopCards(game, 4));
|
||||
controller.revealCards(sourceObject.getName(), cards, game);
|
||||
|
||||
Set<UUID> opponents = game.getOpponents(source.getControllerId());
|
||||
|
|
|
@ -81,8 +81,7 @@ class VesselOfNascencyEffect extends OneShotEffect {
|
|||
Player controller = game.getPlayer(source.getControllerId());
|
||||
MageObject sourceObject = game.getObject(source.getSourceId());
|
||||
if (controller != null && sourceObject != null) {
|
||||
Cards cards = new CardsImpl();
|
||||
cards.addAll(controller.getLibrary().getTopCards(game, 4));
|
||||
Cards cards = new CardsImpl(controller.getLibrary().getTopCards(game, 4));
|
||||
boolean properCardFound = cards.count(filterPutInHand, source.getControllerId(), source.getSourceId(), game) > 0;
|
||||
if (!cards.isEmpty()) {
|
||||
controller.revealCards(sourceObject.getName(), cards, game);
|
||||
|
|
|
@ -67,8 +67,7 @@ class ViviensInvocationEffect extends OneShotEffect {
|
|||
if (controller == null) {
|
||||
return false;
|
||||
}
|
||||
Cards cards = new CardsImpl();
|
||||
cards.addAll(controller.getLibrary().getTopCards(game, 7));
|
||||
Cards cards = new CardsImpl(controller.getLibrary().getTopCards(game, 7));
|
||||
if (!cards.isEmpty()) {
|
||||
TargetCard target = new TargetCard(
|
||||
Zone.LIBRARY,
|
||||
|
|
|
@ -64,8 +64,7 @@ class WildEvocationEffect extends OneShotEffect {
|
|||
if (player != null && sourceObject != null) {
|
||||
Card card = player.getHand().getRandom(game);
|
||||
if (card != null) {
|
||||
Cards cards = new CardsImpl();
|
||||
cards.add(card);
|
||||
Cards cards = new CardsImpl(card);
|
||||
player.revealCards(sourceObject.getIdName() + " Turn: " + game.getTurnNum(), cards, game);
|
||||
if (card.isLand()) {
|
||||
player.moveCards(card, Zone.BATTLEFIELD, source, game);
|
||||
|
|
|
@ -87,8 +87,7 @@ class WildResearchEffect extends OneShotEffect {
|
|||
Card card = controller.getLibrary().remove(target.getFirstTarget(), game);
|
||||
if (card != null) {
|
||||
controller.moveCards(card, Zone.HAND, source, game);
|
||||
Cards cards = new CardsImpl();
|
||||
cards.add(card);
|
||||
Cards cards = new CardsImpl(card);
|
||||
controller.revealCards(sourceObject.getIdName(), cards, game, true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -74,8 +74,7 @@ class WuSpyEffect extends OneShotEffect {
|
|||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Player opponent = game.getPlayer(this.getTargetPointer().getFirst(game, source));
|
||||
if (controller != null && opponent != null) {
|
||||
Cards cards = new CardsImpl();
|
||||
cards.addAll(opponent.getLibrary().getTopCards(game, 2));
|
||||
Cards cards = new CardsImpl(opponent.getLibrary().getTopCards(game, 2));
|
||||
if (!cards.isEmpty()) {
|
||||
TargetCard target = new TargetCardInLibrary(new FilterCard("card to put into graveyard"));
|
||||
controller.choose(Outcome.Benefit, cards, target, game);
|
||||
|
|
|
@ -73,8 +73,7 @@ class ZombieMobEffect extends OneShotEffect {
|
|||
if (amount > 0) {
|
||||
permanent.addCounters(CounterType.P1P1.createInstance(amount), source, game);
|
||||
}
|
||||
Cards cards = new CardsImpl();
|
||||
cards.addAll(controller.getGraveyard().getCards(filter, game));
|
||||
Cards cards = new CardsImpl(controller.getGraveyard().getCards(filter, game));
|
||||
controller.moveCards(cards, Zone.EXILED, source, game);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -65,8 +65,7 @@ public class MiracleWatcher extends Watcher {
|
|||
if (ability instanceof MiracleAbility) {
|
||||
Player controller = game.getPlayer(ability.getControllerId());
|
||||
if (controller != null) {
|
||||
Cards cards = new CardsImpl();
|
||||
cards.add(card);
|
||||
Cards cards = new CardsImpl(card);
|
||||
controller.lookAtCards("Miracle", cards, game);
|
||||
if (controller.chooseUse(Outcome.Benefit, "Reveal " + card.getLogName() + " to be able to use Miracle?", ability, game)) {
|
||||
controller.revealCards("Miracle", cards, game);
|
||||
|
|
Loading…
Reference in a new issue