mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 10:18:01 +00:00
- CheckStyle.
This commit is contained in:
@@ -2326,8 +2326,8 @@ public class AbilityFactory {
|
||||
}
|
||||
|
||||
// give Shroud to targeted creatures
|
||||
if (saviourApi.equals("Pump") && tgt == null && saviourParams.containsKey("KW")
|
||||
&& (saviourParams.get("KW").endsWith("Shroud")
|
||||
if (saviourApi.equals("Pump") && tgt == null && saviourParams.containsKey("KW")
|
||||
&& (saviourParams.get("KW").endsWith("Shroud")
|
||||
|| saviourParams.get("KW").endsWith("Hexproof"))) {
|
||||
continue;
|
||||
}
|
||||
@@ -2372,8 +2372,8 @@ public class AbilityFactory {
|
||||
}
|
||||
|
||||
// give Shroud to targeted creatures
|
||||
if (saviourApi.equals("Pump") && tgt == null && saviourParams.containsKey("KW")
|
||||
&& (saviourParams.get("KW").endsWith("Shroud")
|
||||
if (saviourApi.equals("Pump") && tgt == null && saviourParams.containsKey("KW")
|
||||
&& (saviourParams.get("KW").endsWith("Shroud")
|
||||
|| saviourParams.get("KW").endsWith("Hexproof"))) {
|
||||
continue;
|
||||
}
|
||||
@@ -2394,15 +2394,15 @@ public class AbilityFactory {
|
||||
}
|
||||
// Exiling => bounce/shroud
|
||||
else if ((threatApi.equals("ChangeZone") || threatApi.equals("ChangeZoneAll"))
|
||||
&& (saviourApi.equals("ChangeZone") || saviourApi.equals("Pump"))
|
||||
&& (saviourApi.equals("ChangeZone") || saviourApi.equals("Pump"))
|
||||
&& threatParams.containsKey("Destination")
|
||||
&& threatParams.get("Destination").equals("Exile")) {
|
||||
for (final Object o : objects) {
|
||||
if (o instanceof Card) {
|
||||
final Card c = (Card) o;
|
||||
// give Shroud to targeted creatures
|
||||
if (saviourApi.equals("Pump") && tgt == null && saviourParams.containsKey("KW")
|
||||
&& (saviourParams.get("KW").endsWith("Shroud")
|
||||
if (saviourApi.equals("Pump") && tgt == null && saviourParams.containsKey("KW")
|
||||
&& (saviourParams.get("KW").endsWith("Shroud")
|
||||
|| saviourParams.get("KW").endsWith("Hexproof"))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -538,7 +538,7 @@ public class AbilityFactoryPump {
|
||||
if (!mandatory
|
||||
&& !sa.isTrigger()
|
||||
&& AllZone.getPhaseHandler().isAfter(Constant.Phase.COMBAT_DECLARE_BLOCKERS_INSTANT_ABILITY)
|
||||
&& !(this.abilityFactory.isCurse() && (defense < 0))
|
||||
&& !(this.abilityFactory.isCurse() && (defense < 0))
|
||||
&& !this.containsCombatRelevantKeyword(this.keywords)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ public class CardCollections {
|
||||
this.cube = new StorageImmediatelySerialized<Deck>(new DeckSerializer(new File(file, "cube")));
|
||||
|
||||
System.out.printf("Read decks: %d constructed, %d sealed, %d draft, %d cubes.%n", constructed.getCount(), sealed.getCount(), draft.getCount(), cube.getCount());
|
||||
|
||||
|
||||
// remove this after most people have been switched to new layout
|
||||
final OldDeckParser oldParser = new OldDeckParser(file, this.constructed, this.draft, this.sealed, this.cube);
|
||||
oldParser.tryParse();
|
||||
|
||||
@@ -271,7 +271,7 @@ public class Deck extends DeckBase implements Serializable {
|
||||
out.addAll(Deck.writeCardPool(this.getSideboard()));
|
||||
return out;
|
||||
}
|
||||
|
||||
|
||||
public final static Lambda1<String, Deck> FN_NAME_SELECTOR = new Lambda1<String, Deck>() {
|
||||
@Override
|
||||
public String apply(Deck arg1) {
|
||||
|
||||
@@ -111,7 +111,7 @@ public class DeckGroup extends DeckBase {
|
||||
protected DeckBase newInstance(final String name0) {
|
||||
return new DeckGroup(name0);
|
||||
}
|
||||
|
||||
|
||||
public final static Lambda1<String, DeckGroup> FN_NAME_SELECTOR = new Lambda1<String, DeckGroup>() {
|
||||
@Override
|
||||
public String apply(DeckGroup arg1) {
|
||||
|
||||
@@ -128,7 +128,7 @@ public class DeckGroupSerializer extends StorageReaderFolder<DeckGroup> implemen
|
||||
final File testSubject = new File(dir, name);
|
||||
final boolean isVisibleFolder = testSubject.isDirectory() && !testSubject.isHidden();
|
||||
final boolean hasGoodName = StringUtils.isNotEmpty(name) && !name.startsWith(".");
|
||||
final File fileHumanDeck = new File(testSubject, DeckGroupSerializer.this.humanDeckFile);
|
||||
final File fileHumanDeck = new File(testSubject, DeckGroupSerializer.this.humanDeckFile);
|
||||
return isVisibleFolder && hasGoodName && fileHumanDeck.exists();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -119,12 +119,12 @@ public final class GameFormat {
|
||||
public String toString() {
|
||||
return this.name + " (format)";
|
||||
}
|
||||
|
||||
public static final Lambda1<String,GameFormat> FN_GET_NAME = new Lambda1<String, GameFormat>() {
|
||||
|
||||
public static final Lambda1<String, GameFormat> FN_GET_NAME = new Lambda1<String, GameFormat>() {
|
||||
@Override
|
||||
public String apply(GameFormat arg1) {
|
||||
return arg1.getName();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -126,7 +126,7 @@ public final class BoosterDraft implements IBoosterDraft {
|
||||
}
|
||||
|
||||
} else {
|
||||
final UnOpenedProduct product1 = new UnOpenedProduct(Singletons.getModel().getBoosters().get(sets[0]));
|
||||
final UnOpenedProduct product1 = new UnOpenedProduct(Singletons.getModel().getBoosters().get(sets[0]));
|
||||
for (int i = 0; i < nPacks; i++) {
|
||||
this.product.add(product1);
|
||||
}
|
||||
|
||||
@@ -106,10 +106,10 @@ public class SealedDeck {
|
||||
|
||||
final String[] pp = p.toString().split("/");
|
||||
for (int i = 0; i < nPacks; i++) {
|
||||
this.product.add(new UnOpenedProduct(Singletons.getModel().getBoosters().get(pp[i])));
|
||||
this.product.add(new UnOpenedProduct(Singletons.getModel().getBoosters().get(pp[i])));
|
||||
}
|
||||
} else {
|
||||
final UnOpenedProduct product1 = new UnOpenedProduct(Singletons.getModel().getBoosters().get(sets[0]));
|
||||
final UnOpenedProduct product1 = new UnOpenedProduct(Singletons.getModel().getBoosters().get(sets[0]));
|
||||
for (int i = 0; i < nPacks; i++) {
|
||||
this.product.add(product1);
|
||||
}
|
||||
|
||||
@@ -99,9 +99,6 @@ public class BoosterPack extends OpenablePack {
|
||||
return myCards;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public final String getType() {
|
||||
return "Booster Pack";
|
||||
@@ -119,7 +116,7 @@ public class BoosterPack extends OpenablePack {
|
||||
*/
|
||||
@Override
|
||||
public final Object clone() {
|
||||
return new BoosterPack(name, contents);
|
||||
return new BoosterPack(name, contents);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -134,12 +134,12 @@ public class PreconDeck implements InventoryItemFromSet {
|
||||
public final String getDescription() {
|
||||
return this.description;
|
||||
}
|
||||
|
||||
|
||||
public final static Lambda1<String, PreconDeck> FN_NAME_SELECTOR = new Lambda1<String, PreconDeck>() {
|
||||
@Override
|
||||
public String apply(PreconDeck arg1) {
|
||||
return arg1.getName();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ public enum FModel {
|
||||
private final IStorageView<BoosterData> boosters;
|
||||
private final IStorageView<BoosterData> tournaments;
|
||||
private final StorageView<CardBlock> blocks;
|
||||
|
||||
|
||||
// have to implement lazy initialization - at the moment of FModel.ctor()
|
||||
// CardDb is not ready yet.
|
||||
private CardCollections decks;
|
||||
@@ -132,14 +132,13 @@ public enum FModel {
|
||||
this.matchState = new FMatchState();
|
||||
this.questPreferences = new QuestPreferences();
|
||||
this.questEventManager = new QuestEventManager();
|
||||
|
||||
|
||||
this.editions = new EditionCollection();
|
||||
this.formats = new FormatCollection("res/blockdata/formats.txt");
|
||||
this.boosters = new StorageView<BoosterData>(new BoosterData.Reader("res/blockdata/boosters.txt"));
|
||||
this.tournaments = new StorageView<BoosterData>(new BoosterData.Reader("res/blockdata/starters.txt"));
|
||||
this.blocks = new StorageView<CardBlock>(new CardBlock.Reader("res/blockdata/blocks.txt", editions));
|
||||
|
||||
|
||||
|
||||
// TODO this single setting from preferences should not be here, or,
|
||||
// it should be here with all the other settings at the same time.
|
||||
// Unfortunately, they're tied up in legacy code in the Display
|
||||
|
||||
@@ -306,8 +306,8 @@ public class QuestDataIO {
|
||||
writer.addAttribute("s", booster.getEdition());
|
||||
writer.addAttribute("n", count.toString());
|
||||
writer.endNode();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected void write(final PreconDeck deck, final Integer count, final HierarchicalStreamWriter writer) {
|
||||
writer.startNode("precon");
|
||||
writer.addAttribute("name", deck.getName());
|
||||
@@ -327,7 +327,7 @@ public class QuestDataIO {
|
||||
} else if (item instanceof BoosterPack) {
|
||||
this.write((BoosterPack) item, count, writer);
|
||||
} else if (item instanceof TournamentPack) {
|
||||
this.write((TournamentPack) item, count, writer);
|
||||
this.write((TournamentPack) item, count, writer);
|
||||
} else if (item instanceof PreconDeck) {
|
||||
this.write((PreconDeck) item, count, writer);
|
||||
}
|
||||
@@ -351,7 +351,7 @@ public class QuestDataIO {
|
||||
} else if ("booster".equals(nodename)) {
|
||||
result.add(this.readBooster(reader), cnt);
|
||||
} else if ("tpack".equals(nodename)) {
|
||||
result.add(this.readTournamentPack(reader), cnt);
|
||||
result.add(this.readTournamentPack(reader), cnt);
|
||||
} else if ("precon".equals(nodename)) {
|
||||
final PreconDeck toAdd = this.readPreconDeck(reader);
|
||||
if (null != toAdd) {
|
||||
@@ -384,7 +384,7 @@ public class QuestDataIO {
|
||||
BoosterData bd = Singletons.getModel().getTournamentPacks().get(set);
|
||||
return new TournamentPack(ed.getName(), bd);
|
||||
}
|
||||
|
||||
|
||||
protected CardPrinted readCardPrinted(final HierarchicalStreamReader reader) {
|
||||
final String name = reader.getAttribute("c");
|
||||
final String set = reader.getAttribute("s");
|
||||
|
||||
@@ -209,7 +209,6 @@ public final class QuestUtilCards {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Buy precon deck.
|
||||
*
|
||||
@@ -357,9 +356,9 @@ public final class QuestUtilCards {
|
||||
*/
|
||||
public void generateTournamentsInShop(final int count) {
|
||||
Predicate<CardEdition> hasTournament = CardEdition.Predicates.HAS_TOURNAMENT_PACK;
|
||||
this.q.getShopList().addAllFlat( hasTournament.random(Singletons.getModel().getEditions(), count, TournamentPack.FN_FROM_SET));
|
||||
}
|
||||
|
||||
this.q.getShopList().addAllFlat(hasTournament.random(Singletons.getModel().getEditions(), count, TournamentPack.FN_FROM_SET));
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate precons in shop.
|
||||
*
|
||||
|
||||
@@ -159,7 +159,7 @@ public class FileSection {
|
||||
final Map<String, List<String>> result = new HashMap<String, List<String>>();
|
||||
String currentSection = "";
|
||||
List<String> currentList = null;
|
||||
|
||||
|
||||
for (final String s : source) {
|
||||
final String st = s.trim();
|
||||
if (st.length() == 0) {
|
||||
@@ -173,7 +173,7 @@ public class FileSection {
|
||||
}
|
||||
result.put(currentSection, currentList);
|
||||
}
|
||||
|
||||
|
||||
final String newSection = st.substring(1, st.length() - 1);
|
||||
currentSection = newSection;
|
||||
currentList = null;
|
||||
@@ -184,7 +184,7 @@ public class FileSection {
|
||||
currentList.add(st);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// save final block
|
||||
if ((currentList != null) && (currentList.size() > 0)) {
|
||||
final Object oldVal = result.get(currentSection);
|
||||
@@ -193,7 +193,7 @@ public class FileSection {
|
||||
}
|
||||
result.put(currentSection, currentList);
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -33,6 +33,6 @@ public interface IItemReader<T> {
|
||||
*/
|
||||
Map<String, T> readAll();
|
||||
// T read(File file);
|
||||
|
||||
|
||||
String getItemKey(T item);
|
||||
}
|
||||
|
||||
@@ -42,8 +42,8 @@ public interface IStorageView<T> extends Iterable<T> {
|
||||
* @return a ArrayList<String>
|
||||
*/
|
||||
Collection<String> getNames();
|
||||
|
||||
|
||||
boolean contains(final String name);
|
||||
int getCount();
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -36,19 +36,18 @@ import org.apache.commons.lang3.StringUtils;
|
||||
public abstract class StorageReaderFile<T> implements IItemReader<T> {
|
||||
|
||||
private final File file;
|
||||
private final Lambda1<String,T> keySelector;
|
||||
private final Lambda1<String, T> keySelector;
|
||||
|
||||
/**
|
||||
* Instantiates a new storage reader file.
|
||||
*
|
||||
* @param file0 the file0
|
||||
*/
|
||||
public StorageReaderFile(final String pathname, Lambda1<String,T> keySelector0) {
|
||||
public StorageReaderFile(final String pathname, Lambda1<String, T> keySelector0) {
|
||||
this(new File(pathname), keySelector0);
|
||||
}
|
||||
|
||||
|
||||
public StorageReaderFile(final File file0, Lambda1<String,T> keySelector0) {
|
||||
public StorageReaderFile(final File file0, Lambda1<String, T> keySelector0) {
|
||||
this.file = file0;
|
||||
keySelector = keySelector0;
|
||||
}
|
||||
@@ -94,7 +93,7 @@ public abstract class StorageReaderFile<T> implements IItemReader<T> {
|
||||
protected boolean lineContainsObject(final String line) {
|
||||
return !StringUtils.isBlank(line) && !line.trim().startsWith("#");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getItemKey(T item) {
|
||||
return keySelector.apply(item);
|
||||
|
||||
@@ -45,7 +45,7 @@ import forge.error.ErrorViewer;
|
||||
public abstract class StorageReaderFolder<T> implements IItemReader<T> {
|
||||
|
||||
private final File directory;
|
||||
private final Lambda1<String,T> keySelector;
|
||||
private final Lambda1<String, T> keySelector;
|
||||
|
||||
/**
|
||||
* Gets the directory.
|
||||
@@ -61,7 +61,7 @@ public abstract class StorageReaderFolder<T> implements IItemReader<T> {
|
||||
*
|
||||
* @param deckDir0 the deck dir0
|
||||
*/
|
||||
public StorageReaderFolder(final File deckDir0, Lambda1<String,T> keySelector0) {
|
||||
public StorageReaderFolder(final File deckDir0, Lambda1<String, T> keySelector0) {
|
||||
|
||||
this.directory = deckDir0;
|
||||
keySelector = keySelector0;
|
||||
@@ -143,7 +143,7 @@ public abstract class StorageReaderFolder<T> implements IItemReader<T> {
|
||||
* @return FilenameFilter to pick only relevant objects for deserialization
|
||||
*/
|
||||
protected abstract FilenameFilter getFileFilter();
|
||||
|
||||
|
||||
public String getItemKey(T item) {
|
||||
return keySelector.apply(item);
|
||||
}
|
||||
|
||||
@@ -97,9 +97,9 @@ public class StorageView<T> implements Iterable<T>, IStorageView<T> {
|
||||
public boolean contains(String name) {
|
||||
return this.map.containsKey(name);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
public int getCount() {
|
||||
return this.map.size();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user