Code cleanup

This commit is contained in:
Oleg Agafonov 2020-01-08 05:18:21 +04:00
parent ca4a4528fb
commit 85e65c8f44
10 changed files with 42 additions and 78 deletions

View file

@ -398,7 +398,7 @@ public abstract class ContinuousEffectImpl extends EffectImpl implements Continu
}
}
public boolean isCanLookAtNextTopLibraryCard(Game game) {
public boolean canLookAtNextTopLibraryCard(Game game) {
// If the top card of your library changes while youre casting a spell, playing a land, or activating an ability,
// you cant look at the new top card until you finish doing so. This means that if you cast the top card of
// your library, you cant look at the next one until youre done paying for that spell. (2019-05-03)

View file

@ -20,7 +20,6 @@ public class ChooseACardNameEffect extends OneShotEffect {
public static final String INFO_KEY = "NAMED_CARD";
public enum TypeOfName {
ALL,
NOT_BASIC_LAND_NAME,
NONBASIC_LAND_NAME,

View file

@ -39,7 +39,7 @@ public class LookAtTopCardOfLibraryAnyTimeEffect extends ContinuousEffectImpl {
if (obj == null) {
return false;
}
if (!isCanLookAtNextTopLibraryCard(game)) {
if (!canLookAtNextTopLibraryCard(game)) {
return false;
}
controller.lookAtCards("Top card of " + obj.getIdName() + " controller's library", topCard, game);

View file

@ -44,11 +44,11 @@ public class PlayWithTheTopCardRevealedEffect extends ContinuousEffectImpl {
if (allPlayers) {
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
Player player = game.getPlayer(playerId);
if (player != null && isCanLookAtNextTopLibraryCard(game)) {
if (player != null && canLookAtNextTopLibraryCard(game)) {
player.setTopCardRevealed(true);
}
}
} else if (isCanLookAtNextTopLibraryCard(game)) {
} else if (canLookAtNextTopLibraryCard(game)) {
controller.setTopCardRevealed(true);
}
return true;

View file

@ -456,6 +456,8 @@ public interface Player extends MageItem, Copyable<Player> {
/**
* Adds the cards to the reveal window and adds the source object's id name
* to the title bar of the revealed cards window
* <p>
* Warning, if you use it from continuous effect, then check with extra call isCanLookAtNextTopLibraryCard
*
* @param source
* @param name
@ -472,6 +474,8 @@ public interface Player extends MageItem, Copyable<Player> {
/**
* Adds the cards to the look window and adds the source object's id name to
* the title bar of the lookedAt window
* <p>
* Warning, if you use it from continuous effect, then check with extra call isCanLookAtNextTopLibraryCard
*
* @param source
* @param name

View file

@ -14,7 +14,6 @@ import mage.watchers.Watcher;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.UUID;
/**