mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 19:58:00 +00:00
- CheckStyle.
This commit is contained in:
@@ -6,7 +6,7 @@ import java.util.List;
|
|||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
|
|
||||||
public enum PhaseType {
|
public enum PhaseType {
|
||||||
UNTAP("Untap", 0),
|
UNTAP("Untap", 0),
|
||||||
UPKEEP("Upkeep", 1),
|
UPKEEP("Upkeep", 1),
|
||||||
@@ -23,27 +23,28 @@ public enum PhaseType {
|
|||||||
MAIN2("Main2", 12),
|
MAIN2("Main2", 12),
|
||||||
END_OF_TURN("End of Turn", 13),
|
END_OF_TURN("End of Turn", 13),
|
||||||
CLEANUP("Cleanup", 14);
|
CLEANUP("Cleanup", 14);
|
||||||
|
|
||||||
public final String Name;
|
public final String Name;
|
||||||
public final int Index;
|
public final int Index;
|
||||||
private PhaseType(String name, int index) {
|
private PhaseType(String name, int index) {
|
||||||
Name = name;
|
Name = name;
|
||||||
Index = index;
|
Index = index;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PhaseType getByIndex(int idx) {
|
public static PhaseType getByIndex(int idx) {
|
||||||
for( PhaseType ph : PhaseType.values() )
|
for (PhaseType ph : PhaseType.values()) {
|
||||||
{
|
|
||||||
if ( ph.Index == idx ) return ph;
|
if (ph.Index == idx) {
|
||||||
|
return ph;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
throw new InvalidParameterException("No PhaseType found with index " + idx );
|
throw new InvalidParameterException("No PhaseType found with index " + idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public final boolean isAfter(final PhaseType phase) {
|
public final boolean isAfter(final PhaseType phase) {
|
||||||
return this.Index > phase.Index;
|
return this.Index > phase.Index;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final boolean isMain() {
|
public final boolean isMain() {
|
||||||
return this == MAIN1 || this == MAIN2;
|
return this == MAIN1 || this == MAIN2;
|
||||||
}
|
}
|
||||||
@@ -100,4 +101,4 @@ public enum PhaseType {
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -372,7 +372,7 @@ public class PhaseUtil {
|
|||||||
*/
|
*/
|
||||||
public static boolean isBeforeAttackersAreDeclared() {
|
public static boolean isBeforeAttackersAreDeclared() {
|
||||||
final PhaseType phase = Singletons.getModel().getGameState().getPhaseHandler().getPhase();
|
final PhaseType phase = Singletons.getModel().getGameState().getPhaseHandler().getPhase();
|
||||||
return phase == PhaseType.UNTAP || phase == PhaseType.UPKEEP || phase == PhaseType.DRAW
|
return phase == PhaseType.UNTAP || phase == PhaseType.UPKEEP || phase == PhaseType.DRAW
|
||||||
|| phase == PhaseType.MAIN1 || phase == PhaseType.COMBAT_BEGIN;
|
|| phase == PhaseType.MAIN1 || phase == PhaseType.COMBAT_BEGIN;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -391,8 +391,8 @@ public class PhaseUtil {
|
|||||||
// Index of field; computer is 0, human is 1
|
// Index of field; computer is 0, human is 1
|
||||||
int i = p.isComputer() ? 0 : 1;
|
int i = p.isComputer() ? 0 : 1;
|
||||||
|
|
||||||
switch(s)
|
switch(s) {
|
||||||
{
|
|
||||||
case UPKEEP:
|
case UPKEEP:
|
||||||
lbl = t.getFieldControls().get(i).getView().getLblUpkeep();
|
lbl = t.getFieldControls().get(i).getView().getLblUpkeep();
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -96,10 +96,10 @@ public class ComputerAIInput extends Input {
|
|||||||
|
|
||||||
if (AllZone.getStack().size() > 0) {
|
if (AllZone.getStack().size() > 0) {
|
||||||
this.computer.stackNotEmpty();
|
this.computer.stackNotEmpty();
|
||||||
} else {
|
} else {
|
||||||
switch(phase) {
|
switch(phase) {
|
||||||
case MAIN1:
|
case MAIN1:
|
||||||
Log.debug("Computer main1");
|
Log.debug("Computer main1");
|
||||||
this.computer.main();
|
this.computer.main();
|
||||||
break;
|
break;
|
||||||
case COMBAT_BEGIN:
|
case COMBAT_BEGIN:
|
||||||
|
|||||||
@@ -72,4 +72,4 @@ public enum ZoneType {
|
|||||||
public boolean isKnown() {
|
public boolean isKnown() {
|
||||||
return !holdsHiddenInfo;
|
return !holdsHiddenInfo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -77,7 +77,8 @@ public final class MenuCommon extends MenuBase<Deck> {
|
|||||||
// The only remaining reference to global variable!
|
// The only remaining reference to global variable!
|
||||||
|
|
||||||
|
|
||||||
randomDeck.getMain().addAllFlat(Predicate.not(CardRules.Predicates.Presets.IS_BASIC_LAND).random(CardDb.instance().getAllUniqueCards(), CardPrinted.FN_GET_RULES, 15*5));
|
randomDeck.getMain().addAllFlat(Predicate.not(CardRules.Predicates.Presets.IS_BASIC_LAND)
|
||||||
|
.random(CardDb.instance().getAllUniqueCards(), CardPrinted.FN_GET_RULES, 15 * 5));
|
||||||
randomDeck.getMain().add("Plains");
|
randomDeck.getMain().add("Plains");
|
||||||
randomDeck.getMain().add("Island");
|
randomDeck.getMain().add("Island");
|
||||||
randomDeck.getMain().add("Swamp");
|
randomDeck.getMain().add("Swamp");
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ public enum VSubmenuPreferences implements IVSubmenu {
|
|||||||
|
|
||||||
pnlPrefs.add(cbStackLand, regularConstraints);
|
pnlPrefs.add(cbStackLand, regularConstraints);
|
||||||
pnlPrefs.add(new NoteLabel("Minimizes mana lock in AI hands, giving a slight advantage to computer."), regularConstraints);
|
pnlPrefs.add(new NoteLabel("Minimizes mana lock in AI hands, giving a slight advantage to computer."), regularConstraints);
|
||||||
|
|
||||||
pnlPrefs.add(cbManaBurn, regularConstraints);
|
pnlPrefs.add(cbManaBurn, regularConstraints);
|
||||||
pnlPrefs.add(new NoteLabel("Play with mana burn (from pre-Magic 2010 rules)."), regularConstraints);
|
pnlPrefs.add(new NoteLabel("Play with mana burn (from pre-Magic 2010 rules)."), regularConstraints);
|
||||||
|
|
||||||
|
|||||||
@@ -231,9 +231,9 @@ public class ItemPool<T extends InventoryItem> extends ItemPoolView<T> {
|
|||||||
for (final T e : flat) {
|
for (final T e : flat) {
|
||||||
this.remove(e);
|
this.remove(e);
|
||||||
}
|
}
|
||||||
// need not set out-of-sync: either remove did set, or nothing was removed
|
// need not set out-of-sync: either remove did set, or nothing was removed
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Clear.
|
* Clear.
|
||||||
|
|||||||
@@ -276,10 +276,10 @@ public class PlayArea extends CardPanelContainer implements CardPanelMouseListen
|
|||||||
// Store the current rows and others.
|
// Store the current rows and others.
|
||||||
final List<CardStackRow> storedRows = new ArrayList<CardStackRow>(this.rows.size());
|
final List<CardStackRow> storedRows = new ArrayList<CardStackRow>(this.rows.size());
|
||||||
for (final CardStackRow row : this.rows) {
|
for (final CardStackRow row : this.rows) {
|
||||||
try{
|
try {
|
||||||
storedRows.add((CardStackRow) row.clone());
|
storedRows.add((CardStackRow) row.clone());
|
||||||
}
|
}
|
||||||
catch(NullPointerException e){
|
catch (NullPointerException e) {
|
||||||
System.out.println("Null pointer exception in Row Spacing. Possibly also part of the issue.");
|
System.out.println("Null pointer exception in Row Spacing. Possibly also part of the issue.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -342,9 +342,9 @@ public class PlayArea extends CardPanelContainer implements CardPanelMouseListen
|
|||||||
try {
|
try {
|
||||||
rows.add(insertIndex == -1 ? rows.size() : insertIndex, currentRow);
|
rows.add(insertIndex == -1 ? rows.size() : insertIndex, currentRow);
|
||||||
}
|
}
|
||||||
catch(ArrayIndexOutOfBoundsException e) {
|
catch (ArrayIndexOutOfBoundsException e) {
|
||||||
System.out.println("ArrayIndex Out of Bounds when trying to add row in PlayArea. Someone fix this logic, " +
|
System.out.println("ArrayIndex Out of Bounds when trying to add row in PlayArea. Someone fix this logic, "
|
||||||
" I believe it causes the no cards loading in issue we've noticed.");
|
+ " I believe it causes the no cards loading in issue we've noticed.");
|
||||||
// TODO: There's a crash here, maybe when rows == [null] and currentRow == [[Plant Wall]] and insertIndex is 0
|
// TODO: There's a crash here, maybe when rows == [null] and currentRow == [[Plant Wall]] and insertIndex is 0
|
||||||
}
|
}
|
||||||
currentRow = new CardStackRow();
|
currentRow = new CardStackRow();
|
||||||
@@ -360,9 +360,9 @@ public class PlayArea extends CardPanelContainer implements CardPanelMouseListen
|
|||||||
try {
|
try {
|
||||||
rows.add(insertIndex == -1 ? rows.size() : insertIndex, currentRow);
|
rows.add(insertIndex == -1 ? rows.size() : insertIndex, currentRow);
|
||||||
}
|
}
|
||||||
catch(ArrayIndexOutOfBoundsException e) {
|
catch (ArrayIndexOutOfBoundsException e) {
|
||||||
System.out.println("ArrayIndex Out of Bounds when trying to add row in PlayArea. Someone fix this logic, " +
|
System.out.println("ArrayIndex Out of Bounds when trying to add row in PlayArea. Someone fix this logic, "
|
||||||
" I believe it causes the no cards loading in issue we've noticed.");
|
+ " I believe it causes the no cards loading in issue we've noticed.");
|
||||||
// TODO: There's a crash here, maybe when rows == [null] and currentRow == [[Plant Wall]] and insertIndex is 0
|
// TODO: There's a crash here, maybe when rows == [null] and currentRow == [[Plant Wall]] and insertIndex is 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user