mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
- CheckStyle.
This commit is contained in:
@@ -286,7 +286,7 @@ public class Deck extends DeckBase {
|
||||
out.add(String.format("%s", "[sideboard]"));
|
||||
out.addAll(Deck.writeCardPool(this.getSideboard()));
|
||||
|
||||
if ( getCommander() != null ) {
|
||||
if (getCommander() != null) {
|
||||
out.add(String.format("%s", "[commander]"));
|
||||
out.add(Deck.serializeSingleCard(getCommander(), 1));
|
||||
}
|
||||
@@ -352,44 +352,52 @@ public class Deck extends DeckBase {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(type == GameType.Commander)
|
||||
{//Must contain exactly 1 legendary Commander and no sideboard.
|
||||
//TODO:Enforce color identity
|
||||
if ( null == getCommander())
|
||||
return false;
|
||||
if (type == GameType.Commander) { //Must contain exactly 1 legendary Commander and no sideboard.
|
||||
|
||||
if(!getCommander().getCard().getType().isLegendary())
|
||||
//TODO:Enforce color identity
|
||||
if (null == getCommander()) {
|
||||
return false;
|
||||
}
|
||||
if (!getCommander().getCard().getType().isLegendary()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
//No sideboarding in Commander
|
||||
if(!getSideboard().isEmpty())
|
||||
if (!getSideboard().isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
else if(type == GameType.Planechase)
|
||||
{//Must contain at least 10 planes/phenomenons, but max 2 phenomenons. Singleton.
|
||||
if(getPlanes().countAll() < 10)
|
||||
return false;
|
||||
int phenoms = 0;
|
||||
for(CardPrinted cp : getPlanes().toFlatList())
|
||||
{
|
||||
if(cp.getType().contains("Phenomenon"))
|
||||
phenoms++;
|
||||
if(getPlanes().count(cp) > 1)
|
||||
return false;
|
||||
}
|
||||
if(phenoms > 2)
|
||||
return false;
|
||||
}
|
||||
else if(type == GameType.Archenemy)
|
||||
{//Must contain at least 20 schemes, max 2 of each.
|
||||
if(getSchemes().countAll() < 20)
|
||||
return false;
|
||||
else if (type == GameType.Planechase) { //Must contain at least 10 planes/phenomenons, but max 2 phenomenons. Singleton.
|
||||
|
||||
for(CardPrinted cp : getSchemes().toFlatList())
|
||||
{
|
||||
if(getSchemes().count(cp) > 2)
|
||||
if (getPlanes().countAll() < 10) {
|
||||
return false;
|
||||
}
|
||||
int phenoms = 0;
|
||||
for (CardPrinted cp : getPlanes().toFlatList()) {
|
||||
|
||||
if (cp.getType().contains("Phenomenon")) {
|
||||
phenoms++;
|
||||
}
|
||||
if (getPlanes().count(cp) > 1) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (phenoms > 2) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (type == GameType.Archenemy) { //Must contain at least 20 schemes, max 2 of each.
|
||||
|
||||
if (getSchemes().countAll() < 20) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (CardPrinted cp : getSchemes().toFlatList()) {
|
||||
|
||||
if (getSchemes().count(cp) > 2) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -55,7 +55,7 @@ public class GameNew {
|
||||
final Card card = cardPrinted.toForgeCard(player);
|
||||
|
||||
// apply random pictures for cards
|
||||
if ( player.isComputer() ) {
|
||||
if (player.isComputer()) {
|
||||
final int cntVariants = cardPrinted.getCard().getEditionInfo(cardPrinted.getEdition()).getCopiesCount();
|
||||
if (cntVariants > 1) {
|
||||
card.setRandomPicture(generator.nextInt(cntVariants - 1) + 1);
|
||||
@@ -70,15 +70,16 @@ public class GameNew {
|
||||
}
|
||||
|
||||
if (!useAnte && card.hasKeyword("Remove CARDNAME from your deck before playing if you're not playing for ante.")) {
|
||||
if(!removedAnteCards.containsKey(player))
|
||||
if (!removedAnteCards.containsKey(player)) {
|
||||
removedAnteCards.put(player, new ArrayList<String>());
|
||||
}
|
||||
removedAnteCards.get(player).add(card.getName());
|
||||
} else {
|
||||
library.add(card);
|
||||
}
|
||||
|
||||
// mark card as difficult for AI to play
|
||||
if ( player.isComputer() && card.getSVar("RemAIDeck").equals("True") && !rAICards.contains(card.getName())) {
|
||||
if (player.isComputer() && card.getSVar("RemAIDeck").equals("True") && !rAICards.contains(card.getName())) {
|
||||
rAICards.add(card.getName());
|
||||
// get card picture so that it is in the image cache
|
||||
// ImageCache.getImage(card);
|
||||
@@ -88,13 +89,14 @@ public class GameNew {
|
||||
|
||||
// Shuffling
|
||||
// Ai may cheat
|
||||
if ( player.isComputer() && Singletons.getModel().getPreferences().getPrefBoolean(FPref.UI_SMOOTH_LAND) ) {
|
||||
if (player.isComputer() && Singletons.getModel().getPreferences().getPrefBoolean(FPref.UI_SMOOTH_LAND)) {
|
||||
// do this instead of shuffling Computer's deck
|
||||
final Iterable<Card> c1 = GameNew.smoothComputerManaCurve(player.getCardsIn(ZoneType.Library));
|
||||
player.getZone(ZoneType.Library).setCards(c1);
|
||||
} else
|
||||
} else {
|
||||
player.shuffle();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -104,7 +106,7 @@ public class GameNew {
|
||||
* TODO: Accept something like match state as parameter. Match should be aware of players,
|
||||
* their decks and other special starting conditions.
|
||||
*/
|
||||
public static void newGame(final Map<Player, PlayerStartConditions> playersConditions, final GameState game, final boolean canRandomFoil ) {
|
||||
public static void newGame(final Map<Player, PlayerStartConditions> playersConditions, final GameState game, final boolean canRandomFoil) {
|
||||
Singletons.getModel().getMatch().getInput().clearInput();
|
||||
|
||||
Card.resetUniqueNumber();
|
||||
@@ -118,7 +120,7 @@ public class GameNew {
|
||||
final Map<Player, List<String>> removedAnteCards = new HashMap<Player, List<String>>();
|
||||
final List<String> rAICards = new ArrayList<String>();
|
||||
|
||||
for( Entry<Player, PlayerStartConditions> p : playersConditions.entrySet() ) {
|
||||
for (Entry<Player, PlayerStartConditions> p : playersConditions.entrySet()) {
|
||||
final Player player = p.getKey();
|
||||
player.setStartingLife(p.getValue().getStartingLife());
|
||||
int hand = p.getValue().getStartingHand();
|
||||
@@ -164,8 +166,8 @@ public class GameNew {
|
||||
|
||||
if (!removedAnteCards.isEmpty()) {
|
||||
StringBuilder ante = new StringBuilder("The following ante cards were removed:\n\n");
|
||||
for(Entry<Player, List<String>> ants : removedAnteCards.entrySet() ) {
|
||||
ante.append(buildFourColumnList( "From the " + ants.getKey().getName() + "'s deck:", ants.getValue()));
|
||||
for (Entry<Player, List<String>> ants : removedAnteCards.entrySet()) {
|
||||
ante.append(buildFourColumnList("From the " + ants.getKey().getName() + "'s deck:", ants.getValue()));
|
||||
}
|
||||
JOptionPane.showMessageDialog(null, ante.toString(), "", JOptionPane.INFORMATION_MESSAGE);
|
||||
}
|
||||
@@ -198,7 +200,7 @@ public class GameNew {
|
||||
GameAction action = game.getAction();
|
||||
|
||||
|
||||
for( Entry<Player, PlayerStartConditions> p : playersConditions.entrySet() ) {
|
||||
for (Entry<Player, PlayerStartConditions> p : playersConditions.entrySet()) {
|
||||
final Player player = p.getKey();
|
||||
player.setStartingLife(p.getValue().getStartingLife());
|
||||
player.setNumLandsPlayed(0);
|
||||
@@ -218,7 +220,7 @@ public class GameNew {
|
||||
|
||||
PlayerZone library = player.getZone(ZoneType.Library);
|
||||
List<Card> newLibrary = playerLibraries.get(player);
|
||||
for(Card c : newLibrary) {
|
||||
for (Card c : newLibrary) {
|
||||
action.moveTo(library, c);
|
||||
}
|
||||
|
||||
@@ -287,7 +289,7 @@ public class GameNew {
|
||||
control.setInput(new InputMulligan());
|
||||
} // newGame()
|
||||
|
||||
private static String buildFourColumnList(String firstLine, List<String> cAnteRemoved ) {
|
||||
private static String buildFourColumnList(String firstLine, List<String> cAnteRemoved) {
|
||||
StringBuilder sb = new StringBuilder(firstLine);
|
||||
sb.append("\n");
|
||||
for (int i = 0; i < cAnteRemoved.size(); i++) {
|
||||
@@ -387,9 +389,10 @@ public class GameNew {
|
||||
else {
|
||||
sb.append(" lost the last game.");
|
||||
}
|
||||
if ( goesFirst.isHuman() ) {
|
||||
if( !humanPlayOrDraw(sb.toString()) )
|
||||
if (goesFirst.isHuman()) {
|
||||
if (!humanPlayOrDraw(sb.toString())) {
|
||||
goesFirst = goesFirst.getOpponent();
|
||||
}
|
||||
} else {
|
||||
sb.append("\nComputer Going First");
|
||||
JOptionPane.showMessageDialog(null, sb.toString(),
|
||||
|
||||
@@ -21,7 +21,7 @@ public class MatchStartHelper {
|
||||
private final Map<LobbyPlayer, PlayerStartConditions> players = new HashMap<LobbyPlayer, PlayerStartConditions>();
|
||||
|
||||
public void addPlayer(final LobbyPlayer player, final PlayerStartConditions c) {
|
||||
players.put(player,c);
|
||||
players.put(player, c);
|
||||
}
|
||||
|
||||
public void addPlayer(final LobbyPlayer player, final Deck deck) {
|
||||
@@ -29,8 +29,8 @@ public class MatchStartHelper {
|
||||
players.put(player, start);
|
||||
}
|
||||
|
||||
public void addVanguardPlayer(final LobbyPlayer player, final Deck deck, final CardPrinted avatar)
|
||||
{
|
||||
public void addVanguardPlayer(final LobbyPlayer player, final Deck deck, final CardPrinted avatar) {
|
||||
|
||||
PlayerStartConditions start = new PlayerStartConditions(deck);
|
||||
|
||||
start.setStartingLife(start.getStartingLife() + avatar.getCard().getLife());
|
||||
@@ -50,8 +50,8 @@ public class MatchStartHelper {
|
||||
players.put(player, start);
|
||||
}
|
||||
|
||||
public Map<LobbyPlayer, PlayerStartConditions> getPlayerMap()
|
||||
{
|
||||
public Map<LobbyPlayer, PlayerStartConditions> getPlayerMap() {
|
||||
|
||||
return players;
|
||||
}
|
||||
|
||||
|
||||
@@ -488,9 +488,10 @@ public class MagicStack extends MyObservable {
|
||||
//GuiDisplayUtil.updateGUI();
|
||||
} else {
|
||||
if (sp.getOptionalAdditionalCosts() != null) {
|
||||
for (String s : sp.getOptionalAdditionalCosts())
|
||||
for (String s : sp.getOptionalAdditionalCosts()) {
|
||||
sp.getSourceCard().addOptionalAdditionalCostsPaid(s);
|
||||
}
|
||||
}
|
||||
if (sp.getSourceCard().isCopiedSpell()) {
|
||||
this.push(sp);
|
||||
} else if (!sp.isMultiKicker() && !sp.isReplicate() && !sp.isXCost()) {
|
||||
@@ -1008,13 +1009,13 @@ public class MagicStack extends MyObservable {
|
||||
//Move rebounding card to exile
|
||||
source = game.getAction().exile(source);
|
||||
|
||||
source.setSVar("ReboundAbilityTrigger", "DB$ Play | Defined$ Self " +
|
||||
"| WithoutManaCost$ True | Optional$ True");
|
||||
source.setSVar("ReboundAbilityTrigger", "DB$ Play | Defined$ Self "
|
||||
+ "| WithoutManaCost$ True | Optional$ True");
|
||||
|
||||
//Setup a Rebound-trigger
|
||||
final Trigger reboundTrigger = forge.card.trigger.TriggerHandler.parseTrigger("Mode$ Phase " +
|
||||
"| Phase$ Upkeep | ValidPlayer$ You | OptionalDecider$ You | Execute$ ReboundAbilityTrigger " +
|
||||
"| TriggerDescription$ At the beginning of your next upkeep, you may cast " + source.toString()
|
||||
final Trigger reboundTrigger = forge.card.trigger.TriggerHandler.parseTrigger("Mode$ Phase "
|
||||
+ "| Phase$ Upkeep | ValidPlayer$ You | OptionalDecider$ You | Execute$ ReboundAbilityTrigger "
|
||||
+ "| TriggerDescription$ At the beginning of your next upkeep, you may cast " + source.toString()
|
||||
+ " without paying it's manacost.", source, true);
|
||||
|
||||
game.getTriggerHandler().registerDelayedTrigger(reboundTrigger);
|
||||
@@ -1370,12 +1371,11 @@ public class MagicStack extends MyObservable {
|
||||
} else {
|
||||
this.add(next);
|
||||
}
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
// Otherwise, gave a dual list form to create instead of needing to do it one at a time
|
||||
List<SpellAbility> orderedSAs = GuiChoose.getOrderChoices("Select order for Simultaneous Spell Abilities", "Resolve first", 0, activePlayerSAs, null, null);
|
||||
int size = orderedSAs.size();
|
||||
for(int i = size-1; i >= 0; i--){
|
||||
for (int i = size - 1; i >= 0; i--) {
|
||||
SpellAbility next = orderedSAs.get(i);
|
||||
if (next.isTrigger()) {
|
||||
game.getAction().playSpellAbility(next);
|
||||
|
||||
@@ -280,7 +280,7 @@ public class PlayerZoneBattlefield extends PlayerZone {
|
||||
this.leavesTrigger = b;
|
||||
}
|
||||
|
||||
private static Predicate<Card> isNotPhased = new Predicate<Card>(){
|
||||
private static Predicate<Card> isNotPhased = new Predicate<Card>() {
|
||||
@Override
|
||||
public boolean apply(Card crd) {
|
||||
return !crd.isPhasedOut();
|
||||
|
||||
@@ -207,8 +207,9 @@ public class Zone extends MyObservable implements IZone, Observer, java.io.Seria
|
||||
@Override
|
||||
public final void setCards(final Iterable<Card> cards) {
|
||||
cardList.clear();
|
||||
for(Card c : cards)
|
||||
for (Card c : cards) {
|
||||
cardList.add(c);
|
||||
}
|
||||
this.update();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user