mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 03:38:01 +00:00
- CheckStyle.
This commit is contained in:
@@ -70,7 +70,7 @@ public class ManaCostShard {
|
|||||||
/** A bitmask to represent any mana symbol as an integer. */
|
/** A bitmask to represent any mana symbol as an integer. */
|
||||||
public abstract static class Atom {
|
public abstract static class Atom {
|
||||||
public static final int COLORLESS = 1 << 0;
|
public static final int COLORLESS = 1 << 0;
|
||||||
|
|
||||||
/** The Constant WHITE. */
|
/** The Constant WHITE. */
|
||||||
public static final int WHITE = 1 << 1;
|
public static final int WHITE = 1 << 1;
|
||||||
|
|
||||||
@@ -109,9 +109,9 @@ public class ManaCostShard {
|
|||||||
* I choose the latter, because memory for boxed objects will be taken from
|
* I choose the latter, because memory for boxed objects will be taken from
|
||||||
* heap, while unboxed values will lay on stack, which is faster
|
* heap, while unboxed values will lay on stack, which is faster
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public static final ManaCostShard COLORLESS = new ManaCostShard(Atom.COLORLESS, "1");
|
public static final ManaCostShard COLORLESS = new ManaCostShard(Atom.COLORLESS, "1");
|
||||||
|
|
||||||
/** The Constant X. */
|
/** The Constant X. */
|
||||||
public static final ManaCostShard X = new ManaCostShard(Atom.IS_X, "X");
|
public static final ManaCostShard X = new ManaCostShard(Atom.IS_X, "X");
|
||||||
|
|
||||||
@@ -340,11 +340,11 @@ public class ManaCostShard {
|
|||||||
public boolean isSnow() {
|
public boolean isSnow() {
|
||||||
return (this.shard & Atom.IS_SNOW) != 0;
|
return (this.shard & Atom.IS_SNOW) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isMonoColor() {
|
public boolean isMonoColor() {
|
||||||
int colormask = this.shard & (Atom.WHITE | Atom.BLUE | Atom.BLACK | Atom.RED | Atom.GREEN);
|
int colormask = this.shard & (Atom.WHITE | Atom.BLUE | Atom.BLACK | Atom.RED | Atom.GREEN);
|
||||||
return BinaryUtil.bitCount(colormask) == 1;
|
return BinaryUtil.bitCount(colormask) == 1;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -250,8 +250,8 @@ public abstract class SpellAbility {
|
|||||||
|
|
||||||
public void setManaCost(final String cost) {
|
public void setManaCost(final String cost) {
|
||||||
this.manaCost = cost;
|
this.manaCost = cost;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* Getter for the field <code>additionalManaCost</code>.
|
* Getter for the field <code>additionalManaCost</code>.
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ public class StaticAbilityCostChange {
|
|||||||
//modify the cost here
|
//modify the cost here
|
||||||
return originalCost;
|
return originalCost;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Applies applyReduceCostAbility ability.
|
* Applies applyReduceCostAbility ability.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -522,17 +522,22 @@ public class BoosterDraftAI {
|
|||||||
// count each mana symbol in the mana cost
|
// count each mana symbol in the mana cost
|
||||||
for (ManaCostShard shard : mc.getShards()) {
|
for (ManaCostShard shard : mc.getShards()) {
|
||||||
byte mask = shard.getColorMask();
|
byte mask = shard.getColorMask();
|
||||||
|
|
||||||
if ((mask & CardColor.WHITE) > 0 )
|
if ((mask & CardColor.WHITE) > 0) {
|
||||||
clrCnts[0].setCount(clrCnts[0].getCount() + 1);
|
clrCnts[0].setCount(clrCnts[0].getCount() + 1);
|
||||||
if ((mask & CardColor.BLUE) > 0 )
|
}
|
||||||
|
if ((mask & CardColor.BLUE) > 0) {
|
||||||
clrCnts[1].setCount(clrCnts[1].getCount() + 1);
|
clrCnts[1].setCount(clrCnts[1].getCount() + 1);
|
||||||
if ((mask & CardColor.BLACK) > 0 )
|
}
|
||||||
|
if ((mask & CardColor.BLACK) > 0) {
|
||||||
clrCnts[2].setCount(clrCnts[2].getCount() + 1);
|
clrCnts[2].setCount(clrCnts[2].getCount() + 1);
|
||||||
if ((mask & CardColor.RED) > 0 )
|
}
|
||||||
|
if ((mask & CardColor.RED) > 0) {
|
||||||
clrCnts[3].setCount(clrCnts[3].getCount() + 1);
|
clrCnts[3].setCount(clrCnts[3].getCount() + 1);
|
||||||
if ((mask & CardColor.GREEN) > 0 )
|
}
|
||||||
|
if ((mask & CardColor.GREEN) > 0) {
|
||||||
clrCnts[4].setCount(clrCnts[4].getCount() + 1);
|
clrCnts[4].setCount(clrCnts[4].getCount() + 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -360,17 +360,22 @@ public class SealedDeck {
|
|||||||
// count each mana symbol in the mana cost
|
// count each mana symbol in the mana cost
|
||||||
for (ManaCostShard shard : mc.getShards()) {
|
for (ManaCostShard shard : mc.getShards()) {
|
||||||
byte mask = shard.getColorMask();
|
byte mask = shard.getColorMask();
|
||||||
|
|
||||||
if ((mask & CardColor.WHITE) > 0 )
|
if ((mask & CardColor.WHITE) > 0) {
|
||||||
clrCnts[0].setCount(clrCnts[0].getCount() + 1);
|
clrCnts[0].setCount(clrCnts[0].getCount() + 1);
|
||||||
if ((mask & CardColor.BLUE) > 0 )
|
}
|
||||||
|
if ((mask & CardColor.BLUE) > 0) {
|
||||||
clrCnts[1].setCount(clrCnts[1].getCount() + 1);
|
clrCnts[1].setCount(clrCnts[1].getCount() + 1);
|
||||||
if ((mask & CardColor.BLACK) > 0 )
|
}
|
||||||
|
if ((mask & CardColor.BLACK) > 0) {
|
||||||
clrCnts[2].setCount(clrCnts[2].getCount() + 1);
|
clrCnts[2].setCount(clrCnts[2].getCount() + 1);
|
||||||
if ((mask & CardColor.RED) > 0 )
|
}
|
||||||
|
if ((mask & CardColor.RED) > 0) {
|
||||||
clrCnts[3].setCount(clrCnts[3].getCount() + 1);
|
clrCnts[3].setCount(clrCnts[3].getCount() + 1);
|
||||||
if ((mask & CardColor.GREEN) > 0 )
|
}
|
||||||
|
if ((mask & CardColor.GREEN) > 0) {
|
||||||
clrCnts[4].setCount(clrCnts[4].getCount() + 1);
|
clrCnts[4].setCount(clrCnts[4].getCount() + 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -180,7 +180,7 @@ public class DefaultPlayerZone extends PlayerZone implements java.io.Serializabl
|
|||||||
public final boolean contains(final Card c) {
|
public final boolean contains(final Card c) {
|
||||||
return this.getCardList().contains(c);
|
return this.getCardList().contains(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
*
|
||||||
@@ -194,7 +194,6 @@ public class DefaultPlayerZone extends PlayerZone implements java.io.Serializabl
|
|||||||
}
|
}
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes the.
|
* Removes the.
|
||||||
|
|||||||
@@ -156,7 +156,7 @@ interface IPlayerZone {
|
|||||||
* @return position
|
* @return position
|
||||||
*/
|
*/
|
||||||
Integer getPosition(Card c);
|
Integer getPosition(Card c);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* isEmpty returns true if given zone contains no cards.
|
* isEmpty returns true if given zone contains no cards.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1376,7 +1376,7 @@ public class MagicStack extends MyObservable {
|
|||||||
public final void clearSimultaneousStack() {
|
public final void clearSimultaneousStack() {
|
||||||
this.simultaneousStackEntryList.clear();
|
this.simultaneousStackEntryList.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* addSimultaneousStackEntry.
|
* addSimultaneousStackEntry.
|
||||||
|
|||||||
@@ -148,7 +148,7 @@ public final class CEditorQuestCardShop extends ACEditorBase<InventoryItem, Deck
|
|||||||
private Integer getCardValue(final InventoryItem card) {
|
private Integer getCardValue(final InventoryItem card) {
|
||||||
if (card instanceof CardPrinted) {
|
if (card instanceof CardPrinted) {
|
||||||
String ns = card.getName() + "|" + ((CardPrinted) card).getEdition();
|
String ns = card.getName() + "|" + ((CardPrinted) card).getEdition();
|
||||||
|
|
||||||
if (this.mapPrices.containsKey(ns)) {
|
if (this.mapPrices.containsKey(ns)) {
|
||||||
return this.mapPrices.get(ns);
|
return this.mapPrices.get(ns);
|
||||||
} else if (card instanceof CardPrinted) {
|
} else if (card instanceof CardPrinted) {
|
||||||
|
|||||||
@@ -137,8 +137,7 @@ public class CardFaceSymbols {
|
|||||||
if (manaCost.isEmpty()) {
|
if (manaCost.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
final int genericManaCost = manaCost.getGenericCost();
|
final int genericManaCost = manaCost.getGenericCost();
|
||||||
final boolean hasGeneric = (genericManaCost > 0) || manaCost.isPureGeneric();
|
final boolean hasGeneric = (genericManaCost > 0) || manaCost.isPureGeneric();
|
||||||
final List<ManaCostShard> shards = manaCost.getShards();
|
final List<ManaCostShard> shards = manaCost.getShards();
|
||||||
@@ -234,7 +233,7 @@ public class CardFaceSymbols {
|
|||||||
*/
|
*/
|
||||||
public static int getWidth(final CardManaCost manaCost) {
|
public static int getWidth(final CardManaCost manaCost) {
|
||||||
int width = manaCost.getShards().size();
|
int width = manaCost.getShards().size();
|
||||||
if ( manaCost.getGenericCost() > 0 || ( manaCost.getGenericCost() == 0 && width == 0 ) );
|
if (manaCost.getGenericCost() > 0 || (manaCost.getGenericCost() == 0 && width == 0));
|
||||||
width++;
|
width++;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -32,20 +32,19 @@ import javax.swing.filechooser.FileNameExtensionFilter;
|
|||||||
*/
|
*/
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
public class SaveOpenDialog extends JPanel {
|
public class SaveOpenDialog extends JPanel {
|
||||||
|
|
||||||
private JFileChooser fc;
|
private JFileChooser fc;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enum to contain information for filetype filtering in the open/save dialog.
|
* Enum to contain information for filetype filtering in the open/save dialog.
|
||||||
* Add more entries to enum as needed.
|
* Add more entries to enum as needed.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public enum Filetypes {
|
public enum Filetypes {
|
||||||
LAYOUT ("Layout File", "xml"),
|
LAYOUT ("Layout File", "xml"),
|
||||||
DECK ("Deck File", "dck");
|
DECK ("Deck File", "dck");
|
||||||
|
|
||||||
private final String TypeName;
|
private final String TypeName;
|
||||||
private final String TypeExtension;
|
private final String TypeExtension;
|
||||||
Filetypes(String Name, String Extension) {
|
Filetypes(String Name, String Extension) {
|
||||||
@@ -53,16 +52,15 @@ public class SaveOpenDialog extends JPanel {
|
|||||||
this.TypeExtension = Extension;
|
this.TypeExtension = Extension;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* constructor for a save or open dialog
|
* constructor for a save or open dialog.
|
||||||
*/
|
*/
|
||||||
public SaveOpenDialog() {
|
public SaveOpenDialog() {
|
||||||
fc = new JFileChooser();
|
fc = new JFileChooser();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shows the open dialog for files. If no file selected, returns null. Pass null
|
* Shows the open dialog for files. If no file selected, returns null. Pass null
|
||||||
* to Type to allow all files to be viewed/opened.
|
* to Type to allow all files to be viewed/opened.
|
||||||
@@ -73,14 +71,13 @@ public class SaveOpenDialog extends JPanel {
|
|||||||
*/
|
*/
|
||||||
public File OpenDialog(final File defFileName, final Filetypes type) {
|
public File OpenDialog(final File defFileName, final Filetypes type) {
|
||||||
fc.setCurrentDirectory(defFileName);
|
fc.setCurrentDirectory(defFileName);
|
||||||
|
|
||||||
if (type!=null) {
|
if (type != null) {
|
||||||
fc.setAcceptAllFileFilterUsed(false);
|
fc.setAcceptAllFileFilterUsed(false);
|
||||||
final FileFilter filter = new FileNameExtensionFilter(type.TypeName, type.TypeExtension);
|
final FileFilter filter = new FileNameExtensionFilter(type.TypeName, type.TypeExtension);
|
||||||
fc.addChoosableFileFilter(filter);
|
fc.addChoosableFileFilter(filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int RetValue = fc.showOpenDialog(getParent());
|
int RetValue = fc.showOpenDialog(getParent());
|
||||||
if (RetValue == JFileChooser.APPROVE_OPTION) {
|
if (RetValue == JFileChooser.APPROVE_OPTION) {
|
||||||
final File RetFile = fc.getSelectedFile();
|
final File RetFile = fc.getSelectedFile();
|
||||||
@@ -88,7 +85,7 @@ public class SaveOpenDialog extends JPanel {
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shows the save dialog.
|
* Shows the save dialog.
|
||||||
*
|
*
|
||||||
@@ -100,31 +97,30 @@ public class SaveOpenDialog extends JPanel {
|
|||||||
public File SaveDialog(final File defFileName, final Filetypes type) {
|
public File SaveDialog(final File defFileName, final Filetypes type) {
|
||||||
File RetFile = defFileName;
|
File RetFile = defFileName;
|
||||||
fc.setCurrentDirectory(defFileName);
|
fc.setCurrentDirectory(defFileName);
|
||||||
|
|
||||||
/* set the file filter if desired */
|
/* set the file filter if desired */
|
||||||
if (type!=null) {
|
if (type != null) {
|
||||||
fc.setAcceptAllFileFilterUsed(false);
|
fc.setAcceptAllFileFilterUsed(false);
|
||||||
final FileFilter filter = new FileNameExtensionFilter(type.TypeName, type.TypeExtension);
|
final FileFilter filter = new FileNameExtensionFilter(type.TypeName, type.TypeExtension);
|
||||||
fc.addChoosableFileFilter(filter);
|
fc.addChoosableFileFilter(filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
int RetValue = fc.showSaveDialog(getParent());
|
int RetValue = fc.showSaveDialog(getParent());
|
||||||
|
|
||||||
/* user picked save */
|
/* user picked save */
|
||||||
if (RetValue == JFileChooser.APPROVE_OPTION) {
|
if (RetValue == JFileChooser.APPROVE_OPTION) {
|
||||||
RetFile = fc.getSelectedFile();
|
RetFile = fc.getSelectedFile();
|
||||||
|
|
||||||
/* Adds extension if it is known and not given */
|
/* Adds extension if it is known and not given */
|
||||||
if (type!=null & !(RetFile.getAbsolutePath().endsWith(type.TypeExtension))) {
|
if (type != null & !(RetFile.getAbsolutePath().endsWith(type.TypeExtension))) {
|
||||||
RetFile = new File(RetFile.getAbsolutePath()+"."+type.TypeExtension);
|
RetFile = new File(RetFile.getAbsolutePath() + "." + type.TypeExtension);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return RetFile;
|
return RetFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* user picked cancel */
|
/* user picked cancel */
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,8 +41,8 @@ public class MyObservable extends Observable {
|
|||||||
this.notifyObservers();
|
this.notifyObservers();
|
||||||
|
|
||||||
if (Singletons.getModel() == null) { return; }
|
if (Singletons.getModel() == null) { return; }
|
||||||
PhaseHandler phases = Singletons.getModel().getGameState().getPhaseHandler();
|
PhaseHandler phases = Singletons.getModel().getGameState().getPhaseHandler();
|
||||||
|
|
||||||
if ((phases != null) && phases.isNeedToNextPhase()) {
|
if ((phases != null) && phases.isNeedToNextPhase()) {
|
||||||
if (phases.isNeedToNextPhaseInit()) {
|
if (phases.isNeedToNextPhaseInit()) {
|
||||||
// this is used.
|
// this is used.
|
||||||
|
|||||||
Reference in New Issue
Block a user