mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 18:58:00 +00:00
Fixed a lot of Checkstyle stuff. Removed some checks - method, class and line length
This commit is contained in:
2
pom.xml
2
pom.xml
@@ -469,7 +469,7 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-pmd-plugin</artifactId>
|
<artifactId>maven-pmd-plugin</artifactId>
|
||||||
<version>2.5</version>
|
<version>2.6</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<linkXRef>true</linkXRef>
|
<linkXRef>true</linkXRef>
|
||||||
<sourceEncoding>utf-8</sourceEncoding>
|
<sourceEncoding>utf-8</sourceEncoding>
|
||||||
|
|||||||
@@ -53,7 +53,7 @@
|
|||||||
|
|
||||||
<!-- Checks for Size Violations. -->
|
<!-- Checks for Size Violations. -->
|
||||||
<!-- See http://checkstyle.sf.net/config_sizes.html -->
|
<!-- See http://checkstyle.sf.net/config_sizes.html -->
|
||||||
<module name="FileLength"/>
|
<!-- <module name="FileLength"/> -->
|
||||||
|
|
||||||
<!-- Checks for whitespace -->
|
<!-- Checks for whitespace -->
|
||||||
<!-- See http://checkstyle.sf.net/config_whitespace.html -->
|
<!-- See http://checkstyle.sf.net/config_whitespace.html -->
|
||||||
@@ -131,11 +131,11 @@
|
|||||||
|
|
||||||
<!-- Checks for Size Violations. -->
|
<!-- Checks for Size Violations. -->
|
||||||
<!-- See http://checkstyle.sf.net/config_sizes.html -->
|
<!-- See http://checkstyle.sf.net/config_sizes.html -->
|
||||||
<module name="LineLength">
|
<!-- <module name="LineLength">
|
||||||
<property name="max" value="180"/>
|
<property name="max" value="180"/>
|
||||||
</module>
|
</module>
|
||||||
<module name="MethodLength"/>
|
<module name="MethodLength"/>
|
||||||
<module name="ParameterNumber"/>
|
<module name="ParameterNumber"/> -->
|
||||||
|
|
||||||
|
|
||||||
<!-- Checks for whitespace -->
|
<!-- Checks for whitespace -->
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -96,7 +96,7 @@ public class CardReader implements Runnable {
|
|||||||
private transient Enumeration<? extends ZipEntry> zipEnum;
|
private transient Enumeration<? extends ZipEntry> zipEnum;
|
||||||
|
|
||||||
private transient long estimatedFilesRemaining = // NOPMD by Braids on
|
private transient long estimatedFilesRemaining = // NOPMD by Braids on
|
||||||
// 8/18/11 10:56 PM
|
CardReader.// 8/18/11 10:56 PM
|
||||||
UNKNOWN_NUMBER_OF_FILES_REMAINING;
|
UNKNOWN_NUMBER_OF_FILES_REMAINING;
|
||||||
|
|
||||||
private transient Iterable<File> findNonDirsIterable; // NOPMD by Braids on
|
private transient Iterable<File> findNonDirsIterable; // NOPMD by Braids on
|
||||||
@@ -182,7 +182,7 @@ public class CardReader implements Runnable {
|
|||||||
if (useZip && zipFile.exists()) {
|
if (useZip && zipFile.exists()) {
|
||||||
try {
|
try {
|
||||||
this.zip = new ZipFile(zipFile);
|
this.zip = new ZipFile(zipFile);
|
||||||
} catch (Exception exn) {
|
} catch (final Exception exn) {
|
||||||
System.err.println("Error reading zip file \"" // NOPMD by
|
System.err.println("Error reading zip file \"" // NOPMD by
|
||||||
// Braids on
|
// Braids on
|
||||||
// 8/18/11 10:53
|
// 8/18/11 10:53
|
||||||
@@ -197,12 +197,12 @@ public class CardReader implements Runnable {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (useZip && zip != null) {
|
if (useZip && (this.zip != null)) {
|
||||||
zipEnum = zip.entries();
|
this.zipEnum = this.zip.entries();
|
||||||
estimatedFilesRemaining = zip.size();
|
this.estimatedFilesRemaining = this.zip.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
setEncoding(DEFAULT_CHARSET_NAME);
|
this.setEncoding(CardReader.DEFAULT_CHARSET_NAME);
|
||||||
|
|
||||||
} // CardReader()
|
} // CardReader()
|
||||||
|
|
||||||
@@ -213,12 +213,13 @@ public class CardReader implements Runnable {
|
|||||||
* @throws Throwable
|
* @throws Throwable
|
||||||
* indirectly
|
* indirectly
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
protected final void finalize() throws Throwable {
|
protected final void finalize() throws Throwable {
|
||||||
try {
|
try {
|
||||||
if (findNonDirsIterable != null) {
|
if (this.findNonDirsIterable != null) {
|
||||||
for (@SuppressWarnings("unused")
|
for (@SuppressWarnings("unused")
|
||||||
// Do nothing; just exercising the Iterable.
|
final// Do nothing; just exercising the Iterable.
|
||||||
File ignored : findNonDirsIterable) {
|
File ignored : this.findNonDirsIterable) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
@@ -229,8 +230,9 @@ public class CardReader implements Runnable {
|
|||||||
/**
|
/**
|
||||||
* Reads the rest of ALL the cards into memory. This is not lazy.
|
* Reads the rest of ALL the cards into memory. This is not lazy.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public final void run() {
|
public final void run() {
|
||||||
loadCardsUntilYouFind(null);
|
this.loadCardsUntilYouFind(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -261,27 +263,28 @@ public class CardReader implements Runnable {
|
|||||||
|
|
||||||
// Iterate through txt files or zip archive.
|
// Iterate through txt files or zip archive.
|
||||||
// Report relevant numbers to progress monitor model.
|
// Report relevant numbers to progress monitor model.
|
||||||
if (zip == null) {
|
if (this.zip == null) {
|
||||||
if (estimatedFilesRemaining == UNKNOWN_NUMBER_OF_FILES_REMAINING) {
|
if (this.estimatedFilesRemaining == CardReader.UNKNOWN_NUMBER_OF_FILES_REMAINING) {
|
||||||
final Generator<File> findNonDirsGen = new FindNonDirectoriesSkipDotDirectoriesGenerator(cardsfolder);
|
final Generator<File> findNonDirsGen = new FindNonDirectoriesSkipDotDirectoriesGenerator(
|
||||||
estimatedFilesRemaining = GeneratorFunctions.estimateSize(findNonDirsGen);
|
this.cardsfolder);
|
||||||
findNonDirsIterable = YieldUtils.toIterable(findNonDirsGen);
|
this.estimatedFilesRemaining = GeneratorFunctions.estimateSize(findNonDirsGen);
|
||||||
|
this.findNonDirsIterable = YieldUtils.toIterable(findNonDirsGen);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (monitor != null) {
|
if (monitor != null) {
|
||||||
monitor.setTotalUnitsThisPhase(estimatedFilesRemaining);
|
monitor.setTotalUnitsThisPhase(this.estimatedFilesRemaining);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (File cardTxtFile : findNonDirsIterable) {
|
for (final File cardTxtFile : this.findNonDirsIterable) {
|
||||||
if (!cardTxtFile.getName().endsWith(CARD_FILE_DOT_EXTENSION)) {
|
if (!cardTxtFile.getName().endsWith(CardReader.CARD_FILE_DOT_EXTENSION)) {
|
||||||
monitor.incrementUnitsCompletedThisPhase(1L);
|
monitor.incrementUnitsCompletedThisPhase(1L);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = loadCard(cardTxtFile);
|
result = this.loadCard(cardTxtFile);
|
||||||
monitor.incrementUnitsCompletedThisPhase(1L);
|
monitor.incrementUnitsCompletedThisPhase(1L);
|
||||||
|
|
||||||
if (cardName != null && cardName.equals(result.getName())) {
|
if ((cardName != null) && cardName.equals(result.getName())) {
|
||||||
break; // no thread leak here if entire card DB is loaded,
|
break; // no thread leak here if entire card DB is loaded,
|
||||||
// or if this object is finalized.
|
// or if this object is finalized.
|
||||||
}
|
}
|
||||||
@@ -289,22 +292,22 @@ public class CardReader implements Runnable {
|
|||||||
} // endfor
|
} // endfor
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
monitor.setTotalUnitsThisPhase(estimatedFilesRemaining);
|
monitor.setTotalUnitsThisPhase(this.estimatedFilesRemaining);
|
||||||
ZipEntry entry;
|
ZipEntry entry;
|
||||||
|
|
||||||
// zipEnum was initialized in the constructor.
|
// zipEnum was initialized in the constructor.
|
||||||
while (zipEnum.hasMoreElements()) {
|
while (this.zipEnum.hasMoreElements()) {
|
||||||
entry = (ZipEntry) zipEnum.nextElement();
|
entry = this.zipEnum.nextElement();
|
||||||
|
|
||||||
if (entry.isDirectory() || !entry.getName().endsWith(CARD_FILE_DOT_EXTENSION)) {
|
if (entry.isDirectory() || !entry.getName().endsWith(CardReader.CARD_FILE_DOT_EXTENSION)) {
|
||||||
monitor.incrementUnitsCompletedThisPhase(1L);
|
monitor.incrementUnitsCompletedThisPhase(1L);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = loadCard(entry);
|
result = this.loadCard(entry);
|
||||||
monitor.incrementUnitsCompletedThisPhase(1L);
|
monitor.incrementUnitsCompletedThisPhase(1L);
|
||||||
|
|
||||||
if (cardName != null && cardName.equals(result.getName())) {
|
if ((cardName != null) && cardName.equals(result.getName())) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -348,7 +351,7 @@ public class CardReader implements Runnable {
|
|||||||
line = line.trim();
|
line = line.trim();
|
||||||
}
|
}
|
||||||
return line;
|
return line;
|
||||||
} catch (Exception ex) {
|
} catch (final Exception ex) {
|
||||||
ErrorViewer.showError(ex);
|
ErrorViewer.showError(ex);
|
||||||
throw new RuntimeException("CardReader : readLine(Card) error", ex); // NOPMD
|
throw new RuntimeException("CardReader : readLine(Card) error", ex); // NOPMD
|
||||||
// by
|
// by
|
||||||
@@ -372,17 +375,17 @@ public class CardReader implements Runnable {
|
|||||||
*/
|
*/
|
||||||
protected final Card loadCard(final InputStream inputStream) {
|
protected final Card loadCard(final InputStream inputStream) {
|
||||||
final Card card = new Card();
|
final Card card = new Card();
|
||||||
rulesReader.reset();
|
this.rulesReader.reset();
|
||||||
|
|
||||||
InputStreamReader inputStreamReader = null;
|
InputStreamReader inputStreamReader = null;
|
||||||
BufferedReader reader = null;
|
BufferedReader reader = null;
|
||||||
try {
|
try {
|
||||||
inputStreamReader = new InputStreamReader(inputStream, charset);
|
inputStreamReader = new InputStreamReader(inputStream, this.charset);
|
||||||
reader = new BufferedReader(inputStreamReader);
|
reader = new BufferedReader(inputStreamReader);
|
||||||
|
|
||||||
String line = readLine(reader);
|
String line = CardReader.readLine(reader);
|
||||||
while (!"End".equals(line)) {
|
while (!"End".equals(line)) {
|
||||||
rulesReader.parseLine(line);
|
this.rulesReader.parseLine(line);
|
||||||
if (line.isEmpty()) {
|
if (line.isEmpty()) {
|
||||||
// Ignore empty lines.
|
// Ignore empty lines.
|
||||||
} else if (line.charAt(0) == '#') { // NOPMD by Braids on
|
} else if (line.charAt(0) == '#') { // NOPMD by Braids on
|
||||||
@@ -391,7 +394,7 @@ public class CardReader implements Runnable {
|
|||||||
} else if (line.startsWith("Name:")) {
|
} else if (line.startsWith("Name:")) {
|
||||||
final String value = line.substring(5);
|
final String value = line.substring(5);
|
||||||
// System.out.println(s);
|
// System.out.println(s);
|
||||||
if (mapToFill.containsKey(value)) {
|
if (this.mapToFill.containsKey(value)) {
|
||||||
break; // this card has already been loaded.
|
break; // this card has already been loaded.
|
||||||
} else {
|
} else {
|
||||||
card.setName(value);
|
card.setName(value);
|
||||||
@@ -403,7 +406,7 @@ public class CardReader implements Runnable {
|
|||||||
card.setManaCost(value);
|
card.setManaCost(value);
|
||||||
}
|
}
|
||||||
} else if (line.startsWith("Types:")) {
|
} else if (line.startsWith("Types:")) {
|
||||||
addTypes(card, line.substring("Types:".length()));
|
CardReader.addTypes(card, line.substring("Types:".length()));
|
||||||
} else if (line.startsWith("Text:")) {
|
} else if (line.startsWith("Text:")) {
|
||||||
String value = line.substring("Text:".length());
|
String value = line.substring("Text:".length());
|
||||||
// if (!t.equals("no text"));
|
// if (!t.equals("no text"));
|
||||||
@@ -457,10 +460,9 @@ public class CardReader implements Runnable {
|
|||||||
// 8/18/11 11:08 PM
|
// 8/18/11 11:08 PM
|
||||||
} else if (line.equals("ALTERNATE")) {
|
} else if (line.equals("ALTERNATE")) {
|
||||||
String mode;
|
String mode;
|
||||||
if(card.isFlip()) {
|
if (card.isFlip()) {
|
||||||
mode = "Flipped";
|
mode = "Flipped";
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
mode = "Transformed";
|
mode = "Transformed";
|
||||||
}
|
}
|
||||||
card.addAlternateState(mode);
|
card.addAlternateState(mode);
|
||||||
@@ -474,9 +476,9 @@ public class CardReader implements Runnable {
|
|||||||
}
|
}
|
||||||
} else if (line.startsWith("Colors:")) {
|
} else if (line.startsWith("Colors:")) {
|
||||||
final String value = line.substring("Colors:".length());
|
final String value = line.substring("Colors:".length());
|
||||||
ArrayList<CardColor> newCols = new ArrayList<CardColor>();
|
final ArrayList<CardColor> newCols = new ArrayList<CardColor>();
|
||||||
for (String col : value.split(",")) {
|
for (final String col : value.split(",")) {
|
||||||
CardColor newCol = new CardColor(card);
|
final CardColor newCol = new CardColor(card);
|
||||||
newCol.addToCardColor(col);
|
newCol.addToCardColor(col);
|
||||||
newCols.add(newCol);
|
newCols.add(newCol);
|
||||||
}
|
}
|
||||||
@@ -485,18 +487,20 @@ public class CardReader implements Runnable {
|
|||||||
card.setCardColorsOverridden(true);
|
card.setCardColorsOverridden(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
line = readLine(reader);
|
line = CardReader.readLine(reader);
|
||||||
} // while !End
|
} // while !End
|
||||||
} finally {
|
} finally {
|
||||||
try {
|
try {
|
||||||
reader.close();
|
reader.close();
|
||||||
} catch (IOException ignored) { // NOPMD by Braids on 8/18/11 11:08
|
} catch (final IOException ignored) { // NOPMD by Braids on 8/18/11
|
||||||
// PM
|
// 11:08
|
||||||
|
// PM
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
inputStreamReader.close();
|
inputStreamReader.close();
|
||||||
} catch (IOException ignored) { // NOPMD by Braids on 8/18/11 11:08
|
} catch (final IOException ignored) { // NOPMD by Braids on 8/18/11
|
||||||
// PM
|
// 11:08
|
||||||
|
// PM
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -504,8 +508,8 @@ public class CardReader implements Runnable {
|
|||||||
card.setState("Original");
|
card.setState("Original");
|
||||||
}
|
}
|
||||||
|
|
||||||
listRulesToFill.add(rulesReader.getCard());
|
this.listRulesToFill.add(this.rulesReader.getCard());
|
||||||
mapToFill.put(card.getName(), card);
|
this.mapToFill.put(card.getName(), card);
|
||||||
return card;
|
return card;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -531,16 +535,17 @@ public class CardReader implements Runnable {
|
|||||||
FileInputStream fileInputStream = null;
|
FileInputStream fileInputStream = null;
|
||||||
try {
|
try {
|
||||||
fileInputStream = new FileInputStream(pathToTxtFile);
|
fileInputStream = new FileInputStream(pathToTxtFile);
|
||||||
return loadCard(fileInputStream);
|
return this.loadCard(fileInputStream);
|
||||||
} catch (FileNotFoundException ex) {
|
} catch (final FileNotFoundException ex) {
|
||||||
ErrorViewer.showError(ex, "File \"%s\" exception", pathToTxtFile.getAbsolutePath());
|
ErrorViewer.showError(ex, "File \"%s\" exception", pathToTxtFile.getAbsolutePath());
|
||||||
throw new RuntimeException(// NOPMD by Braids on 8/18/11 10:53 PM
|
throw new RuntimeException(// NOPMD by Braids on 8/18/11 10:53 PM
|
||||||
"CardReader : run error -- file exception -- filename is " + pathToTxtFile.getPath(), ex);
|
"CardReader : run error -- file exception -- filename is " + pathToTxtFile.getPath(), ex);
|
||||||
} finally {
|
} finally {
|
||||||
try {
|
try {
|
||||||
fileInputStream.close();
|
fileInputStream.close();
|
||||||
} catch (IOException ignored) { // NOPMD by Braids on 8/18/11 11:08
|
} catch (final IOException ignored) { // NOPMD by Braids on 8/18/11
|
||||||
// PM
|
// 11:08
|
||||||
|
// PM
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -556,10 +561,10 @@ public class CardReader implements Runnable {
|
|||||||
protected final Card loadCard(final ZipEntry entry) {
|
protected final Card loadCard(final ZipEntry entry) {
|
||||||
InputStream zipInputStream = null;
|
InputStream zipInputStream = null;
|
||||||
try {
|
try {
|
||||||
zipInputStream = zip.getInputStream(entry);
|
zipInputStream = this.zip.getInputStream(entry);
|
||||||
return loadCard(zipInputStream);
|
return this.loadCard(zipInputStream);
|
||||||
|
|
||||||
} catch (IOException exn) {
|
} catch (final IOException exn) {
|
||||||
throw new RuntimeException(exn); // NOPMD by Braids on 8/18/11 10:53
|
throw new RuntimeException(exn); // NOPMD by Braids on 8/18/11 10:53
|
||||||
// PM
|
// PM
|
||||||
} finally {
|
} finally {
|
||||||
@@ -567,8 +572,9 @@ public class CardReader implements Runnable {
|
|||||||
if (zipInputStream != null) {
|
if (zipInputStream != null) {
|
||||||
zipInputStream.close();
|
zipInputStream.close();
|
||||||
}
|
}
|
||||||
} catch (IOException ignored) { // NOPMD by Braids on 8/18/11 11:08
|
} catch (final IOException ignored) { // NOPMD by Braids on 8/18/11
|
||||||
// PM
|
// 11:08
|
||||||
|
// PM
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -597,19 +603,20 @@ public class CardReader implements Runnable {
|
|||||||
* http://www.slightlymagic.net/forum/viewtopic.php?f=52&t=4887#p63189
|
* http://www.slightlymagic.net/forum/viewtopic.php?f=52&t=4887#p63189
|
||||||
*/
|
*/
|
||||||
|
|
||||||
baseFileName = HYPHEN_OR_SPACE.matcher(baseFileName).replaceAll("_");
|
baseFileName = CardReader.HYPHEN_OR_SPACE.matcher(baseFileName).replaceAll("_");
|
||||||
baseFileName = MULTIPLE_UNDERSCORES.matcher(baseFileName).replaceAll("_");
|
baseFileName = CardReader.MULTIPLE_UNDERSCORES.matcher(baseFileName).replaceAll("_");
|
||||||
baseFileName = PUNCTUATION_TO_ZAP.matcher(baseFileName).replaceAll("");
|
baseFileName = CardReader.PUNCTUATION_TO_ZAP.matcher(baseFileName).replaceAll("");
|
||||||
|
|
||||||
// Place the file within a single-letter subdirectory.
|
// Place the file within a single-letter subdirectory.
|
||||||
final StringBuffer buf = new StringBuffer(1 + 1 + baseFileName.length() + CARD_FILE_DOT_EXTENSION.length());
|
final StringBuffer buf = new StringBuffer(1 + 1 + baseFileName.length()
|
||||||
|
+ CardReader.CARD_FILE_DOT_EXTENSION.length());
|
||||||
buf.append(Character.toLowerCase(baseFileName.charAt(0)));
|
buf.append(Character.toLowerCase(baseFileName.charAt(0)));
|
||||||
|
|
||||||
// Zip file is always created with unix-style path names.
|
// Zip file is always created with unix-style path names.
|
||||||
buf.append('/');
|
buf.append('/');
|
||||||
|
|
||||||
buf.append(baseFileName.toLowerCase(Locale.ENGLISH));
|
buf.append(baseFileName.toLowerCase(Locale.ENGLISH));
|
||||||
buf.append(CARD_FILE_DOT_EXTENSION);
|
buf.append(CardReader.CARD_FILE_DOT_EXTENSION);
|
||||||
|
|
||||||
return buf.toString();
|
return buf.toString();
|
||||||
}
|
}
|
||||||
@@ -628,25 +635,25 @@ public class CardReader implements Runnable {
|
|||||||
// 11:08 PM
|
// 11:08 PM
|
||||||
UtilFunctions.checkNotNull("canonicalASCIIName", canonicalASCIIName);
|
UtilFunctions.checkNotNull("canonicalASCIIName", canonicalASCIIName);
|
||||||
|
|
||||||
final String cardFilePath = toMostLikelyPath(canonicalASCIIName);
|
final String cardFilePath = this.toMostLikelyPath(canonicalASCIIName);
|
||||||
|
|
||||||
Card result = null;
|
Card result = null;
|
||||||
|
|
||||||
if (zip != null) {
|
if (this.zip != null) {
|
||||||
final ZipEntry entry = zip.getEntry(cardFilePath);
|
final ZipEntry entry = this.zip.getEntry(cardFilePath);
|
||||||
|
|
||||||
if (entry != null) {
|
if (entry != null) {
|
||||||
result = loadCard(entry);
|
result = this.loadCard(entry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result == null) {
|
if (result == null) {
|
||||||
result = loadCard(new File(cardsfolder, cardFilePath));
|
result = this.loadCard(new File(this.cardsfolder, cardFilePath));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result == null || !(result.getName().equals(canonicalASCIIName))) {
|
if ((result == null) || !(result.getName().equals(canonicalASCIIName))) {
|
||||||
// System.err.println(":Could not find \"" + cardFilePath + "\".");
|
// System.err.println(":Could not find \"" + cardFilePath + "\".");
|
||||||
result = loadCardsUntilYouFind(canonicalASCIIName);
|
result = this.loadCardsUntilYouFind(canonicalASCIIName);
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
@@ -51,11 +51,11 @@ public final class CardUtil {
|
|||||||
* @return a int.
|
* @return a int.
|
||||||
*/
|
*/
|
||||||
public static int getRandomIndex(final Object[] o) {
|
public static int getRandomIndex(final Object[] o) {
|
||||||
if (o == null || o.length == 0) {
|
if ((o == null) || (o.length == 0)) {
|
||||||
throw new RuntimeException("CardUtil : getRandomIndex() argument is null or length is 0");
|
throw new RuntimeException("CardUtil : getRandomIndex() argument is null or length is 0");
|
||||||
}
|
}
|
||||||
|
|
||||||
return RANDOM.nextInt(o.length);
|
return CardUtil.RANDOM.nextInt(o.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -68,7 +68,7 @@ public final class CardUtil {
|
|||||||
* @return a {@link forge.Card} object.
|
* @return a {@link forge.Card} object.
|
||||||
*/
|
*/
|
||||||
public static Card getRandom(final Card[] o) {
|
public static Card getRandom(final Card[] o) {
|
||||||
return o[getRandomIndex(o)];
|
return o[CardUtil.getRandomIndex(o)];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -81,11 +81,11 @@ public final class CardUtil {
|
|||||||
* @return a int.
|
* @return a int.
|
||||||
*/
|
*/
|
||||||
public static int getRandomIndex(final SpellAbilityList list) {
|
public static int getRandomIndex(final SpellAbilityList list) {
|
||||||
if (list == null || list.size() == 0) {
|
if ((list == null) || (list.size() == 0)) {
|
||||||
throw new RuntimeException("CardUtil : getRandomIndex(SpellAbilityList) argument is null or length is 0");
|
throw new RuntimeException("CardUtil : getRandomIndex(SpellAbilityList) argument is null or length is 0");
|
||||||
}
|
}
|
||||||
|
|
||||||
return RANDOM.nextInt(list.size());
|
return CardUtil.RANDOM.nextInt(list.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -98,7 +98,7 @@ public final class CardUtil {
|
|||||||
* @return a int.
|
* @return a int.
|
||||||
*/
|
*/
|
||||||
public static int getRandomIndex(final CardList c) {
|
public static int getRandomIndex(final CardList c) {
|
||||||
return RANDOM.nextInt(c.size());
|
return CardUtil.RANDOM.nextInt(c.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
// returns Card Name (unique number) attack/defense
|
// returns Card Name (unique number) attack/defense
|
||||||
@@ -126,11 +126,11 @@ public final class CardUtil {
|
|||||||
* @return an array of {@link forge.Card} objects.
|
* @return an array of {@link forge.Card} objects.
|
||||||
*/
|
*/
|
||||||
public static Card[] toCard(final Collection<Card> col) {
|
public static Card[] toCard(final Collection<Card> col) {
|
||||||
Object[] o = col.toArray();
|
final Object[] o = col.toArray();
|
||||||
Card[] c = new Card[o.length];
|
final Card[] c = new Card[o.length];
|
||||||
|
|
||||||
for (int i = 0; i < c.length; i++) {
|
for (int i = 0; i < c.length; i++) {
|
||||||
Object swap = o[i];
|
final Object swap = o[i];
|
||||||
if (swap instanceof Card) {
|
if (swap instanceof Card) {
|
||||||
c[i] = (Card) o[i];
|
c[i] = (Card) o[i];
|
||||||
} else {
|
} else {
|
||||||
@@ -152,7 +152,7 @@ public final class CardUtil {
|
|||||||
* @return an array of {@link forge.Card} objects.
|
* @return an array of {@link forge.Card} objects.
|
||||||
*/
|
*/
|
||||||
public static Card[] toCard(final ArrayList<Card> list) {
|
public static Card[] toCard(final ArrayList<Card> list) {
|
||||||
Card[] c = new Card[list.size()];
|
final Card[] c = new Card[list.size()];
|
||||||
list.toArray(c);
|
list.toArray(c);
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
@@ -167,9 +167,9 @@ public final class CardUtil {
|
|||||||
* @return a {@link java.util.ArrayList} object.
|
* @return a {@link java.util.ArrayList} object.
|
||||||
*/
|
*/
|
||||||
public static ArrayList<Card> toList(final Card[] c) {
|
public static ArrayList<Card> toList(final Card[] c) {
|
||||||
ArrayList<Card> a = new ArrayList<Card>();
|
final ArrayList<Card> a = new ArrayList<Card>();
|
||||||
for (int i = 0; i < c.length; i++) {
|
for (final Card element : c) {
|
||||||
a.add(c[i]);
|
a.add(element);
|
||||||
}
|
}
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
@@ -185,14 +185,14 @@ public final class CardUtil {
|
|||||||
* @return a {@link java.lang.String} object.
|
* @return a {@link java.lang.String} object.
|
||||||
*/
|
*/
|
||||||
public static String getShortColor(final String longColor) {
|
public static String getShortColor(final String longColor) {
|
||||||
Map<String, String> map = new HashMap<String, String>();
|
final Map<String, String> map = new HashMap<String, String>();
|
||||||
map.put(Constant.Color.BLACK.toString(), "B");
|
map.put(Constant.Color.BLACK.toString(), "B");
|
||||||
map.put(Constant.Color.BLUE.toString(), "U");
|
map.put(Constant.Color.BLUE.toString(), "U");
|
||||||
map.put(Constant.Color.GREEN.toString(), "G");
|
map.put(Constant.Color.GREEN.toString(), "G");
|
||||||
map.put(Constant.Color.RED.toString(), "R");
|
map.put(Constant.Color.RED.toString(), "R");
|
||||||
map.put(Constant.Color.WHITE.toString(), "W");
|
map.put(Constant.Color.WHITE.toString(), "W");
|
||||||
|
|
||||||
Object o = map.get(longColor);
|
final Object o = map.get(longColor);
|
||||||
if (o == null) {
|
if (o == null) {
|
||||||
throw new RuntimeException("CardUtil : getShortColor() invalid argument - " + longColor);
|
throw new RuntimeException("CardUtil : getShortColor() invalid argument - " + longColor);
|
||||||
}
|
}
|
||||||
@@ -212,7 +212,7 @@ public final class CardUtil {
|
|||||||
* @return a boolean.
|
* @return a boolean.
|
||||||
*/
|
*/
|
||||||
public static boolean isColor(final Card c, final String col) {
|
public static boolean isColor(final Card c, final String col) {
|
||||||
ArrayList<String> list = getColors(c);
|
final ArrayList<String> list = CardUtil.getColors(c);
|
||||||
return list.contains(col);
|
return list.contains(col);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -239,8 +239,8 @@ public final class CardUtil {
|
|||||||
* @return a {@link java.util.ArrayList} object.
|
* @return a {@link java.util.ArrayList} object.
|
||||||
*/
|
*/
|
||||||
public static ArrayList<String> getOnlyColors(final Card c) {
|
public static ArrayList<String> getOnlyColors(final Card c) {
|
||||||
String m = c.getManaCost();
|
final String m = c.getManaCost();
|
||||||
Set<String> colors = new HashSet<String>();
|
final Set<String> colors = new HashSet<String>();
|
||||||
|
|
||||||
for (int i = 0; i < m.length(); i++) {
|
for (int i = 0; i < m.length(); i++) {
|
||||||
switch (m.charAt(i)) {
|
switch (m.charAt(i)) {
|
||||||
@@ -265,9 +265,9 @@ public final class CardUtil {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (String kw : c.getKeyword()) {
|
for (final String kw : c.getKeyword()) {
|
||||||
if (kw.startsWith(c.getName() + " is ") || kw.startsWith("CARDNAME is ")) {
|
if (kw.startsWith(c.getName() + " is ") || kw.startsWith("CARDNAME is ")) {
|
||||||
for (String color : Constant.Color.COLORS) {
|
for (final String color : Constant.Color.COLORS) {
|
||||||
if (kw.endsWith(color + ".")) {
|
if (kw.endsWith(color + ".")) {
|
||||||
colors.add(color);
|
colors.add(color);
|
||||||
}
|
}
|
||||||
@@ -313,7 +313,7 @@ public final class CardUtil {
|
|||||||
* @return a int.
|
* @return a int.
|
||||||
*/
|
*/
|
||||||
public static int getConvertedManaCost(final SpellAbility sa) {
|
public static int getConvertedManaCost(final SpellAbility sa) {
|
||||||
return getConvertedManaCost(sa.getManaCost());
|
return CardUtil.getConvertedManaCost(sa.getManaCost());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -329,7 +329,7 @@ public final class CardUtil {
|
|||||||
if (c.isToken() && !c.isCopiedToken()) {
|
if (c.isToken() && !c.isCopiedToken()) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return getConvertedManaCost(c.getManaCost());
|
return CardUtil.getConvertedManaCost(c.getManaCost());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -346,7 +346,7 @@ public final class CardUtil {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ManaCost cost = new ManaCost(manaCost);
|
final ManaCost cost = new ManaCost(manaCost);
|
||||||
return cost.getConvertedManaCost();
|
return cost.getConvertedManaCost();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -413,8 +413,7 @@ public final class CardUtil {
|
|||||||
return c.getEquipping().get(0);
|
return c.getEquipping().get(0);
|
||||||
// else if(relation.startsWith("target ")) return c.getTargetCard();
|
// else if(relation.startsWith("target ")) return c.getTargetCard();
|
||||||
} else {
|
} else {
|
||||||
throw new IllegalArgumentException("Error at CardUtil.getRelative: "
|
throw new IllegalArgumentException("Error at CardUtil.getRelative: " + relation + "is not a valid relation");
|
||||||
+ relation + "is not a valid relation");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -428,7 +427,7 @@ public final class CardUtil {
|
|||||||
* @return a boolean.
|
* @return a boolean.
|
||||||
*/
|
*/
|
||||||
public static boolean isACardType(final String cardType) {
|
public static boolean isACardType(final String cardType) {
|
||||||
return getAllCardTypes().contains(cardType);
|
return CardUtil.getAllCardTypes().contains(cardType);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -439,7 +438,7 @@ public final class CardUtil {
|
|||||||
* @return a {@link java.util.ArrayList} object.
|
* @return a {@link java.util.ArrayList} object.
|
||||||
*/
|
*/
|
||||||
public static ArrayList<String> getAllCardTypes() {
|
public static ArrayList<String> getAllCardTypes() {
|
||||||
ArrayList<String> types = new ArrayList<String>();
|
final ArrayList<String> types = new ArrayList<String>();
|
||||||
|
|
||||||
// types.addAll(getCardTypes());
|
// types.addAll(getCardTypes());
|
||||||
types.addAll(Constant.CardTypes.CARD_TYPES[0].getList());
|
types.addAll(Constant.CardTypes.CARD_TYPES[0].getList());
|
||||||
@@ -460,7 +459,7 @@ public final class CardUtil {
|
|||||||
* @return a {@link java.util.ArrayList} object.
|
* @return a {@link java.util.ArrayList} object.
|
||||||
*/
|
*/
|
||||||
public static ArrayList<String> getCardTypes() {
|
public static ArrayList<String> getCardTypes() {
|
||||||
ArrayList<String> types = new ArrayList<String>();
|
final ArrayList<String> types = new ArrayList<String>();
|
||||||
|
|
||||||
// types.add("Artifact");
|
// types.add("Artifact");
|
||||||
// types.add("Creature");
|
// types.add("Creature");
|
||||||
@@ -485,7 +484,7 @@ public final class CardUtil {
|
|||||||
* @since 1.1.3
|
* @since 1.1.3
|
||||||
*/
|
*/
|
||||||
public static ArrayList<String> getBasicTypes() {
|
public static ArrayList<String> getBasicTypes() {
|
||||||
ArrayList<String> types = new ArrayList<String>();
|
final ArrayList<String> types = new ArrayList<String>();
|
||||||
|
|
||||||
types.addAll(Constant.CardTypes.BASIC_TYPES[0].getList());
|
types.addAll(Constant.CardTypes.BASIC_TYPES[0].getList());
|
||||||
|
|
||||||
@@ -498,7 +497,7 @@ public final class CardUtil {
|
|||||||
* @return the land types
|
* @return the land types
|
||||||
*/
|
*/
|
||||||
public static ArrayList<String> getLandTypes() {
|
public static ArrayList<String> getLandTypes() {
|
||||||
ArrayList<String> types = new ArrayList<String>();
|
final ArrayList<String> types = new ArrayList<String>();
|
||||||
|
|
||||||
types.addAll(Constant.CardTypes.BASIC_TYPES[0].getList());
|
types.addAll(Constant.CardTypes.BASIC_TYPES[0].getList());
|
||||||
types.addAll(Constant.CardTypes.LAND_TYPES[0].getList());
|
types.addAll(Constant.CardTypes.LAND_TYPES[0].getList());
|
||||||
@@ -515,7 +514,7 @@ public final class CardUtil {
|
|||||||
* @since 1.1.6
|
* @since 1.1.6
|
||||||
*/
|
*/
|
||||||
public static ArrayList<String> getCreatureTypes() {
|
public static ArrayList<String> getCreatureTypes() {
|
||||||
ArrayList<String> types = new ArrayList<String>();
|
final ArrayList<String> types = new ArrayList<String>();
|
||||||
|
|
||||||
types.addAll(Constant.CardTypes.CREATURE_TYPES[0].getList());
|
types.addAll(Constant.CardTypes.CREATURE_TYPES[0].getList());
|
||||||
|
|
||||||
@@ -546,7 +545,7 @@ public final class CardUtil {
|
|||||||
* @return a boolean.
|
* @return a boolean.
|
||||||
*/
|
*/
|
||||||
public static boolean isASubType(final String cardType) {
|
public static boolean isASubType(final String cardType) {
|
||||||
return (!isASuperType(cardType) && !isACardType(cardType));
|
return (!CardUtil.isASuperType(cardType) && !CardUtil.isACardType(cardType));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -624,7 +623,7 @@ public final class CardUtil {
|
|||||||
* @return a boolean.
|
* @return a boolean.
|
||||||
*/
|
*/
|
||||||
public static boolean isStackingKeyword(final String keyword) {
|
public static boolean isStackingKeyword(final String keyword) {
|
||||||
return !isNonStackingKeyword(keyword);
|
return !CardUtil.isNonStackingKeyword(keyword);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -639,8 +638,8 @@ public final class CardUtil {
|
|||||||
* @return the string
|
* @return the string
|
||||||
*/
|
*/
|
||||||
public static String buildIdealFilename(final String cardName, final int artIndex, final int artIndexMax) {
|
public static String buildIdealFilename(final String cardName, final int artIndex, final int artIndexMax) {
|
||||||
String nn = artIndexMax > 1 ? Integer.toString(artIndex + 1) : "";
|
final String nn = artIndexMax > 1 ? Integer.toString(artIndex + 1) : "";
|
||||||
String mwsCardName = GuiDisplayUtil.cleanStringMWS(cardName);
|
final String mwsCardName = GuiDisplayUtil.cleanStringMWS(cardName);
|
||||||
// 3 letter set code with MWS filename format
|
// 3 letter set code with MWS filename format
|
||||||
return String.format("%s%s.full.jpg", mwsCardName, nn);
|
return String.format("%s%s.full.jpg", mwsCardName, nn);
|
||||||
}
|
}
|
||||||
@@ -655,18 +654,19 @@ public final class CardUtil {
|
|||||||
* @return a {@link java.lang.String} object.
|
* @return a {@link java.lang.String} object.
|
||||||
*/
|
*/
|
||||||
public static String buildFilename(final Card card) {
|
public static String buildFilename(final Card card) {
|
||||||
boolean token = card.isToken() && !card.isCopiedToken();
|
final boolean token = card.isToken() && !card.isCopiedToken();
|
||||||
|
|
||||||
final String set = card.getCurSetCode();
|
final String set = card.getCurSetCode();
|
||||||
Predicate<SetInfo> findSetInfo = new Predicate<SetInfo>() {
|
final Predicate<SetInfo> findSetInfo = new Predicate<SetInfo>() {
|
||||||
@Override
|
@Override
|
||||||
public boolean isTrue(final SetInfo subject) {
|
public boolean isTrue(final SetInfo subject) {
|
||||||
return subject.getCode().equals(set);
|
return subject.getCode().equals(set);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
SetInfo neededSet = findSetInfo.first(card.getSets());
|
final SetInfo neededSet = findSetInfo.first(card.getSets());
|
||||||
int cntPictures = neededSet == null ? 1 : neededSet.getPicCount();
|
final int cntPictures = neededSet == null ? 1 : neededSet.getPicCount();
|
||||||
return buildFilename(card.getName(), card.getCurSetCode(), card.getRandomPicture(), cntPictures, token);
|
return CardUtil
|
||||||
|
.buildFilename(card.getName(), card.getCurSetCode(), card.getRandomPicture(), cntPictures, token);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -677,41 +677,48 @@ public final class CardUtil {
|
|||||||
* @return the string
|
* @return the string
|
||||||
*/
|
*/
|
||||||
public static String buildFilename(final CardPrinted card) {
|
public static String buildFilename(final CardPrinted card) {
|
||||||
int maxIndex = card.getCard().getSetInfo(card.getSet()).getCopiesCount();
|
final int maxIndex = card.getCard().getSetInfo(card.getSet()).getCopiesCount();
|
||||||
return buildFilename(card.getName(), card.getSet(), card.getArtIndex(), maxIndex, false);
|
return CardUtil.buildFilename(card.getName(), card.getSet(), card.getArtIndex(), maxIndex, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Builds the filename.
|
||||||
|
*
|
||||||
|
* @param card the card
|
||||||
|
* @param nameToUse the name to use
|
||||||
|
* @return the string
|
||||||
|
*/
|
||||||
|
public static String buildFilename(final CardPrinted card, final String nameToUse) {
|
||||||
|
final int maxIndex = card.getCard().getSetInfo(card.getSet()).getCopiesCount();
|
||||||
|
return CardUtil.buildFilename(nameToUse, card.getSet(), card.getArtIndex(), maxIndex, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String buildFilename(final CardPrinted card, String nameToUse) {
|
|
||||||
int maxIndex = card.getCard().getSetInfo(card.getSet()).getCopiesCount();
|
|
||||||
return buildFilename(nameToUse, card.getSet(), card.getArtIndex(), maxIndex, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static String buildFilename(final String cardName, final String setName, final int artIndex,
|
private static String buildFilename(final String cardName, final String setName, final int artIndex,
|
||||||
final int artIndexMax, final boolean isToken) {
|
final int artIndexMax, final boolean isToken) {
|
||||||
File path = ForgeProps.getFile(isToken ? NewConstants.IMAGE_TOKEN : NewConstants.IMAGE_BASE);
|
final File path = ForgeProps.getFile(isToken ? NewConstants.IMAGE_TOKEN : NewConstants.IMAGE_BASE);
|
||||||
String nn = artIndexMax > 1 ? Integer.toString(artIndex + 1) : "";
|
final String nn = artIndexMax > 1 ? Integer.toString(artIndex + 1) : "";
|
||||||
String cleanCardName = GuiDisplayUtil.cleanString(cardName);
|
final String cleanCardName = GuiDisplayUtil.cleanString(cardName);
|
||||||
|
|
||||||
File f = null;
|
File f = null;
|
||||||
if (StringUtils.isNotBlank(setName)) {
|
if (StringUtils.isNotBlank(setName)) {
|
||||||
String mwsCardName = GuiDisplayUtil.cleanStringMWS(cardName);
|
final String mwsCardName = GuiDisplayUtil.cleanStringMWS(cardName);
|
||||||
|
|
||||||
// First, try 3 letter set code with MWS filename format
|
// First, try 3 letter set code with MWS filename format
|
||||||
String mwsSet3 = String.format("%s/%s%s.full", setName, mwsCardName, nn);
|
final String mwsSet3 = String.format("%s/%s%s.full", setName, mwsCardName, nn);
|
||||||
f = new File(path, mwsSet3 + ".jpg");
|
f = new File(path, mwsSet3 + ".jpg");
|
||||||
if (f.exists()) {
|
if (f.exists()) {
|
||||||
return mwsSet3;
|
return mwsSet3;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Second, try 2 letter set code with MWS filename format
|
// Second, try 2 letter set code with MWS filename format
|
||||||
String mwsSet2 = String.format("%s/%s%s.full", SetUtils.getCode2ByCode(setName), mwsCardName, nn);
|
final String mwsSet2 = String.format("%s/%s%s.full", SetUtils.getCode2ByCode(setName), mwsCardName, nn);
|
||||||
f = new File(path, mwsSet2 + ".jpg");
|
f = new File(path, mwsSet2 + ".jpg");
|
||||||
if (f.exists()) {
|
if (f.exists()) {
|
||||||
return mwsSet2;
|
return mwsSet2;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Third, try 3 letter set code with Forge filename format
|
// Third, try 3 letter set code with Forge filename format
|
||||||
String forgeSet3 = String.format("%s/%s%s", setName, cleanCardName, nn);
|
final String forgeSet3 = String.format("%s/%s%s", setName, cleanCardName, nn);
|
||||||
f = new File(path, forgeSet3 + ".jpg");
|
f = new File(path, forgeSet3 + ".jpg");
|
||||||
if (f.exists()) {
|
if (f.exists()) {
|
||||||
return forgeSet3;
|
return forgeSet3;
|
||||||
@@ -719,7 +726,7 @@ public final class CardUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Last, give up with set images, go with the old picture type
|
// Last, give up with set images, go with the old picture type
|
||||||
String forgePlain = String.format("%s%s", cleanCardName, nn);
|
final String forgePlain = String.format("%s%s", cleanCardName, nn);
|
||||||
|
|
||||||
f = new File(path, forgePlain + ".jpg");
|
f = new File(path, forgePlain + ".jpg");
|
||||||
if (f.exists()) {
|
if (f.exists()) {
|
||||||
@@ -750,7 +757,7 @@ public final class CardUtil {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ManaCost cost = new ManaCost(manaCost);
|
final ManaCost cost = new ManaCost(manaCost);
|
||||||
return cost.getWeightedManaCost();
|
return cost.getWeightedManaCost();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -765,7 +772,7 @@ public final class CardUtil {
|
|||||||
*/
|
*/
|
||||||
public static String getShortColorsString(final ArrayList<String> colors) {
|
public static String getShortColorsString(final ArrayList<String> colors) {
|
||||||
String colorDesc = "";
|
String colorDesc = "";
|
||||||
for (String col : colors) {
|
for (final String col : colors) {
|
||||||
if (col.equalsIgnoreCase("White")) {
|
if (col.equalsIgnoreCase("White")) {
|
||||||
colorDesc += "W";
|
colorDesc += "W";
|
||||||
} else if (col.equalsIgnoreCase("Blue")) {
|
} else if (col.equalsIgnoreCase("Blue")) {
|
||||||
@@ -888,7 +895,7 @@ public final class CardUtil {
|
|||||||
* @return a copy of C with LastKnownInfo stuff retained.
|
* @return a copy of C with LastKnownInfo stuff retained.
|
||||||
*/
|
*/
|
||||||
public static Card getLKICopy(final Card c) {
|
public static Card getLKICopy(final Card c) {
|
||||||
Card res = AllZone.getCardFactory().copyCard(c);
|
final Card res = AllZone.getCardFactory().copyCard(c);
|
||||||
res.setControllerObjects(c.getControllerObjects());
|
res.setControllerObjects(c.getControllerObjects());
|
||||||
res.addTempAttackBoost(c.getTempAttackBoost());
|
res.addTempAttackBoost(c.getTempAttackBoost());
|
||||||
res.addTempDefenseBoost(c.getTempDefenseBoost());
|
res.addTempDefenseBoost(c.getTempDefenseBoost());
|
||||||
@@ -899,7 +906,7 @@ public final class CardUtil {
|
|||||||
res.setNewPT(c.getNewPT());
|
res.setNewPT(c.getNewPT());
|
||||||
res.setReceivedDamageFromThisTurn(c.getReceivedDamageFromThisTurn());
|
res.setReceivedDamageFromThisTurn(c.getReceivedDamageFromThisTurn());
|
||||||
res.setHaunting(c.getHaunting());
|
res.setHaunting(c.getHaunting());
|
||||||
for (Card haunter : c.getHauntedBy()) {
|
for (final Card haunter : c.getHauntedBy()) {
|
||||||
res.addHauntedBy(haunter);
|
res.addHauntedBy(haunter);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -918,14 +925,14 @@ public final class CardUtil {
|
|||||||
* @return the radiance
|
* @return the radiance
|
||||||
*/
|
*/
|
||||||
public static CardList getRadiance(final Card source, final Card origin, final String[] valid) {
|
public static CardList getRadiance(final Card source, final Card origin, final String[] valid) {
|
||||||
CardList res = new CardList();
|
final CardList res = new CardList();
|
||||||
|
|
||||||
for (CardColor col : origin.getColor()) {
|
for (final CardColor col : origin.getColor()) {
|
||||||
for (String strCol : col.toStringArray()) {
|
for (final String strCol : col.toStringArray()) {
|
||||||
if (strCol.equalsIgnoreCase("Colorless")) {
|
if (strCol.equalsIgnoreCase("Colorless")) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
for (Card c : AllZoneUtil.getColorInPlay(strCol)) {
|
for (final Card c : AllZoneUtil.getColorInPlay(strCol)) {
|
||||||
if (!res.contains(c) && c.isValid(valid, source.getController(), source) && !c.equals(origin)) {
|
if (!res.contains(c) && c.isValid(valid, source.getController(), source) && !c.equals(origin)) {
|
||||||
res.add(c);
|
res.add(c);
|
||||||
}
|
}
|
||||||
@@ -935,48 +942,54 @@ public final class CardUtil {
|
|||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ArrayList<String> getConvokableColors(final Card cardToConvoke, ManaCost cost)
|
/**
|
||||||
{
|
* Gets the convokable colors.
|
||||||
ArrayList<String> usableColors = new ArrayList<String>();
|
*
|
||||||
|
* @param cardToConvoke the card to convoke
|
||||||
if(cost.getColorlessManaAmount() > 0)
|
* @param cost the cost
|
||||||
{
|
* @return the convokable colors
|
||||||
|
*/
|
||||||
|
public static ArrayList<String> getConvokableColors(final Card cardToConvoke, final ManaCost cost) {
|
||||||
|
final ArrayList<String> usableColors = new ArrayList<String>();
|
||||||
|
|
||||||
|
if (cost.getColorlessManaAmount() > 0) {
|
||||||
usableColors.add("colorless");
|
usableColors.add("colorless");
|
||||||
}
|
}
|
||||||
for(CardColor col : cardToConvoke.getColor())
|
for (final CardColor col : cardToConvoke.getColor()) {
|
||||||
{
|
for (final String strCol : col.toStringArray()) {
|
||||||
for(String strCol : col.toStringArray())
|
if (strCol.equals("colorless")) {
|
||||||
{
|
|
||||||
if(strCol.equals("colorless"))
|
|
||||||
{
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if(cost.toString().contains(InputPayManaCostUtil.getShortColorString(strCol)))
|
if (cost.toString().contains(InputPayManaCostUtil.getShortColorString(strCol))) {
|
||||||
{
|
|
||||||
usableColors.add(strCol.toString());
|
usableColors.add(strCol.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return usableColors;
|
return usableColors;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the face down characteristic.
|
||||||
|
*
|
||||||
|
* @return the face down characteristic
|
||||||
|
*/
|
||||||
public static CardCharacteristics getFaceDownCharacteristic() {
|
public static CardCharacteristics getFaceDownCharacteristic() {
|
||||||
ArrayList<String> types = new ArrayList<String>();
|
final ArrayList<String> types = new ArrayList<String>();
|
||||||
types.add("Creature");
|
types.add("Creature");
|
||||||
|
|
||||||
CardCharacteristics ret = new CardCharacteristics();
|
final CardCharacteristics ret = new CardCharacteristics();
|
||||||
ret.setBaseAttack(2);
|
ret.setBaseAttack(2);
|
||||||
ret.setBaseDefense(2);
|
ret.setBaseDefense(2);
|
||||||
|
|
||||||
ret.setName("");
|
ret.setName("");
|
||||||
ret.setType(types);
|
ret.setType(types);
|
||||||
|
|
||||||
ret.setImageFilename("morph.jpg");
|
ret.setImageFilename("morph.jpg");
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // end class CardUtil
|
} // end class CardUtil
|
||||||
|
|||||||
@@ -225,7 +225,9 @@ public class Combat {
|
|||||||
if (attackingPlayer != null) {
|
if (attackingPlayer != null) {
|
||||||
return attackingPlayer;
|
return attackingPlayer;
|
||||||
}
|
}
|
||||||
else return AllZone.getPhase().getPlayerTurn();
|
else {
|
||||||
|
return AllZone.getPhase().getPlayerTurn();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -239,7 +241,9 @@ public class Combat {
|
|||||||
if (attackingPlayer != null) {
|
if (attackingPlayer != null) {
|
||||||
return defendingPlayer;
|
return defendingPlayer;
|
||||||
}
|
}
|
||||||
else return AllZone.getPhase().getPlayerTurn().getOpponent();
|
else {
|
||||||
|
return AllZone.getPhase().getPlayerTurn().getOpponent();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -35,13 +35,14 @@ public class ComputerAIGeneral implements Computer {
|
|||||||
* main1.
|
* main1.
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public final void main1() {
|
public final void main1() {
|
||||||
ComputerUtil.chooseLandsToPlay();
|
ComputerUtil.chooseLandsToPlay();
|
||||||
|
|
||||||
if (AllZone.getStack().size() == 0) {
|
if (AllZone.getStack().size() == 0) {
|
||||||
playCards(Constant.Phase.MAIN1);
|
this.playCards(Constant.Phase.MAIN1);
|
||||||
} else {
|
} else {
|
||||||
stackResponse();
|
this.stackResponse();
|
||||||
}
|
}
|
||||||
} // main1()
|
} // main1()
|
||||||
|
|
||||||
@@ -50,13 +51,14 @@ public class ComputerAIGeneral implements Computer {
|
|||||||
* main2.
|
* main2.
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public final void main2() {
|
public final void main2() {
|
||||||
ComputerUtil.chooseLandsToPlay();
|
ComputerUtil.chooseLandsToPlay();
|
||||||
|
|
||||||
if (AllZone.getStack().size() == 0) {
|
if (AllZone.getStack().size() == 0) {
|
||||||
playCards(Constant.Phase.MAIN2);
|
this.playCards(Constant.Phase.MAIN2);
|
||||||
} else {
|
} else {
|
||||||
stackResponse();
|
this.stackResponse();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,9 +71,9 @@ public class ComputerAIGeneral implements Computer {
|
|||||||
* a {@link java.lang.String} object.
|
* a {@link java.lang.String} object.
|
||||||
*/
|
*/
|
||||||
private void playCards(final String phase) {
|
private void playCards(final String phase) {
|
||||||
SpellAbility[] sp = phase.equals(Constant.Phase.MAIN1) ? getMain1() : getMain2();
|
final SpellAbility[] sp = phase.equals(Constant.Phase.MAIN1) ? this.getMain1() : this.getMain2();
|
||||||
|
|
||||||
boolean nextPhase = ComputerUtil.playAbilities(sp);
|
final boolean nextPhase = ComputerUtil.playAbilities(sp);
|
||||||
|
|
||||||
if (nextPhase) {
|
if (nextPhase) {
|
||||||
AllZone.getPhase().passPriority();
|
AllZone.getPhase().passPriority();
|
||||||
@@ -88,11 +90,12 @@ public class ComputerAIGeneral implements Computer {
|
|||||||
private SpellAbility[] getMain1() {
|
private SpellAbility[] getMain1() {
|
||||||
// Card list of all cards to consider
|
// Card list of all cards to consider
|
||||||
CardList hand = AllZone.getComputerPlayer().getCardsIn(Zone.Hand);
|
CardList hand = AllZone.getComputerPlayer().getCardsIn(Zone.Hand);
|
||||||
|
|
||||||
final boolean hasACardGivingHaste = hasACardGivingHaste();
|
final boolean hasACardGivingHaste = this.hasACardGivingHaste();
|
||||||
|
|
||||||
if (AllZone.getComputerPlayer().getManaPool().isEmpty()) {
|
if (AllZone.getComputerPlayer().getManaPool().isEmpty()) {
|
||||||
hand = hand.filter(new CardListFilter() {
|
hand = hand.filter(new CardListFilter() {
|
||||||
|
@Override
|
||||||
public boolean addCard(final Card c) {
|
public boolean addCard(final Card c) {
|
||||||
|
|
||||||
if (c.getSVar("PlayMain1").equals("TRUE")) {
|
if (c.getSVar("PlayMain1").equals("TRUE")) {
|
||||||
@@ -104,17 +107,17 @@ public class ComputerAIGeneral implements Computer {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c.isCreature() && (hasACardGivingHaste || c.hasKeyword("Haste")) || c.hasKeyword("Exalted")) {
|
if ((c.isCreature() && (hasACardGivingHaste || c.hasKeyword("Haste"))) || c.hasKeyword("Exalted")) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// get all cards the computer controls with BuffedBy
|
// get all cards the computer controls with BuffedBy
|
||||||
CardList buffed = AllZone.getComputerPlayer().getCardsIn(Zone.Battlefield);
|
final CardList buffed = AllZone.getComputerPlayer().getCardsIn(Zone.Battlefield);
|
||||||
for (int j = 0; j < buffed.size(); j++) {
|
for (int j = 0; j < buffed.size(); j++) {
|
||||||
Card buffedcard = buffed.get(j);
|
final Card buffedcard = buffed.get(j);
|
||||||
if (buffedcard.getSVar("BuffedBy").length() > 0) {
|
if (buffedcard.getSVar("BuffedBy").length() > 0) {
|
||||||
String buffedby = buffedcard.getSVar("BuffedBy");
|
final String buffedby = buffedcard.getSVar("BuffedBy");
|
||||||
String[] bffdby = buffedby.split(",");
|
final String[] bffdby = buffedby.split(",");
|
||||||
if (c.isValid(bffdby, c.getController(), c)) {
|
if (c.isValid(bffdby, c.getController(), c)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -122,12 +125,12 @@ public class ComputerAIGeneral implements Computer {
|
|||||||
} // BuffedBy
|
} // BuffedBy
|
||||||
|
|
||||||
// get all cards the human controls with AntiBuffedBy
|
// get all cards the human controls with AntiBuffedBy
|
||||||
CardList antibuffed = AllZone.getHumanPlayer().getCardsIn(Zone.Battlefield);
|
final CardList antibuffed = AllZone.getHumanPlayer().getCardsIn(Zone.Battlefield);
|
||||||
for (int k = 0; k < antibuffed.size(); k++) {
|
for (int k = 0; k < antibuffed.size(); k++) {
|
||||||
Card buffedcard = antibuffed.get(k);
|
final Card buffedcard = antibuffed.get(k);
|
||||||
if (buffedcard.getSVar("AntiBuffedBy").length() > 0) {
|
if (buffedcard.getSVar("AntiBuffedBy").length() > 0) {
|
||||||
String buffedby = buffedcard.getSVar("AntiBuffedBy");
|
final String buffedby = buffedcard.getSVar("AntiBuffedBy");
|
||||||
String[] bffdby = buffedby.split(",");
|
final String[] bffdby = buffedby.split(",");
|
||||||
if (c.isValid(bffdby, c.getController(), c)) {
|
if (c.isValid(bffdby, c.getController(), c)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -138,19 +141,20 @@ public class ComputerAIGeneral implements Computer {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
CardList vengevines = AllZone.getComputerPlayer().getCardsIn(Zone.Graveyard, "Vengevine");
|
final CardList vengevines = AllZone.getComputerPlayer().getCardsIn(Zone.Graveyard, "Vengevine");
|
||||||
if (vengevines.size() > 0) {
|
if (vengevines.size() > 0) {
|
||||||
CardList creatures = AllZone.getComputerPlayer().getCardsIn(Zone.Hand);
|
final CardList creatures = AllZone.getComputerPlayer().getCardsIn(Zone.Hand);
|
||||||
CardList creatures2 = new CardList();
|
final CardList creatures2 = new CardList();
|
||||||
for (int i = 0; i < creatures.size(); i++) {
|
for (int i = 0; i < creatures.size(); i++) {
|
||||||
if (creatures.get(i).isCreature()
|
if (creatures.get(i).isCreature()
|
||||||
&& CardUtil.getConvertedManaCost(creatures.get(i).getManaCost()) <= 3) {
|
&& (CardUtil.getConvertedManaCost(creatures.get(i).getManaCost()) <= 3)) {
|
||||||
creatures2.add(creatures.get(i));
|
creatures2.add(creatures.get(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (creatures2.size() + CardUtil.getThisTurnCast("Creature.YouCtrl",
|
if (((creatures2.size() + CardUtil.getThisTurnCast("Creature.YouCtrl", vengevines.get(0))
|
||||||
vengevines.get(0)).size() > 1
|
.size()) > 1)
|
||||||
&& c.isCreature() && CardUtil.getConvertedManaCost(c.getManaCost()) <= 3) {
|
&& c.isCreature()
|
||||||
|
&& (CardUtil.getConvertedManaCost(c.getManaCost()) <= 3)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} // AI Improvement for Vengevine
|
} // AI Improvement for Vengevine
|
||||||
@@ -159,12 +163,13 @@ public class ComputerAIGeneral implements Computer {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
CardList all = AllZone.getComputerPlayer().getCardsIn(Zone.Battlefield);
|
final CardList all = AllZone.getComputerPlayer().getCardsIn(Zone.Battlefield);
|
||||||
all.addAll(CardFactoryUtil.getExternalZoneActivationCards(AllZone.getComputerPlayer()));
|
all.addAll(CardFactoryUtil.getExternalZoneActivationCards(AllZone.getComputerPlayer()));
|
||||||
all.addAll(hand);
|
all.addAll(hand);
|
||||||
|
|
||||||
CardList humanPlayable = AllZone.getHumanPlayer().getCardsIn(Zone.Battlefield);
|
CardList humanPlayable = AllZone.getHumanPlayer().getCardsIn(Zone.Battlefield);
|
||||||
humanPlayable = humanPlayable.filter(new CardListFilter() {
|
humanPlayable = humanPlayable.filter(new CardListFilter() {
|
||||||
|
@Override
|
||||||
public boolean addCard(final Card c) {
|
public boolean addCard(final Card c) {
|
||||||
return (c.canAnyPlayerActivate());
|
return (c.canAnyPlayerActivate());
|
||||||
}
|
}
|
||||||
@@ -172,9 +177,9 @@ public class ComputerAIGeneral implements Computer {
|
|||||||
|
|
||||||
all.addAll(humanPlayable);
|
all.addAll(humanPlayable);
|
||||||
|
|
||||||
return getPlayable(all);
|
return this.getPlayable(all);
|
||||||
} // getMain1()
|
} // getMain1()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* hasACardGivingHaste.
|
* hasACardGivingHaste.
|
||||||
@@ -183,17 +188,17 @@ public class ComputerAIGeneral implements Computer {
|
|||||||
* @return a boolean.
|
* @return a boolean.
|
||||||
*/
|
*/
|
||||||
public boolean hasACardGivingHaste() {
|
public boolean hasACardGivingHaste() {
|
||||||
CardList all = AllZone.getComputerPlayer().getCardsIn(Zone.Battlefield);
|
final CardList all = AllZone.getComputerPlayer().getCardsIn(Zone.Battlefield);
|
||||||
all.addAll(CardFactoryUtil.getExternalZoneActivationCards(AllZone.getComputerPlayer()));
|
all.addAll(CardFactoryUtil.getExternalZoneActivationCards(AllZone.getComputerPlayer()));
|
||||||
all.addAll(AllZone.getComputerPlayer().getCardsIn(Zone.Hand));
|
all.addAll(AllZone.getComputerPlayer().getCardsIn(Zone.Hand));
|
||||||
|
|
||||||
for (Card c : all) {
|
for (final Card c : all) {
|
||||||
for (SpellAbility sa : c.getSpellAbility()) {
|
for (final SpellAbility sa : c.getSpellAbility()) {
|
||||||
if(sa.getAbilityFactory() == null) {
|
if (sa.getAbilityFactory() == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
AbilityFactory af = sa.getAbilityFactory();
|
final AbilityFactory af = sa.getAbilityFactory();
|
||||||
HashMap<String, String> abilityParams = af.getMapParams();
|
final HashMap<String, String> abilityParams = af.getMapParams();
|
||||||
if (abilityParams.containsKey("AB") && !abilityParams.get("AB").equals("Pump")) {
|
if (abilityParams.containsKey("AB") && !abilityParams.get("AB").equals("Pump")) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -205,9 +210,9 @@ public class ComputerAIGeneral implements Computer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
} //hasACardGivingHaste
|
} // hasACardGivingHaste
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@@ -221,6 +226,7 @@ public class ComputerAIGeneral implements Computer {
|
|||||||
CardList all = AllZone.getComputerPlayer().getCardsIn(Zone.Hand);
|
CardList all = AllZone.getComputerPlayer().getCardsIn(Zone.Hand);
|
||||||
// Don't play permanents with Flash before humans declare attackers step
|
// Don't play permanents with Flash before humans declare attackers step
|
||||||
all = all.filter(new CardListFilter() {
|
all = all.filter(new CardListFilter() {
|
||||||
|
@Override
|
||||||
public boolean addCard(final Card c) {
|
public boolean addCard(final Card c) {
|
||||||
if (c.isPermanent()
|
if (c.isPermanent()
|
||||||
&& c.hasKeyword("Flash")
|
&& c.hasKeyword("Flash")
|
||||||
@@ -239,6 +245,7 @@ public class ComputerAIGeneral implements Computer {
|
|||||||
all = all.getNotKeyword("At the beginning of the end step, sacrifice CARDNAME.");
|
all = all.getNotKeyword("At the beginning of the end step, sacrifice CARDNAME.");
|
||||||
|
|
||||||
all = all.filter(new CardListFilter() {
|
all = all.filter(new CardListFilter() {
|
||||||
|
@Override
|
||||||
public boolean addCard(final Card c) {
|
public boolean addCard(final Card c) {
|
||||||
if (c.isLand()) {
|
if (c.isLand()) {
|
||||||
return false;
|
return false;
|
||||||
@@ -249,13 +256,14 @@ public class ComputerAIGeneral implements Computer {
|
|||||||
|
|
||||||
CardList humanPlayable = AllZone.getHumanPlayer().getCardsIn(Zone.Battlefield);
|
CardList humanPlayable = AllZone.getHumanPlayer().getCardsIn(Zone.Battlefield);
|
||||||
humanPlayable = humanPlayable.filter(new CardListFilter() {
|
humanPlayable = humanPlayable.filter(new CardListFilter() {
|
||||||
|
@Override
|
||||||
public boolean addCard(final Card c) {
|
public boolean addCard(final Card c) {
|
||||||
return (c.canAnyPlayerActivate());
|
return (c.canAnyPlayerActivate());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
all.addAll(humanPlayable);
|
all.addAll(humanPlayable);
|
||||||
|
|
||||||
return getPlayable(all);
|
return this.getPlayable(all);
|
||||||
} // getMain2()
|
} // getMain2()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -269,6 +277,7 @@ public class ComputerAIGeneral implements Computer {
|
|||||||
CardList all = AllZone.getComputerPlayer().getCardsIn(Zone.Hand);
|
CardList all = AllZone.getComputerPlayer().getCardsIn(Zone.Hand);
|
||||||
// Don't play permanents with Flash before humans declare attackers step
|
// Don't play permanents with Flash before humans declare attackers step
|
||||||
all = all.filter(new CardListFilter() {
|
all = all.filter(new CardListFilter() {
|
||||||
|
@Override
|
||||||
public boolean addCard(final Card c) {
|
public boolean addCard(final Card c) {
|
||||||
if (c.isPermanent()
|
if (c.isPermanent()
|
||||||
&& c.hasKeyword("Flash")
|
&& c.hasKeyword("Flash")
|
||||||
@@ -284,6 +293,7 @@ public class ComputerAIGeneral implements Computer {
|
|||||||
|
|
||||||
CardList humanPlayable = AllZone.getHumanPlayer().getCardsIn(Zone.Battlefield);
|
CardList humanPlayable = AllZone.getHumanPlayer().getCardsIn(Zone.Battlefield);
|
||||||
humanPlayable = humanPlayable.filter(new CardListFilter() {
|
humanPlayable = humanPlayable.filter(new CardListFilter() {
|
||||||
|
@Override
|
||||||
public boolean addCard(final Card c) {
|
public boolean addCard(final Card c) {
|
||||||
return (c.canAnyPlayerActivate());
|
return (c.canAnyPlayerActivate());
|
||||||
}
|
}
|
||||||
@@ -300,7 +310,7 @@ public class ComputerAIGeneral implements Computer {
|
|||||||
* @return an array of {@link forge.card.spellability.SpellAbility} objects.
|
* @return an array of {@link forge.card.spellability.SpellAbility} objects.
|
||||||
*/
|
*/
|
||||||
private SpellAbility[] getOtherPhases() {
|
private SpellAbility[] getOtherPhases() {
|
||||||
return getPlayable(getAvailableSpellAbilities());
|
return this.getPlayable(this.getAvailableSpellAbilities());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -311,7 +321,7 @@ public class ComputerAIGeneral implements Computer {
|
|||||||
* @return a {@link java.util.ArrayList} object.
|
* @return a {@link java.util.ArrayList} object.
|
||||||
*/
|
*/
|
||||||
private ArrayList<SpellAbility> getPossibleCounters() {
|
private ArrayList<SpellAbility> getPossibleCounters() {
|
||||||
return getPlayableCounters(getAvailableSpellAbilities());
|
return this.getPlayableCounters(this.getAvailableSpellAbilities());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -322,7 +332,7 @@ public class ComputerAIGeneral implements Computer {
|
|||||||
* @return a {@link java.util.ArrayList} object.
|
* @return a {@link java.util.ArrayList} object.
|
||||||
*/
|
*/
|
||||||
private ArrayList<SpellAbility> getPossibleETBCounters() {
|
private ArrayList<SpellAbility> getPossibleETBCounters() {
|
||||||
return getETBCounters(getAvailableSpellAbilities());
|
return this.getETBCounters(this.getAvailableSpellAbilities());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -334,9 +344,9 @@ public class ComputerAIGeneral implements Computer {
|
|||||||
* @return an array of {@link forge.card.spellability.SpellAbility} objects.
|
* @return an array of {@link forge.card.spellability.SpellAbility} objects.
|
||||||
*/
|
*/
|
||||||
private SpellAbility[] getPlayable(final CardList l) {
|
private SpellAbility[] getPlayable(final CardList l) {
|
||||||
ArrayList<SpellAbility> spellAbility = new ArrayList<SpellAbility>();
|
final ArrayList<SpellAbility> spellAbility = new ArrayList<SpellAbility>();
|
||||||
for (Card c : l) {
|
for (final Card c : l) {
|
||||||
for (SpellAbility sa : c.getSpellAbility()) {
|
for (final SpellAbility sa : c.getSpellAbility()) {
|
||||||
spellAbility.add(sa);
|
spellAbility.add(sa);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -353,11 +363,11 @@ public class ComputerAIGeneral implements Computer {
|
|||||||
* @return a {@link java.util.ArrayList} object.
|
* @return a {@link java.util.ArrayList} object.
|
||||||
*/
|
*/
|
||||||
private ArrayList<SpellAbility> getPlayableCounters(final CardList l) {
|
private ArrayList<SpellAbility> getPlayableCounters(final CardList l) {
|
||||||
ArrayList<SpellAbility> spellAbility = new ArrayList<SpellAbility>();
|
final ArrayList<SpellAbility> spellAbility = new ArrayList<SpellAbility>();
|
||||||
for (Card c : l) {
|
for (final Card c : l) {
|
||||||
for (SpellAbility sa : c.getSpellAbility()) {
|
for (final SpellAbility sa : c.getSpellAbility()) {
|
||||||
// Check if this AF is a Counterpsell
|
// Check if this AF is a Counterpsell
|
||||||
if (sa.getAbilityFactory() != null && sa.getAbilityFactory().getAPI().equals("Counter")) {
|
if ((sa.getAbilityFactory() != null) && sa.getAbilityFactory().getAPI().equals("Counter")) {
|
||||||
spellAbility.add(sa);
|
spellAbility.add(sa);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -376,9 +386,9 @@ public class ComputerAIGeneral implements Computer {
|
|||||||
* @return a {@link java.util.ArrayList} object.
|
* @return a {@link java.util.ArrayList} object.
|
||||||
*/
|
*/
|
||||||
private ArrayList<SpellAbility> getETBCounters(final CardList l) {
|
private ArrayList<SpellAbility> getETBCounters(final CardList l) {
|
||||||
ArrayList<SpellAbility> spellAbility = new ArrayList<SpellAbility>();
|
final ArrayList<SpellAbility> spellAbility = new ArrayList<SpellAbility>();
|
||||||
for (Card c : l) {
|
for (final Card c : l) {
|
||||||
for (SpellAbility sa : c.getSpellAbility()) {
|
for (final SpellAbility sa : c.getSpellAbility()) {
|
||||||
// Or if this Permanent has an ETB ability with Counter
|
// Or if this Permanent has an ETB ability with Counter
|
||||||
if (sa instanceof SpellPermanent) {
|
if (sa instanceof SpellPermanent) {
|
||||||
if (SpellPermanent.checkETBEffects(c, sa, "Counter")) {
|
if (SpellPermanent.checkETBEffects(c, sa, "Counter")) {
|
||||||
@@ -396,8 +406,9 @@ public class ComputerAIGeneral implements Computer {
|
|||||||
* begin_combat.
|
* begin_combat.
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public final void beginCombat() {
|
public final void beginCombat() {
|
||||||
stackResponse();
|
this.stackResponse();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -405,20 +416,21 @@ public class ComputerAIGeneral implements Computer {
|
|||||||
* declare_attackers.
|
* declare_attackers.
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public final void declareAttackers() {
|
public final void declareAttackers() {
|
||||||
// 12/2/10(sol) the decision making here has moved to getAttackers()
|
// 12/2/10(sol) the decision making here has moved to getAttackers()
|
||||||
|
|
||||||
AllZone.setCombat(ComputerUtil.getAttackers());
|
AllZone.setCombat(ComputerUtil.getAttackers());
|
||||||
|
|
||||||
Card[] att = AllZone.getCombat().getAttackers();
|
final Card[] att = AllZone.getCombat().getAttackers();
|
||||||
if (att.length > 0) {
|
if (att.length > 0) {
|
||||||
AllZone.getPhase().setCombat(true);
|
AllZone.getPhase().setCombat(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < att.length; i++) {
|
for (final Card element : att) {
|
||||||
// tapping of attackers happens after Propaganda is paid for
|
// tapping of attackers happens after Propaganda is paid for
|
||||||
// if (!att[i].hasKeyword("Vigilance")) att[i].tap();
|
// if (!att[i].hasKeyword("Vigilance")) att[i].tap();
|
||||||
Log.debug("Computer just assigned " + att[i].getName() + " as an attacker.");
|
Log.debug("Computer just assigned " + element.getName() + " as an attacker.");
|
||||||
}
|
}
|
||||||
|
|
||||||
AllZone.getComputerPlayer().getZone(Zone.Battlefield).updateObservers();
|
AllZone.getComputerPlayer().getZone(Zone.Battlefield).updateObservers();
|
||||||
@@ -432,8 +444,9 @@ public class ComputerAIGeneral implements Computer {
|
|||||||
* declare_attackers_after.
|
* declare_attackers_after.
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public final void declareAttackersAfter() {
|
public final void declareAttackersAfter() {
|
||||||
stackResponse();
|
this.stackResponse();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -441,8 +454,9 @@ public class ComputerAIGeneral implements Computer {
|
|||||||
* declare_blockers.
|
* declare_blockers.
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public final void declareBlockers() {
|
public final void declareBlockers() {
|
||||||
CardList blockers = AllZoneUtil.getCreaturesInPlay(AllZone.getComputerPlayer());
|
final CardList blockers = AllZoneUtil.getCreaturesInPlay(AllZone.getComputerPlayer());
|
||||||
|
|
||||||
AllZone.setCombat(ComputerUtilBlock.getBlockers(AllZone.getCombat(), blockers));
|
AllZone.setCombat(ComputerUtilBlock.getBlockers(AllZone.getCombat(), blockers));
|
||||||
|
|
||||||
@@ -456,8 +470,9 @@ public class ComputerAIGeneral implements Computer {
|
|||||||
* declare_blockers_after.
|
* declare_blockers_after.
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public final void declareBlockersAfter() {
|
public final void declareBlockersAfter() {
|
||||||
stackResponse();
|
this.stackResponse();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -465,8 +480,9 @@ public class ComputerAIGeneral implements Computer {
|
|||||||
* end_of_combat.
|
* end_of_combat.
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public final void endOfCombat() {
|
public final void endOfCombat() {
|
||||||
stackResponse();
|
this.stackResponse();
|
||||||
}
|
}
|
||||||
|
|
||||||
// end of Human's turn
|
// end of Human's turn
|
||||||
@@ -475,8 +491,9 @@ public class ComputerAIGeneral implements Computer {
|
|||||||
* end_of_turn.
|
* end_of_turn.
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public final void endOfTurn() {
|
public final void endOfTurn() {
|
||||||
stackResponse();
|
this.stackResponse();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -484,8 +501,9 @@ public class ComputerAIGeneral implements Computer {
|
|||||||
* stack_not_empty.
|
* stack_not_empty.
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public final void stackNotEmpty() {
|
public final void stackNotEmpty() {
|
||||||
stackResponse();
|
this.stackResponse();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -495,7 +513,7 @@ public class ComputerAIGeneral implements Computer {
|
|||||||
*/
|
*/
|
||||||
public final void stackResponse() {
|
public final void stackResponse() {
|
||||||
// if top of stack is empty
|
// if top of stack is empty
|
||||||
SpellAbility[] sas = getOtherPhases();
|
final SpellAbility[] sas = this.getOtherPhases();
|
||||||
if (AllZone.getStack().size() == 0) {
|
if (AllZone.getStack().size() == 0) {
|
||||||
|
|
||||||
boolean pass = (sas.length == 0)
|
boolean pass = (sas.length == 0)
|
||||||
@@ -519,9 +537,9 @@ public class ComputerAIGeneral implements Computer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// top of stack is owned by human,
|
// top of stack is owned by human,
|
||||||
ArrayList<SpellAbility> possibleCounters = getPossibleCounters();
|
ArrayList<SpellAbility> possibleCounters = this.getPossibleCounters();
|
||||||
|
|
||||||
if (possibleCounters.size() > 0 && ComputerUtil.playCounterSpell(possibleCounters)) {
|
if ((possibleCounters.size() > 0) && ComputerUtil.playCounterSpell(possibleCounters)) {
|
||||||
// Responding CounterSpell is on the Stack trying to Counter the
|
// Responding CounterSpell is on the Stack trying to Counter the
|
||||||
// Spell
|
// Spell
|
||||||
// If playCounterSpell returns true, a Spell is hitting the Stack
|
// If playCounterSpell returns true, a Spell is hitting the Stack
|
||||||
@@ -529,8 +547,8 @@ public class ComputerAIGeneral implements Computer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
possibleCounters.clear();
|
possibleCounters.clear();
|
||||||
possibleCounters = getPossibleETBCounters();
|
possibleCounters = this.getPossibleETBCounters();
|
||||||
if (possibleCounters.size() > 0 && !ComputerUtil.playAbilities(possibleCounters)) {
|
if ((possibleCounters.size() > 0) && !ComputerUtil.playAbilities(possibleCounters)) {
|
||||||
// Responding Permanent w/ ETB Counter is on the Stack
|
// Responding Permanent w/ ETB Counter is on the Stack
|
||||||
// AllZone.getPhase().passPriority();
|
// AllZone.getPhase().passPriority();
|
||||||
return;
|
return;
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -20,12 +20,12 @@ import forge.card.trigger.Trigger;
|
|||||||
public class ComputerUtilAttack {
|
public class ComputerUtilAttack {
|
||||||
|
|
||||||
// possible attackers and blockers
|
// possible attackers and blockers
|
||||||
private CardList attackers;
|
private final CardList attackers;
|
||||||
private CardList blockers;
|
private final CardList blockers;
|
||||||
private CardList playerCreatures;
|
private CardList playerCreatures;
|
||||||
|
|
||||||
private Random random = MyRandom.getRandom();
|
private final Random random = MyRandom.getRandom();
|
||||||
private final int randomInt = random.nextInt();
|
private final int randomInt = this.random.nextInt();
|
||||||
|
|
||||||
private CardList humanList; // holds human player creatures
|
private CardList humanList; // holds human player creatures
|
||||||
private CardList computerList; // holds computer creatures
|
private CardList computerList; // holds computer creatures
|
||||||
@@ -42,8 +42,6 @@ public class ComputerUtilAttack {
|
|||||||
* an array of {@link forge.Card} objects.
|
* an array of {@link forge.Card} objects.
|
||||||
* @param possibleBlockers
|
* @param possibleBlockers
|
||||||
* an array of {@link forge.Card} objects.
|
* an array of {@link forge.Card} objects.
|
||||||
* @param blockerLife
|
|
||||||
* a int.
|
|
||||||
*/
|
*/
|
||||||
public ComputerUtilAttack(final Card[] possibleAttackers, final Card[] possibleBlockers) {
|
public ComputerUtilAttack(final Card[] possibleAttackers, final Card[] possibleBlockers) {
|
||||||
this(new CardList(possibleAttackers), new CardList(possibleBlockers));
|
this(new CardList(possibleAttackers), new CardList(possibleBlockers));
|
||||||
@@ -58,20 +56,18 @@ public class ComputerUtilAttack {
|
|||||||
* a {@link forge.CardList} object.
|
* a {@link forge.CardList} object.
|
||||||
* @param possibleBlockers
|
* @param possibleBlockers
|
||||||
* a {@link forge.CardList} object.
|
* a {@link forge.CardList} object.
|
||||||
* @param blockerLife
|
|
||||||
* a int.
|
|
||||||
*/
|
*/
|
||||||
public ComputerUtilAttack(final CardList possibleAttackers, final CardList possibleBlockers) {
|
public ComputerUtilAttack(final CardList possibleAttackers, final CardList possibleBlockers) {
|
||||||
humanList = new CardList(possibleBlockers.toArray());
|
this.humanList = new CardList(possibleBlockers.toArray());
|
||||||
humanList = humanList.getType("Creature");
|
this.humanList = this.humanList.getType("Creature");
|
||||||
|
|
||||||
computerList = new CardList(possibleAttackers.toArray());
|
this.computerList = new CardList(possibleAttackers.toArray());
|
||||||
computerList = computerList.getType("Creature");
|
this.computerList = this.computerList.getType("Creature");
|
||||||
playerCreatures = new CardList(possibleBlockers.toArray());
|
this.playerCreatures = new CardList(possibleBlockers.toArray());
|
||||||
playerCreatures = playerCreatures.getType("Creature");
|
this.playerCreatures = this.playerCreatures.getType("Creature");
|
||||||
|
|
||||||
attackers = getPossibleAttackers(possibleAttackers);
|
this.attackers = this.getPossibleAttackers(possibleAttackers);
|
||||||
blockers = getPossibleBlockers(possibleBlockers, attackers);
|
this.blockers = this.getPossibleBlockers(possibleBlockers, this.attackers);
|
||||||
} // constructor
|
} // constructor
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -84,20 +80,20 @@ public class ComputerUtilAttack {
|
|||||||
* @return a {@link forge.CardList} object.
|
* @return a {@link forge.CardList} object.
|
||||||
*/
|
*/
|
||||||
public final CardList sortAttackers(final CardList in) {
|
public final CardList sortAttackers(final CardList in) {
|
||||||
CardList list = new CardList();
|
final CardList list = new CardList();
|
||||||
|
|
||||||
// Cards with triggers should come first (for Battle Cry)
|
// Cards with triggers should come first (for Battle Cry)
|
||||||
for (Card attacker : in) {
|
for (final Card attacker : in) {
|
||||||
ArrayList<Trigger> registeredTriggers = attacker.getTriggers();
|
final ArrayList<Trigger> registeredTriggers = attacker.getTriggers();
|
||||||
for (Trigger trigger : registeredTriggers) {
|
for (final Trigger trigger : registeredTriggers) {
|
||||||
HashMap<String, String> trigParams = trigger.getMapParams();
|
final HashMap<String, String> trigParams = trigger.getMapParams();
|
||||||
if (trigParams.get("Mode").equals("Attacks")) {
|
if (trigParams.get("Mode").equals("Attacks")) {
|
||||||
list.add(attacker);
|
list.add(attacker);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Card attacker : in) {
|
for (final Card attacker : in) {
|
||||||
if (!list.contains(attacker)) {
|
if (!list.contains(attacker)) {
|
||||||
list.add(attacker);
|
list.add(attacker);
|
||||||
}
|
}
|
||||||
@@ -121,7 +117,7 @@ public class ComputerUtilAttack {
|
|||||||
public final boolean isEffectiveAttacker(final Card attacker, final Combat combat) {
|
public final boolean isEffectiveAttacker(final Card attacker, final Combat combat) {
|
||||||
|
|
||||||
// if the attacker will die when attacking don't attack
|
// if the attacker will die when attacking don't attack
|
||||||
if (attacker.getNetDefense() + CombatUtil.predictToughnessBonusOfAttacker(attacker, null, combat) <= 0) {
|
if ((attacker.getNetDefense() + CombatUtil.predictToughnessBonusOfAttacker(attacker, null, combat)) <= 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -132,10 +128,10 @@ public class ComputerUtilAttack {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
CardList controlledByCompy = AllZone.getComputerPlayer().getAllCards();
|
final CardList controlledByCompy = AllZone.getComputerPlayer().getAllCards();
|
||||||
|
|
||||||
for (Card c : controlledByCompy) {
|
for (final Card c : controlledByCompy) {
|
||||||
for (Trigger trigger : c.getTriggers()) {
|
for (final Trigger trigger : c.getTriggers()) {
|
||||||
if (CombatUtil.combatTriggerWillTrigger(attacker, null, trigger, combat)) {
|
if (CombatUtil.combatTriggerWillTrigger(attacker, null, trigger, combat)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -157,6 +153,7 @@ public class ComputerUtilAttack {
|
|||||||
public final CardList getPossibleAttackers(final CardList in) {
|
public final CardList getPossibleAttackers(final CardList in) {
|
||||||
CardList list = new CardList(in.toArray());
|
CardList list = new CardList(in.toArray());
|
||||||
list = list.filter(new CardListFilter() {
|
list = list.filter(new CardListFilter() {
|
||||||
|
@Override
|
||||||
public boolean addCard(final Card c) {
|
public boolean addCard(final Card c) {
|
||||||
return CombatUtil.canAttack(c);
|
return CombatUtil.canAttack(c);
|
||||||
}
|
}
|
||||||
@@ -179,11 +176,12 @@ public class ComputerUtilAttack {
|
|||||||
CardList possibleBlockers = new CardList(blockers.toArray());
|
CardList possibleBlockers = new CardList(blockers.toArray());
|
||||||
final CardList attackerList = new CardList(attackers.toArray());
|
final CardList attackerList = new CardList(attackers.toArray());
|
||||||
possibleBlockers = possibleBlockers.filter(new CardListFilter() {
|
possibleBlockers = possibleBlockers.filter(new CardListFilter() {
|
||||||
|
@Override
|
||||||
public boolean addCard(final Card c) {
|
public boolean addCard(final Card c) {
|
||||||
if (!c.isCreature()) {
|
if (!c.isCreature()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
for (Card attacker : attackerList) {
|
for (final Card attacker : attackerList) {
|
||||||
if (CombatUtil.canBlock(attacker, c)) {
|
if (CombatUtil.canBlock(attacker, c)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -209,15 +207,15 @@ public class ComputerUtilAttack {
|
|||||||
* @return a {@link forge.CardList} object.
|
* @return a {@link forge.CardList} object.
|
||||||
*/
|
*/
|
||||||
public final CardList notNeededAsBlockers(final CardList attackers, final Combat combat) {
|
public final CardList notNeededAsBlockers(final CardList attackers, final Combat combat) {
|
||||||
CardList notNeededAsBlockers = new CardList(attackers.toArray());
|
final CardList notNeededAsBlockers = new CardList(attackers.toArray());
|
||||||
CardListUtil.sortAttackLowFirst(attackers);
|
CardListUtil.sortAttackLowFirst(attackers);
|
||||||
int blockersNeeded = attackers.size();
|
int blockersNeeded = attackers.size();
|
||||||
|
|
||||||
// don't hold back creatures that can't block any of the human creatures
|
// don't hold back creatures that can't block any of the human creatures
|
||||||
CardList list = getPossibleBlockers(attackers, humanList);
|
final CardList list = this.getPossibleBlockers(attackers, this.humanList);
|
||||||
|
|
||||||
for (int i = 0; i < list.size(); i++) {
|
for (int i = 0; i < list.size(); i++) {
|
||||||
if (!doesHumanAttackAndWin(i)) {
|
if (!this.doesHumanAttackAndWin(i)) {
|
||||||
blockersNeeded = i;
|
blockersNeeded = i;
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
@@ -236,34 +234,33 @@ public class ComputerUtilAttack {
|
|||||||
// In addition, if the computer guesses it needs no blockers, make sure
|
// In addition, if the computer guesses it needs no blockers, make sure
|
||||||
// that
|
// that
|
||||||
// it won't be surprised by Exalted
|
// it won't be surprised by Exalted
|
||||||
int humanExaltedBonus = countExaltedBonus(AllZone.getHumanPlayer());
|
final int humanExaltedBonus = this.countExaltedBonus(AllZone.getHumanPlayer());
|
||||||
|
|
||||||
if (humanExaltedBonus > 0) {
|
if (humanExaltedBonus > 0) {
|
||||||
int nFinestHours = AllZone.getHumanPlayer().getCardsIn(Zone.Battlefield, "Finest Hour").size();
|
final int nFinestHours = AllZone.getHumanPlayer().getCardsIn(Zone.Battlefield, "Finest Hour").size();
|
||||||
|
|
||||||
if ((blockersNeeded == 0 || nFinestHours > 0) && humanList.size() > 0) {
|
if (((blockersNeeded == 0) || (nFinestHours > 0)) && (this.humanList.size() > 0)) {
|
||||||
//
|
//
|
||||||
// total attack = biggest creature + exalted, *2 if Rafiq is in
|
// total attack = biggest creature + exalted, *2 if Rafiq is in
|
||||||
// play
|
// play
|
||||||
int humanBaseAttack = getAttack(humanList.get(0)) + humanExaltedBonus;
|
int humanBaseAttack = this.getAttack(this.humanList.get(0)) + humanExaltedBonus;
|
||||||
if (nFinestHours > 0) {
|
if (nFinestHours > 0) {
|
||||||
// For Finest Hour, one creature could attack and get the
|
// For Finest Hour, one creature could attack and get the
|
||||||
// bonus TWICE
|
// bonus TWICE
|
||||||
humanBaseAttack = humanBaseAttack + humanExaltedBonus;
|
humanBaseAttack = humanBaseAttack + humanExaltedBonus;
|
||||||
}
|
}
|
||||||
int totalExaltedAttack = AllZoneUtil.isCardInPlay("Rafiq of the Many",
|
final int totalExaltedAttack = AllZoneUtil.isCardInPlay("Rafiq of the Many", AllZone.getHumanPlayer()) ? 2 * humanBaseAttack
|
||||||
AllZone.getHumanPlayer()) ? 2 * humanBaseAttack
|
|
||||||
: humanBaseAttack;
|
: humanBaseAttack;
|
||||||
if ((AllZone.getComputerPlayer().getLife() - 3) <= totalExaltedAttack) {
|
if ((AllZone.getComputerPlayer().getLife() - 3) <= totalExaltedAttack) {
|
||||||
// We will lose if there is an Exalted attack -- keep one
|
// We will lose if there is an Exalted attack -- keep one
|
||||||
// blocker
|
// blocker
|
||||||
if (blockersNeeded == 0 && notNeededAsBlockers.size() > 0) {
|
if ((blockersNeeded == 0) && (notNeededAsBlockers.size() > 0)) {
|
||||||
notNeededAsBlockers.remove(0);
|
notNeededAsBlockers.remove(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Finest Hour allows a second Exalted attack: keep a
|
// Finest Hour allows a second Exalted attack: keep a
|
||||||
// blocker for that too
|
// blocker for that too
|
||||||
if (nFinestHours > 0 && notNeededAsBlockers.size() > 0) {
|
if ((nFinestHours > 0) && (notNeededAsBlockers.size() > 0)) {
|
||||||
notNeededAsBlockers.remove(0);
|
notNeededAsBlockers.remove(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -271,7 +268,7 @@ public class ComputerUtilAttack {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// re-add creatures with vigilance
|
// re-add creatures with vigilance
|
||||||
for (Card c : attackers) {
|
for (final Card c : attackers) {
|
||||||
if (c.hasKeyword("Vigilance")) {
|
if (c.hasKeyword("Vigilance")) {
|
||||||
notNeededAsBlockers.add(c);
|
notNeededAsBlockers.add(c);
|
||||||
}
|
}
|
||||||
@@ -292,10 +289,10 @@ public class ComputerUtilAttack {
|
|||||||
*/
|
*/
|
||||||
public final boolean doesHumanAttackAndWin(final int nBlockingCreatures) {
|
public final boolean doesHumanAttackAndWin(final int nBlockingCreatures) {
|
||||||
int totalAttack = 0;
|
int totalAttack = 0;
|
||||||
int stop = humanList.size() - nBlockingCreatures;
|
final int stop = this.humanList.size() - nBlockingCreatures;
|
||||||
|
|
||||||
for (int i = 0; i < stop; i++) {
|
for (int i = 0; i < stop; i++) {
|
||||||
totalAttack += getAttack(humanList.get(i));
|
totalAttack += this.getAttack(this.humanList.get(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
// originally -3 so the computer will try to stay at 3 life
|
// originally -3 so the computer will try to stay at 3 life
|
||||||
@@ -313,41 +310,43 @@ public class ComputerUtilAttack {
|
|||||||
*/
|
*/
|
||||||
private boolean doAssault() {
|
private boolean doAssault() {
|
||||||
// Beastmaster Ascension
|
// Beastmaster Ascension
|
||||||
if (AllZoneUtil.isCardInPlay("Beastmaster Ascension", AllZone.getComputerPlayer()) && attackers.size() > 1) {
|
if (AllZoneUtil.isCardInPlay("Beastmaster Ascension", AllZone.getComputerPlayer())
|
||||||
CardList beastions = AllZone.getComputerPlayer().getCardsIn(Constant.Zone.Battlefield)
|
&& (this.attackers.size() > 1)) {
|
||||||
|
final CardList beastions = AllZone.getComputerPlayer().getCardsIn(Constant.Zone.Battlefield)
|
||||||
.getName("Beastmaster Ascension");
|
.getName("Beastmaster Ascension");
|
||||||
int minCreatures = 7;
|
int minCreatures = 7;
|
||||||
for (Card beastion : beastions) {
|
for (final Card beastion : beastions) {
|
||||||
int counters = beastion.getCounters(Counters.QUEST);
|
final int counters = beastion.getCounters(Counters.QUEST);
|
||||||
minCreatures = Math.min(minCreatures, 7 - counters);
|
minCreatures = Math.min(minCreatures, 7 - counters);
|
||||||
}
|
}
|
||||||
if (attackers.size() >= minCreatures) {
|
if (this.attackers.size() >= minCreatures) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CardListUtil.sortAttack(attackers);
|
CardListUtil.sortAttack(this.attackers);
|
||||||
|
|
||||||
CardList remainingAttackers = new CardList(attackers.toArray());
|
final CardList remainingAttackers = new CardList(this.attackers.toArray());
|
||||||
CardList blockableAttackers = new CardList(attackers.toArray());
|
final CardList blockableAttackers = new CardList(this.attackers.toArray());
|
||||||
|
|
||||||
for (int i = 0; i < attackers.size(); i++) {
|
for (int i = 0; i < this.attackers.size(); i++) {
|
||||||
if(!CombatUtil.canBeBlocked(attackers.get(i), blockers)) {
|
if (!CombatUtil.canBeBlocked(this.attackers.get(i), this.blockers)) {
|
||||||
blockableAttackers.remove(attackers.get(i));
|
blockableAttackers.remove(this.attackers.get(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// presumes the Human will block
|
// presumes the Human will block
|
||||||
for (int i = 0; i < blockers.size() && i < blockableAttackers.size(); i++) {
|
for (int i = 0; (i < this.blockers.size()) && (i < blockableAttackers.size()); i++) {
|
||||||
remainingAttackers.remove(blockableAttackers.get(i));
|
remainingAttackers.remove(blockableAttackers.get(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(CombatUtil.sumDamageIfUnblocked(remainingAttackers, AllZone.getHumanPlayer()) > AllZone.getHumanPlayer().getLife()
|
if ((CombatUtil.sumDamageIfUnblocked(remainingAttackers, AllZone.getHumanPlayer()) > AllZone.getHumanPlayer()
|
||||||
&& AllZone.getHumanPlayer().canLoseLife()) {
|
.getLife()) && AllZone.getHumanPlayer().canLoseLife()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(CombatUtil.sumPoisonIfUnblocked(remainingAttackers, AllZone.getHumanPlayer()) >= 10 - AllZone.getHumanPlayer().getPoisonCounters()) {
|
if (CombatUtil.sumPoisonIfUnblocked(remainingAttackers, AllZone.getHumanPlayer()) >= (10 - AllZone
|
||||||
|
.getHumanPlayer().getPoisonCounters())) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -367,15 +366,15 @@ public class ComputerUtilAttack {
|
|||||||
public final void chooseDefender(final Combat c, final boolean bAssault) {
|
public final void chooseDefender(final Combat c, final boolean bAssault) {
|
||||||
// TODO split attackers to different planeswalker/human
|
// TODO split attackers to different planeswalker/human
|
||||||
// AI will only attack one Defender per combat for now
|
// AI will only attack one Defender per combat for now
|
||||||
ArrayList<Object> defs = c.getDefenders();
|
final ArrayList<Object> defs = c.getDefenders();
|
||||||
|
|
||||||
// Randomly determine who EVERYONE is attacking
|
// Randomly determine who EVERYONE is attacking
|
||||||
// would be better to determine more individually
|
// would be better to determine more individually
|
||||||
int n = MyRandom.getRandom().nextInt(defs.size());
|
int n = MyRandom.getRandom().nextInt(defs.size());
|
||||||
|
|
||||||
Object entity = AllZone.getComputerPlayer().getMustAttackEntity();
|
final Object entity = AllZone.getComputerPlayer().getMustAttackEntity();
|
||||||
if (null != entity) {
|
if (null != entity) {
|
||||||
ArrayList<Object> defenders = AllZone.getCombat().getDefenders();
|
final ArrayList<Object> defenders = AllZone.getCombat().getDefenders();
|
||||||
n = defenders.indexOf(entity);
|
n = defenders.indexOf(entity);
|
||||||
if (-1 == n) {
|
if (-1 == n) {
|
||||||
System.out.println("getMustAttackEntity() returned something not in defenders.");
|
System.out.println("getMustAttackEntity() returned something not in defenders.");
|
||||||
@@ -384,7 +383,7 @@ public class ComputerUtilAttack {
|
|||||||
c.setCurrentDefender(n);
|
c.setCurrentDefender(n);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (defs.size() == 1 || bAssault) {
|
if ((defs.size() == 1) || bAssault) {
|
||||||
c.setCurrentDefender(0);
|
c.setCurrentDefender(0);
|
||||||
} else {
|
} else {
|
||||||
c.setCurrentDefender(n);
|
c.setCurrentDefender(n);
|
||||||
@@ -407,22 +406,22 @@ public class ComputerUtilAttack {
|
|||||||
// randomInt is used so that the computer doesn't always
|
// randomInt is used so that the computer doesn't always
|
||||||
// do the same thing on turn 3 if he had the same creatures in play
|
// do the same thing on turn 3 if he had the same creatures in play
|
||||||
// I know this is a little confusing
|
// I know this is a little confusing
|
||||||
random.setSeed(AllZone.getPhase().getTurn() + randomInt);
|
this.random.setSeed(AllZone.getPhase().getTurn() + this.randomInt);
|
||||||
|
|
||||||
Combat combat = new Combat();
|
final Combat combat = new Combat();
|
||||||
combat.setAttackingPlayer(AllZone.getCombat().getAttackingPlayer());
|
combat.setAttackingPlayer(AllZone.getCombat().getAttackingPlayer());
|
||||||
combat.setDefendingPlayer(AllZone.getCombat().getDefendingPlayer());
|
combat.setDefendingPlayer(AllZone.getCombat().getDefendingPlayer());
|
||||||
|
|
||||||
combat.setDefenders(AllZone.getCombat().getDefenders());
|
combat.setDefenders(AllZone.getCombat().getDefenders());
|
||||||
|
|
||||||
boolean bAssault = doAssault();
|
final boolean bAssault = this.doAssault();
|
||||||
// Determine who will be attacked
|
// Determine who will be attacked
|
||||||
chooseDefender(combat, bAssault);
|
this.chooseDefender(combat, bAssault);
|
||||||
|
|
||||||
CardList attackersLeft = new CardList(attackers.toArray());
|
CardList attackersLeft = new CardList(this.attackers.toArray());
|
||||||
|
|
||||||
// Attackers that don't really have a choice
|
// Attackers that don't really have a choice
|
||||||
for (Card attacker : attackers) {
|
for (final Card attacker : this.attackers) {
|
||||||
if ((attacker.hasKeyword("CARDNAME attacks each turn if able.")
|
if ((attacker.hasKeyword("CARDNAME attacks each turn if able.")
|
||||||
|| attacker.hasKeyword("At the beginning of the end step, destroy CARDNAME.")
|
|| attacker.hasKeyword("At the beginning of the end step, destroy CARDNAME.")
|
||||||
|| attacker.hasKeyword("At the beginning of the end step, exile CARDNAME.")
|
|| attacker.hasKeyword("At the beginning of the end step, exile CARDNAME.")
|
||||||
@@ -443,10 +442,10 @@ public class ComputerUtilAttack {
|
|||||||
int playerForcesForAttritionalAttack = 0;
|
int playerForcesForAttritionalAttack = 0;
|
||||||
|
|
||||||
// examine the potential forces
|
// examine the potential forces
|
||||||
CardList nextTurnAttackers = new CardList();
|
final CardList nextTurnAttackers = new CardList();
|
||||||
int candidateCounterAttackDamage = 0;
|
int candidateCounterAttackDamage = 0;
|
||||||
// int candidateTotalBlockDamage = 0;
|
// int candidateTotalBlockDamage = 0;
|
||||||
for (Card pCard : playerCreatures) {
|
for (final Card pCard : this.playerCreatures) {
|
||||||
|
|
||||||
// if the creature can attack next turn add it to counter attackers
|
// if the creature can attack next turn add it to counter attackers
|
||||||
// list
|
// list
|
||||||
@@ -472,9 +471,9 @@ public class ComputerUtilAttack {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// get the potential damage and strength of the AI forces
|
// get the potential damage and strength of the AI forces
|
||||||
CardList candidateAttackers = new CardList();
|
final CardList candidateAttackers = new CardList();
|
||||||
int candidateUnblockedDamage = 0;
|
int candidateUnblockedDamage = 0;
|
||||||
for (Card pCard : computerList) {
|
for (final Card pCard : this.computerList) {
|
||||||
// if the creature can attack then it's a potential attacker this
|
// if the creature can attack then it's a potential attacker this
|
||||||
// turn, assume summoning sickness creatures will be able to
|
// turn, assume summoning sickness creatures will be able to
|
||||||
if (CombatUtil.canAttackNextTurn(pCard)) {
|
if (CombatUtil.canAttackNextTurn(pCard)) {
|
||||||
@@ -502,10 +501,10 @@ public class ComputerUtilAttack {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// determine if the ai outnumbers the player
|
// determine if the ai outnumbers the player
|
||||||
int outNumber = computerForces - playerForces;
|
final int outNumber = computerForces - playerForces;
|
||||||
|
|
||||||
// compare the ratios, higher = better for ai
|
// compare the ratios, higher = better for ai
|
||||||
double ratioDiff = aiLifeToPlayerDamageRatio - playerLifeToDamageRatio;
|
final double ratioDiff = aiLifeToPlayerDamageRatio - playerLifeToDamageRatio;
|
||||||
/*
|
/*
|
||||||
* System.out.println(String.valueOf(ratioDiff) +
|
* System.out.println(String.valueOf(ratioDiff) +
|
||||||
* " = ratio difference, higher = better for ai");
|
* " = ratio difference, higher = better for ai");
|
||||||
@@ -524,17 +523,17 @@ public class ComputerUtilAttack {
|
|||||||
// *********************
|
// *********************
|
||||||
boolean doAttritionalAttack = false;
|
boolean doAttritionalAttack = false;
|
||||||
// get list of attackers ordered from low power to high
|
// get list of attackers ordered from low power to high
|
||||||
CardListUtil.sortAttackLowFirst(attackers);
|
CardListUtil.sortAttackLowFirst(this.attackers);
|
||||||
// get player life total
|
// get player life total
|
||||||
int playerLife = AllZone.getHumanPlayer().getLife();
|
int playerLife = AllZone.getHumanPlayer().getLife();
|
||||||
// get the list of attackers up to the first blocked one
|
// get the list of attackers up to the first blocked one
|
||||||
CardList attritionalAttackers = new CardList();
|
final CardList attritionalAttackers = new CardList();
|
||||||
for (int x = 0; x < attackers.size() - playerForces; x++) {
|
for (int x = 0; x < (this.attackers.size() - playerForces); x++) {
|
||||||
attritionalAttackers.add(attackers.getCard(x));
|
attritionalAttackers.add(this.attackers.getCard(x));
|
||||||
}
|
}
|
||||||
// until the attackers are used up or the player would run out of life
|
// until the attackers are used up or the player would run out of life
|
||||||
int attackRounds = 1;
|
int attackRounds = 1;
|
||||||
while (attritionalAttackers.size() > 0 && playerLife > 0 && attackRounds < 99) {
|
while ((attritionalAttackers.size() > 0) && (playerLife > 0) && (attackRounds < 99)) {
|
||||||
// sum attacker damage
|
// sum attacker damage
|
||||||
int damageThisRound = 0;
|
int damageThisRound = 0;
|
||||||
for (int y = 0; y < attritionalAttackers.size(); y++) {
|
for (int y = 0; y < attritionalAttackers.size(); y++) {
|
||||||
@@ -565,11 +564,11 @@ public class ComputerUtilAttack {
|
|||||||
double unblockableDamage = 0;
|
double unblockableDamage = 0;
|
||||||
double turnsUntilDeathByUnblockable = 0;
|
double turnsUntilDeathByUnblockable = 0;
|
||||||
boolean doUnblockableAttack = false;
|
boolean doUnblockableAttack = false;
|
||||||
for (Card attacker : attackers) {
|
for (final Card attacker : this.attackers) {
|
||||||
boolean isUnblockableCreature = true;
|
boolean isUnblockableCreature = true;
|
||||||
// check blockers individually, as the bulk canBeBlocked doesn't
|
// check blockers individually, as the bulk canBeBlocked doesn't
|
||||||
// check all circumstances
|
// check all circumstances
|
||||||
for (Card blocker : blockers) {
|
for (final Card blocker : this.blockers) {
|
||||||
if (CombatUtil.canBlock(attacker, blocker)) {
|
if (CombatUtil.canBlock(attacker, blocker)) {
|
||||||
isUnblockableCreature = false;
|
isUnblockableCreature = false;
|
||||||
}
|
}
|
||||||
@@ -592,56 +591,58 @@ public class ComputerUtilAttack {
|
|||||||
// totals and other considerations
|
// totals and other considerations
|
||||||
// some bad "magic numbers" here, TODO replace with nice descriptive
|
// some bad "magic numbers" here, TODO replace with nice descriptive
|
||||||
// variable names
|
// variable names
|
||||||
if ((ratioDiff > 0 && doAttritionalAttack)) { // (playerLifeToDamageRatio
|
if (((ratioDiff > 0) && doAttritionalAttack)) { // (playerLifeToDamageRatio
|
||||||
// <= 1 && ratioDiff >= 1
|
// <= 1 && ratioDiff >=
|
||||||
// && outNumber > 0) ||
|
// 1
|
||||||
aiAggression = 5; // attack at all costs
|
// && outNumber > 0) ||
|
||||||
} else if ((playerLifeToDamageRatio < 2 && ratioDiff >= 0)
|
this.aiAggression = 5; // attack at all costs
|
||||||
|| ratioDiff > 3 || (ratioDiff > 0 && outNumber > 0)) {
|
} else if (((playerLifeToDamageRatio < 2) && (ratioDiff >= 0)) || (ratioDiff > 3)
|
||||||
aiAggression = 3; // attack expecting to kill creatures or damage
|
|| ((ratioDiff > 0) && (outNumber > 0))) {
|
||||||
// player.
|
this.aiAggression = 3; // attack expecting to kill creatures or
|
||||||
} else if (ratioDiff >= 0 || ratioDiff + outNumber >= -1) {
|
// damage
|
||||||
|
// player.
|
||||||
|
} else if ((ratioDiff >= 0) || ((ratioDiff + outNumber) >= -1)) {
|
||||||
// at 0 ratio expect to potentially gain an advantage by attacking
|
// at 0 ratio expect to potentially gain an advantage by attacking
|
||||||
// first
|
// first
|
||||||
// if the ai has a slight advantage
|
// if the ai has a slight advantage
|
||||||
// or the ai has a significant advantage numerically but only a
|
// or the ai has a significant advantage numerically but only a
|
||||||
// slight disadvantage damage/life
|
// slight disadvantage damage/life
|
||||||
aiAggression = 2; // attack expecting to destroy creatures/be
|
this.aiAggression = 2; // attack expecting to destroy creatures/be
|
||||||
// unblockable
|
// unblockable
|
||||||
} else if (ratioDiff < 0 && aiLifeToPlayerDamageRatio > 1) {
|
} else if ((ratioDiff < 0) && (aiLifeToPlayerDamageRatio > 1)) {
|
||||||
// the player is overmatched but there are a few turns before death
|
// the player is overmatched but there are a few turns before death
|
||||||
aiAggression = 2; // attack expecting to destroy creatures/be
|
this.aiAggression = 2; // attack expecting to destroy creatures/be
|
||||||
// unblockable
|
// unblockable
|
||||||
} else if (doUnblockableAttack || ((ratioDiff * -1) < turnsUntilDeathByUnblockable)) {
|
} else if (doUnblockableAttack || ((ratioDiff * -1) < turnsUntilDeathByUnblockable)) {
|
||||||
aiAggression = 1; // look for unblockable creatures that might be
|
this.aiAggression = 1; // look for unblockable creatures that might
|
||||||
// able to attack for a bit of
|
// be
|
||||||
|
// able to attack for a bit of
|
||||||
// fatal damage even if the player is significantly better
|
// fatal damage even if the player is significantly better
|
||||||
} else if (ratioDiff < 0) {
|
} else if (ratioDiff < 0) {
|
||||||
aiAggression = 0;
|
this.aiAggression = 0;
|
||||||
} // stay at home to block
|
} // stay at home to block
|
||||||
System.out.println(String.valueOf(aiAggression) + " = ai aggression");
|
System.out.println(String.valueOf(this.aiAggression) + " = ai aggression");
|
||||||
|
|
||||||
// ****************
|
// ****************
|
||||||
// End of edits
|
// End of edits
|
||||||
// ****************
|
// ****************
|
||||||
|
|
||||||
// Exalted
|
// Exalted
|
||||||
if (combat.getAttackers().length == 0
|
if ((combat.getAttackers().length == 0)
|
||||||
&& (countExaltedBonus(AllZone.getComputerPlayer()) >= 3
|
&& ((this.countExaltedBonus(AllZone.getComputerPlayer()) >= 3)
|
||||||
|| AllZoneUtil.isCardInPlay("Rafiq of the Many", AllZone.getComputerPlayer())
|
|| AllZoneUtil.isCardInPlay("Rafiq of the Many", AllZone.getComputerPlayer())
|
||||||
|| AllZone.getComputerPlayer().getCardsIn(Zone.Battlefield,
|
|| (AllZone.getComputerPlayer().getCardsIn(Zone.Battlefield, "Battlegrace Angel").size() >= 2) || ((AllZone
|
||||||
"Battlegrace Angel").size() >= 2 || (AllZone
|
.getComputerPlayer().getCardsIn(Zone.Battlefield, "Finest Hour").size() >= 1) && AllZone
|
||||||
.getComputerPlayer().getCardsIn(Zone.Battlefield, "Finest Hour").size() >= 1)
|
.getPhase().isFirstCombat())) && !bAssault) {
|
||||||
&& AllZone.getPhase().isFirstCombat()) && !bAssault) {
|
|
||||||
int biggest = 0;
|
int biggest = 0;
|
||||||
Card att = null;
|
Card att = null;
|
||||||
for (int i = 0; i < attackersLeft.size(); i++) {
|
for (int i = 0; i < attackersLeft.size(); i++) {
|
||||||
if (getAttack(attackersLeft.get(i)) > biggest) {
|
if (this.getAttack(attackersLeft.get(i)) > biggest) {
|
||||||
biggest = getAttack(attackersLeft.get(i));
|
biggest = this.getAttack(attackersLeft.get(i));
|
||||||
att = attackersLeft.get(i);
|
att = attackersLeft.get(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (att != null && CombatUtil.canAttack(att, combat)) {
|
if ((att != null) && CombatUtil.canAttack(att, combat)) {
|
||||||
combat.addAttacker(att);
|
combat.addAttacker(att);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -656,26 +657,26 @@ public class ComputerUtilAttack {
|
|||||||
for (int i = 0; i < attackersLeft.size(); i++) {
|
for (int i = 0; i < attackersLeft.size(); i++) {
|
||||||
if (CombatUtil.canAttack(attackersLeft.get(i), combat)) {
|
if (CombatUtil.canAttack(attackersLeft.get(i), combat)) {
|
||||||
combat.addAttacker(attackersLeft.get(i));
|
combat.addAttacker(attackersLeft.get(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
System.out.println("Normal attack");
|
System.out.println("Normal attack");
|
||||||
|
|
||||||
attackersLeft = notNeededAsBlockers(attackersLeft, combat);
|
attackersLeft = this.notNeededAsBlockers(attackersLeft, combat);
|
||||||
System.out.println(attackersLeft.size());
|
System.out.println(attackersLeft.size());
|
||||||
|
|
||||||
attackersLeft = sortAttackers(attackersLeft);
|
attackersLeft = this.sortAttackers(attackersLeft);
|
||||||
|
|
||||||
for (int i = 0; i < attackersLeft.size(); i++) {
|
for (int i = 0; i < attackersLeft.size(); i++) {
|
||||||
Card attacker = attackersLeft.get(i);
|
final Card attacker = attackersLeft.get(i);
|
||||||
int totalFirstStrikeBlockPower = 0;
|
int totalFirstStrikeBlockPower = 0;
|
||||||
if (!attacker.hasFirstStrike() && !attacker.hasDoubleStrike()) {
|
if (!attacker.hasFirstStrike() && !attacker.hasDoubleStrike()) {
|
||||||
totalFirstStrikeBlockPower = CombatUtil.getTotalFirstStrikeBlockPower(attacker,
|
totalFirstStrikeBlockPower = CombatUtil.getTotalFirstStrikeBlockPower(attacker,
|
||||||
AllZone.getHumanPlayer());
|
AllZone.getHumanPlayer());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (shouldAttack(attacker, blockers, combat)
|
if (this.shouldAttack(attacker, this.blockers, combat)
|
||||||
&& (totalFirstStrikeBlockPower < attacker.getKillDamage() || aiAggression == 5)
|
&& ((totalFirstStrikeBlockPower < attacker.getKillDamage()) || (this.aiAggression == 5))
|
||||||
&& CombatUtil.canAttack(attacker, combat)) {
|
&& CombatUtil.canAttack(attacker, combat)) {
|
||||||
combat.addAttacker(attacker);
|
combat.addAttacker(attacker);
|
||||||
}
|
}
|
||||||
@@ -697,6 +698,7 @@ public class ComputerUtilAttack {
|
|||||||
public final int countExaltedBonus(final Player player) {
|
public final int countExaltedBonus(final Player player) {
|
||||||
CardList list = player.getCardsIn(Zone.Battlefield);
|
CardList list = player.getCardsIn(Zone.Battlefield);
|
||||||
list = list.filter(new CardListFilter() {
|
list = list.filter(new CardListFilter() {
|
||||||
|
@Override
|
||||||
public boolean addCard(final Card c) {
|
public boolean addCard(final Card c) {
|
||||||
return c.hasKeyword("Exalted");
|
return c.hasKeyword("Exalted");
|
||||||
}
|
}
|
||||||
@@ -748,7 +750,7 @@ public class ComputerUtilAttack {
|
|||||||
boolean isWorthLessThanAllKillers = true;
|
boolean isWorthLessThanAllKillers = true;
|
||||||
boolean canBeBlocked = false;
|
boolean canBeBlocked = false;
|
||||||
|
|
||||||
if (!isEffectiveAttacker(attacker, combat)) {
|
if (!this.isEffectiveAttacker(attacker, combat)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -756,7 +758,7 @@ public class ComputerUtilAttack {
|
|||||||
// number of factors about the attacking
|
// number of factors about the attacking
|
||||||
// context that will be relevant to the attackers decision according to
|
// context that will be relevant to the attackers decision according to
|
||||||
// the selected strategy
|
// the selected strategy
|
||||||
for (Card defender : defenders) {
|
for (final Card defender : defenders) {
|
||||||
if (CombatUtil.canBlock(attacker, defender)) { // , combat )) {
|
if (CombatUtil.canBlock(attacker, defender)) { // , combat )) {
|
||||||
canBeBlocked = true;
|
canBeBlocked = true;
|
||||||
if (CombatUtil.canDestroyAttacker(attacker, defender, combat, false)) {
|
if (CombatUtil.canDestroyAttacker(attacker, defender, combat, false)) {
|
||||||
@@ -793,7 +795,7 @@ public class ComputerUtilAttack {
|
|||||||
|
|
||||||
// decide if the creature should attack based on the prevailing strategy
|
// decide if the creature should attack based on the prevailing strategy
|
||||||
// choice in aiAggression
|
// choice in aiAggression
|
||||||
switch (aiAggression) {
|
switch (this.aiAggression) {
|
||||||
case 5: // all out attacking
|
case 5: // all out attacking
|
||||||
System.out.println(attacker.getName() + " = all out attacking");
|
System.out.println(attacker.getName() + " = all out attacking");
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -256,7 +256,7 @@ public enum Counters {
|
|||||||
|
|
||||||
/** The STUDY. */
|
/** The STUDY. */
|
||||||
STUDY(),
|
STUDY(),
|
||||||
|
|
||||||
/** The THEFT. */
|
/** The THEFT. */
|
||||||
THEFT(),
|
THEFT(),
|
||||||
|
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ public class GameAction {
|
|||||||
c.switchStates("Cloner", "Original");
|
c.switchStates("Cloner", "Original");
|
||||||
c.setState("Original");
|
c.setState("Original");
|
||||||
}
|
}
|
||||||
|
|
||||||
copied = AllZone.getCardFactory().copyCard(c);
|
copied = AllZone.getCardFactory().copyCard(c);
|
||||||
lastKnownInfo = CardUtil.getLKICopy(c);
|
lastKnownInfo = CardUtil.getLKICopy(c);
|
||||||
|
|
||||||
@@ -540,9 +540,8 @@ public class GameAction {
|
|||||||
if (c.isToken()) {
|
if (c.isToken()) {
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(c.isInAlternateState())
|
if (c.isInAlternateState()) {
|
||||||
{
|
|
||||||
c.setState("Original");
|
c.setState("Original");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -893,7 +892,8 @@ public class GameAction {
|
|||||||
|
|
||||||
if (entity instanceof Card) {
|
if (entity instanceof Card) {
|
||||||
final Card perm = (Card) entity;
|
final Card perm = (Card) entity;
|
||||||
if (!AllZoneUtil.isCardInPlay(perm) || perm.hasProtectionFrom(c) || perm.hasKeyword("CARDNAME can't be enchanted.")
|
if (!AllZoneUtil.isCardInPlay(perm) || perm.hasProtectionFrom(c)
|
||||||
|
|| perm.hasKeyword("CARDNAME can't be enchanted.")
|
||||||
|| ((tgt != null) && !perm.isValid(tgt.getValidTgts(), c.getController(), c))) {
|
|| ((tgt != null) && !perm.isValid(tgt.getValidTgts(), c.getController(), c))) {
|
||||||
c.unEnchantEntity(perm);
|
c.unEnchantEntity(perm);
|
||||||
this.moveToGraveyard(c);
|
this.moveToGraveyard(c);
|
||||||
@@ -1342,13 +1342,13 @@ public class GameAction {
|
|||||||
AllZone.getHumanPlayer().getZone(Zone.Library).add(card);
|
AllZone.getHumanPlayer().getZone(Zone.Library).add(card);
|
||||||
|
|
||||||
if (card.hasAlternateState()) {
|
if (card.hasAlternateState()) {
|
||||||
if(card.isDoubleFaced()) {
|
if (card.isDoubleFaced()) {
|
||||||
card.setState("Transformed");
|
card.setState("Transformed");
|
||||||
}
|
}
|
||||||
if(card.isFlip()) {
|
if (card.isFlip()) {
|
||||||
card.setState("Flipped");
|
card.setState("Flipped");
|
||||||
}
|
}
|
||||||
|
|
||||||
card.setImageFilename(CardUtil.buildFilename(card));
|
card.setImageFilename(CardUtil.buildFilename(card));
|
||||||
|
|
||||||
card.setState("Original");
|
card.setState("Original");
|
||||||
@@ -1385,13 +1385,13 @@ public class GameAction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (card.hasAlternateState()) {
|
if (card.hasAlternateState()) {
|
||||||
if(card.isDoubleFaced()) {
|
if (card.isDoubleFaced()) {
|
||||||
card.setState("Transformed");
|
card.setState("Transformed");
|
||||||
}
|
}
|
||||||
if(card.isFlip()) {
|
if (card.isFlip()) {
|
||||||
card.setState("Flipped");
|
card.setState("Flipped");
|
||||||
}
|
}
|
||||||
|
|
||||||
card.setImageFilename(CardUtil.buildFilename(card));
|
card.setImageFilename(CardUtil.buildFilename(card));
|
||||||
|
|
||||||
card.setState("Original");
|
card.setState("Original");
|
||||||
@@ -1634,9 +1634,8 @@ public class GameAction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (((flip == 0) && q.equals(0)) || ((flip == 1) && q.equals(1))) {
|
if (((flip == 0) && q.equals(0)) || ((flip == 1) && q.equals(1))) {
|
||||||
JOptionPane.showMessageDialog(null,
|
JOptionPane.showMessageDialog(null, humanFlip + "\r\n" + ForgeProps.getLocalized(GameActionText.HUMAN_WIN),
|
||||||
humanFlip + "\r\n" + ForgeProps.getLocalized(GameActionText.HUMAN_WIN), "",
|
"", JOptionPane.INFORMATION_MESSAGE);
|
||||||
JOptionPane.INFORMATION_MESSAGE);
|
|
||||||
} else {
|
} else {
|
||||||
this.computerStartsGame();
|
this.computerStartsGame();
|
||||||
JOptionPane.showMessageDialog(null,
|
JOptionPane.showMessageDialog(null,
|
||||||
@@ -1795,16 +1794,19 @@ public class GameAction {
|
|||||||
// for uncastables like lotus bloom, check if manaCost is blank
|
// for uncastables like lotus bloom, check if manaCost is blank
|
||||||
sa.setActivatingPlayer(human);
|
sa.setActivatingPlayer(human);
|
||||||
if (sa.canPlay() && (!sa.isSpell() || !sa.getManaCost().equals(""))) {
|
if (sa.canPlay() && (!sa.isSpell() || !sa.getManaCost().equals(""))) {
|
||||||
|
|
||||||
boolean flashb = false;
|
boolean flashb = false;
|
||||||
|
|
||||||
//check for flashback keywords
|
// check for flashback keywords
|
||||||
if (c.isInZone(Constant.Zone.Graveyard) && sa.isSpell() && (c.isInstant() || c.isSorcery())) {
|
if (c.isInZone(Constant.Zone.Graveyard) && sa.isSpell() && (c.isInstant() || c.isSorcery())) {
|
||||||
for(String keyword : c.getKeyword()) {
|
for (final String keyword : c.getKeyword()) {
|
||||||
if (keyword.startsWith("Flashback")) {
|
if (keyword.startsWith("Flashback")) {
|
||||||
SpellAbility flashback = sa.copy();
|
final SpellAbility flashback = sa.copy();
|
||||||
flashback.setFlashBackAbility(true);
|
flashback.setFlashBackAbility(true);
|
||||||
if (!keyword.equals("Flashback")) {//there is a flashback cost (and not the cards cost)
|
if (!keyword.equals("Flashback")) { // there is a
|
||||||
|
// flashback cost
|
||||||
|
// (and not the
|
||||||
|
// cards cost)
|
||||||
final Cost fbCost = new Cost(keyword.substring(10), c.getName(), false);
|
final Cost fbCost = new Cost(keyword.substring(10), c.getName(), false);
|
||||||
flashback.setPayCosts(fbCost);
|
flashback.setPayCosts(fbCost);
|
||||||
}
|
}
|
||||||
@@ -2072,97 +2074,94 @@ public class GameAction {
|
|||||||
} else if (spell.getSourceCard().hasKeyword("Convoke")) {
|
} else if (spell.getSourceCard().hasKeyword("Convoke")) {
|
||||||
CardList untappedCreats = spell.getActivatingPlayer().getCardsIn(Zone.Battlefield).getType("Creature");
|
CardList untappedCreats = spell.getActivatingPlayer().getCardsIn(Zone.Battlefield).getType("Creature");
|
||||||
untappedCreats = untappedCreats.filter(new CardListFilter() {
|
untappedCreats = untappedCreats.filter(new CardListFilter() {
|
||||||
public boolean addCard(Card c) {
|
@Override
|
||||||
return !c.isTapped();
|
public boolean addCard(final Card c) {
|
||||||
}
|
return !c.isTapped();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if(untappedCreats.size() != 0)
|
if (untappedCreats.size() != 0) {
|
||||||
{
|
final ArrayList<Object> choices = new ArrayList<Object>();
|
||||||
ArrayList<Object> choices = new ArrayList<Object>();
|
for (final Card c : untappedCreats) {
|
||||||
for(Card c : untappedCreats) {
|
|
||||||
choices.add(c);
|
choices.add(c);
|
||||||
}
|
}
|
||||||
choices.add("DONE");
|
choices.add("DONE");
|
||||||
ArrayList<String> usableColors = new ArrayList<String>();
|
ArrayList<String> usableColors = new ArrayList<String>();
|
||||||
ManaCost newCost = new ManaCost(originalCost.toString());
|
ManaCost newCost = new ManaCost(originalCost.toString());
|
||||||
Object tapForConvoke = null;
|
Object tapForConvoke = null;
|
||||||
if(sa.getActivatingPlayer().isHuman())
|
if (sa.getActivatingPlayer().isHuman()) {
|
||||||
{
|
tapForConvoke = GuiUtils.getChoiceOptional("Tap for Convoke? " + newCost.toString(),
|
||||||
tapForConvoke = GuiUtils.getChoiceOptional("Tap for Convoke? " + newCost.toString(), choices.toArray());
|
choices.toArray());
|
||||||
|
} else {
|
||||||
|
// TODO: AI to choose a creature to tap would go here
|
||||||
|
// Probably along with deciding how many creatures to
|
||||||
|
// tap
|
||||||
}
|
}
|
||||||
else {
|
while ((tapForConvoke != null) && (tapForConvoke instanceof Card) && (untappedCreats.size() != 0)) {
|
||||||
//TODO: AI to choose a creature to tap would go here
|
final Card workingCard = (Card) tapForConvoke;
|
||||||
//Probably along with deciding how many creatures to tap
|
|
||||||
}
|
|
||||||
while(tapForConvoke != null && (tapForConvoke instanceof Card) && untappedCreats.size() != 0) {
|
|
||||||
Card workingCard = (Card) tapForConvoke;
|
|
||||||
usableColors = CardUtil.getConvokableColors(workingCard, newCost);
|
usableColors = CardUtil.getConvokableColors(workingCard, newCost);
|
||||||
|
|
||||||
if(usableColors.size() != 0)
|
if (usableColors.size() != 0) {
|
||||||
{
|
|
||||||
String chosenColor = usableColors.get(0);
|
String chosenColor = usableColors.get(0);
|
||||||
if(usableColors.size() > 1)
|
if (usableColors.size() > 1) {
|
||||||
{
|
if (sa.getActivatingPlayer().isHuman()) {
|
||||||
if(sa.getActivatingPlayer().isHuman())
|
chosenColor = (String) GuiUtils.getChoice("Convoke for which color?",
|
||||||
{
|
usableColors.toArray());
|
||||||
chosenColor = (String)GuiUtils.getChoice("Convoke for which color?", usableColors.toArray());
|
} else {
|
||||||
}
|
// TODO: AI for choosing which color to
|
||||||
else
|
// convoke goes here.
|
||||||
{
|
|
||||||
//TODO: AI for choosing which color to convoke goes here.
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(chosenColor.equals("colorless"))
|
if (chosenColor.equals("colorless")) {
|
||||||
{
|
|
||||||
newCost.decreaseColorlessMana(1);
|
newCost.decreaseColorlessMana(1);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
String newCostStr = newCost.toString();
|
String newCostStr = newCost.toString();
|
||||||
newCostStr = newCostStr.replaceFirst(InputPayManaCostUtil.getShortColorString(chosenColor), "");
|
newCostStr = newCostStr.replaceFirst(
|
||||||
|
InputPayManaCostUtil.getShortColorString(chosenColor), "");
|
||||||
newCost = new ManaCost(newCostStr.trim());
|
newCost = new ManaCost(newCostStr.trim());
|
||||||
}
|
}
|
||||||
|
|
||||||
sa.addTappedForConvoke(workingCard);
|
sa.addTappedForConvoke(workingCard);
|
||||||
choices.remove(workingCard);
|
choices.remove(workingCard);
|
||||||
untappedCreats.remove(workingCard);
|
untappedCreats.remove(workingCard);
|
||||||
if(choices.size() < 2 || newCost.getConvertedManaCost() == 0) {
|
if ((choices.size() < 2) || (newCost.getConvertedManaCost() == 0)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
untappedCreats.remove(workingCard);
|
untappedCreats.remove(workingCard);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(sa.getActivatingPlayer().isHuman())
|
if (sa.getActivatingPlayer().isHuman()) {
|
||||||
{
|
tapForConvoke = GuiUtils.getChoiceOptional("Tap for Convoke? " + newCost.toString(),
|
||||||
tapForConvoke = GuiUtils.getChoiceOptional("Tap for Convoke? " + newCost.toString(), choices.toArray());
|
choices.toArray());
|
||||||
}
|
} else {
|
||||||
else {
|
// TODO: AI to choose a creature to tap would go
|
||||||
//TODO: AI to choose a creature to tap would go here
|
// here
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//will only be null if user cancelled.
|
// will only be null if user cancelled.
|
||||||
if(tapForConvoke != null) {
|
if (tapForConvoke != null) {
|
||||||
//Convoked creats are tapped here with triggers suppressed,
|
// Convoked creats are tapped here with triggers
|
||||||
//Then again when payment is done(In InputPayManaCost.done()) with suppression cleared.
|
// suppressed,
|
||||||
//This is to make sure that triggers go off at the right time
|
// Then again when payment is done(In
|
||||||
//AND that you can't use mana tapabilities of convoked creatures
|
// InputPayManaCost.done()) with suppression cleared.
|
||||||
//to pay the convoked cost.
|
// This is to make sure that triggers go off at the
|
||||||
|
// right time
|
||||||
|
// AND that you can't use mana tapabilities of convoked
|
||||||
|
// creatures
|
||||||
|
// to pay the convoked cost.
|
||||||
AllZone.getTriggerHandler().suppressMode("Taps");
|
AllZone.getTriggerHandler().suppressMode("Taps");
|
||||||
for(Card c : sa.getTappedForConvoke()) {
|
for (final Card c : sa.getTappedForConvoke()) {
|
||||||
c.tap();
|
c.tap();
|
||||||
}
|
}
|
||||||
AllZone.getTriggerHandler().clearSuppression("Taps");
|
AllZone.getTriggerHandler().clearSuppression("Taps");
|
||||||
|
|
||||||
manaCost = newCost;
|
manaCost = newCost;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
} // isSpell
|
} // isSpell
|
||||||
|
|
||||||
@@ -2540,8 +2539,8 @@ public class GameAction {
|
|||||||
// Not Included as X Costs are not in
|
// Not Included as X Costs are not in
|
||||||
// Colored Mana
|
// Colored Mana
|
||||||
if (sa.isMultiKicker()) {
|
if (sa.isMultiKicker()) {
|
||||||
this.setCostCuttingGetMultiMickerManaCostPaidColored(this.getCostCuttingGetMultiMickerManaCostPaidColored()
|
this.setCostCuttingGetMultiMickerManaCostPaidColored(this
|
||||||
+ k[3]);
|
.getCostCuttingGetMultiMickerManaCostPaidColored() + k[3]);
|
||||||
// JOptionPane.showMessageDialog(null,
|
// JOptionPane.showMessageDialog(null,
|
||||||
// CostCutting_GetMultiMickerManaCostPaid_Colored,
|
// CostCutting_GetMultiMickerManaCostPaid_Colored,
|
||||||
// "", JOptionPane.INFORMATION_MESSAGE);
|
// "", JOptionPane.INFORMATION_MESSAGE);
|
||||||
@@ -2665,7 +2664,7 @@ public class GameAction {
|
|||||||
AllZone.getInputControl().setInput(sa.getAfterPayMana());
|
AllZone.getInputControl().setInput(sa.getAfterPayMana());
|
||||||
}
|
}
|
||||||
} else if (sa.getBeforePayMana() == null) {
|
} else if (sa.getBeforePayMana() == null) {
|
||||||
AllZone.getInputControl().setInput(new InputPayManaCost(sa,manaCost));
|
AllZone.getInputControl().setInput(new InputPayManaCost(sa, manaCost));
|
||||||
} else {
|
} else {
|
||||||
AllZone.getInputControl().setInput(sa.getBeforePayMana());
|
AllZone.getInputControl().setInput(sa.getBeforePayMana());
|
||||||
}
|
}
|
||||||
@@ -2820,30 +2819,49 @@ public class GameAction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Gets the cost cutting get multi micker mana cost paid.
|
||||||
|
*
|
||||||
* @return the costCuttingGetMultiMickerManaCostPaid
|
* @return the costCuttingGetMultiMickerManaCostPaid
|
||||||
*/
|
*/
|
||||||
public int getCostCuttingGetMultiMickerManaCostPaid() {
|
public int getCostCuttingGetMultiMickerManaCostPaid() {
|
||||||
return costCuttingGetMultiMickerManaCostPaid;
|
return this.costCuttingGetMultiMickerManaCostPaid;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Sets the cost cutting get multi micker mana cost paid.
|
||||||
|
*
|
||||||
* @param costCuttingGetMultiMickerManaCostPaid the costCuttingGetMultiMickerManaCostPaid to set
|
* @param costCuttingGetMultiMickerManaCostPaid the costCuttingGetMultiMickerManaCostPaid to set
|
||||||
*/
|
*/
|
||||||
public void setCostCuttingGetMultiMickerManaCostPaid(int costCuttingGetMultiMickerManaCostPaid) {
|
public void setCostCuttingGetMultiMickerManaCostPaid(final int costCuttingGetMultiMickerManaCostPaid) {
|
||||||
this.costCuttingGetMultiMickerManaCostPaid = costCuttingGetMultiMickerManaCostPaid; // TODO: Add 0 to parameter's name.
|
this.costCuttingGetMultiMickerManaCostPaid = costCuttingGetMultiMickerManaCostPaid; // TODO:
|
||||||
|
// Add
|
||||||
|
// 0
|
||||||
|
// to
|
||||||
|
// parameter's
|
||||||
|
// name.
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Gets the cost cutting get multi micker mana cost paid colored.
|
||||||
|
*
|
||||||
* @return the costCuttingGetMultiMickerManaCostPaidColored
|
* @return the costCuttingGetMultiMickerManaCostPaidColored
|
||||||
*/
|
*/
|
||||||
public String getCostCuttingGetMultiMickerManaCostPaidColored() {
|
public String getCostCuttingGetMultiMickerManaCostPaidColored() {
|
||||||
return costCuttingGetMultiMickerManaCostPaidColored;
|
return this.costCuttingGetMultiMickerManaCostPaidColored;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Sets the cost cutting get multi micker mana cost paid colored.
|
||||||
|
*
|
||||||
* @param costCuttingGetMultiMickerManaCostPaidColored the costCuttingGetMultiMickerManaCostPaidColored to set
|
* @param costCuttingGetMultiMickerManaCostPaidColored the costCuttingGetMultiMickerManaCostPaidColored to set
|
||||||
*/
|
*/
|
||||||
public void setCostCuttingGetMultiMickerManaCostPaidColored(String costCuttingGetMultiMickerManaCostPaidColored) {
|
public void setCostCuttingGetMultiMickerManaCostPaidColored(
|
||||||
this.costCuttingGetMultiMickerManaCostPaidColored = costCuttingGetMultiMickerManaCostPaidColored; // TODO: Add 0 to parameter's name.
|
final String costCuttingGetMultiMickerManaCostPaidColored) {
|
||||||
|
this.costCuttingGetMultiMickerManaCostPaidColored = costCuttingGetMultiMickerManaCostPaidColored; // TODO:
|
||||||
|
// Add
|
||||||
|
// 0
|
||||||
|
// to
|
||||||
|
// parameter's
|
||||||
|
// name.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ public class GuiDownloadPicturesLQ extends GuiDownloader {
|
|||||||
c.setState("Flip");
|
c.setState("Flip");
|
||||||
cList.addAll(createDLObjects(c, base));
|
cList.addAll(createDLObjects(c, base));
|
||||||
}
|
}
|
||||||
if(c.isDoubleFaced()) {
|
if (c.isDoubleFaced()) {
|
||||||
c.setState("Transformed");
|
c.setState("Transformed");
|
||||||
cList.addAll(createDLObjects(c, base));
|
cList.addAll(createDLObjects(c, base));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ public class GuiDownloadSetPicturesLQ extends GuiDownloader {
|
|||||||
|
|
||||||
private static final long serialVersionUID = -7890794857949935256L;
|
private static final long serialVersionUID = -7890794857949935256L;
|
||||||
private String picturesPath;
|
private String picturesPath;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* Constructor for Gui_DownloadSetPictures_LQ.
|
* Constructor for Gui_DownloadSetPictures_LQ.
|
||||||
@@ -36,33 +36,38 @@ public class GuiDownloadSetPicturesLQ extends GuiDownloader {
|
|||||||
*/
|
*/
|
||||||
public GuiDownloadSetPicturesLQ(final JFrame frame) {
|
public GuiDownloadSetPicturesLQ(final JFrame frame) {
|
||||||
super(frame);
|
super(frame);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final void addCardToList(ArrayList<DownloadObject> cList, CardPrinted c, String cardName)
|
/**
|
||||||
{
|
* Adds the card to list.
|
||||||
|
*
|
||||||
|
* @param cList the c list
|
||||||
|
* @param c the c
|
||||||
|
* @param cardName the card name
|
||||||
|
*/
|
||||||
|
protected final void addCardToList(final ArrayList<DownloadObject> cList, final CardPrinted c, final String cardName) {
|
||||||
final String urlBase = "http://cardforge.org/fpics/";
|
final String urlBase = "http://cardforge.org/fpics/";
|
||||||
|
|
||||||
String setCode3 = c.getSet();
|
final String setCode3 = c.getSet();
|
||||||
CardSet thisSet = SetUtils.getSetByCode(setCode3);
|
final CardSet thisSet = SetUtils.getSetByCode(setCode3);
|
||||||
String setCode2 = thisSet.getCode2();
|
final String setCode2 = thisSet.getCode2();
|
||||||
|
|
||||||
String imgFN = CardUtil.buildFilename(c, cardName);
|
final String imgFN = CardUtil.buildFilename(c, cardName);
|
||||||
boolean foundSetImage = imgFN.contains(setCode3) || imgFN.contains(setCode2);
|
final boolean foundSetImage = imgFN.contains(setCode3) || imgFN.contains(setCode2);
|
||||||
|
|
||||||
if(picturesPath == null)
|
if (this.picturesPath == null) {
|
||||||
{
|
|
||||||
System.out.println("Oh snap!");
|
System.out.println("Oh snap!");
|
||||||
}
|
}
|
||||||
if (!foundSetImage) {
|
if (!foundSetImage) {
|
||||||
int artsCnt = c.getCard().getSetInfo(setCode3).getCopiesCount();
|
final int artsCnt = c.getCard().getSetInfo(setCode3).getCopiesCount();
|
||||||
String fn = CardUtil.buildIdealFilename(cardName, c.getArtIndex(), artsCnt);
|
final String fn = CardUtil.buildIdealFilename(cardName, c.getArtIndex(), artsCnt);
|
||||||
cList.add(new DownloadObject(fn, urlBase + setCode2 + "/" + Base64Coder.encodeString(fn, true),
|
cList.add(new DownloadObject(fn, urlBase + setCode2 + "/" + Base64Coder.encodeString(fn, true),
|
||||||
picturesPath + File.separator + setCode3));
|
this.picturesPath + File.separator + setCode3));
|
||||||
System.out.println(String.format("%s [%s - %s]", cardName, setCode3, thisSet.getName() ));
|
System.out.println(String.format("%s [%s - %s]", cardName, setCode3, thisSet.getName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* getNeededCards.
|
* getNeededCards.
|
||||||
@@ -70,40 +75,40 @@ public class GuiDownloadSetPicturesLQ extends GuiDownloader {
|
|||||||
*
|
*
|
||||||
* @return an array of {@link forge.GuiDownloader.DownloadObject} objects.
|
* @return an array of {@link forge.GuiDownloader.DownloadObject} objects.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
protected final DownloadObject[] getNeededImages() {
|
protected final DownloadObject[] getNeededImages() {
|
||||||
if(picturesPath == null)
|
if (this.picturesPath == null) {
|
||||||
{
|
this.picturesPath = ForgeProps.getFile(NewConstants.IMAGE_BASE).getPath();
|
||||||
picturesPath = ForgeProps.getFile(NewConstants.IMAGE_BASE).getPath();
|
|
||||||
}
|
}
|
||||||
// read token names and urls
|
// read token names and urls
|
||||||
DownloadObject[] cardTokenLQ = readFileWithNames(NewConstants.TOKEN_IMAGES, ForgeProps.getFile(NewConstants.IMAGE_TOKEN));
|
final DownloadObject[] cardTokenLQ = GuiDownloader.readFileWithNames(NewConstants.TOKEN_IMAGES,
|
||||||
ArrayList<DownloadObject> cList = new ArrayList<DownloadObject>();
|
ForgeProps.getFile(NewConstants.IMAGE_TOKEN));
|
||||||
|
final ArrayList<DownloadObject> cList = new ArrayList<DownloadObject>();
|
||||||
|
|
||||||
for (CardPrinted c : CardDb.instance().getAllCards()) {
|
for (final CardPrinted c : CardDb.instance().getAllCards()) {
|
||||||
String setCode3 = c.getSet();
|
final String setCode3 = c.getSet();
|
||||||
if (StringUtils.isBlank(setCode3) || "???".equals(setCode3)) {
|
if (StringUtils.isBlank(setCode3) || "???".equals(setCode3)) {
|
||||||
continue; // we don't want cards from unknown sets
|
continue; // we don't want cards from unknown sets
|
||||||
}
|
}
|
||||||
|
|
||||||
addCardToList(cList, c, c.getCard().getName());
|
this.addCardToList(cList, c, c.getCard().getName());
|
||||||
if ( c.getCard().isDoubleFaced() )
|
if (c.getCard().isDoubleFaced()) {
|
||||||
{
|
this.addCardToList(cList, c, c.getCard().getSlavePart().getName());
|
||||||
addCardToList(cList, c, c.getCard().getSlavePart().getName());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// add missing tokens to the list of things to download
|
// add missing tokens to the list of things to download
|
||||||
File file;
|
File file;
|
||||||
File filebase = ForgeProps.getFile(NewConstants.IMAGE_TOKEN);
|
final File filebase = ForgeProps.getFile(NewConstants.IMAGE_TOKEN);
|
||||||
for (int i = 0; i < cardTokenLQ.length; i++) {
|
for (final DownloadObject element : cardTokenLQ) {
|
||||||
file = new File(filebase, cardTokenLQ[i].getName());
|
file = new File(filebase, element.getName());
|
||||||
if (!file.exists()) {
|
if (!file.exists()) {
|
||||||
cList.add(cardTokenLQ[i]);
|
cList.add(element);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// return all card names and urls that are needed
|
// return all card names and urls that are needed
|
||||||
DownloadObject[] out = new DownloadObject[cList.size()];
|
final DownloadObject[] out = new DownloadObject[cList.size()];
|
||||||
cList.toArray(out);
|
cList.toArray(out);
|
||||||
|
|
||||||
return out;
|
return out;
|
||||||
|
|||||||
@@ -502,8 +502,9 @@ public class Upkeep implements java.io.Serializable {
|
|||||||
|
|
||||||
for (final Card c : cards) {
|
for (final Card c : cards) {
|
||||||
final Card abyss = c;
|
final Card abyss = c;
|
||||||
|
|
||||||
final CardList abyssGetTargets = AllZoneUtil.getCreaturesInPlay(player).filter(CardListFilter.NON_ARTIFACTS);
|
final CardList abyssGetTargets = AllZoneUtil.getCreaturesInPlay(player)
|
||||||
|
.filter(CardListFilter.NON_ARTIFACTS);
|
||||||
|
|
||||||
final Ability sacrificeCreature = new Ability(abyss, "") {
|
final Ability sacrificeCreature = new Ability(abyss, "") {
|
||||||
@Override
|
@Override
|
||||||
@@ -533,11 +534,11 @@ public class Upkeep implements java.io.Serializable {
|
|||||||
}); // Input
|
}); // Input
|
||||||
}
|
}
|
||||||
} else { // computer
|
} else { // computer
|
||||||
|
|
||||||
final CardList indestruct = targets.getKeyword("Indestructible");
|
final CardList indestruct = targets.getKeyword("Indestructible");
|
||||||
if (indestruct.size() > 0) {
|
if (indestruct.size() > 0) {
|
||||||
AllZone.getGameAction().destroyNoRegeneration(indestruct.get(0));
|
AllZone.getGameAction().destroyNoRegeneration(indestruct.get(0));
|
||||||
} else if (targets.size() > 0){
|
} else if (targets.size() > 0) {
|
||||||
final Card target = CardFactoryUtil.getWorstCreatureAI(targets);
|
final Card target = CardFactoryUtil.getWorstCreatureAI(targets);
|
||||||
if (null == target) {
|
if (null == target) {
|
||||||
// must be nothing valid to destroy
|
// must be nothing valid to destroy
|
||||||
@@ -2455,7 +2456,7 @@ public class Upkeep implements java.io.Serializable {
|
|||||||
// is
|
// is
|
||||||
final Player player = AllZone.getPhase().getPlayerTurn();
|
final Player player = AllZone.getPhase().getPlayerTurn();
|
||||||
final String keyword = "At the beginning of your upkeep, you may have this "
|
final String keyword = "At the beginning of your upkeep, you may have this "
|
||||||
+ "creature become a copy of target creature except it doesn't copy that "
|
+ "creature become a copy of target creature except it doesn't copy that "
|
||||||
+ "creature's color. If you do, this creature gains this ability.";
|
+ "creature's color. If you do, this creature gains this ability.";
|
||||||
CardList list = player.getCardsIn(Zone.Battlefield);
|
CardList list = player.getCardsIn(Zone.Battlefield);
|
||||||
list = list.getKeyword(keyword);
|
list = list.getKeyword(keyword);
|
||||||
@@ -2482,15 +2483,16 @@ public class Upkeep implements java.io.Serializable {
|
|||||||
* add new to play
|
* add new to play
|
||||||
*/
|
*/
|
||||||
|
|
||||||
final Card newCopy = AllZone.getCardFactory().getCard(newTarget[0].getState("Original").getName(), player);
|
final Card newCopy = AllZone.getCardFactory().getCard(
|
||||||
|
newTarget[0].getState("Original").getName(), player);
|
||||||
newCopy.setCurSetCode(newTarget[0].getCurSetCode());
|
newCopy.setCurSetCode(newTarget[0].getCurSetCode());
|
||||||
newCopy.setImageFilename(newTarget[0].getImageFilename());
|
newCopy.setImageFilename(newTarget[0].getImageFilename());
|
||||||
|
|
||||||
newCopy.setState(newTarget[0].getCurState());
|
newCopy.setState(newTarget[0].getCurState());
|
||||||
|
|
||||||
CardFactoryUtil.copyCharacteristics(newCopy, c);
|
CardFactoryUtil.copyCharacteristics(newCopy, c);
|
||||||
c.addColor("U");
|
c.addColor("U");
|
||||||
|
|
||||||
c.addExtrinsicKeyword(keyword);
|
c.addExtrinsicKeyword(keyword);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2528,7 +2530,7 @@ public class Upkeep implements java.io.Serializable {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
ability.setDescription("At the beginning of your upkeep, you may have this creature become "
|
ability.setDescription("At the beginning of your upkeep, you may have this creature become "
|
||||||
+ "a copy of target creature except it doesn't copy that creature's color. If you do, this creature gains this ability.");
|
+ "a copy of target creature except it doesn't copy that creature's color. If you do, this creature gains this ability.");
|
||||||
ability.setStackDescription(c.getName() + " - you may have this creature become a copy of target creature.");
|
ability.setStackDescription(c.getName() + " - you may have this creature become a copy of target creature.");
|
||||||
|
|
||||||
AllZone.getStack().addSimultaneousStackEntry(ability);
|
AllZone.getStack().addSimultaneousStackEntry(ability);
|
||||||
|
|||||||
@@ -26,8 +26,7 @@ public class BoosterGenerator {
|
|||||||
|
|
||||||
// Function to open a booster as it is.
|
// Function to open a booster as it is.
|
||||||
/** The Constant IDENTITY_PICK. */
|
/** The Constant IDENTITY_PICK. */
|
||||||
public static final Lambda1<List<CardPrinted>, BoosterGenerator> IDENTITY_PICK
|
public static final Lambda1<List<CardPrinted>, BoosterGenerator> IDENTITY_PICK = new Lambda1<List<CardPrinted>, BoosterGenerator>() {
|
||||||
= new Lambda1<List<CardPrinted>, BoosterGenerator>() {
|
|
||||||
@Override
|
@Override
|
||||||
public List<CardPrinted> apply(final BoosterGenerator arg1) {
|
public List<CardPrinted> apply(final BoosterGenerator arg1) {
|
||||||
return arg1.getBoosterPack();
|
return arg1.getBoosterPack();
|
||||||
@@ -133,8 +132,7 @@ public class BoosterGenerator {
|
|||||||
return this.pickRandomCards(source, count, false);
|
return this.pickRandomCards(source, count, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<CardPrinted> pickRandomCards(final List<CardPrinted> source,
|
private List<CardPrinted> pickRandomCards(final List<CardPrinted> source, final int count, final boolean singleton) {
|
||||||
final int count, final boolean singleton) {
|
|
||||||
int listSize = source == null ? 0 : source.size();
|
int listSize = source == null ? 0 : source.size();
|
||||||
if ((count <= 0) || (listSize == 0)) {
|
if ((count <= 0) || (listSize == 0)) {
|
||||||
return BoosterGenerator.EMPTY_LIST;
|
return BoosterGenerator.EMPTY_LIST;
|
||||||
@@ -205,8 +203,9 @@ public class BoosterGenerator {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the singleton booster pack.
|
* Gets the singleton booster pack.
|
||||||
*
|
*
|
||||||
* @param nAnyCard the n any card
|
* @param nAnyCard
|
||||||
|
* the n any card
|
||||||
* @return the singleton booster pack
|
* @return the singleton booster pack
|
||||||
*/
|
*/
|
||||||
public final List<CardPrinted> getSingletonBoosterPack(final int nAnyCard) {
|
public final List<CardPrinted> getSingletonBoosterPack(final int nAnyCard) {
|
||||||
@@ -266,19 +265,19 @@ public class BoosterGenerator {
|
|||||||
temp.addAll(this.pickRandomCards(this.mythics, nMythics));
|
temp.addAll(this.pickRandomCards(this.mythics, nMythics));
|
||||||
}
|
}
|
||||||
if (nDoubls > 0) {
|
if (nDoubls > 0) {
|
||||||
int dblFacedRarity = MyRandom.getRandom().nextInt(14);
|
final int dblFacedRarity = MyRandom.getRandom().nextInt(14);
|
||||||
List<CardPrinted> listToUse;
|
List<CardPrinted> listToUse;
|
||||||
if (dblFacedRarity < 9) { //Common
|
if (dblFacedRarity < 9) { // Common
|
||||||
listToUse = doubleFacedCommons;
|
listToUse = this.doubleFacedCommons;
|
||||||
} else if (dblFacedRarity < 13) { //Uncommon
|
} else if (dblFacedRarity < 13) { // Uncommon
|
||||||
listToUse = doubleFacedUncommons;
|
listToUse = this.doubleFacedUncommons;
|
||||||
} else {//Rare or Mythic
|
} else { // Rare or Mythic
|
||||||
if(MyRandom.getRandom().nextInt(8) == 0) {
|
if (MyRandom.getRandom().nextInt(8) == 0) {
|
||||||
listToUse = doubleFacedMythics;
|
listToUse = this.doubleFacedMythics;
|
||||||
} else {
|
} else {
|
||||||
listToUse = doubleFacedRares;
|
listToUse = this.doubleFacedRares;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
temp.addAll(this.pickRandomCards(listToUse, nDoubls));
|
temp.addAll(this.pickRandomCards(listToUse, nDoubls));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ public final class CardRules {
|
|||||||
* @return the name
|
* @return the name
|
||||||
*/
|
*/
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return characteristics.getCardName();
|
return this.characteristics.getCardName();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -57,7 +57,7 @@ public final class CardRules {
|
|||||||
* @return the type
|
* @return the type
|
||||||
*/
|
*/
|
||||||
public CardType getType() {
|
public CardType getType() {
|
||||||
return characteristics.getCardType();
|
return this.characteristics.getCardType();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -66,7 +66,7 @@ public final class CardRules {
|
|||||||
* @return the mana cost
|
* @return the mana cost
|
||||||
*/
|
*/
|
||||||
public CardManaCost getManaCost() {
|
public CardManaCost getManaCost() {
|
||||||
return characteristics.getManaCost();
|
return this.characteristics.getManaCost();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -75,7 +75,7 @@ public final class CardRules {
|
|||||||
* @return the color
|
* @return the color
|
||||||
*/
|
*/
|
||||||
public CardColor getColor() {
|
public CardColor getColor() {
|
||||||
return characteristics.getColor();
|
return this.characteristics.getColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -84,18 +84,25 @@ public final class CardRules {
|
|||||||
* @return the rules
|
* @return the rules
|
||||||
*/
|
*/
|
||||||
public String[] getRules() {
|
public String[] getRules() {
|
||||||
return characteristics.getCardRules();
|
return this.characteristics.getCardRules();
|
||||||
}
|
}
|
||||||
|
|
||||||
public final CardRules getSlavePart() { return slavePart; }
|
/**
|
||||||
|
*
|
||||||
|
* Gets Slave Part.
|
||||||
|
* @return CardRules
|
||||||
|
*/
|
||||||
|
public CardRules getSlavePart() {
|
||||||
|
return this.slavePart;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the sets printed.
|
* Gets the sets printed.
|
||||||
*
|
*
|
||||||
* @return the sets printed
|
* @return the sets printed
|
||||||
*/
|
*/
|
||||||
public Set<Entry<String, CardInSet>> getSetsPrinted() {
|
public Set<Entry<String, CardInSet>> getSetsPrinted() {
|
||||||
return characteristics.getSetsData().entrySet();
|
return this.characteristics.getSetsData().entrySet();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -104,7 +111,7 @@ public final class CardRules {
|
|||||||
* @return the power
|
* @return the power
|
||||||
*/
|
*/
|
||||||
public String getPower() {
|
public String getPower() {
|
||||||
return power;
|
return this.power;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -113,7 +120,7 @@ public final class CardRules {
|
|||||||
* @return the int power
|
* @return the int power
|
||||||
*/
|
*/
|
||||||
public int getIntPower() {
|
public int getIntPower() {
|
||||||
return iPower;
|
return this.iPower;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -122,7 +129,7 @@ public final class CardRules {
|
|||||||
* @return the toughness
|
* @return the toughness
|
||||||
*/
|
*/
|
||||||
public String getToughness() {
|
public String getToughness() {
|
||||||
return toughness;
|
return this.toughness;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -131,7 +138,7 @@ public final class CardRules {
|
|||||||
* @return the int toughness
|
* @return the int toughness
|
||||||
*/
|
*/
|
||||||
public int getIntToughness() {
|
public int getIntToughness() {
|
||||||
return iToughness;
|
return this.iToughness;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -140,7 +147,7 @@ public final class CardRules {
|
|||||||
* @return the loyalty
|
* @return the loyalty
|
||||||
*/
|
*/
|
||||||
public String getLoyalty() {
|
public String getLoyalty() {
|
||||||
return loyalty;
|
return this.loyalty;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -149,7 +156,7 @@ public final class CardRules {
|
|||||||
* @return the rem ai decks
|
* @return the rem ai decks
|
||||||
*/
|
*/
|
||||||
public boolean getRemAIDecks() {
|
public boolean getRemAIDecks() {
|
||||||
return isRemovedFromAIDecks;
|
return this.isRemovedFromAIDecks;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -158,7 +165,7 @@ public final class CardRules {
|
|||||||
* @return the rem random decks
|
* @return the rem random decks
|
||||||
*/
|
*/
|
||||||
public boolean getRemRandomDecks() {
|
public boolean getRemRandomDecks() {
|
||||||
return isRemovedFromRandomDecks;
|
return this.isRemovedFromRandomDecks;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -167,11 +174,11 @@ public final class CardRules {
|
|||||||
* @return the p tor loyalty
|
* @return the p tor loyalty
|
||||||
*/
|
*/
|
||||||
public String getPTorLoyalty() {
|
public String getPTorLoyalty() {
|
||||||
if (getType().isCreature()) {
|
if (this.getType().isCreature()) {
|
||||||
return power + "/" + toughness;
|
return this.power + "/" + this.toughness;
|
||||||
}
|
}
|
||||||
if (getType().isPlaneswalker()) {
|
if (this.getType().isPlaneswalker()) {
|
||||||
return loyalty;
|
return this.loyalty;
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
@@ -182,7 +189,7 @@ public final class CardRules {
|
|||||||
* @return true, if is alt state
|
* @return true, if is alt state
|
||||||
*/
|
*/
|
||||||
public boolean isAltState() {
|
public boolean isAltState() {
|
||||||
return isDoubleFaced() && slavePart == null;
|
return this.isDoubleFaced() && (this.slavePart == null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -191,7 +198,7 @@ public final class CardRules {
|
|||||||
* @return true, if is double faced
|
* @return true, if is double faced
|
||||||
*/
|
*/
|
||||||
public boolean isDoubleFaced() {
|
public boolean isDoubleFaced() {
|
||||||
return hasOtherFace;
|
return this.hasOtherFace;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -201,8 +208,8 @@ public final class CardRules {
|
|||||||
* the chars
|
* the chars
|
||||||
* @param isDoubleFacedCard
|
* @param isDoubleFacedCard
|
||||||
* the is double faced card
|
* the is double faced card
|
||||||
* @param isAlt0
|
* @param otherPart
|
||||||
* the is alt0
|
* the otherPart
|
||||||
* @param removedFromRandomDecks
|
* @param removedFromRandomDecks
|
||||||
* the removed from random decks
|
* the removed from random decks
|
||||||
* @param removedFromAIDecks
|
* @param removedFromAIDecks
|
||||||
@@ -210,31 +217,33 @@ public final class CardRules {
|
|||||||
*/
|
*/
|
||||||
public CardRules(final CardRuleCharacteristics chars, final boolean isDoubleFacedCard, final CardRules otherPart,
|
public CardRules(final CardRuleCharacteristics chars, final boolean isDoubleFacedCard, final CardRules otherPart,
|
||||||
final boolean removedFromRandomDecks, final boolean removedFromAIDecks) {
|
final boolean removedFromRandomDecks, final boolean removedFromAIDecks) {
|
||||||
characteristics = chars;
|
this.characteristics = chars;
|
||||||
slavePart = otherPart;
|
this.slavePart = otherPart;
|
||||||
hasOtherFace = isDoubleFacedCard;
|
this.hasOtherFace = isDoubleFacedCard;
|
||||||
this.isRemovedFromAIDecks = removedFromAIDecks;
|
this.isRemovedFromAIDecks = removedFromAIDecks;
|
||||||
this.isRemovedFromRandomDecks = removedFromRandomDecks;
|
this.isRemovedFromRandomDecks = removedFromRandomDecks;
|
||||||
|
|
||||||
// System.out.println(cardName);
|
// System.out.println(cardName);
|
||||||
|
|
||||||
if (getType().isCreature()) {
|
if (this.getType().isCreature()) {
|
||||||
int slashPos = characteristics.getPtLine() == null ? -1 : characteristics.getPtLine().indexOf('/');
|
final int slashPos = this.characteristics.getPtLine() == null ? -1 : this.characteristics.getPtLine()
|
||||||
|
.indexOf('/');
|
||||||
if (slashPos == -1) {
|
if (slashPos == -1) {
|
||||||
throw new RuntimeException(String.format("Creature '%s' has bad p/t stats", getName()));
|
throw new RuntimeException(String.format("Creature '%s' has bad p/t stats", this.getName()));
|
||||||
}
|
}
|
||||||
this.power = characteristics.getPtLine().substring(0, slashPos);
|
this.power = this.characteristics.getPtLine().substring(0, slashPos);
|
||||||
this.toughness = characteristics.getPtLine().substring(slashPos + 1, characteristics.getPtLine().length());
|
this.toughness = this.characteristics.getPtLine().substring(slashPos + 1,
|
||||||
this.iPower = StringUtils.isNumeric(power) ? Integer.parseInt(power) : 0;
|
this.characteristics.getPtLine().length());
|
||||||
this.iToughness = StringUtils.isNumeric(toughness) ? Integer.parseInt(toughness) : 0;
|
this.iPower = StringUtils.isNumeric(this.power) ? Integer.parseInt(this.power) : 0;
|
||||||
} else if (getType().isPlaneswalker()) {
|
this.iToughness = StringUtils.isNumeric(this.toughness) ? Integer.parseInt(this.toughness) : 0;
|
||||||
this.loyalty = characteristics.getPtLine();
|
} else if (this.getType().isPlaneswalker()) {
|
||||||
|
this.loyalty = this.characteristics.getPtLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (characteristics.getSetsData().isEmpty()) {
|
if (this.characteristics.getSetsData().isEmpty()) {
|
||||||
characteristics.getSetsData().put("???", new CardInSet(CardRarity.Unknown, 1));
|
this.characteristics.getSetsData().put("???", new CardInSet(CardRarity.Unknown, 1));
|
||||||
}
|
}
|
||||||
setsPrinted = characteristics.getSetsData();
|
this.setsPrinted = this.characteristics.getSetsData();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -245,10 +254,10 @@ public final class CardRules {
|
|||||||
* @return true, if successful
|
* @return true, if successful
|
||||||
*/
|
*/
|
||||||
public boolean rulesContain(final String text) {
|
public boolean rulesContain(final String text) {
|
||||||
if (characteristics.getCardRules() == null) {
|
if (this.characteristics.getCardRules() == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
for (String r : characteristics.getCardRules()) {
|
for (final String r : this.characteristics.getCardRules()) {
|
||||||
if (StringUtils.containsIgnoreCase(r, text)) {
|
if (StringUtils.containsIgnoreCase(r, text)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -264,7 +273,7 @@ public final class CardRules {
|
|||||||
public String getLatestSetPrinted() {
|
public String getLatestSetPrinted() {
|
||||||
String lastSet = null;
|
String lastSet = null;
|
||||||
// TODO: Make a true release-date based sorting
|
// TODO: Make a true release-date based sorting
|
||||||
for (String cs : setsPrinted.keySet()) {
|
for (final String cs : this.setsPrinted.keySet()) {
|
||||||
lastSet = cs;
|
lastSet = cs;
|
||||||
}
|
}
|
||||||
return lastSet;
|
return lastSet;
|
||||||
@@ -278,11 +287,11 @@ public final class CardRules {
|
|||||||
* @return the sets the info
|
* @return the sets the info
|
||||||
*/
|
*/
|
||||||
public CardInSet getSetInfo(final String setCode) {
|
public CardInSet getSetInfo(final String setCode) {
|
||||||
CardInSet result = setsPrinted.get(setCode);
|
final CardInSet result = this.setsPrinted.get(setCode);
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
throw new RuntimeException(String.format("Card '%s' was never printed in set '%s'", getName(), setCode));
|
throw new RuntimeException(String.format("Card '%s' was never printed in set '%s'", this.getName(), setCode));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -292,7 +301,7 @@ public final class CardRules {
|
|||||||
* @return the rarity from latest set
|
* @return the rarity from latest set
|
||||||
*/
|
*/
|
||||||
public CardRarity getRarityFromLatestSet() {
|
public CardRarity getRarityFromLatestSet() {
|
||||||
CardInSet cis = setsPrinted.get(getLatestSetPrinted());
|
final CardInSet cis = this.setsPrinted.get(this.getLatestSetPrinted());
|
||||||
return cis.getRarity();
|
return cis.getRarity();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -302,8 +311,8 @@ public final class CardRules {
|
|||||||
* @return the ai status
|
* @return the ai status
|
||||||
*/
|
*/
|
||||||
public String getAiStatus() {
|
public String getAiStatus() {
|
||||||
return isRemovedFromAIDecks ? (isRemovedFromRandomDecks ? "AI ?" : "AI")
|
return this.isRemovedFromAIDecks ? (this.isRemovedFromRandomDecks ? "AI ?" : "AI")
|
||||||
: (isRemovedFromRandomDecks ? "?" : "");
|
: (this.isRemovedFromRandomDecks ? "?" : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -312,11 +321,11 @@ public final class CardRules {
|
|||||||
* @return the ai status comparable
|
* @return the ai status comparable
|
||||||
*/
|
*/
|
||||||
public Integer getAiStatusComparable() {
|
public Integer getAiStatusComparable() {
|
||||||
if (isRemovedFromAIDecks && isRemovedFromRandomDecks) {
|
if (this.isRemovedFromAIDecks && this.isRemovedFromRandomDecks) {
|
||||||
return Integer.valueOf(3);
|
return Integer.valueOf(3);
|
||||||
} else if (isRemovedFromAIDecks) {
|
} else if (this.isRemovedFromAIDecks) {
|
||||||
return Integer.valueOf(4);
|
return Integer.valueOf(4);
|
||||||
} else if (isRemovedFromRandomDecks) {
|
} else if (this.isRemovedFromRandomDecks) {
|
||||||
return Integer.valueOf(2);
|
return Integer.valueOf(2);
|
||||||
} else {
|
} else {
|
||||||
return Integer.valueOf(1);
|
return Integer.valueOf(1);
|
||||||
@@ -447,8 +456,8 @@ public final class CardRules {
|
|||||||
*/
|
*/
|
||||||
public static Predicate<CardRules> coreType(final boolean isEqual, final String what) {
|
public static Predicate<CardRules> coreType(final boolean isEqual, final String what) {
|
||||||
try {
|
try {
|
||||||
return coreType(isEqual, CardCoreType.valueOf(CardCoreType.class, what));
|
return Predicates.coreType(isEqual, Enum.valueOf(CardCoreType.class, what));
|
||||||
} catch (Exception e) {
|
} catch (final Exception e) {
|
||||||
return Predicate.getFalse(CardRules.class);
|
return Predicate.getFalse(CardRules.class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -477,8 +486,8 @@ public final class CardRules {
|
|||||||
*/
|
*/
|
||||||
public static Predicate<CardRules> superType(final boolean isEqual, final String what) {
|
public static Predicate<CardRules> superType(final boolean isEqual, final String what) {
|
||||||
try {
|
try {
|
||||||
return superType(isEqual, CardSuperType.valueOf(CardSuperType.class, what));
|
return Predicates.superType(isEqual, Enum.valueOf(CardSuperType.class, what));
|
||||||
} catch (Exception e) {
|
} catch (final Exception e) {
|
||||||
return Predicate.getFalse(CardRules.class);
|
return Predicate.getFalse(CardRules.class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -564,17 +573,19 @@ public final class CardRules {
|
|||||||
@Override
|
@Override
|
||||||
public boolean isTrue(final CardRules card) {
|
public boolean isTrue(final CardRules card) {
|
||||||
boolean shouldConatin;
|
boolean shouldConatin;
|
||||||
switch (field) {
|
switch (this.field) {
|
||||||
case NAME:
|
case NAME:
|
||||||
return op(card.getName(), operand);
|
return this.op(card.getName(), this.operand);
|
||||||
case SUBTYPE:
|
case SUBTYPE:
|
||||||
shouldConatin = getOperator() == StringOp.CONTAINS || getOperator() == StringOp.EQUALS;
|
shouldConatin = (this.getOperator() == StringOp.CONTAINS)
|
||||||
return shouldConatin == card.getType().subTypeContains(operand);
|
|| (this.getOperator() == StringOp.EQUALS);
|
||||||
|
return shouldConatin == card.getType().subTypeContains(this.operand);
|
||||||
case RULES:
|
case RULES:
|
||||||
shouldConatin = getOperator() == StringOp.CONTAINS || getOperator() == StringOp.EQUALS;
|
shouldConatin = (this.getOperator() == StringOp.CONTAINS)
|
||||||
return shouldConatin == card.rulesContain(operand);
|
|| (this.getOperator() == StringOp.EQUALS);
|
||||||
|
return shouldConatin == card.rulesContain(this.operand);
|
||||||
case JOINED_TYPE:
|
case JOINED_TYPE:
|
||||||
return op(card.getType().toString(), operand);
|
return this.op(card.getType().toString(), this.operand);
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -596,23 +607,23 @@ public final class CardRules {
|
|||||||
private final byte color;
|
private final byte color;
|
||||||
|
|
||||||
public LeafColor(final ColorOperator operator, final byte thatColor) {
|
public LeafColor(final ColorOperator operator, final byte thatColor) {
|
||||||
op = operator;
|
this.op = operator;
|
||||||
color = thatColor;
|
this.color = thatColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isTrue(final CardRules subject) {
|
public boolean isTrue(final CardRules subject) {
|
||||||
switch (op) {
|
switch (this.op) {
|
||||||
case CountColors:
|
case CountColors:
|
||||||
return subject.getColor().countColors() == color;
|
return subject.getColor().countColors() == this.color;
|
||||||
case CountColorsGreaterOrEqual:
|
case CountColorsGreaterOrEqual:
|
||||||
return subject.getColor().countColors() >= color;
|
return subject.getColor().countColors() >= this.color;
|
||||||
case Equals:
|
case Equals:
|
||||||
return subject.getColor().isEqual(color);
|
return subject.getColor().isEqual(this.color);
|
||||||
case HasAllOf:
|
case HasAllOf:
|
||||||
return subject.getColor().hasAllColors(color);
|
return subject.getColor().hasAllColors(this.color);
|
||||||
case HasAnyOf:
|
case HasAnyOf:
|
||||||
return subject.getColor().hasAnyColor(color);
|
return subject.getColor().hasAnyColor(this.color);
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -630,29 +641,29 @@ public final class CardRules {
|
|||||||
|
|
||||||
public LeafNumber(final CardField field, final ComparableOp op, final int what) {
|
public LeafNumber(final CardField field, final ComparableOp op, final int what) {
|
||||||
this.field = field;
|
this.field = field;
|
||||||
operand = what;
|
this.operand = what;
|
||||||
operator = op;
|
this.operator = op;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isTrue(final CardRules card) {
|
public boolean isTrue(final CardRules card) {
|
||||||
int value;
|
int value;
|
||||||
switch (field) {
|
switch (this.field) {
|
||||||
case CMC:
|
case CMC:
|
||||||
return op(card.getManaCost().getCMC(), operand);
|
return this.op(card.getManaCost().getCMC(), this.operand);
|
||||||
case POWER:
|
case POWER:
|
||||||
value = card.getIntPower();
|
value = card.getIntPower();
|
||||||
return value >= 0 ? op(value, operand) : false;
|
return value >= 0 ? this.op(value, this.operand) : false;
|
||||||
case TOUGHNESS:
|
case TOUGHNESS:
|
||||||
value = card.getIntToughness();
|
value = card.getIntToughness();
|
||||||
return value >= 0 ? op(value, operand) : false;
|
return value >= 0 ? this.op(value, this.operand) : false;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean op(final int op1, final int op2) {
|
private boolean op(final int op1, final int op2) {
|
||||||
switch (operator) {
|
switch (this.operator) {
|
||||||
case EQUALS:
|
case EQUALS:
|
||||||
return op1 == op2;
|
return op1 == op2;
|
||||||
case GREATER_THAN:
|
case GREATER_THAN:
|
||||||
@@ -677,12 +688,12 @@ public final class CardRules {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isTrue(final CardRules card) {
|
public boolean isTrue(final CardRules card) {
|
||||||
return shouldBeEqual == card.getType().typeContains(operand);
|
return this.shouldBeEqual == card.getType().typeContains(this.operand);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PredicateCoreType(final CardCoreType type, final boolean wantEqual) {
|
public PredicateCoreType(final CardCoreType type, final boolean wantEqual) {
|
||||||
operand = type;
|
this.operand = type;
|
||||||
shouldBeEqual = wantEqual;
|
this.shouldBeEqual = wantEqual;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -692,12 +703,12 @@ public final class CardRules {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isTrue(final CardRules card) {
|
public boolean isTrue(final CardRules card) {
|
||||||
return shouldBeEqual == card.getType().superTypeContains(operand);
|
return this.shouldBeEqual == card.getType().superTypeContains(this.operand);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PredicateSuperType(final CardSuperType type, final boolean wantEqual) {
|
public PredicateSuperType(final CardSuperType type, final boolean wantEqual) {
|
||||||
operand = type;
|
this.operand = type;
|
||||||
shouldBeEqual = wantEqual;
|
this.shouldBeEqual = wantEqual;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -707,12 +718,12 @@ public final class CardRules {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isTrue(final CardRules card) {
|
public boolean isTrue(final CardRules card) {
|
||||||
return card.getRarityFromLatestSet().equals(operand) == shouldBeEqual;
|
return card.getRarityFromLatestSet().equals(this.operand) == this.shouldBeEqual;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PredicateLastesSetRarity(final CardRarity type, final boolean wantEqual) {
|
public PredicateLastesSetRarity(final CardRarity type, final boolean wantEqual) {
|
||||||
operand = type;
|
this.operand = type;
|
||||||
shouldBeEqual = wantEqual;
|
this.shouldBeEqual = wantEqual;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -720,12 +731,12 @@ public final class CardRules {
|
|||||||
private final List<String> sets;
|
private final List<String> sets;
|
||||||
|
|
||||||
public PredicateExitsInSets(final List<String> wantSets) {
|
public PredicateExitsInSets(final List<String> wantSets) {
|
||||||
sets = wantSets; // maybe should make a copy here?
|
this.sets = wantSets; // maybe should make a copy here?
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isTrue(final CardRules subject) {
|
public boolean isTrue(final CardRules subject) {
|
||||||
for (String s : sets) {
|
for (final String s : this.sets) {
|
||||||
if (subject.setsPrinted.containsKey(s)) {
|
if (subject.setsPrinted.containsKey(s)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -740,13 +751,13 @@ public final class CardRules {
|
|||||||
public static class Presets {
|
public static class Presets {
|
||||||
|
|
||||||
/** The Constant isCreature. */
|
/** The Constant isCreature. */
|
||||||
public static final Predicate<CardRules> IS_CREATURE = coreType(true, CardCoreType.Creature);
|
public static final Predicate<CardRules> IS_CREATURE = Predicates.coreType(true, CardCoreType.Creature);
|
||||||
|
|
||||||
/** The Constant isArtifact. */
|
/** The Constant isArtifact. */
|
||||||
public static final Predicate<CardRules> IS_ARTIFACT = coreType(true, CardCoreType.Artifact);
|
public static final Predicate<CardRules> IS_ARTIFACT = Predicates.coreType(true, CardCoreType.Artifact);
|
||||||
|
|
||||||
/** The Constant isLand. */
|
/** The Constant isLand. */
|
||||||
public static final Predicate<CardRules> IS_LAND = coreType(true, CardCoreType.Land);
|
public static final Predicate<CardRules> IS_LAND = Predicates.coreType(true, CardCoreType.Land);
|
||||||
|
|
||||||
/** The Constant isBasicLand. */
|
/** The Constant isBasicLand. */
|
||||||
public static final Predicate<CardRules> IS_BASIC_LAND = new Predicate<CardRules>() {
|
public static final Predicate<CardRules> IS_BASIC_LAND = new Predicate<CardRules>() {
|
||||||
@@ -757,54 +768,56 @@ public final class CardRules {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/** The Constant isPlaneswalker. */
|
/** The Constant isPlaneswalker. */
|
||||||
public static final Predicate<CardRules> IS_PLANESWALKER = coreType(true, CardCoreType.Planeswalker);
|
public static final Predicate<CardRules> IS_PLANESWALKER = Predicates.coreType(true,
|
||||||
|
CardCoreType.Planeswalker);
|
||||||
|
|
||||||
/** The Constant isInstant. */
|
/** The Constant isInstant. */
|
||||||
public static final Predicate<CardRules> IS_INSTANT = coreType(true, CardCoreType.Instant);
|
public static final Predicate<CardRules> IS_INSTANT = Predicates.coreType(true, CardCoreType.Instant);
|
||||||
|
|
||||||
/** The Constant isSorcery. */
|
/** The Constant isSorcery. */
|
||||||
public static final Predicate<CardRules> IS_SORCERY = coreType(true, CardCoreType.Sorcery);
|
public static final Predicate<CardRules> IS_SORCERY = Predicates.coreType(true, CardCoreType.Sorcery);
|
||||||
|
|
||||||
/** The Constant isEnchantment. */
|
/** The Constant isEnchantment. */
|
||||||
public static final Predicate<CardRules> IS_ENCHANTMENT = coreType(true, CardCoreType.Enchantment);
|
public static final Predicate<CardRules> IS_ENCHANTMENT = Predicates.coreType(true,
|
||||||
|
CardCoreType.Enchantment);
|
||||||
|
|
||||||
/** The Constant isNonLand. */
|
/** The Constant isNonLand. */
|
||||||
public static final Predicate<CardRules> IS_NON_LAND = coreType(false, CardCoreType.Land);
|
public static final Predicate<CardRules> IS_NON_LAND = Predicates.coreType(false, CardCoreType.Land);
|
||||||
|
|
||||||
/** The Constant isNonCreatureSpell. */
|
/** The Constant isNonCreatureSpell. */
|
||||||
public static final Predicate<CardRules> IS_NON_CREATURE_SPELL = Predicate.compose(IS_CREATURE,
|
public static final Predicate<CardRules> IS_NON_CREATURE_SPELL = Predicate.compose(Presets.IS_CREATURE,
|
||||||
PredicatesOp.NOR, IS_LAND);
|
PredicatesOp.NOR, Presets.IS_LAND);
|
||||||
|
|
||||||
/** The Constant isWhite. */
|
/** The Constant isWhite. */
|
||||||
public static final Predicate<CardRules> IS_WHITE = isColor(CardColor.WHITE);
|
public static final Predicate<CardRules> IS_WHITE = Predicates.isColor(CardColor.WHITE);
|
||||||
|
|
||||||
/** The Constant isBlue. */
|
/** The Constant isBlue. */
|
||||||
public static final Predicate<CardRules> IS_BLUE = isColor(CardColor.BLUE);
|
public static final Predicate<CardRules> IS_BLUE = Predicates.isColor(CardColor.BLUE);
|
||||||
|
|
||||||
/** The Constant isBlack. */
|
/** The Constant isBlack. */
|
||||||
public static final Predicate<CardRules> IS_BLACK = isColor(CardColor.BLACK);
|
public static final Predicate<CardRules> IS_BLACK = Predicates.isColor(CardColor.BLACK);
|
||||||
|
|
||||||
/** The Constant isRed. */
|
/** The Constant isRed. */
|
||||||
public static final Predicate<CardRules> IS_RED = isColor(CardColor.RED);
|
public static final Predicate<CardRules> IS_RED = Predicates.isColor(CardColor.RED);
|
||||||
|
|
||||||
/** The Constant isGreen. */
|
/** The Constant isGreen. */
|
||||||
public static final Predicate<CardRules> IS_GREEN = isColor(CardColor.GREEN);
|
public static final Predicate<CardRules> IS_GREEN = Predicates.isColor(CardColor.GREEN);
|
||||||
|
|
||||||
/** The Constant isColorless. */
|
/** The Constant isColorless. */
|
||||||
public static final Predicate<CardRules> IS_COLORLESS = hasCntColors((byte) 0);
|
public static final Predicate<CardRules> IS_COLORLESS = Predicates.hasCntColors((byte) 0);
|
||||||
|
|
||||||
/** The Constant isMulticolor. */
|
/** The Constant isMulticolor. */
|
||||||
public static final Predicate<CardRules> IS_MULTICOLOR = hasAtLeastCntColors((byte) 2);
|
public static final Predicate<CardRules> IS_MULTICOLOR = Predicates.hasAtLeastCntColors((byte) 2);
|
||||||
|
|
||||||
/** The Constant colors. */
|
/** The Constant colors. */
|
||||||
public static final List<Predicate<CardRules>> COLORS = new ArrayList<Predicate<CardRules>>();
|
public static final List<Predicate<CardRules>> COLORS = new ArrayList<Predicate<CardRules>>();
|
||||||
static {
|
static {
|
||||||
COLORS.add(IS_WHITE);
|
Presets.COLORS.add(Presets.IS_WHITE);
|
||||||
COLORS.add(IS_BLUE);
|
Presets.COLORS.add(Presets.IS_BLUE);
|
||||||
COLORS.add(IS_BLACK);
|
Presets.COLORS.add(Presets.IS_BLACK);
|
||||||
COLORS.add(IS_RED);
|
Presets.COLORS.add(Presets.IS_RED);
|
||||||
COLORS.add(IS_GREEN);
|
Presets.COLORS.add(Presets.IS_GREEN);
|
||||||
COLORS.add(IS_COLORLESS);
|
Presets.COLORS.add(Presets.IS_COLORLESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** The Constant constantTrue. */
|
/** The Constant constantTrue. */
|
||||||
@@ -813,22 +826,23 @@ public final class CardRules {
|
|||||||
// Think twice before using these, since rarity is a prop of printed
|
// Think twice before using these, since rarity is a prop of printed
|
||||||
// card.
|
// card.
|
||||||
/** The Constant isInLatestSetCommon. */
|
/** The Constant isInLatestSetCommon. */
|
||||||
public static final Predicate<CardRules> IS_IN_LATEST_SET_COMMON = rarityInCardsLatestSet(true,
|
public static final Predicate<CardRules> IS_IN_LATEST_SET_COMMON = Predicates.rarityInCardsLatestSet(true,
|
||||||
CardRarity.Common);
|
CardRarity.Common);
|
||||||
|
|
||||||
/** The Constant isInLatestSetUncommon. */
|
/** The Constant isInLatestSetUncommon. */
|
||||||
public static final Predicate<CardRules> IS_IN_LATEST_SET_UNCOMMON = rarityInCardsLatestSet(true,
|
public static final Predicate<CardRules> IS_IN_LATEST_SET_UNCOMMON = Predicates.rarityInCardsLatestSet(
|
||||||
CardRarity.Uncommon);
|
true, CardRarity.Uncommon);
|
||||||
|
|
||||||
/** The Constant isInLatestSetRare. */
|
/** The Constant isInLatestSetRare. */
|
||||||
public static final Predicate<CardRules> IS_IN_LATEST_SET_RARE = rarityInCardsLatestSet(true, CardRarity.Rare);
|
public static final Predicate<CardRules> IS_IN_LATEST_SET_RARE = Predicates.rarityInCardsLatestSet(true,
|
||||||
|
CardRarity.Rare);
|
||||||
|
|
||||||
/** The Constant isInLatestSetMythicRare. */
|
/** The Constant isInLatestSetMythicRare. */
|
||||||
public static final Predicate<CardRules> IS_IN_LATEST_SET_MYTHIC_RARE = rarityInCardsLatestSet(true,
|
public static final Predicate<CardRules> IS_IN_LATEST_SET_MYTHIC_RARE = Predicates.rarityInCardsLatestSet(
|
||||||
CardRarity.MythicRare);
|
true, CardRarity.MythicRare);
|
||||||
|
|
||||||
/** The Constant isInLatestSetSpecial. */
|
/** The Constant isInLatestSetSpecial. */
|
||||||
public static final Predicate<CardRules> IS_IN_LATEST_SET_SPECIAL = rarityInCardsLatestSet(true,
|
public static final Predicate<CardRules> IS_IN_LATEST_SET_SPECIAL = Predicates.rarityInCardsLatestSet(true,
|
||||||
CardRarity.Special);
|
CardRarity.Special);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ public class CardRulesReader {
|
|||||||
*/
|
*/
|
||||||
public final CardRules getCard() {
|
public final CardRules getCard() {
|
||||||
boolean hasOtherPart = this.characteristics[1] != null;
|
boolean hasOtherPart = this.characteristics[1] != null;
|
||||||
CardRules otherPart = hasOtherPart
|
CardRules otherPart = hasOtherPart
|
||||||
? new CardRules(this.characteristics[1], true, null, this.removedFromRandomDecks, this.removedFromAIDecks)
|
? new CardRules(this.characteristics[1], true, null, this.removedFromRandomDecks, this.removedFromAIDecks)
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ public final class MtgDataParser implements Iterator<CardRules> {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
CardRules otherPart = hasOtherPart ? new CardRules(this.chars[1], hasOtherPart, null, false, false) : null;
|
CardRules otherPart = hasOtherPart ? new CardRules(this.chars[1], hasOtherPart, null, false, false) : null;
|
||||||
return new CardRules(this.chars[0], hasOtherPart, otherPart, false, false);
|
return new CardRules(this.chars[0], hasOtherPart, otherPart, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1411,7 +1411,7 @@ public final class AbilityFactoryChoose {
|
|||||||
// still missing a listener to display the card preview
|
// still missing a listener to display the card preview
|
||||||
// in the right
|
// in the right
|
||||||
name = choice.getSelectedValue();
|
name = choice.getSelectedValue();
|
||||||
if(AllZone.getCardFactory().getCard(name, p).isValid(valid, host.getController(), host)) {
|
if (AllZone.getCardFactory().getCard(name, p).isValid(valid, host.getController(), host)) {
|
||||||
host.setNamedCard(choice.getSelectedValue());
|
host.setNamedCard(choice.getSelectedValue());
|
||||||
ok = true;
|
ok = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,8 +63,8 @@ public class AbilityFactoryDealDamage {
|
|||||||
* @return a {@link forge.card.spellability.SpellAbility} object.
|
* @return a {@link forge.card.spellability.SpellAbility} object.
|
||||||
*/
|
*/
|
||||||
public final SpellAbility getAbilityDealDamage() {
|
public final SpellAbility getAbilityDealDamage() {
|
||||||
final SpellAbility abDamage = new AbilityActivated(this.abilityFactory.getHostCard(), this.abilityFactory.getAbCost(),
|
final SpellAbility abDamage = new AbilityActivated(this.abilityFactory.getHostCard(),
|
||||||
this.abilityFactory.getAbTgt()) {
|
this.abilityFactory.getAbCost(), this.abilityFactory.getAbTgt()) {
|
||||||
private static final long serialVersionUID = -7560349014757367722L;
|
private static final long serialVersionUID = -7560349014757367722L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -74,7 +74,8 @@ public class AbilityFactoryDealDamage {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getStackDescription() {
|
public String getStackDescription() {
|
||||||
return AbilityFactoryDealDamage.this.dealDamageStackDescription(AbilityFactoryDealDamage.this.abilityFactory, this);
|
return AbilityFactoryDealDamage.this.dealDamageStackDescription(
|
||||||
|
AbilityFactoryDealDamage.this.abilityFactory, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -84,8 +85,8 @@ public class AbilityFactoryDealDamage {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean doTrigger(final boolean mandatory) {
|
public boolean doTrigger(final boolean mandatory) {
|
||||||
return AbilityFactoryDealDamage.this.dealDamageDoTriggerAI(AbilityFactoryDealDamage.this.abilityFactory, this,
|
return AbilityFactoryDealDamage.this.dealDamageDoTriggerAI(
|
||||||
mandatory);
|
AbilityFactoryDealDamage.this.abilityFactory, this, mandatory);
|
||||||
}
|
}
|
||||||
}; // Ability_Activated
|
}; // Ability_Activated
|
||||||
|
|
||||||
@@ -100,7 +101,8 @@ public class AbilityFactoryDealDamage {
|
|||||||
* @return a {@link forge.card.spellability.SpellAbility} object.
|
* @return a {@link forge.card.spellability.SpellAbility} object.
|
||||||
*/
|
*/
|
||||||
public final SpellAbility getSpellDealDamage() {
|
public final SpellAbility getSpellDealDamage() {
|
||||||
final SpellAbility spDealDamage = new Spell(this.abilityFactory.getHostCard(), this.abilityFactory.getAbCost(), this.abilityFactory.getAbTgt()) {
|
final SpellAbility spDealDamage = new Spell(this.abilityFactory.getHostCard(), this.abilityFactory.getAbCost(),
|
||||||
|
this.abilityFactory.getAbTgt()) {
|
||||||
private static final long serialVersionUID = 7239608350643325111L;
|
private static final long serialVersionUID = 7239608350643325111L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -111,7 +113,8 @@ public class AbilityFactoryDealDamage {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getStackDescription() {
|
public String getStackDescription() {
|
||||||
return AbilityFactoryDealDamage.this.dealDamageStackDescription(AbilityFactoryDealDamage.this.abilityFactory, this);
|
return AbilityFactoryDealDamage.this.dealDamageStackDescription(
|
||||||
|
AbilityFactoryDealDamage.this.abilityFactory, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -132,7 +135,8 @@ public class AbilityFactoryDealDamage {
|
|||||||
* @return a {@link forge.card.spellability.SpellAbility} object.
|
* @return a {@link forge.card.spellability.SpellAbility} object.
|
||||||
*/
|
*/
|
||||||
public final SpellAbility getDrawbackDealDamage() {
|
public final SpellAbility getDrawbackDealDamage() {
|
||||||
final SpellAbility dbDealDamage = new AbilitySub(this.abilityFactory.getHostCard(), this.abilityFactory.getAbTgt()) {
|
final SpellAbility dbDealDamage = new AbilitySub(this.abilityFactory.getHostCard(),
|
||||||
|
this.abilityFactory.getAbTgt()) {
|
||||||
private static final long serialVersionUID = 7239608350643325111L;
|
private static final long serialVersionUID = 7239608350643325111L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -143,7 +147,8 @@ public class AbilityFactoryDealDamage {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getStackDescription() {
|
public String getStackDescription() {
|
||||||
return AbilityFactoryDealDamage.this.dealDamageStackDescription(AbilityFactoryDealDamage.this.abilityFactory, this);
|
return AbilityFactoryDealDamage.this.dealDamageStackDescription(
|
||||||
|
AbilityFactoryDealDamage.this.abilityFactory, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -153,8 +158,8 @@ public class AbilityFactoryDealDamage {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean doTrigger(final boolean mandatory) {
|
public boolean doTrigger(final boolean mandatory) {
|
||||||
return AbilityFactoryDealDamage.this.dealDamageDoTriggerAI(AbilityFactoryDealDamage.this.abilityFactory, this,
|
return AbilityFactoryDealDamage.this.dealDamageDoTriggerAI(
|
||||||
mandatory);
|
AbilityFactoryDealDamage.this.abilityFactory, this, mandatory);
|
||||||
}
|
}
|
||||||
|
|
||||||
}; // Drawback
|
}; // Drawback
|
||||||
@@ -428,7 +433,8 @@ public class AbilityFactoryDealDamage {
|
|||||||
* a boolean.
|
* a boolean.
|
||||||
* @return a {@link forge.Card} object.
|
* @return a {@link forge.Card} object.
|
||||||
*/
|
*/
|
||||||
private Card dealDamageChooseTgtC(final SpellAbility saMe, final int d, final boolean noPrevention, final Player pl, final boolean mandatory) {
|
private Card dealDamageChooseTgtC(final SpellAbility saMe, final int d, final boolean noPrevention,
|
||||||
|
final Player pl, final boolean mandatory) {
|
||||||
final Target tgt = this.abilityFactory.getAbTgt();
|
final Target tgt = this.abilityFactory.getAbTgt();
|
||||||
final Card source = this.abilityFactory.getHostCard();
|
final Card source = this.abilityFactory.getHostCard();
|
||||||
CardList hPlay = pl.getCardsIn(Zone.Battlefield);
|
CardList hPlay = pl.getCardsIn(Zone.Battlefield);
|
||||||
@@ -594,8 +600,8 @@ public class AbilityFactoryDealDamage {
|
|||||||
*/
|
*/
|
||||||
private boolean damageChooseNontargeted(final SpellAbility saMe, final int dmg) {
|
private boolean damageChooseNontargeted(final SpellAbility saMe, final int dmg) {
|
||||||
// TODO: Improve circumstances where the Defined Damage is unwanted
|
// TODO: Improve circumstances where the Defined Damage is unwanted
|
||||||
final ArrayList<Object> objects = AbilityFactory.getDefinedObjects(saMe.getSourceCard(), this.abilityFactory.getMapParams()
|
final ArrayList<Object> objects = AbilityFactory.getDefinedObjects(saMe.getSourceCard(), this.abilityFactory
|
||||||
.get("Defined"), saMe);
|
.getMapParams().get("Defined"), saMe);
|
||||||
|
|
||||||
for (final Object o : objects) {
|
for (final Object o : objects) {
|
||||||
if (o instanceof Card) {
|
if (o instanceof Card) {
|
||||||
@@ -643,7 +649,8 @@ public class AbilityFactoryDealDamage {
|
|||||||
while (tgt.getNumTargeted() < tgt.getMinTargets(saMe.getSourceCard(), saMe)) {
|
while (tgt.getNumTargeted() < tgt.getMinTargets(saMe.getSourceCard(), saMe)) {
|
||||||
// TODO: Consider targeting the planeswalker
|
// TODO: Consider targeting the planeswalker
|
||||||
if (tgt.canTgtCreature()) {
|
if (tgt.canTgtCreature()) {
|
||||||
final Card c = this.dealDamageChooseTgtC(saMe, dmg, noPrevention, AllZone.getComputerPlayer(), mandatory);
|
final Card c = this.dealDamageChooseTgtC(saMe, dmg, noPrevention, AllZone.getComputerPlayer(),
|
||||||
|
mandatory);
|
||||||
if (c != null) {
|
if (c != null) {
|
||||||
tgt.addTarget(c);
|
tgt.addTarget(c);
|
||||||
continue;
|
continue;
|
||||||
@@ -757,7 +764,7 @@ public class AbilityFactoryDealDamage {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Can't radiate from a player
|
// Can't radiate from a player
|
||||||
if (origin != null) {
|
if (origin != null) {
|
||||||
for (final Card c : CardUtil.getRadiance(this.abilityFactory.getHostCard(), origin,
|
for (final Card c : CardUtil.getRadiance(this.abilityFactory.getHostCard(), origin,
|
||||||
params.get("ValidTgts").split(","))) {
|
params.get("ValidTgts").split(","))) {
|
||||||
@@ -806,8 +813,8 @@ public class AbilityFactoryDealDamage {
|
|||||||
*/
|
*/
|
||||||
public final SpellAbility getAbilityDamageAll() {
|
public final SpellAbility getAbilityDamageAll() {
|
||||||
|
|
||||||
final SpellAbility abDamageAll = new AbilityActivated(this.abilityFactory.getHostCard(), this.abilityFactory.getAbCost(),
|
final SpellAbility abDamageAll = new AbilityActivated(this.abilityFactory.getHostCard(),
|
||||||
this.abilityFactory.getAbTgt()) {
|
this.abilityFactory.getAbCost(), this.abilityFactory.getAbTgt()) {
|
||||||
private static final long serialVersionUID = -1831356710492849854L;
|
private static final long serialVersionUID = -1831356710492849854L;
|
||||||
private final AbilityFactory af = AbilityFactoryDealDamage.this.abilityFactory;
|
private final AbilityFactory af = AbilityFactoryDealDamage.this.abilityFactory;
|
||||||
|
|
||||||
@@ -828,8 +835,8 @@ public class AbilityFactoryDealDamage {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean doTrigger(final boolean mandatory) {
|
public boolean doTrigger(final boolean mandatory) {
|
||||||
return AbilityFactoryDealDamage.this.damageAllDoTriggerAI(AbilityFactoryDealDamage.this.abilityFactory, this,
|
return AbilityFactoryDealDamage.this.damageAllDoTriggerAI(AbilityFactoryDealDamage.this.abilityFactory,
|
||||||
mandatory);
|
this, mandatory);
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
@@ -844,7 +851,8 @@ public class AbilityFactoryDealDamage {
|
|||||||
* @return a {@link forge.card.spellability.SpellAbility} object.
|
* @return a {@link forge.card.spellability.SpellAbility} object.
|
||||||
*/
|
*/
|
||||||
public final SpellAbility getSpellDamageAll() {
|
public final SpellAbility getSpellDamageAll() {
|
||||||
final SpellAbility spDamageAll = new Spell(this.abilityFactory.getHostCard(), this.abilityFactory.getAbCost(), this.abilityFactory.getAbTgt()) {
|
final SpellAbility spDamageAll = new Spell(this.abilityFactory.getHostCard(), this.abilityFactory.getAbCost(),
|
||||||
|
this.abilityFactory.getAbTgt()) {
|
||||||
private static final long serialVersionUID = 8004957182752984818L;
|
private static final long serialVersionUID = 8004957182752984818L;
|
||||||
private final AbilityFactory af = AbilityFactoryDealDamage.this.abilityFactory;
|
private final AbilityFactory af = AbilityFactoryDealDamage.this.abilityFactory;
|
||||||
private final HashMap<String, String> params = this.af.getMapParams();
|
private final HashMap<String, String> params = this.af.getMapParams();
|
||||||
@@ -881,7 +889,8 @@ public class AbilityFactoryDealDamage {
|
|||||||
* @return a {@link forge.card.spellability.SpellAbility} object.
|
* @return a {@link forge.card.spellability.SpellAbility} object.
|
||||||
*/
|
*/
|
||||||
public final SpellAbility getDrawbackDamageAll() {
|
public final SpellAbility getDrawbackDamageAll() {
|
||||||
final SpellAbility dbDamageAll = new AbilitySub(this.abilityFactory.getHostCard(), this.abilityFactory.getAbTgt()) {
|
final SpellAbility dbDamageAll = new AbilitySub(this.abilityFactory.getHostCard(),
|
||||||
|
this.abilityFactory.getAbTgt()) {
|
||||||
private static final long serialVersionUID = -6169562107675964474L;
|
private static final long serialVersionUID = -6169562107675964474L;
|
||||||
private final AbilityFactory af = AbilityFactoryDealDamage.this.abilityFactory;
|
private final AbilityFactory af = AbilityFactoryDealDamage.this.abilityFactory;
|
||||||
|
|
||||||
@@ -903,8 +912,8 @@ public class AbilityFactoryDealDamage {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean doTrigger(final boolean mandatory) {
|
public boolean doTrigger(final boolean mandatory) {
|
||||||
return AbilityFactoryDealDamage.this.damageAllDoTriggerAI(AbilityFactoryDealDamage.this.abilityFactory, this,
|
return AbilityFactoryDealDamage.this.damageAllDoTriggerAI(AbilityFactoryDealDamage.this.abilityFactory,
|
||||||
mandatory);
|
this, mandatory);
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
@@ -1207,7 +1216,7 @@ public class AbilityFactoryDealDamage {
|
|||||||
targetPlayer.addDamage(dmg, card);
|
targetPlayer.addDamage(dmg, card);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// *************************************************************************
|
// *************************************************************************
|
||||||
// ***************************** EachDamage ********************************
|
// ***************************** EachDamage ********************************
|
||||||
// *************************************************************************
|
// *************************************************************************
|
||||||
@@ -1220,8 +1229,8 @@ public class AbilityFactoryDealDamage {
|
|||||||
*/
|
*/
|
||||||
public final SpellAbility getAbilityEachDamage() {
|
public final SpellAbility getAbilityEachDamage() {
|
||||||
|
|
||||||
final SpellAbility abEachDamage = new AbilityActivated(this.abilityFactory.getHostCard(), this.abilityFactory.getAbCost(),
|
final SpellAbility abEachDamage = new AbilityActivated(this.abilityFactory.getHostCard(),
|
||||||
this.abilityFactory.getAbTgt()) {
|
this.abilityFactory.getAbCost(), this.abilityFactory.getAbTgt()) {
|
||||||
private static final long serialVersionUID = -1831356710492849854L;
|
private static final long serialVersionUID = -1831356710492849854L;
|
||||||
private final AbilityFactory af = AbilityFactoryDealDamage.this.abilityFactory;
|
private final AbilityFactory af = AbilityFactoryDealDamage.this.abilityFactory;
|
||||||
|
|
||||||
@@ -1242,8 +1251,8 @@ public class AbilityFactoryDealDamage {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean doTrigger(final boolean mandatory) {
|
public boolean doTrigger(final boolean mandatory) {
|
||||||
return AbilityFactoryDealDamage.this.eachDamageDoTriggerAI(AbilityFactoryDealDamage.this.abilityFactory, this,
|
return AbilityFactoryDealDamage.this.eachDamageDoTriggerAI(
|
||||||
mandatory);
|
AbilityFactoryDealDamage.this.abilityFactory, this, mandatory);
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
@@ -1258,7 +1267,8 @@ public class AbilityFactoryDealDamage {
|
|||||||
* @return a {@link forge.card.spellability.SpellAbility} object.
|
* @return a {@link forge.card.spellability.SpellAbility} object.
|
||||||
*/
|
*/
|
||||||
public final SpellAbility getSpellEachDamage() {
|
public final SpellAbility getSpellEachDamage() {
|
||||||
final SpellAbility spEachDamage = new Spell(this.abilityFactory.getHostCard(), this.abilityFactory.getAbCost(), this.abilityFactory.getAbTgt()) {
|
final SpellAbility spEachDamage = new Spell(this.abilityFactory.getHostCard(), this.abilityFactory.getAbCost(),
|
||||||
|
this.abilityFactory.getAbTgt()) {
|
||||||
private static final long serialVersionUID = 8004957182752984818L;
|
private static final long serialVersionUID = 8004957182752984818L;
|
||||||
private final AbilityFactory af = AbilityFactoryDealDamage.this.abilityFactory;
|
private final AbilityFactory af = AbilityFactoryDealDamage.this.abilityFactory;
|
||||||
private final HashMap<String, String> params = this.af.getMapParams();
|
private final HashMap<String, String> params = this.af.getMapParams();
|
||||||
@@ -1295,7 +1305,8 @@ public class AbilityFactoryDealDamage {
|
|||||||
* @return a {@link forge.card.spellability.SpellAbility} object.
|
* @return a {@link forge.card.spellability.SpellAbility} object.
|
||||||
*/
|
*/
|
||||||
public final SpellAbility getDrawbackEachDamage() {
|
public final SpellAbility getDrawbackEachDamage() {
|
||||||
final SpellAbility dbEachDamage = new AbilitySub(this.abilityFactory.getHostCard(), this.abilityFactory.getAbTgt()) {
|
final SpellAbility dbEachDamage = new AbilitySub(this.abilityFactory.getHostCard(),
|
||||||
|
this.abilityFactory.getAbTgt()) {
|
||||||
private static final long serialVersionUID = -6169562107675964474L;
|
private static final long serialVersionUID = -6169562107675964474L;
|
||||||
private final AbilityFactory af = AbilityFactoryDealDamage.this.abilityFactory;
|
private final AbilityFactory af = AbilityFactoryDealDamage.this.abilityFactory;
|
||||||
|
|
||||||
@@ -1317,8 +1328,8 @@ public class AbilityFactoryDealDamage {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean doTrigger(final boolean mandatory) {
|
public boolean doTrigger(final boolean mandatory) {
|
||||||
return AbilityFactoryDealDamage.this.eachDamageDoTriggerAI(AbilityFactoryDealDamage.this.abilityFactory, this,
|
return AbilityFactoryDealDamage.this.eachDamageDoTriggerAI(
|
||||||
mandatory);
|
AbilityFactoryDealDamage.this.abilityFactory, this, mandatory);
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
@@ -1339,36 +1350,36 @@ public class AbilityFactoryDealDamage {
|
|||||||
private String eachDamageStackDescription(final AbilityFactory af, final SpellAbility sa) {
|
private String eachDamageStackDescription(final AbilityFactory af, final SpellAbility sa) {
|
||||||
final StringBuilder sb = new StringBuilder();
|
final StringBuilder sb = new StringBuilder();
|
||||||
final HashMap<String, String> params = af.getMapParams();
|
final HashMap<String, String> params = af.getMapParams();
|
||||||
|
|
||||||
if (sa instanceof AbilitySub) {
|
if (sa instanceof AbilitySub) {
|
||||||
sb.append(" ");
|
sb.append(" ");
|
||||||
} else {
|
} else {
|
||||||
sb.append(sa.getSourceCard()).append(" - ");
|
sb.append(sa.getSourceCard()).append(" - ");
|
||||||
}
|
}
|
||||||
|
|
||||||
ArrayList<Player> tgtPlayers;
|
ArrayList<Player> tgtPlayers;
|
||||||
|
|
||||||
Target tgt = af.getAbTgt();
|
final Target tgt = af.getAbTgt();
|
||||||
if (tgt != null) {
|
if (tgt != null) {
|
||||||
tgtPlayers = tgt.getTargetPlayers();
|
tgtPlayers = tgt.getTargetPlayers();
|
||||||
} else {
|
} else {
|
||||||
tgtPlayers = AbilityFactory.getDefinedPlayers(sa.getSourceCard(), params.get("DefinedPlayers"), sa);
|
tgtPlayers = AbilityFactory.getDefinedPlayers(sa.getSourceCard(), params.get("DefinedPlayers"), sa);
|
||||||
}
|
}
|
||||||
|
|
||||||
String desc = params.get("ValidCards");
|
String desc = params.get("ValidCards");
|
||||||
if (params.containsKey("ValidDescription")) {
|
if (params.containsKey("ValidDescription")) {
|
||||||
desc = params.get("ValidDescription");
|
desc = params.get("ValidDescription");
|
||||||
}
|
}
|
||||||
|
|
||||||
String dmg = "";
|
String dmg = "";
|
||||||
if (params.containsKey("DamageDesc")) {
|
if (params.containsKey("DamageDesc")) {
|
||||||
dmg = params.get("DamageDesc");
|
dmg = params.get("DamageDesc");
|
||||||
} else {
|
} else {
|
||||||
dmg += getNumDamage(sa) + " damage";
|
dmg += this.getNumDamage(sa) + " damage";
|
||||||
}
|
}
|
||||||
|
|
||||||
sb.append("Each ").append(desc).append(" deals ").append(dmg).append(" to ");
|
sb.append("Each ").append(desc).append(" deals ").append(dmg).append(" to ");
|
||||||
for (Player p : tgtPlayers) {
|
for (final Player p : tgtPlayers) {
|
||||||
sb.append(p);
|
sb.append(p);
|
||||||
}
|
}
|
||||||
if (params.containsKey("DefinedCards")) {
|
if (params.containsKey("DefinedCards")) {
|
||||||
@@ -1394,8 +1405,8 @@ public class AbilityFactoryDealDamage {
|
|||||||
tgt.resetTargets();
|
tgt.resetTargets();
|
||||||
sa.getTarget().addTarget(AllZone.getHumanPlayer());
|
sa.getTarget().addTarget(AllZone.getHumanPlayer());
|
||||||
}
|
}
|
||||||
|
|
||||||
return shouldTgtP(sa, getNumDamage(sa), false);
|
return this.shouldTgtP(sa, this.getNumDamage(sa), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean eachDamageDoTriggerAI(final AbilityFactory af, final SpellAbility sa, final boolean mandatory) {
|
private boolean eachDamageDoTriggerAI(final AbilityFactory af, final SpellAbility sa, final boolean mandatory) {
|
||||||
@@ -1407,7 +1418,7 @@ public class AbilityFactoryDealDamage {
|
|||||||
return sa.getSubAbility().doTrigger(mandatory);
|
return sa.getSubAbility().doTrigger(mandatory);
|
||||||
}
|
}
|
||||||
|
|
||||||
return eachDamageCanPlayAI(af, sa);
|
return this.eachDamageCanPlayAI(af, sa);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void eachDamageResolve(final AbilityFactory af, final SpellAbility sa) {
|
private void eachDamageResolve(final AbilityFactory af, final SpellAbility sa) {
|
||||||
@@ -1418,7 +1429,7 @@ public class AbilityFactoryDealDamage {
|
|||||||
if (params.containsKey("ValidCards")) {
|
if (params.containsKey("ValidCards")) {
|
||||||
sources = sources.getValidCards(params.get("ValidCards"), card.getController(), card);
|
sources = sources.getValidCards(params.get("ValidCards"), card.getController(), card);
|
||||||
}
|
}
|
||||||
|
|
||||||
ArrayList<Object> tgts = new ArrayList<Object>();
|
ArrayList<Object> tgts = new ArrayList<Object>();
|
||||||
if (sa.getTarget() == null) {
|
if (sa.getTarget() == null) {
|
||||||
tgts = AbilityFactory.getDefinedObjects(sa.getSourceCard(), params.get("DefinedPlayers"), sa);
|
tgts = AbilityFactory.getDefinedObjects(sa.getSourceCard(), params.get("DefinedPlayers"), sa);
|
||||||
@@ -1429,9 +1440,9 @@ public class AbilityFactoryDealDamage {
|
|||||||
final boolean targeted = (this.abilityFactory.getAbTgt() != null);
|
final boolean targeted = (this.abilityFactory.getAbTgt() != null);
|
||||||
|
|
||||||
for (final Object o : tgts) {
|
for (final Object o : tgts) {
|
||||||
for (Card source : sources) {
|
for (final Card source : sources) {
|
||||||
int dmg = CardFactoryUtil.xCount(source, card.getSVar("X"));
|
final int dmg = CardFactoryUtil.xCount(source, card.getSVar("X"));
|
||||||
//System.out.println(source+" deals "+dmg+" damage to "+o.toString());
|
// System.out.println(source+" deals "+dmg+" damage to "+o.toString());
|
||||||
if (o instanceof Card) {
|
if (o instanceof Card) {
|
||||||
final Card c = (Card) o;
|
final Card c = (Card) o;
|
||||||
if (AllZoneUtil.isCardInPlay(c) && (!targeted || c.canBeTargetedBy(sa))) {
|
if (AllZoneUtil.isCardInPlay(c) && (!targeted || c.canBeTargetedBy(sa))) {
|
||||||
@@ -1448,12 +1459,12 @@ public class AbilityFactoryDealDamage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (params.containsKey("DefinedCards") && params.get("DefinedCards").equals("Self")) {
|
if (params.containsKey("DefinedCards") && params.get("DefinedCards").equals("Self")) {
|
||||||
for (Card source : sources) {
|
for (final Card source : sources) {
|
||||||
int dmg = CardFactoryUtil.xCount(source, card.getSVar("X"));
|
final int dmg = CardFactoryUtil.xCount(source, card.getSVar("X"));
|
||||||
//System.out.println(source+" deals "+dmg+" damage to "+source);
|
// System.out.println(source+" deals "+dmg+" damage to "+source);
|
||||||
source.addDamage(dmg, source);
|
source.addDamage(dmg, source);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} //end class AbilityFactoryDealDamage
|
} // end class AbilityFactoryDealDamage
|
||||||
|
|||||||
@@ -414,11 +414,11 @@ public class AbilityFactoryDestroy {
|
|||||||
} else {
|
} else {
|
||||||
sb.append(host).append(" - ");
|
sb.append(host).append(" - ");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(params.containsKey("Sacrifice")) {
|
if (params.containsKey("Sacrifice")) {
|
||||||
sb.append("Sacrifice ");
|
sb.append("Sacrifice ");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
sb.append("Destroy ");
|
sb.append("Destroy ");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -403,7 +403,7 @@ public class AbilityFactoryGainControl {
|
|||||||
|
|
||||||
if (this.params.containsKey("NewController")) {
|
if (this.params.containsKey("NewController")) {
|
||||||
tgtC.addController(newController.get(0));
|
tgtC.addController(newController.get(0));
|
||||||
} else if (tgt != null && tgt.getTargetPlayers() != null){
|
} else if (tgt != null && tgt.getTargetPlayers() != null) {
|
||||||
tgtC.addController(newController.get(0));
|
tgtC.addController(newController.get(0));
|
||||||
} else {
|
} else {
|
||||||
tgtC.addController(this.hostCard);
|
tgtC.addController(this.hostCard);
|
||||||
|
|||||||
@@ -93,7 +93,8 @@ public class AbilityFactoryPump {
|
|||||||
* @return a {@link forge.card.spellability.SpellAbility} object.
|
* @return a {@link forge.card.spellability.SpellAbility} object.
|
||||||
*/
|
*/
|
||||||
public final SpellAbility getSpellPump() {
|
public final SpellAbility getSpellPump() {
|
||||||
final SpellAbility spPump = new Spell(this.hostCard, this.abilityFactory.getAbCost(), this.abilityFactory.getAbTgt()) {
|
final SpellAbility spPump = new Spell(this.hostCard, this.abilityFactory.getAbCost(),
|
||||||
|
this.abilityFactory.getAbTgt()) {
|
||||||
private static final long serialVersionUID = 42244224L;
|
private static final long serialVersionUID = 42244224L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -123,7 +124,8 @@ public class AbilityFactoryPump {
|
|||||||
* @return a {@link forge.card.spellability.SpellAbility} object.
|
* @return a {@link forge.card.spellability.SpellAbility} object.
|
||||||
*/
|
*/
|
||||||
public final SpellAbility getAbilityPump() {
|
public final SpellAbility getAbilityPump() {
|
||||||
final SpellAbility abPump = new AbilityActivated(this.hostCard, this.abilityFactory.getAbCost(), this.abilityFactory.getAbTgt()) {
|
final SpellAbility abPump = new AbilityActivated(this.hostCard, this.abilityFactory.getAbCost(),
|
||||||
|
this.abilityFactory.getAbTgt()) {
|
||||||
private static final long serialVersionUID = -1118592153328758083L;
|
private static final long serialVersionUID = -1118592153328758083L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -360,7 +362,7 @@ public class AbilityFactoryPump {
|
|||||||
if (!this.containsCombatRelevantKeyword(this.keywords)
|
if (!this.containsCombatRelevantKeyword(this.keywords)
|
||||||
&& AllZone.getPhase().isBefore(Constant.Phase.MAIN2)) {
|
&& AllZone.getPhase().isBefore(Constant.Phase.MAIN2)) {
|
||||||
list.clear(); // this keyword is not combat relevenat
|
list.clear(); // this keyword is not combat relevenat
|
||||||
} else if (this.keywords.get(0).equals("HIDDEN CARDNAME attacks each turn if able.")
|
} else if (this.keywords.get(0).equals("HIDDEN CARDNAME attacks each turn if able.")
|
||||||
&& AllZone.getPhase().isPlayerTurn(AllZone.getComputerPlayer())) {
|
&& AllZone.getPhase().isPlayerTurn(AllZone.getComputerPlayer())) {
|
||||||
list.clear();
|
list.clear();
|
||||||
}
|
}
|
||||||
@@ -368,8 +370,9 @@ public class AbilityFactoryPump {
|
|||||||
list = list.filter(new CardListFilter() {
|
list = list.filter(new CardListFilter() {
|
||||||
@Override
|
@Override
|
||||||
public boolean addCard(final Card c) {
|
public boolean addCard(final Card c) {
|
||||||
return !c.hasAnyKeyword(keywords); // don't add duplicate
|
return !c.hasAnyKeyword(keywords); // don't add
|
||||||
// negative keywords
|
// duplicate
|
||||||
|
// negative keywords
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -530,8 +533,10 @@ public class AbilityFactoryPump {
|
|||||||
* @return a boolean.
|
* @return a boolean.
|
||||||
*/
|
*/
|
||||||
private boolean pumpTgtAI(final SpellAbility sa, final int defense, final int attack, final boolean mandatory) {
|
private boolean pumpTgtAI(final SpellAbility sa, final int defense, final int attack, final boolean mandatory) {
|
||||||
if (!mandatory && AllZone.getPhase().isAfter(Constant.Phase.COMBAT_DECLARE_BLOCKERS_INSTANT_ABILITY)
|
if (!mandatory
|
||||||
&& !(this.abilityFactory.isCurse() && ((defense < 0) || !this.containsCombatRelevantKeyword(this.keywords)))) {
|
&& AllZone.getPhase().isAfter(Constant.Phase.COMBAT_DECLARE_BLOCKERS_INSTANT_ABILITY)
|
||||||
|
&& !(this.abilityFactory.isCurse() && ((defense < 0) || !this
|
||||||
|
.containsCombatRelevantKeyword(this.keywords)))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -970,7 +975,8 @@ public class AbilityFactoryPump {
|
|||||||
* @return a {@link forge.card.spellability.SpellAbility} object.
|
* @return a {@link forge.card.spellability.SpellAbility} object.
|
||||||
*/
|
*/
|
||||||
public final SpellAbility getAbilityPumpAll() {
|
public final SpellAbility getAbilityPumpAll() {
|
||||||
final SpellAbility abPumpAll = new AbilityActivated(this.hostCard, this.abilityFactory.getAbCost(), this.abilityFactory.getAbTgt()) {
|
final SpellAbility abPumpAll = new AbilityActivated(this.hostCard, this.abilityFactory.getAbCost(),
|
||||||
|
this.abilityFactory.getAbTgt()) {
|
||||||
private static final long serialVersionUID = -8299417521903307630L;
|
private static final long serialVersionUID = -8299417521903307630L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -990,7 +996,8 @@ public class AbilityFactoryPump {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean doTrigger(final boolean mandatory) {
|
public boolean doTrigger(final boolean mandatory) {
|
||||||
return AbilityFactoryPump.this.pumpAllTriggerAI(AbilityFactoryPump.this.abilityFactory, this, mandatory);
|
return AbilityFactoryPump.this
|
||||||
|
.pumpAllTriggerAI(AbilityFactoryPump.this.abilityFactory, this, mandatory);
|
||||||
}
|
}
|
||||||
|
|
||||||
}; // SpellAbility
|
}; // SpellAbility
|
||||||
@@ -1006,7 +1013,8 @@ public class AbilityFactoryPump {
|
|||||||
* @return a {@link forge.card.spellability.SpellAbility} object.
|
* @return a {@link forge.card.spellability.SpellAbility} object.
|
||||||
*/
|
*/
|
||||||
public final SpellAbility getSpellPumpAll() {
|
public final SpellAbility getSpellPumpAll() {
|
||||||
final SpellAbility spPumpAll = new Spell(this.hostCard, this.abilityFactory.getAbCost(), this.abilityFactory.getAbTgt()) {
|
final SpellAbility spPumpAll = new Spell(this.hostCard, this.abilityFactory.getAbCost(),
|
||||||
|
this.abilityFactory.getAbTgt()) {
|
||||||
private static final long serialVersionUID = -4055467978660824703L;
|
private static final long serialVersionUID = -4055467978660824703L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -1056,7 +1064,8 @@ public class AbilityFactoryPump {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean doTrigger(final boolean mandatory) {
|
public boolean doTrigger(final boolean mandatory) {
|
||||||
return AbilityFactoryPump.this.pumpAllTriggerAI(AbilityFactoryPump.this.abilityFactory, this, mandatory);
|
return AbilityFactoryPump.this
|
||||||
|
.pumpAllTriggerAI(AbilityFactoryPump.this.abilityFactory, this, mandatory);
|
||||||
}
|
}
|
||||||
}; // SpellAbility
|
}; // SpellAbility
|
||||||
|
|
||||||
@@ -1165,29 +1174,26 @@ public class AbilityFactoryPump {
|
|||||||
// use it
|
// use it
|
||||||
tgtPlayers = AbilityFactory.getDefinedPlayers(sa.getSourceCard(), this.params.get("Defined"), sa);
|
tgtPlayers = AbilityFactory.getDefinedPlayers(sa.getSourceCard(), this.params.get("Defined"), sa);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this.params.containsKey("PumpZone")) {
|
if (this.params.containsKey("PumpZone")) {
|
||||||
for(String zone : this.params.get("PumpZone").split(",")) {
|
for (final String zone : this.params.get("PumpZone").split(",")) {
|
||||||
affectedZones.add(Zone.valueOf(zone));
|
affectedZones.add(Zone.valueOf(zone));
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
affectedZones.add(Zone.Battlefield);
|
affectedZones.add(Zone.Battlefield);
|
||||||
}
|
}
|
||||||
|
|
||||||
list = new CardList();
|
list = new CardList();
|
||||||
if ((tgtPlayers == null) || tgtPlayers.isEmpty()) {
|
if ((tgtPlayers == null) || tgtPlayers.isEmpty()) {
|
||||||
for(Zone zone : affectedZones) {
|
for (final Zone zone : affectedZones) {
|
||||||
list.addAll(AllZoneUtil.getCardsIn(zone));
|
list.addAll(AllZoneUtil.getCardsIn(zone));
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
for(Zone zone : affectedZones) {
|
for (final Zone zone : affectedZones) {
|
||||||
list.addAll(tgtPlayers.get(0).getCardsIn(zone));
|
list.addAll(tgtPlayers.get(0).getCardsIn(zone));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
String valid = "";
|
String valid = "";
|
||||||
if (this.params.containsKey("ValidCards")) {
|
if (this.params.containsKey("ValidCards")) {
|
||||||
@@ -1204,8 +1210,8 @@ public class AbilityFactoryPump {
|
|||||||
|
|
||||||
// only pump things in the affected zones.
|
// only pump things in the affected zones.
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
for(Zone z : affectedZones) {
|
for (final Zone z : affectedZones) {
|
||||||
if(c.isInZone(z)) {
|
if (c.isInZone(z)) {
|
||||||
found = true;
|
found = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -373,14 +373,14 @@ public final class AbilityFactoryReveal {
|
|||||||
// - for when it exists
|
// - for when it exists
|
||||||
} else if (params.containsKey("RevealOptional")) {
|
} else if (params.containsKey("RevealOptional")) {
|
||||||
String question = "Reveal: ";
|
String question = "Reveal: ";
|
||||||
for (Card c : top) {
|
for (final Card c : top) {
|
||||||
question += c + " ";
|
question += c + " ";
|
||||||
}
|
}
|
||||||
if (p.isHuman() && GameActionUtil.showYesNoDialog(host, question)) {
|
if (p.isHuman() && GameActionUtil.showYesNoDialog(host, question)) {
|
||||||
GuiUtils.getChoice("Revealing cards from library", top.toArray());
|
GuiUtils.getChoice("Revealing cards from library", top.toArray());
|
||||||
// AllZone.getGameAction().revealToCopmuter(top.toArray());
|
// AllZone.getGameAction().revealToCopmuter(top.toArray());
|
||||||
if (params.containsKey("RememberRevealed")) {
|
if (params.containsKey("RememberRevealed")) {
|
||||||
for (Card one : top) {
|
for (final Card one : top) {
|
||||||
host.addRemembered(one);
|
host.addRemembered(one);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -947,8 +947,8 @@ public final class AbilityFactoryReveal {
|
|||||||
final Card c = itr.next();
|
final Card c = itr.next();
|
||||||
AllZone.getGameAction().moveTo(revealedDest, c, revealedLibPos);
|
AllZone.getGameAction().moveTo(revealedDest, c, revealedLibPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(params.containsKey("Shuffle")) {
|
if (params.containsKey("Shuffle")) {
|
||||||
p.shuffle();
|
p.shuffle();
|
||||||
}
|
}
|
||||||
} // end foreach player
|
} // end foreach player
|
||||||
|
|||||||
@@ -193,30 +193,23 @@ public class AbilityFactorySetState {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(abilityFactory.getMapParams().containsKey("Transform"))
|
if (abilityFactory.getMapParams().containsKey("Transform")) {
|
||||||
{
|
if (tgt.getCurState().equals("Transformed")) {
|
||||||
if(tgt.getCurState().equals("Transformed")) {
|
|
||||||
tgt.setState("Original");
|
tgt.setState("Original");
|
||||||
}
|
} else if (tgt.hasAlternateState() && tgt.getCurState().equals("Original")) {
|
||||||
else if(tgt.hasAlternateState() && tgt.getCurState().equals("Original")) {
|
if (tgt.isDoubleFaced()) {
|
||||||
if(tgt.isDoubleFaced()) {
|
|
||||||
tgt.setState("Transformed");
|
tgt.setState("Transformed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else if (abilityFactory.getMapParams().containsKey("Flip")) {
|
||||||
else if(abilityFactory.getMapParams().containsKey("Flip"))
|
if (tgt.getCurState().equals("Flipped")) {
|
||||||
{
|
|
||||||
if(tgt.getCurState().equals("Flipped")) {
|
|
||||||
tgt.setState("Original");
|
tgt.setState("Original");
|
||||||
}
|
} else if (tgt.hasAlternateState()) {
|
||||||
else if(tgt.hasAlternateState()) {
|
if (tgt.isFlip() && tgt.getCurState().equals("Original")) {
|
||||||
if(tgt.isFlip() && tgt.getCurState().equals("Original")) {
|
|
||||||
tgt.setState("Flipped");
|
tgt.setState("Flipped");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
tgt.setState(abilityFactory.getMapParams().get("NewState"));
|
tgt.setState(abilityFactory.getMapParams().get("NewState"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -364,38 +357,32 @@ public class AbilityFactorySetState {
|
|||||||
|
|
||||||
for (int i = 0; i < list.size(); i++) {
|
for (int i = 0; i < list.size(); i++) {
|
||||||
String mode = list.get(i).getCurState();
|
String mode = list.get(i).getCurState();
|
||||||
if(list.get(i).isDoubleFaced()) {
|
if (list.get(i).isDoubleFaced()) {
|
||||||
if(list.get(i).getCurState().equals("Original"))
|
if (list.get(i).getCurState().equals("Original")) {
|
||||||
{
|
|
||||||
mode = "Transformed";
|
mode = "Transformed";
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
mode = "Original";
|
mode = "Original";
|
||||||
}
|
}
|
||||||
|
|
||||||
if(list.get(i).setState(mode) && remChanged) {
|
if (list.get(i).setState(mode) && remChanged) {
|
||||||
card.addRemembered(list.get(i));
|
card.addRemembered(list.get(i));
|
||||||
}
|
}
|
||||||
}
|
} else if (list.get(i).isFlip()) {
|
||||||
else if(list.get(i).isFlip()) {
|
if (list.get(i).getCurState().equals("Original")) {
|
||||||
if(list.get(i).getCurState().equals("Original"))
|
|
||||||
{
|
|
||||||
mode = "Flipped";
|
mode = "Flipped";
|
||||||
}
|
} else if (list.get(i).getCurState().equals("Flipped")) {
|
||||||
else if(list.get(i).getCurState().equals("Flipped")){
|
|
||||||
mode = "Original";
|
mode = "Original";
|
||||||
}
|
}
|
||||||
|
|
||||||
if(list.get(i).setState(mode) && remChanged) {
|
if (list.get(i).setState(mode) && remChanged) {
|
||||||
|
card.addRemembered(list.get(i));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (list.get(i).setState(abilityFactory.getMapParams().get("NewState")) && remChanged) {
|
||||||
card.addRemembered(list.get(i));
|
card.addRemembered(list.get(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
if(list.get(i).setState(abilityFactory.getMapParams().get("NewState")) && remChanged) {
|
|
||||||
card.addRemembered(list.get(i));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1098,8 +1098,9 @@ public class AbilityFactoryZoneAffecting {
|
|||||||
for (final Player p : tgtPlayers) {
|
for (final Player p : tgtPlayers) {
|
||||||
if ((tgt == null) || p.canBeTargetedBy(sa)) {
|
if ((tgt == null) || p.canBeTargetedBy(sa)) {
|
||||||
if (mode.equals("Defined")) {
|
if (mode.equals("Defined")) {
|
||||||
final ArrayList<Card> toDiscard = AbilityFactory.getDefinedCards(host, params.get("DefinedCards"), sa);
|
final ArrayList<Card> toDiscard = AbilityFactory.getDefinedCards(host, params.get("DefinedCards"),
|
||||||
for (Card c : toDiscard) {
|
sa);
|
||||||
|
for (final Card c : toDiscard) {
|
||||||
discarded.addAll(p.discard(c, sa));
|
discarded.addAll(p.discard(c, sa));
|
||||||
}
|
}
|
||||||
if (params.containsKey("RememberDiscarded")) {
|
if (params.containsKey("RememberDiscarded")) {
|
||||||
@@ -1109,7 +1110,7 @@ public class AbilityFactoryZoneAffecting {
|
|||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mode.equals("Hand")) {
|
if (mode.equals("Hand")) {
|
||||||
final CardList list = p.discardHand(sa);
|
final CardList list = p.discardHand(sa);
|
||||||
if (params.containsKey("RememberDiscarded")) {
|
if (params.containsKey("RememberDiscarded")) {
|
||||||
@@ -1316,7 +1317,7 @@ public class AbilityFactoryZoneAffecting {
|
|||||||
}
|
}
|
||||||
sb.append(" of type: ").append(valid);
|
sb.append(" of type: ").append(valid);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mode.equals("Defined")) {
|
if (mode.equals("Defined")) {
|
||||||
sb.append(" defined cards");
|
sb.append(" defined cards");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -171,8 +171,8 @@ public abstract class AbstractCardFactory implements CardFactoryInterface {
|
|||||||
|
|
||||||
CardFactoryUtil.copyCharacteristics(in, out);
|
CardFactoryUtil.copyCharacteristics(in, out);
|
||||||
if (in.hasAlternateState()) {
|
if (in.hasAlternateState()) {
|
||||||
String curState = in.getCurState();
|
final String curState = in.getCurState();
|
||||||
for(String state : in.getStates()) {
|
for (final String state : in.getStates()) {
|
||||||
in.setState(state);
|
in.setState(state);
|
||||||
out.setState(state);
|
out.setState(state);
|
||||||
CardFactoryUtil.copyCharacteristics(in, out);
|
CardFactoryUtil.copyCharacteristics(in, out);
|
||||||
@@ -483,7 +483,7 @@ public abstract class AbstractCardFactory implements CardFactoryInterface {
|
|||||||
card.addColor(card.getManaCost());
|
card.addColor(card.getManaCost());
|
||||||
}
|
}
|
||||||
// may have to change the spell
|
// may have to change the spell
|
||||||
|
|
||||||
// this is so permanents like creatures and artifacts have a "default"
|
// this is so permanents like creatures and artifacts have a "default"
|
||||||
// spell
|
// spell
|
||||||
if (card.isPermanent() && !card.isLand() && !card.isAura()) {
|
if (card.isPermanent() && !card.isLand() && !card.isAura()) {
|
||||||
@@ -503,7 +503,7 @@ public abstract class AbstractCardFactory implements CardFactoryInterface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (card.hasAlternateState()) {
|
if (card.hasAlternateState()) {
|
||||||
for(String state : card.getStates()) {
|
for (final String state : card.getStates()) {
|
||||||
card.setState(state);
|
card.setState(state);
|
||||||
this.addAbilityFactoryAbilities(card);
|
this.addAbilityFactoryAbilities(card);
|
||||||
stAbs = card.getStaticAbilityStrings();
|
stAbs = card.getStaticAbilityStrings();
|
||||||
@@ -513,7 +513,7 @@ public abstract class AbstractCardFactory implements CardFactoryInterface {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
card.setState("Original");
|
card.setState("Original");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -644,8 +644,8 @@ public abstract class AbstractCardFactory implements CardFactoryInterface {
|
|||||||
sb.append("As Sarpadian Empires, Vol. VII enters the battlefield, ");
|
sb.append("As Sarpadian Empires, Vol. VII enters the battlefield, ");
|
||||||
sb.append("choose white Citizen, blue Camarid, black Thrull, red Goblin, or green Saproling.\r\n");
|
sb.append("choose white Citizen, blue Camarid, black Thrull, red Goblin, or green Saproling.\r\n");
|
||||||
sb.append("3, Tap: Put a 1/1 creature token of the chosen color and type onto the battlefield.\r\n");
|
sb.append("3, Tap: Put a 1/1 creature token of the chosen color and type onto the battlefield.\r\n");
|
||||||
sb.append(card.getText()); // In the slight chance that there may be
|
sb.append(card.getText()); // In the slight chance that there may be
|
||||||
// a need to add a note to this card.
|
// a need to add a note to this card.
|
||||||
card.setText(sb.toString());
|
card.setText(sb.toString());
|
||||||
|
|
||||||
card.addComesIntoPlayCommand(intoPlay);
|
card.addComesIntoPlayCommand(intoPlay);
|
||||||
@@ -1252,57 +1252,44 @@ public abstract class AbstractCardFactory implements CardFactoryInterface {
|
|||||||
} // *************** END ************ END **************************
|
} // *************** END ************ END **************************
|
||||||
|
|
||||||
// *************** START *********** START **************************
|
// *************** START *********** START **************************
|
||||||
/*else if (cardName.equals("Pithing Needle")) {
|
/*
|
||||||
final SpellAbility ability = new AbilityStatic(card, "0") {
|
* else if (cardName.equals("Pithing Needle")) { final SpellAbility
|
||||||
@Override
|
* ability = new AbilityStatic(card, "0") {
|
||||||
public void resolve() {
|
*
|
||||||
String cardName = "";
|
* @Override public void resolve() { String cardName = ""; if
|
||||||
if (card.getController().isHuman()) {
|
* (card.getController().isHuman()) { final List<String> cards = new
|
||||||
final List<String> cards = new ArrayList<String>();
|
* ArrayList<String>(); for (final CardPrinted c :
|
||||||
for (final CardPrinted c : CardDb.instance().getAllUniqueCards()) {
|
* CardDb.instance().getAllUniqueCards()) { cards.add(c.getName()); }
|
||||||
cards.add(c.getName());
|
* Collections.sort(cards);
|
||||||
}
|
*
|
||||||
Collections.sort(cards);
|
* // use standard forge's list selection dialog final
|
||||||
|
* ListChooser<String> c = new ListChooser<String>(
|
||||||
// use standard forge's list selection dialog
|
* "Name a card to disable activation of its non-mana abilities", 1, 1,
|
||||||
final ListChooser<String> c = new ListChooser<String>(
|
* cards); c.show(); // still missing a listener to display the card
|
||||||
"Name a card to disable activation of its non-mana abilities", 1, 1, cards);
|
* preview // in the right cardName = c.getSelectedValue(); } else { //
|
||||||
c.show();
|
* AI CODE WILL EVENTUALLY GO HERE! } card.setSVar("PithingTarget",
|
||||||
// still missing a listener to display the card preview
|
* cardName); card.setChosenType(cardName); } }; // ability
|
||||||
// in the right
|
* ability.setStackDescription
|
||||||
cardName = c.getSelectedValue();
|
* ("As Pithing Needle enters the battlefield, name a card."); final
|
||||||
} else {
|
* Command intoPlay = new Command() {
|
||||||
// AI CODE WILL EVENTUALLY GO HERE!
|
*
|
||||||
}
|
* private static final long serialVersionUID = 2266471224097876143L;
|
||||||
card.setSVar("PithingTarget", cardName);
|
*
|
||||||
card.setChosenType(cardName);
|
* @Override public void execute() {
|
||||||
}
|
* AllZone.getStack().addSimultaneousStackEntry(ability);
|
||||||
}; // ability
|
*
|
||||||
ability.setStackDescription("As Pithing Needle enters the battlefield, name a card.");
|
* } };
|
||||||
final Command intoPlay = new Command() {
|
*
|
||||||
|
* final Command leavesPlay = new Command() {
|
||||||
private static final long serialVersionUID = 2266471224097876143L;
|
*
|
||||||
|
* private static final long serialVersionUID = 7079781778752377760L;
|
||||||
@Override
|
*
|
||||||
public void execute() {
|
* @Override public void execute() { card.setSVar("Pithing Target", "");
|
||||||
AllZone.getStack().addSimultaneousStackEntry(ability);
|
* } };
|
||||||
|
*
|
||||||
}
|
* card.addComesIntoPlayCommand(intoPlay);
|
||||||
};
|
* card.addLeavesPlayCommand(leavesPlay); }
|
||||||
|
*/// *************** END ************ END **************************
|
||||||
final Command leavesPlay = new Command() {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 7079781778752377760L;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void execute() {
|
|
||||||
card.setSVar("Pithing Target", "");
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
card.addComesIntoPlayCommand(intoPlay);
|
|
||||||
card.addLeavesPlayCommand(leavesPlay);
|
|
||||||
}*/ // *************** END ************ END **************************
|
|
||||||
|
|
||||||
// *************** START *********** START **************************
|
// *************** START *********** START **************************
|
||||||
else if (cardName.equals("Phyrexian Processor")) {
|
else if (cardName.equals("Phyrexian Processor")) {
|
||||||
|
|||||||
@@ -536,8 +536,8 @@ public class CardFactoryCreatures {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI() {
|
public boolean canPlayAI() {
|
||||||
return (!AllZone.getComputerPlayer().getCardsIn(Zone.Battlefield).getType("Artifact").isEmpty()
|
return (!AllZone.getComputerPlayer().getCardsIn(Zone.Battlefield).getType("Artifact").isEmpty() && AllZone
|
||||||
&& AllZone.getZoneOf(this.getSourceCard()).is(Constant.Zone.Hand));
|
.getZoneOf(this.getSourceCard()).is(Constant.Zone.Hand));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
card.addComesIntoPlayCommand(intoPlay);
|
card.addComesIntoPlayCommand(intoPlay);
|
||||||
@@ -740,19 +740,19 @@ public class CardFactoryCreatures {
|
|||||||
sb.append("Adarkar Valkyrie - Return ").append(target[0]);
|
sb.append("Adarkar Valkyrie - Return ").append(target[0]);
|
||||||
sb.append(" from graveyard to the battlefield");
|
sb.append(" from graveyard to the battlefield");
|
||||||
AllZone.getStack().addSimultaneousStackEntry(new Ability(card, "0", sb.toString()) {
|
AllZone.getStack().addSimultaneousStackEntry(new Ability(card, "0", sb.toString()) {
|
||||||
@Override
|
@Override
|
||||||
public void resolve() {
|
public void resolve() {
|
||||||
final PlayerZone grave = AllZone.getZoneOf(target[0]);
|
final PlayerZone grave = AllZone.getZoneOf(target[0]);
|
||||||
// checks to see if card is still in the
|
// checks to see if card is still in the
|
||||||
// graveyard
|
// graveyard
|
||||||
|
|
||||||
if ((grave != null) && grave.contains(target[0])) {
|
if ((grave != null) && grave.contains(target[0])) {
|
||||||
final PlayerZone play = card.getController().getZone(Constant.Zone.Battlefield);
|
final PlayerZone play = card.getController().getZone(Constant.Zone.Battlefield);
|
||||||
target[0].addController(card.getController());
|
target[0].addController(card.getController());
|
||||||
AllZone.getGameAction().moveTo(play, target[0]);
|
AllZone.getGameAction().moveTo(play, target[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} // execute()
|
} // execute()
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -2244,77 +2244,80 @@ public class CardFactoryCreatures {
|
|||||||
|
|
||||||
if (copyTarget[0] != null) {
|
if (copyTarget[0] != null) {
|
||||||
Card cloned;
|
Card cloned;
|
||||||
|
|
||||||
cloned = cfact.getCard(copyTarget[0].getState("Original").getName(), card.getOwner());
|
cloned = cfact.getCard(copyTarget[0].getState("Original").getName(), card.getOwner());
|
||||||
card.addAlternateState("Cloner");
|
card.addAlternateState("Cloner");
|
||||||
card.switchStates("Original", "Cloner");
|
card.switchStates("Original", "Cloner");
|
||||||
card.setState("Original");
|
card.setState("Original");
|
||||||
|
|
||||||
if(copyTarget[0].getCurState().equals("Transformed") && copyTarget[0].isDoubleFaced()) {
|
if (copyTarget[0].getCurState().equals("Transformed") && copyTarget[0].isDoubleFaced()) {
|
||||||
cloned.setState("Transformed");
|
cloned.setState("Transformed");
|
||||||
}
|
}
|
||||||
|
|
||||||
CardFactoryUtil.copyCharacteristics(cloned,card);
|
|
||||||
this.grantExtras();
|
|
||||||
|
|
||||||
|
|
||||||
//If target is a flipped card, also copy the flipped state.
|
CardFactoryUtil.copyCharacteristics(cloned, card);
|
||||||
if(copyTarget[0].isFlip()) {
|
this.grantExtras();
|
||||||
|
|
||||||
|
// If target is a flipped card, also copy the flipped
|
||||||
|
// state.
|
||||||
|
if (copyTarget[0].isFlip()) {
|
||||||
cloned.setState("Flipped");
|
cloned.setState("Flipped");
|
||||||
cloned.setImageFilename(CardUtil.buildFilename(cloned));
|
cloned.setImageFilename(CardUtil.buildFilename(cloned));
|
||||||
card.addAlternateState("Flipped");
|
card.addAlternateState("Flipped");
|
||||||
card.setState("Flipped");
|
card.setState("Flipped");
|
||||||
CardFactoryUtil.copyCharacteristics(cloned,card);
|
CardFactoryUtil.copyCharacteristics(cloned, card);
|
||||||
this.grantExtras();
|
this.grantExtras();
|
||||||
|
|
||||||
card.setFlip(true);
|
card.setFlip(true);
|
||||||
|
|
||||||
card.setState("Original");
|
card.setState("Original");
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
card.setFlip(false);
|
card.setFlip(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
AllZone.getGameAction().moveToPlay(card);
|
AllZone.getGameAction().moveToPlay(card);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void grantExtras() {
|
private void grantExtras() {
|
||||||
//Grant stuff from specific cloners
|
// Grant stuff from specific cloners
|
||||||
if(cardName.equals("Vesuvan Doppelganger")) {
|
if (cardName.equals("Vesuvan Doppelganger")) {
|
||||||
final String keyword = "At the beginning of your upkeep, you may have this "
|
final String keyword = "At the beginning of your upkeep, you may have this "
|
||||||
+ "creature become a copy of target creature except it doesn't copy that "
|
+ "creature become a copy of target creature except it doesn't copy that "
|
||||||
+ "creature's color. If you do, this creature gains this ability.";
|
+ "creature's color. If you do, this creature gains this ability.";
|
||||||
card.addIntrinsicKeyword(keyword);
|
card.addIntrinsicKeyword(keyword);
|
||||||
card.addColor("U");
|
card.addColor("U");
|
||||||
}
|
} else if (cardName.equals("Quicksilver Gargantuan")) {
|
||||||
else if(cardName.equals("Quicksilver Gargantuan")) {
|
|
||||||
card.setBaseAttack(7);
|
card.setBaseAttack(7);
|
||||||
card.setBaseDefense(7);
|
card.setBaseDefense(7);
|
||||||
}
|
} else if (cardName.equals("Phyrexian Metamorph")) {
|
||||||
else if(cardName.equals("Phyrexian Metamorph")) {
|
|
||||||
card.addType("Artifact");
|
card.addType("Artifact");
|
||||||
}
|
} else if (cardName.equals("Phantasmal Image")) {
|
||||||
else if(cardName.equals("Phantasmal Image")) {
|
final Trigger t = forge.card.trigger.TriggerHandler
|
||||||
Trigger t = forge.card.trigger.TriggerHandler.parseTrigger("Mode$ BecomesTarget | ValidTarget$ Card.Self | Execute$ TrigSac | TriggerDescription$ When this creature becomes the target of a spell or ability, sacrifice it.", card, true);
|
.parseTrigger(
|
||||||
|
"Mode$ BecomesTarget | ValidTarget$ Card.Self | Execute$ TrigSac | TriggerDescription$ When this creature becomes the target of a spell or ability, sacrifice it.",
|
||||||
|
card, true);
|
||||||
card.addTrigger(t);
|
card.addTrigger(t);
|
||||||
card.setSVar("TrigSac", "AB$Sacrifice | Cost$ 0 | Defined$ Self");
|
card.setSVar("TrigSac", "AB$Sacrifice | Cost$ 0 | Defined$ Self");
|
||||||
}
|
} else if (cardName.equals("Evil Twin")) {
|
||||||
else if(cardName.equals("Evil Twin")) {
|
final AbilityFactory af = new AbilityFactory();
|
||||||
AbilityFactory af = new AbilityFactory();
|
|
||||||
|
final SpellAbility ab = af
|
||||||
SpellAbility ab = af.getAbility("AB$Destroy | Cost$ U B T | ValidTgts$ Creature.sameName | TgtPrompt$ Select target creature with the same name. | SpellDescription$ Destroy target creature with the same name as this creature.", card);
|
.getAbility(
|
||||||
|
"AB$Destroy | Cost$ U B T | ValidTgts$ Creature.sameName | TgtPrompt$ Select target creature with the same name. | SpellDescription$ Destroy target creature with the same name as this creature.",
|
||||||
|
card);
|
||||||
|
|
||||||
card.addSpellAbility(ab);
|
card.addSpellAbility(ab);
|
||||||
}
|
} else if (cardName.equals("Sakashima the Impostor")) {
|
||||||
else if(cardName.equals("Sakashima the Impostor")) {
|
final AbilityFactory af = new AbilityFactory();
|
||||||
AbilityFactory af = new AbilityFactory();
|
final SpellAbility ab = af
|
||||||
SpellAbility ab = af.getAbility("AB$DelayedTrigger | Cost$ 2 U U | Mode$ Phase | Phase$ End of Turn | Execute$ TrigReturnSak | TriggerDescription$ Return CARDNAME to it's owners hand at the beginning of the next end step.",card);
|
.getAbility(
|
||||||
|
"AB$DelayedTrigger | Cost$ 2 U U | Mode$ Phase | Phase$ End of Turn | Execute$ TrigReturnSak | TriggerDescription$ Return CARDNAME to it's owners hand at the beginning of the next end step.",
|
||||||
|
card);
|
||||||
|
|
||||||
card.addSpellAbility(ab);
|
card.addSpellAbility(ab);
|
||||||
card.setSVar("TrigReturnSak","AB$ChangeZone | Cost$ 0 | Defined$ Self | Origin$ Battlefield | Destination$ Hand");
|
card.setSVar("TrigReturnSak",
|
||||||
|
"AB$ChangeZone | Cost$ 0 | Defined$ Self | Origin$ Battlefield | Destination$ Hand");
|
||||||
card.setName("Sakashima the Impostor");
|
card.setName("Sakashima the Impostor");
|
||||||
card.addType("Legendary");
|
card.addType("Legendary");
|
||||||
}
|
}
|
||||||
@@ -2609,8 +2612,8 @@ public class CardFactoryCreatures {
|
|||||||
theCost = "R";
|
theCost = "R";
|
||||||
}
|
}
|
||||||
|
|
||||||
final SpellAbility finalAb = new AbilityActivated(card, new Cost(theCost, cardName, true), new Target(
|
final SpellAbility finalAb = new AbilityActivated(card, new Cost(theCost, cardName, true), new Target(card,
|
||||||
card, "Select target creature.", "Creature")) {
|
"Select target creature.", "Creature")) {
|
||||||
private static final long serialVersionUID = 2391351140880148283L;
|
private static final long serialVersionUID = 2391351140880148283L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -2694,35 +2697,36 @@ public class CardFactoryCreatures {
|
|||||||
ability.setStackDescription(sbStack.toString());
|
ability.setStackDescription(sbStack.toString());
|
||||||
} // *************** END ************ END **************************
|
} // *************** END ************ END **************************
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// *************** START *********** START **************************
|
// *************** START *********** START **************************
|
||||||
else if (cardName.equals("Ixidron")) {
|
else if (cardName.equals("Ixidron")) {
|
||||||
Trigger tfdTrigger = forge.card.trigger.TriggerHandler.parseTrigger("Mode$ ChangesZone | Destination$ Battlefield | ValidCard$ Card.Self | Static$ True | TriggerDescription$ As CARDNAME enters the battlefield, turn all other nontoken creatures face down. (They're 2/2 creatures.)", card, true);
|
final Trigger tfdTrigger = forge.card.trigger.TriggerHandler
|
||||||
|
.parseTrigger(
|
||||||
|
"Mode$ ChangesZone | Destination$ Battlefield | ValidCard$ Card.Self | Static$ True | TriggerDescription$ As CARDNAME enters the battlefield, turn all other nontoken creatures face down. (They're 2/2 creatures.)",
|
||||||
|
card, true);
|
||||||
|
|
||||||
final SpellAbility triggeredAbility = new Ability(card, "0") {
|
final SpellAbility triggeredAbility = new Ability(card, "0") {
|
||||||
@Override
|
@Override
|
||||||
public void resolve() {
|
public void resolve() {
|
||||||
CardList creatsInPlay = AllZoneUtil.getCreaturesInPlay();
|
CardList creatsInPlay = AllZoneUtil.getCreaturesInPlay();
|
||||||
|
|
||||||
creatsInPlay = creatsInPlay.filter(new CardListFilter() {
|
creatsInPlay = creatsInPlay.filter(new CardListFilter() {
|
||||||
@Override
|
@Override
|
||||||
public boolean addCard(Card c) {
|
public boolean addCard(final Card c) {
|
||||||
return !c.isToken() && !c.equals(card);
|
return !c.isToken() && !c.equals(card);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
for(Card c : creatsInPlay) {
|
for (final Card c : creatsInPlay) {
|
||||||
c.turnFaceDown();
|
c.turnFaceDown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
tfdTrigger.setOverridingAbility(triggeredAbility);
|
tfdTrigger.setOverridingAbility(triggeredAbility);
|
||||||
|
|
||||||
card.addTrigger(tfdTrigger);
|
card.addTrigger(tfdTrigger);
|
||||||
} // *************** END ************ END **************************
|
} // *************** END ************ END **************************
|
||||||
|
|
||||||
// ***************************************************
|
// ***************************************************
|
||||||
// end of card specific code
|
// end of card specific code
|
||||||
// ***************************************************
|
// ***************************************************
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ import forge.AllZone;
|
|||||||
import forge.AllZoneUtil;
|
import forge.AllZoneUtil;
|
||||||
import forge.ButtonUtil;
|
import forge.ButtonUtil;
|
||||||
import forge.Card;
|
import forge.Card;
|
||||||
import forge.CardColor;
|
|
||||||
import forge.CardList;
|
import forge.CardList;
|
||||||
import forge.CardListFilter;
|
import forge.CardListFilter;
|
||||||
import forge.CardUtil;
|
import forge.CardUtil;
|
||||||
@@ -919,7 +918,7 @@ public class CardFactoryUtil {
|
|||||||
@Override
|
@Override
|
||||||
public void resolve() {
|
public void resolve() {
|
||||||
sourceCard.turnFaceDown();
|
sourceCard.turnFaceDown();
|
||||||
|
|
||||||
sourceCard.comesIntoPlay();
|
sourceCard.comesIntoPlay();
|
||||||
|
|
||||||
AllZone.getGameAction().moveToPlay(sourceCard);
|
AllZone.getGameAction().moveToPlay(sourceCard);
|
||||||
@@ -958,18 +957,13 @@ public class CardFactoryUtil {
|
|||||||
*/
|
*/
|
||||||
public static AbilityActivated abilityMorphUp(final Card sourceCard, final Cost cost, final String orgManaCost,
|
public static AbilityActivated abilityMorphUp(final Card sourceCard, final Cost cost, final String orgManaCost,
|
||||||
final int a, final int d) {
|
final int a, final int d) {
|
||||||
// final String player = sourceCard.getController();
|
|
||||||
// final String manaCost = cost;
|
|
||||||
final int attack = a;
|
|
||||||
final int defense = d;
|
|
||||||
final String origManaCost = orgManaCost;
|
|
||||||
final AbilityActivated morphUp = new AbilityActivated(sourceCard, cost, null) {
|
final AbilityActivated morphUp = new AbilityActivated(sourceCard, cost, null) {
|
||||||
private static final long serialVersionUID = -3663857013937085953L;
|
private static final long serialVersionUID = -3663857013937085953L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void resolve() {
|
public void resolve() {
|
||||||
sourceCard.turnFaceUp();
|
sourceCard.turnFaceUp();
|
||||||
|
|
||||||
// Run triggers
|
// Run triggers
|
||||||
final Map<String, Object> runParams = new TreeMap<String, Object>();
|
final Map<String, Object> runParams = new TreeMap<String, Object>();
|
||||||
runParams.put("Card", sourceCard);
|
runParams.put("Card", sourceCard);
|
||||||
@@ -978,9 +972,6 @@ public class CardFactoryUtil {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlay() {
|
public boolean canPlay() {
|
||||||
// unMorphing a card is a Special Action, and not affected by
|
|
||||||
// Linvala
|
|
||||||
Card c = sourceCard;
|
|
||||||
return sourceCard.getController().equals(this.getActivatingPlayer()) && sourceCard.isFaceDown()
|
return sourceCard.getController().equals(this.getActivatingPlayer()) && sourceCard.isFaceDown()
|
||||||
&& AllZoneUtil.isCardInPlay(sourceCard);
|
&& AllZoneUtil.isCardInPlay(sourceCard);
|
||||||
}
|
}
|
||||||
@@ -2305,16 +2296,14 @@ public class CardFactoryUtil {
|
|||||||
* <p>
|
* <p>
|
||||||
* canBeTargetedBy.
|
* canBeTargetedBy.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @param ability
|
* @param c the c
|
||||||
* a {@link forge.card.spellability.SpellAbility} object.
|
|
||||||
* @param target
|
|
||||||
* a {@link forge.Card} object.
|
|
||||||
* @return a boolean.
|
* @return a boolean.
|
||||||
*/
|
*/
|
||||||
/*public static boolean canBeTargetedBy(final SpellAbility ability, final Card target) {
|
/*
|
||||||
return target.canBeTargetedBy(ability);
|
* public static boolean canBeTargetedBy(final SpellAbility ability, final
|
||||||
}*/
|
* Card target) { return target.canBeTargetedBy(ability); }
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@@ -2333,91 +2322,57 @@ public class CardFactoryUtil {
|
|||||||
* <p>
|
* <p>
|
||||||
* canBeTargetedBy.
|
* canBeTargetedBy.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @param spell
|
* @param card the card
|
||||||
* a {@link forge.Card} object.
|
* @param target a {@link forge.Card} object.
|
||||||
* @param target
|
|
||||||
* a {@link forge.Card} object.
|
|
||||||
* @return a boolean.
|
* @return a boolean.
|
||||||
*/
|
*/
|
||||||
/*public static boolean canBeTargetedBy(final Card spell, final Card target) {
|
/*
|
||||||
if (target == null) {
|
* public static boolean canBeTargetedBy(final Card spell, final Card
|
||||||
return true;
|
* target) { if (target == null) { return true; }
|
||||||
}
|
*
|
||||||
|
* if (target.isImmutable()) { return false; }
|
||||||
if (target.isImmutable()) {
|
*
|
||||||
return false;
|
* final PlayerZone zone = AllZone.getZoneOf(target); // if zone is null, it
|
||||||
}
|
* means its on the stack if ((zone == null) ||
|
||||||
|
* !zone.is(Constant.Zone.Battlefield)) { // targets not in play, can
|
||||||
final PlayerZone zone = AllZone.getZoneOf(target);
|
* normally be targeted return true; }
|
||||||
// if zone is null, it means its on the stack
|
*
|
||||||
if ((zone == null) || !zone.is(Constant.Zone.Battlefield)) {
|
* if (AllZoneUtil.isCardInPlay("Spellbane Centaur", target.getController())
|
||||||
// targets not in play, can normally be targeted
|
* && target.isCreature() && spell.isBlue()) { return false; }
|
||||||
return true;
|
*
|
||||||
}
|
* if (target.getName().equals("Gaea's Revenge") && !spell.isGreen()) {
|
||||||
|
* return false; }
|
||||||
if (AllZoneUtil.isCardInPlay("Spellbane Centaur", target.getController()) && target.isCreature()
|
*
|
||||||
&& spell.isBlue()) {
|
* if (CardFactoryUtil.hasProtectionFrom(spell, target)) { return false; }
|
||||||
return false;
|
*
|
||||||
}
|
* if (target.getKeyword() != null) { final ArrayList<String> list =
|
||||||
|
* target.getKeyword();
|
||||||
if (target.getName().equals("Gaea's Revenge") && !spell.isGreen()) {
|
*
|
||||||
return false;
|
* String kw = ""; for (int i = 0; i < list.size(); i++) { kw = list.get(i);
|
||||||
}
|
* if (kw.equals("Shroud")) { return false; }
|
||||||
|
*
|
||||||
if (CardFactoryUtil.hasProtectionFrom(spell, target)) {
|
* if (kw.equals("Hexproof")) { if
|
||||||
return false;
|
* (!spell.getController().equals(target.getController())) { return false; }
|
||||||
}
|
* }
|
||||||
|
*
|
||||||
if (target.getKeyword() != null) {
|
* if (kw.equals("CARDNAME can't be the target of Aura spells.") ||
|
||||||
final ArrayList<String> list = target.getKeyword();
|
* kw.equals("CARDNAME can't be enchanted.")) { if (spell.isAura() &&
|
||||||
|
* spell.isSpell()) { return false; } }
|
||||||
String kw = "";
|
*
|
||||||
for (int i = 0; i < list.size(); i++) {
|
* if (kw.equals(
|
||||||
kw = list.get(i);
|
* "CARDNAME can't be the target of red spells or abilities from red sources."
|
||||||
if (kw.equals("Shroud")) {
|
* )) { if (spell.isRed()) { return false; } }
|
||||||
return false;
|
*
|
||||||
}
|
* if (kw.equals("CARDNAME can't be the target of black spells.")) { if
|
||||||
|
* (spell.isBlack() && spell.isSpell()) { return false; } }
|
||||||
if (kw.equals("Hexproof")) {
|
*
|
||||||
if (!spell.getController().equals(target.getController())) {
|
* if (kw.equals("CARDNAME can't be the target of blue spells.")) { if
|
||||||
return false;
|
* (spell.isBlue() && spell.isSpell()) { return false; } }
|
||||||
}
|
*
|
||||||
}
|
* if (kw.equals("CARDNAME can't be the target of spells.")) { if
|
||||||
|
* (spell.isSpell()) { return false; } } } } return true; }
|
||||||
if (kw.equals("CARDNAME can't be the target of Aura spells.") || kw.equals("CARDNAME can't be enchanted.")) {
|
*/
|
||||||
if (spell.isAura() && spell.isSpell()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (kw.equals("CARDNAME can't be the target of red spells or abilities from red sources.")) {
|
|
||||||
if (spell.isRed()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (kw.equals("CARDNAME can't be the target of black spells.")) {
|
|
||||||
if (spell.isBlack() && spell.isSpell()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (kw.equals("CARDNAME can't be the target of blue spells.")) {
|
|
||||||
if (spell.isBlue() && spell.isSpell()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (kw.equals("CARDNAME can't be the target of spells.")) {
|
|
||||||
if (spell.isSpell()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
// does "target" have protection from "card"?
|
// does "target" have protection from "card"?
|
||||||
/**
|
/**
|
||||||
@@ -2544,9 +2499,10 @@ public class CardFactoryUtil {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sa.isSpell() && !zone.is(Zone.Battlefield) && (c.hasStartOfKeyword("May be played")
|
if (sa.isSpell()
|
||||||
|| (c.hasStartOfKeyword("Flashback") && zone.is(Zone.Graveyard)))
|
&& !zone.is(Zone.Battlefield)
|
||||||
&& restrictZone.equals(Zone.Hand)) {
|
&& (c.hasStartOfKeyword("May be played") || (c.hasStartOfKeyword("Flashback") && zone
|
||||||
|
.is(Zone.Graveyard))) && restrictZone.equals(Zone.Hand)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2640,7 +2596,7 @@ public class CardFactoryUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (sq[0].contains("DomainPlayer")) {
|
if (sq[0].contains("DomainPlayer")) {
|
||||||
CardList someCards = new CardList();
|
final CardList someCards = new CardList();
|
||||||
someCards.addAll(players.get(0).getCardsIn(Zone.Battlefield));
|
someCards.addAll(players.get(0).getCardsIn(Zone.Battlefield));
|
||||||
final String[] basic = { "Forest", "Plains", "Mountain", "Island", "Swamp" };
|
final String[] basic = { "Forest", "Plains", "Mountain", "Island", "Swamp" };
|
||||||
|
|
||||||
@@ -2698,7 +2654,6 @@ public class CardFactoryUtil {
|
|||||||
return CardFactoryUtil.doXMath(n, m, source);
|
return CardFactoryUtil.doXMath(n, m, source);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* parseSVar TODO - flesh out javadoc for this method.
|
* parseSVar TODO - flesh out javadoc for this method.
|
||||||
*
|
*
|
||||||
@@ -4218,14 +4173,14 @@ public class CardFactoryUtil {
|
|||||||
|
|
||||||
CardFactoryUtil.copyCharacteristics(sim, c);
|
CardFactoryUtil.copyCharacteristics(sim, c);
|
||||||
if (sim.hasAlternateState()) {
|
if (sim.hasAlternateState()) {
|
||||||
String origState = sim.getCurState();
|
final String origState = sim.getCurState();
|
||||||
for(String state : sim.getStates()) {
|
for (final String state : sim.getStates()) {
|
||||||
c.addAlternateState(state);
|
c.addAlternateState(state);
|
||||||
c.setState(state);
|
c.setState(state);
|
||||||
sim.setState(state);
|
sim.setState(state);
|
||||||
CardFactoryUtil.copyCharacteristics(sim, c);
|
CardFactoryUtil.copyCharacteristics(sim, c);
|
||||||
}
|
}
|
||||||
|
|
||||||
sim.setState(origState);
|
sim.setState(origState);
|
||||||
c.setState(origState);
|
c.setState(origState);
|
||||||
}
|
}
|
||||||
@@ -4265,7 +4220,7 @@ public class CardFactoryUtil {
|
|||||||
to.setImageFilename(from.getImageFilename());
|
to.setImageFilename(from.getImageFilename());
|
||||||
to.setTriggers(from.getTriggers());
|
to.setTriggers(from.getTriggers());
|
||||||
to.setStaticAbilityStrings(from.getStaticAbilityStrings());
|
to.setStaticAbilityStrings(from.getStaticAbilityStrings());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -4720,8 +4675,8 @@ public class CardFactoryUtil {
|
|||||||
sbHaunter.append("Destination$ Graveyard | ValidCard$ Card.Self | ");
|
sbHaunter.append("Destination$ Graveyard | ValidCard$ Card.Self | ");
|
||||||
sbHaunter.append("Static$ True | Secondary$ True | TriggerDescription$ Blank");
|
sbHaunter.append("Static$ True | Secondary$ True | TriggerDescription$ Blank");
|
||||||
|
|
||||||
final Trigger haunterDies = forge.card.trigger.TriggerHandler.parseTrigger(
|
final Trigger haunterDies = forge.card.trigger.TriggerHandler
|
||||||
sbHaunter.toString(), card, true);
|
.parseTrigger(sbHaunter.toString(), card, true);
|
||||||
|
|
||||||
final Ability haunterDiesWork = new Ability(card, "0") {
|
final Ability haunterDiesWork = new Ability(card, "0") {
|
||||||
@Override
|
@Override
|
||||||
@@ -4796,8 +4751,7 @@ public class CardFactoryUtil {
|
|||||||
sbDies.append("ValidCard$ Creature.HauntedBy | Execute$ ").append(hauntSVarName);
|
sbDies.append("ValidCard$ Creature.HauntedBy | Execute$ ").append(hauntSVarName);
|
||||||
sbDies.append(" | TriggerDescription$ ").append(hauntDescription);
|
sbDies.append(" | TriggerDescription$ ").append(hauntDescription);
|
||||||
|
|
||||||
final Trigger hauntedDies = forge.card.trigger.TriggerHandler.parseTrigger(
|
final Trigger hauntedDies = forge.card.trigger.TriggerHandler.parseTrigger(sbDies.toString(), card, true);
|
||||||
sbDies.toString(), card, true);
|
|
||||||
|
|
||||||
// Third, create the trigger that runs when the haunting creature
|
// Third, create the trigger that runs when the haunting creature
|
||||||
// enters the battlefield
|
// enters the battlefield
|
||||||
@@ -4806,8 +4760,7 @@ public class CardFactoryUtil {
|
|||||||
sbETB.append(hauntSVarName).append(" | Secondary$ True | TriggerDescription$ ");
|
sbETB.append(hauntSVarName).append(" | Secondary$ True | TriggerDescription$ ");
|
||||||
sbETB.append(hauntDescription);
|
sbETB.append(hauntDescription);
|
||||||
|
|
||||||
final Trigger haunterETB = forge.card.trigger.TriggerHandler.parseTrigger(
|
final Trigger haunterETB = forge.card.trigger.TriggerHandler.parseTrigger(sbETB.toString(), card, true);
|
||||||
sbETB.toString(), card, true);
|
|
||||||
|
|
||||||
// Fourth, create a trigger that removes the haunting status if the
|
// Fourth, create a trigger that removes the haunting status if the
|
||||||
// haunter leaves the exile
|
// haunter leaves the exile
|
||||||
@@ -4816,8 +4769,8 @@ public class CardFactoryUtil {
|
|||||||
sbUnExiled.append("ValidCard$ Card.Self | Static$ True | Secondary$ True | ");
|
sbUnExiled.append("ValidCard$ Card.Self | Static$ True | Secondary$ True | ");
|
||||||
sbUnExiled.append("TriggerDescription$ Blank");
|
sbUnExiled.append("TriggerDescription$ Blank");
|
||||||
|
|
||||||
final Trigger haunterUnExiled = forge.card.trigger.TriggerHandler.parseTrigger(
|
final Trigger haunterUnExiled = forge.card.trigger.TriggerHandler.parseTrigger(sbUnExiled.toString(), card,
|
||||||
sbUnExiled.toString(), card, true);
|
true);
|
||||||
|
|
||||||
final Ability haunterUnExiledWork = new Ability(card, "0") {
|
final Ability haunterUnExiledWork = new Ability(card, "0") {
|
||||||
@Override
|
@Override
|
||||||
@@ -5112,11 +5065,11 @@ public class CardFactoryUtil {
|
|||||||
final String orgManaCost = card.getManaCost();
|
final String orgManaCost = card.getManaCost();
|
||||||
|
|
||||||
card.addSpellAbility(CardFactoryUtil.abilityMorphDown(card));
|
card.addSpellAbility(CardFactoryUtil.abilityMorphDown(card));
|
||||||
|
|
||||||
card.turnFaceDown();
|
card.turnFaceDown();
|
||||||
|
|
||||||
card.addSpellAbility(CardFactoryUtil.abilityMorphUp(card, cost, orgManaCost, attack, defense));
|
card.addSpellAbility(CardFactoryUtil.abilityMorphUp(card, cost, orgManaCost, attack, defense));
|
||||||
|
|
||||||
card.turnFaceUp();
|
card.turnFaceUp();
|
||||||
}
|
}
|
||||||
} // Morph
|
} // Morph
|
||||||
|
|||||||
@@ -271,8 +271,8 @@ public class CostMana extends CostPart {
|
|||||||
|
|
||||||
this.manaCost = InputPayManaCostUtil.activateManaAbility(sa, card, this.manaCost);
|
this.manaCost = InputPayManaCostUtil.activateManaAbility(sa, card, this.manaCost);
|
||||||
if (this.manaCost.isPaid()) {
|
if (this.manaCost.isPaid()) {
|
||||||
if (!colorsPaid.contains(this.manaCost.getColorsPaid())) {
|
if (!this.colorsPaid.contains(this.manaCost.getColorsPaid())) {
|
||||||
colorsPaid += this.manaCost.getColorsPaid();
|
this.colorsPaid += this.manaCost.getColorsPaid();
|
||||||
}
|
}
|
||||||
this.manaCost = new ManaCost(Integer.toString(numX));
|
this.manaCost = new ManaCost(Integer.toString(numX));
|
||||||
this.xPaid++;
|
this.xPaid++;
|
||||||
@@ -295,8 +295,8 @@ public class CostMana extends CostPart {
|
|||||||
this.stop();
|
this.stop();
|
||||||
payment.getCard().setXManaCostPaid(this.xPaid);
|
payment.getCard().setXManaCostPaid(this.xPaid);
|
||||||
payment.paidCost(costMana);
|
payment.paidCost(costMana);
|
||||||
payment.getCard().setColorsPaid(colorsPaid);
|
payment.getCard().setColorsPaid(this.colorsPaid);
|
||||||
payment.getCard().setSunburstValue(colorsPaid.length());
|
payment.getCard().setSunburstValue(this.colorsPaid.length());
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
@@ -393,16 +393,19 @@ public class CostMana extends CostPart {
|
|||||||
source.setXManaCostPaid(0);
|
source.setXManaCostPaid(0);
|
||||||
CostUtil.setInput(CostMana.inputPayXMana(sa, payment, costMana, costMana.getXMana()));
|
CostUtil.setInput(CostMana.inputPayXMana(sa, payment, costMana, costMana.getXMana()));
|
||||||
}
|
}
|
||||||
|
|
||||||
//If this is a spell with convoke, re-tap all creatures used for it.
|
// If this is a spell with convoke, re-tap all creatures used
|
||||||
//This is done to make sure Taps triggers go off at the right time
|
// for it.
|
||||||
//(i.e. AFTER cost payment, they are tapped previously as well so that
|
// This is done to make sure Taps triggers go off at the right
|
||||||
//any mana tapabilities can't be used in payment as well as being tapped for convoke)
|
// time
|
||||||
|
// (i.e. AFTER cost payment, they are tapped previously as well
|
||||||
if(sa.getTappedForConvoke() != null)
|
// so that
|
||||||
{
|
// any mana tapabilities can't be used in payment as well as
|
||||||
|
// being tapped for convoke)
|
||||||
|
|
||||||
|
if (sa.getTappedForConvoke() != null) {
|
||||||
AllZone.getTriggerHandler().suppressMode("Untaps");
|
AllZone.getTriggerHandler().suppressMode("Untaps");
|
||||||
for(Card c : sa.getTappedForConvoke()) {
|
for (final Card c : sa.getTappedForConvoke()) {
|
||||||
c.untap();
|
c.untap();
|
||||||
c.tap();
|
c.tap();
|
||||||
}
|
}
|
||||||
@@ -414,17 +417,17 @@ public class CostMana extends CostPart {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void selectButtonCancel() {
|
public void selectButtonCancel() {
|
||||||
//If we're paying for a spell with convoke, untap all creatures used for it.
|
// If we're paying for a spell with convoke, untap all creatures
|
||||||
if(sa.getTappedForConvoke() != null)
|
// used for it.
|
||||||
{
|
if (sa.getTappedForConvoke() != null) {
|
||||||
AllZone.getTriggerHandler().suppressMode("Untaps");
|
AllZone.getTriggerHandler().suppressMode("Untaps");
|
||||||
for(Card c : sa.getTappedForConvoke()) {
|
for (final Card c : sa.getTappedForConvoke()) {
|
||||||
c.untap();
|
c.untap();
|
||||||
}
|
}
|
||||||
AllZone.getTriggerHandler().clearSuppression("Untaps");
|
AllZone.getTriggerHandler().clearSuppression("Untaps");
|
||||||
sa.clearTappedForConvoke();
|
sa.clearTappedForConvoke();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.stop();
|
this.stop();
|
||||||
this.resetManaCost();
|
this.resetManaCost();
|
||||||
payment.cancelCost();
|
payment.cancelCost();
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import forge.AllZoneUtil;
|
|||||||
import forge.Card;
|
import forge.Card;
|
||||||
import forge.CardList;
|
import forge.CardList;
|
||||||
import forge.Constant.Zone;
|
import forge.Constant.Zone;
|
||||||
import forge.Player;
|
|
||||||
import forge.card.cost.Cost;
|
import forge.card.cost.Cost;
|
||||||
import forge.card.cost.CostPayment;
|
import forge.card.cost.CostPayment;
|
||||||
import forge.card.staticability.StaticAbility;
|
import forge.card.staticability.StaticAbility;
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ public abstract class SpellAbility {
|
|||||||
public void execute(final Object o) {
|
public void execute(final Object o) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private CardList tappedForConvoke = null;
|
private CardList tappedForConvoke = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -700,8 +700,7 @@ public abstract class SpellAbility {
|
|||||||
* Getter for the field <code>restrictions</code>.
|
* Getter for the field <code>restrictions</code>.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @return a {@link forge.card.spellability.SpellAbilityRestriction}
|
* @return a {@link forge.card.spellability.SpellAbilityRestriction} object.
|
||||||
* object.
|
|
||||||
*/
|
*/
|
||||||
public SpellAbilityRestriction getRestrictions() {
|
public SpellAbilityRestriction getRestrictions() {
|
||||||
return this.restrictions;
|
return this.restrictions;
|
||||||
@@ -1051,6 +1050,7 @@ public abstract class SpellAbility {
|
|||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* Extrinsic or Intrinsic:
|
* Extrinsic or Intrinsic:
|
||||||
|
*
|
||||||
* @param s
|
* @param s
|
||||||
* a {@link java.lang.String} object.
|
* a {@link java.lang.String} object.
|
||||||
*/
|
*/
|
||||||
@@ -1066,7 +1066,7 @@ public abstract class SpellAbility {
|
|||||||
* @return a {@link java.lang.String} object.
|
* @return a {@link java.lang.String} object.
|
||||||
*/
|
*/
|
||||||
public String getType() {
|
public String getType() {
|
||||||
// Extrinsic or Intrinsic:
|
// Extrinsic or Intrinsic:
|
||||||
return this.type;
|
return this.type;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1682,53 +1682,69 @@ public abstract class SpellAbility {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Gets the ability.
|
||||||
|
*
|
||||||
* @return the ability
|
* @return the ability
|
||||||
*/
|
*/
|
||||||
public static int getAbility() {
|
public static int getAbility() {
|
||||||
return ABILITY;
|
return SpellAbility.ABILITY;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Gets the spell.
|
||||||
|
*
|
||||||
* @return the spell
|
* @return the spell
|
||||||
*/
|
*/
|
||||||
public static int getSpell() {
|
public static int getSpell() {
|
||||||
return SPELL;
|
return SpellAbility.SPELL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Gets the chosen target.
|
||||||
|
*
|
||||||
* @return the chosenTarget
|
* @return the chosenTarget
|
||||||
*/
|
*/
|
||||||
public Target getChosenTarget() {
|
public Target getChosenTarget() {
|
||||||
return chosenTarget;
|
return this.chosenTarget;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Sets the chosen target.
|
||||||
|
*
|
||||||
* @param chosenTarget the chosenTarget to set
|
* @param chosenTarget the chosenTarget to set
|
||||||
*/
|
*/
|
||||||
public void setChosenTarget(Target chosenTarget) {
|
public void setChosenTarget(final Target chosenTarget) {
|
||||||
this.chosenTarget = chosenTarget; // TODO: Add 0 to parameter's name.
|
this.chosenTarget = chosenTarget; // TODO: Add 0 to parameter's name.
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addTappedForConvoke(Card c)
|
/**
|
||||||
{
|
* Adds the tapped for convoke.
|
||||||
if(tappedForConvoke == null)
|
*
|
||||||
{
|
* @param c the c
|
||||||
tappedForConvoke = new CardList();
|
*/
|
||||||
|
public void addTappedForConvoke(final Card c) {
|
||||||
|
if (this.tappedForConvoke == null) {
|
||||||
|
this.tappedForConvoke = new CardList();
|
||||||
}
|
}
|
||||||
|
|
||||||
tappedForConvoke.add(c);
|
this.tappedForConvoke.add(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
public CardList getTappedForConvoke()
|
/**
|
||||||
{
|
* Gets the tapped for convoke.
|
||||||
return tappedForConvoke;
|
*
|
||||||
|
* @return the tapped for convoke
|
||||||
|
*/
|
||||||
|
public CardList getTappedForConvoke() {
|
||||||
|
return this.tappedForConvoke;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clearTappedForConvoke()
|
/**
|
||||||
{
|
* Clear tapped for convoke.
|
||||||
if(tappedForConvoke != null)
|
*/
|
||||||
{
|
public void clearTappedForConvoke() {
|
||||||
tappedForConvoke.clear();
|
if (this.tappedForConvoke != null) {
|
||||||
|
this.tappedForConvoke.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -182,7 +182,7 @@ public class SpellAbilityRestriction extends SpellAbilityVariables {
|
|||||||
// Not a Spell, or on Battlefield, return false
|
// Not a Spell, or on Battlefield, return false
|
||||||
if (!sa.isSpell() || cardZone.is(Zone.Battlefield) || !this.getZone().equals(Zone.Hand)) {
|
if (!sa.isSpell() || cardZone.is(Zone.Battlefield) || !this.getZone().equals(Zone.Hand)) {
|
||||||
return false;
|
return false;
|
||||||
} else if (!c.hasStartOfKeyword("May be played")
|
} else if (!c.hasStartOfKeyword("May be played")
|
||||||
&& !(c.hasStartOfKeyword("Flashback") && cardZone.is(Zone.Graveyard))) {
|
&& !(c.hasStartOfKeyword("Flashback") && cardZone.is(Zone.Graveyard))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -613,10 +613,9 @@ public class Target {
|
|||||||
* <p>
|
* <p>
|
||||||
* hasCandidates.
|
* hasCandidates.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @param isTargeted
|
* @param sa the sa
|
||||||
* Check Valid Candidates and Targeting
|
* @param isTargeted Check Valid Candidates and Targeting
|
||||||
*
|
|
||||||
* @return a boolean.
|
* @return a boolean.
|
||||||
*/
|
*/
|
||||||
public final boolean hasCandidates(final SpellAbility sa, final boolean isTargeted) {
|
public final boolean hasCandidates(final SpellAbility sa, final boolean isTargeted) {
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ public class StaticAbility {
|
|||||||
private boolean temporarilySuppressed = false;
|
private boolean temporarilySuppressed = false;
|
||||||
|
|
||||||
/** The suppressed. */
|
/** The suppressed. */
|
||||||
private boolean suppressed = false;
|
private final boolean suppressed = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@@ -285,7 +285,7 @@ public class StaticAbility {
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Apply ability.
|
* Apply ability.
|
||||||
*
|
*
|
||||||
@@ -293,13 +293,11 @@ public class StaticAbility {
|
|||||||
* the mode
|
* the mode
|
||||||
* @param card
|
* @param card
|
||||||
* the card
|
* the card
|
||||||
* @param activator
|
* @param spellAbility
|
||||||
* the activator
|
|
||||||
* @param sa
|
|
||||||
* the ability
|
* the ability
|
||||||
* @return true, if successful
|
* @return true, if successful
|
||||||
*/
|
*/
|
||||||
public final boolean applyAbility(final String mode, final Card card, SpellAbility sa) {
|
public final boolean applyAbility(final String mode, final Card card, final SpellAbility spellAbility) {
|
||||||
|
|
||||||
// don't apply the ability if it hasn't got the right mode
|
// don't apply the ability if it hasn't got the right mode
|
||||||
if (!this.mapParams.get("Mode").equals(mode)) {
|
if (!this.mapParams.get("Mode").equals(mode)) {
|
||||||
@@ -311,11 +309,11 @@ public class StaticAbility {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (mode.equals("CantBeActivated")) {
|
if (mode.equals("CantBeActivated")) {
|
||||||
return StaticAbilityCantBeCast.applyCantBeActivatedAbility(this, card, sa);
|
return StaticAbilityCantBeCast.applyCantBeActivatedAbility(this, card, spellAbility);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mode.equals("CantTarget")) {
|
if (mode.equals("CantTarget")) {
|
||||||
return StaticAbilityCantTarget.applyCantTargetAbility(this, card, sa);
|
return StaticAbilityCantTarget.applyCantTargetAbility(this, card, spellAbility);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@@ -331,36 +329,36 @@ public class StaticAbility {
|
|||||||
|
|
||||||
Zone effectZone = Zone.Battlefield; // default
|
Zone effectZone = Zone.Battlefield; // default
|
||||||
|
|
||||||
if (mapParams.containsKey("EffectZone")) {
|
if (this.mapParams.containsKey("EffectZone")) {
|
||||||
effectZone = Zone.smartValueOf(this.mapParams.get("EffectZone"));
|
effectZone = Zone.smartValueOf(this.mapParams.get("EffectZone"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((effectZone != null) && (!hostCard.isInZone(effectZone) || hostCard.isPhasedOut())) {
|
if ((effectZone != null) && (!this.hostCard.isInZone(effectZone) || this.hostCard.isPhasedOut())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mapParams.containsKey("Threshold") && !controller.hasThreshold()) {
|
if (this.mapParams.containsKey("Threshold") && !controller.hasThreshold()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mapParams.containsKey("Hellbent") && !controller.hasHellbent()) {
|
if (this.mapParams.containsKey("Hellbent") && !controller.hasHellbent()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mapParams.containsKey("Metalcraft") && !controller.hasMetalcraft()) {
|
if (this.mapParams.containsKey("Metalcraft") && !controller.hasMetalcraft()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mapParams.containsKey("PlayerTurn") && !AllZone.getPhase().isPlayerTurn(controller)) {
|
if (this.mapParams.containsKey("PlayerTurn") && !AllZone.getPhase().isPlayerTurn(controller)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mapParams.containsKey("OpponentTurn") && !AllZone.getPhase().isPlayerTurn(controller.getOpponent())) {
|
if (this.mapParams.containsKey("OpponentTurn") && !AllZone.getPhase().isPlayerTurn(controller.getOpponent())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mapParams.containsKey("Phases")) {
|
if (this.mapParams.containsKey("Phases")) {
|
||||||
String phases = mapParams.get("Phases");
|
String phases = this.mapParams.get("Phases");
|
||||||
|
|
||||||
if (phases.contains("->")) {
|
if (phases.contains("->")) {
|
||||||
// If phases lists a Range, split and Build Activate String
|
// If phases lists a Range, split and Build Activate String
|
||||||
|
|||||||
@@ -46,20 +46,20 @@ public class StaticAbilityCantBeCast {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO Write javadoc for this method.
|
* Applies Cant Be Activated ability.
|
||||||
*
|
*
|
||||||
* @param stAb
|
* @param staticAbility
|
||||||
* a StaticAbility
|
* a StaticAbility
|
||||||
* @param card
|
* @param card
|
||||||
* the card
|
* the card
|
||||||
* @param activator
|
* @param spellAbility
|
||||||
* the activator
|
* a SpellAbility
|
||||||
* @return true, if successful
|
* @return true, if successful
|
||||||
*/
|
*/
|
||||||
public static boolean applyCantBeActivatedAbility(final StaticAbility stAb, final Card card, SpellAbility sa) {
|
public static boolean applyCantBeActivatedAbility(final StaticAbility staticAbility, final Card card, final SpellAbility spellAbility) {
|
||||||
final HashMap<String, String> params = stAb.getMapParams();
|
final HashMap<String, String> params = staticAbility.getMapParams();
|
||||||
final Card hostCard = stAb.getHostCard();
|
final Card hostCard = staticAbility.getHostCard();
|
||||||
final Player activator = sa.getActivatingPlayer();
|
final Player activator = spellAbility.getActivatingPlayer();
|
||||||
|
|
||||||
if (params.containsKey("ValidCard")
|
if (params.containsKey("ValidCard")
|
||||||
&& !card.isValid(params.get("ValidCard").split(","), hostCard.getController(), hostCard)) {
|
&& !card.isValid(params.get("ValidCard").split(","), hostCard.getController(), hostCard)) {
|
||||||
@@ -70,8 +70,8 @@ public class StaticAbilityCantBeCast {
|
|||||||
&& !activator.isValid(params.get("Activator"), hostCard.getController(), hostCard)) {
|
&& !activator.isValid(params.get("Activator"), hostCard.getController(), hostCard)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (params.containsKey("NonMana") && sa instanceof AbilityMana) {
|
if (params.containsKey("NonMana") && (spellAbility instanceof AbilityMana)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ import java.util.HashMap;
|
|||||||
|
|
||||||
import forge.Card;
|
import forge.Card;
|
||||||
import forge.Constant;
|
import forge.Constant;
|
||||||
import forge.Player;
|
|
||||||
import forge.Constant.Zone;
|
import forge.Constant.Zone;
|
||||||
|
import forge.Player;
|
||||||
import forge.card.spellability.SpellAbility;
|
import forge.card.spellability.SpellAbility;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -13,14 +13,22 @@ import forge.card.spellability.SpellAbility;
|
|||||||
*/
|
*/
|
||||||
public class StaticAbilityCantTarget {
|
public class StaticAbilityCantTarget {
|
||||||
|
|
||||||
public static boolean applyCantTargetAbility(final StaticAbility stAb, final Card card, SpellAbility sa) {
|
/**
|
||||||
final HashMap<String, String> params = stAb.getMapParams();
|
* Apply can't target ability.
|
||||||
final Card hostCard = stAb.getHostCard();
|
*
|
||||||
final Card source = sa.getSourceCard();
|
* @param staticAbility the static ability
|
||||||
final Player activator = sa.getActivatingPlayer();
|
* @param card the card
|
||||||
|
* @param spellAbility the spell Ability
|
||||||
|
* @return true, if successful
|
||||||
|
*/
|
||||||
|
public static boolean applyCantTargetAbility(final StaticAbility staticAbility, final Card card, final SpellAbility spellAbility) {
|
||||||
|
final HashMap<String, String> params = staticAbility.getMapParams();
|
||||||
|
final Card hostCard = staticAbility.getHostCard();
|
||||||
|
final Card source = spellAbility.getSourceCard();
|
||||||
|
final Player activator = spellAbility.getActivatingPlayer();
|
||||||
|
|
||||||
if (params.containsKey("AffectedZone")) {
|
if (params.containsKey("AffectedZone")) {
|
||||||
if(!card.isInZone(Zone.smartValueOf(params.get("AffectedZone")))) {
|
if (!card.isInZone(Zone.smartValueOf(params.get("AffectedZone")))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else { // default zone is battlefield
|
} else { // default zone is battlefield
|
||||||
@@ -28,8 +36,8 @@ public class StaticAbilityCantTarget {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (params.containsKey("Spell") && !sa.isSpell()) {
|
if (params.containsKey("Spell") && !spellAbility.isSpell()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -37,7 +45,7 @@ public class StaticAbilityCantTarget {
|
|||||||
&& !card.isValid(params.get("ValidCard").split(","), hostCard.getController(), hostCard)) {
|
&& !card.isValid(params.get("ValidCard").split(","), hostCard.getController(), hostCard)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (params.containsKey("ValidSource")
|
if (params.containsKey("ValidSource")
|
||||||
&& !source.isValid(params.get("ValidSource").split(","), hostCard.getController(), hostCard)) {
|
&& !source.isValid(params.get("ValidSource").split(","), hostCard.getController(), hostCard)) {
|
||||||
return false;
|
return false;
|
||||||
@@ -48,7 +56,6 @@ public class StaticAbilityCantTarget {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ public class TriggerHandler {
|
|||||||
public final void registerDelayedTrigger(final Trigger trig) {
|
public final void registerDelayedTrigger(final Trigger trig) {
|
||||||
this.delayedTriggers.add(trig);
|
this.delayedTriggers.add(trig);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* clearDelayedTrigger.
|
* clearDelayedTrigger.
|
||||||
|
|||||||
@@ -63,9 +63,9 @@ public class Generate2ColorDeck {
|
|||||||
this.notColors.add("black");
|
this.notColors.add("black");
|
||||||
this.notColors.add("red");
|
this.notColors.add("red");
|
||||||
this.notColors.add("green");
|
this.notColors.add("green");
|
||||||
|
|
||||||
if(Singletons.getModel().getPreferences().isDeckGenSingletons()) {
|
if (Singletons.getModel().getPreferences().isDeckGenSingletons()) {
|
||||||
maxDuplicates = 1;
|
this.maxDuplicates = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (clr1.equals("AI")) {
|
if (clr1.equals("AI")) {
|
||||||
@@ -128,7 +128,7 @@ public class Generate2ColorDeck {
|
|||||||
|
|
||||||
// reduce to cards that match the colors
|
// reduce to cards that match the colors
|
||||||
CardList cl1 = allCards.getColor(this.color1);
|
CardList cl1 = allCards.getColor(this.color1);
|
||||||
if(!Singletons.getModel().getPreferences().isDeckGenRmvArtifacts()) {
|
if (!Singletons.getModel().getPreferences().isDeckGenRmvArtifacts()) {
|
||||||
cl1.addAll(allCards.getColor(Constant.Color.COLORLESS));
|
cl1.addAll(allCards.getColor(Constant.Color.COLORLESS));
|
||||||
}
|
}
|
||||||
CardList cl2 = allCards.getColor(this.color2);
|
CardList cl2 = allCards.getColor(this.color2);
|
||||||
@@ -226,7 +226,7 @@ public class Generate2ColorDeck {
|
|||||||
Card c = cr12.get(this.r.nextInt(cr12.size()));
|
Card c = cr12.get(this.r.nextInt(cr12.size()));
|
||||||
|
|
||||||
lc = 0;
|
lc = 0;
|
||||||
while ((this.cardCounts.get(c.getName()) > maxDuplicates - 1) || (lc > 100)) {
|
while ((this.cardCounts.get(c.getName()) > (this.maxDuplicates - 1)) || (lc > 100)) {
|
||||||
c = cr12.get(this.r.nextInt(cr12.size()));
|
c = cr12.get(this.r.nextInt(cr12.size()));
|
||||||
lc++;
|
lc++;
|
||||||
}
|
}
|
||||||
@@ -244,7 +244,7 @@ public class Generate2ColorDeck {
|
|||||||
Card c = sp12.get(this.r.nextInt(sp12.size()));
|
Card c = sp12.get(this.r.nextInt(sp12.size()));
|
||||||
|
|
||||||
lc = 0;
|
lc = 0;
|
||||||
while ((this.cardCounts.get(c.getName()) > maxDuplicates - 1) || (lc > 100)) {
|
while ((this.cardCounts.get(c.getName()) > (this.maxDuplicates - 1)) || (lc > 100)) {
|
||||||
c = sp12.get(this.r.nextInt(sp12.size()));
|
c = sp12.get(this.r.nextInt(sp12.size()));
|
||||||
lc++;
|
lc++;
|
||||||
}
|
}
|
||||||
@@ -292,7 +292,7 @@ public class Generate2ColorDeck {
|
|||||||
numLands -= nDLands;
|
numLands -= nDLands;
|
||||||
|
|
||||||
if (numLands > 0) {
|
if (numLands > 0) {
|
||||||
// attempt to optimize basic land counts according to
|
// attempt to optimize basic land counts according to
|
||||||
// color representation
|
// color representation
|
||||||
final CCnt[] clrCnts = { new CCnt("Plains", 0), new CCnt("Island", 0), new CCnt("Swamp", 0),
|
final CCnt[] clrCnts = { new CCnt("Plains", 0), new CCnt("Island", 0), new CCnt("Swamp", 0),
|
||||||
new CCnt("Mountain", 0), new CCnt("Forest", 0) };
|
new CCnt("Mountain", 0), new CCnt("Forest", 0) };
|
||||||
@@ -393,7 +393,7 @@ public class Generate2ColorDeck {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private class CCnt {
|
private class CCnt {
|
||||||
private String color;
|
private final String color;
|
||||||
private int count;
|
private int count;
|
||||||
|
|
||||||
public CCnt(final String clr, final int cnt) {
|
public CCnt(final String clr, final int cnt) {
|
||||||
|
|||||||
@@ -66,9 +66,9 @@ public class Generate3ColorDeck {
|
|||||||
this.notColors.add("black");
|
this.notColors.add("black");
|
||||||
this.notColors.add("red");
|
this.notColors.add("red");
|
||||||
this.notColors.add("green");
|
this.notColors.add("green");
|
||||||
|
|
||||||
if(Singletons.getModel().getPreferences().isDeckGenSingletons()) {
|
if (Singletons.getModel().getPreferences().isDeckGenSingletons()) {
|
||||||
maxDuplicates = 1;
|
this.maxDuplicates = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (clr1.equals("AI")) {
|
if (clr1.equals("AI")) {
|
||||||
@@ -140,7 +140,7 @@ public class Generate3ColorDeck {
|
|||||||
|
|
||||||
// reduce to cards that match the colors
|
// reduce to cards that match the colors
|
||||||
CardList cl1 = allCards.getColor(this.color1);
|
CardList cl1 = allCards.getColor(this.color1);
|
||||||
if(!Singletons.getModel().getPreferences().isDeckGenRmvArtifacts()) {
|
if (!Singletons.getModel().getPreferences().isDeckGenRmvArtifacts()) {
|
||||||
cl1.addAll(allCards.getColor(Constant.Color.COLORLESS));
|
cl1.addAll(allCards.getColor(Constant.Color.COLORLESS));
|
||||||
}
|
}
|
||||||
CardList cl2 = allCards.getColor(this.color2);
|
CardList cl2 = allCards.getColor(this.color2);
|
||||||
@@ -252,7 +252,7 @@ public class Generate3ColorDeck {
|
|||||||
Card c = cr123.get(this.r.nextInt(cr123.size()));
|
Card c = cr123.get(this.r.nextInt(cr123.size()));
|
||||||
|
|
||||||
lc = 0;
|
lc = 0;
|
||||||
while ((this.cardCounts.get(c.getName()) > maxDuplicates - 1) || (lc > 100)) {
|
while ((this.cardCounts.get(c.getName()) > (this.maxDuplicates - 1)) || (lc > 100)) {
|
||||||
c = cr123.get(this.r.nextInt(cr123.size()));
|
c = cr123.get(this.r.nextInt(cr123.size()));
|
||||||
lc++;
|
lc++;
|
||||||
}
|
}
|
||||||
@@ -270,7 +270,7 @@ public class Generate3ColorDeck {
|
|||||||
Card c = sp123.get(this.r.nextInt(sp123.size()));
|
Card c = sp123.get(this.r.nextInt(sp123.size()));
|
||||||
|
|
||||||
lc = 0;
|
lc = 0;
|
||||||
while ((this.cardCounts.get(c.getName()) > maxDuplicates - 1) || (lc > 100)) {
|
while ((this.cardCounts.get(c.getName()) > (this.maxDuplicates - 1)) || (lc > 100)) {
|
||||||
c = sp123.get(this.r.nextInt(sp123.size()));
|
c = sp123.get(this.r.nextInt(sp123.size()));
|
||||||
lc++;
|
lc++;
|
||||||
}
|
}
|
||||||
@@ -318,7 +318,7 @@ public class Generate3ColorDeck {
|
|||||||
numLands -= ndLands;
|
numLands -= ndLands;
|
||||||
|
|
||||||
if (numLands > 0) {
|
if (numLands > 0) {
|
||||||
// attempt to optimize basic land counts according to
|
// attempt to optimize basic land counts according to
|
||||||
// color representation
|
// color representation
|
||||||
final CCnt[] clrCnts = { new CCnt("Plains", 0), new CCnt("Island", 0), new CCnt("Swamp", 0),
|
final CCnt[] clrCnts = { new CCnt("Plains", 0), new CCnt("Island", 0), new CCnt("Swamp", 0),
|
||||||
new CCnt("Mountain", 0), new CCnt("Forest", 0) };
|
new CCnt("Mountain", 0), new CCnt("Forest", 0) };
|
||||||
@@ -420,7 +420,7 @@ public class Generate3ColorDeck {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private class CCnt {
|
private class CCnt {
|
||||||
private String color;
|
private final String color;
|
||||||
private int count;
|
private int count;
|
||||||
|
|
||||||
public CCnt(final String clr, final int cnt) {
|
public CCnt(final String clr, final int cnt) {
|
||||||
|
|||||||
@@ -92,9 +92,9 @@ public class Generate5ColorDeck {
|
|||||||
this.notColors.remove(this.color3);
|
this.notColors.remove(this.color3);
|
||||||
this.notColors.remove(this.color4);
|
this.notColors.remove(this.color4);
|
||||||
this.notColors.remove(this.color5);
|
this.notColors.remove(this.color5);
|
||||||
|
|
||||||
if(Singletons.getModel().getPreferences().isDeckGenSingletons()) {
|
if (Singletons.getModel().getPreferences().isDeckGenSingletons()) {
|
||||||
maxDuplicates = 1;
|
this.maxDuplicates = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.dl = GenerateDeckUtil.getDualLandList("WUBRG");
|
this.dl = GenerateDeckUtil.getDualLandList("WUBRG");
|
||||||
@@ -138,7 +138,7 @@ public class Generate5ColorDeck {
|
|||||||
|
|
||||||
// reduce to cards that match the colors
|
// reduce to cards that match the colors
|
||||||
CardList cL1 = allCards.getColor(this.color1);
|
CardList cL1 = allCards.getColor(this.color1);
|
||||||
if(!Singletons.getModel().getPreferences().isDeckGenRmvArtifacts()) {
|
if (!Singletons.getModel().getPreferences().isDeckGenRmvArtifacts()) {
|
||||||
cL1.addAll(allCards.getColor(Constant.Color.COLORLESS));
|
cL1.addAll(allCards.getColor(Constant.Color.COLORLESS));
|
||||||
}
|
}
|
||||||
CardList cL2 = allCards.getColor(this.color2);
|
CardList cL2 = allCards.getColor(this.color2);
|
||||||
@@ -278,7 +278,7 @@ public class Generate5ColorDeck {
|
|||||||
Card c = cr12345.get(this.r.nextInt(cr12345.size()));
|
Card c = cr12345.get(this.r.nextInt(cr12345.size()));
|
||||||
|
|
||||||
lc = 0;
|
lc = 0;
|
||||||
while ((this.cardCounts.get(c.getName()) > maxDuplicates - 1) || (lc > 100)) {
|
while ((this.cardCounts.get(c.getName()) > (this.maxDuplicates - 1)) || (lc > 100)) {
|
||||||
c = cr12345.get(this.r.nextInt(cr12345.size()));
|
c = cr12345.get(this.r.nextInt(cr12345.size()));
|
||||||
lc++;
|
lc++;
|
||||||
}
|
}
|
||||||
@@ -296,7 +296,7 @@ public class Generate5ColorDeck {
|
|||||||
Card c = sp12345.get(this.r.nextInt(sp12345.size()));
|
Card c = sp12345.get(this.r.nextInt(sp12345.size()));
|
||||||
|
|
||||||
lc = 0;
|
lc = 0;
|
||||||
while ((this.cardCounts.get(c.getName()) > maxDuplicates - 1) || (lc > 100)) {
|
while ((this.cardCounts.get(c.getName()) > (this.maxDuplicates - 1)) || (lc > 100)) {
|
||||||
c = sp12345.get(this.r.nextInt(sp12345.size()));
|
c = sp12345.get(this.r.nextInt(sp12345.size()));
|
||||||
lc++;
|
lc++;
|
||||||
}
|
}
|
||||||
@@ -344,7 +344,7 @@ public class Generate5ColorDeck {
|
|||||||
numLands -= nDLands;
|
numLands -= nDLands;
|
||||||
|
|
||||||
if (numLands > 0) {
|
if (numLands > 0) {
|
||||||
// attempt to optimize basic land counts according to
|
// attempt to optimize basic land counts according to
|
||||||
// color representation
|
// color representation
|
||||||
final CCnt[] clrCnts = { new CCnt("Plains", 0), new CCnt("Island", 0), new CCnt("Swamp", 0),
|
final CCnt[] clrCnts = { new CCnt("Plains", 0), new CCnt("Island", 0), new CCnt("Swamp", 0),
|
||||||
new CCnt("Mountain", 0), new CCnt("Forest", 0) };
|
new CCnt("Mountain", 0), new CCnt("Forest", 0) };
|
||||||
|
|||||||
@@ -169,7 +169,7 @@ public class GenerateThemeDeck {
|
|||||||
|
|
||||||
int lc = 0;
|
int lc = 0;
|
||||||
while ((cardCounts.get(s) >= g.maxCnt) || (lc > size)) {
|
while ((cardCounts.get(s) >= g.maxCnt) || (lc > size)) {
|
||||||
// looping
|
// looping
|
||||||
// forever
|
// forever
|
||||||
s = g.cardnames.get(r.nextInt(cnSize));
|
s = g.cardnames.get(r.nextInt(cnSize));
|
||||||
lc++;
|
lc++;
|
||||||
@@ -199,7 +199,7 @@ public class GenerateThemeDeck {
|
|||||||
tmpDeck += "numBLands:" + numBLands + "\n";
|
tmpDeck += "numBLands:" + numBLands + "\n";
|
||||||
|
|
||||||
if (numBLands > 0) {
|
if (numBLands > 0) {
|
||||||
// attempt to optimize basic land counts according to
|
// attempt to optimize basic land counts according to
|
||||||
// color representation
|
// color representation
|
||||||
final CCnt[] clrCnts = { new CCnt("Plains", 0), new CCnt("Island", 0), new CCnt("Swamp", 0),
|
final CCnt[] clrCnts = { new CCnt("Plains", 0), new CCnt("Island", 0), new CCnt("Swamp", 0),
|
||||||
new CCnt("Mountain", 0), new CCnt("Forest", 0) };
|
new CCnt("Mountain", 0), new CCnt("Forest", 0) };
|
||||||
@@ -317,7 +317,7 @@ public class GenerateThemeDeck {
|
|||||||
class CCnt {
|
class CCnt {
|
||||||
|
|
||||||
/** The Color. */
|
/** The Color. */
|
||||||
private String color;
|
private final String color;
|
||||||
|
|
||||||
/** The Count. */
|
/** The Count. */
|
||||||
private int count;
|
private int count;
|
||||||
@@ -344,7 +344,7 @@ public class GenerateThemeDeck {
|
|||||||
class Grp {
|
class Grp {
|
||||||
|
|
||||||
/** The Cardnames. */
|
/** The Cardnames. */
|
||||||
private ArrayList<String> cardnames = new ArrayList<String>();
|
private final ArrayList<String> cardnames = new ArrayList<String>();
|
||||||
|
|
||||||
/** The Max cnt. */
|
/** The Max cnt. */
|
||||||
private int maxCnt;
|
private int maxCnt;
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package forge.gui.deckeditor;
|
|||||||
|
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import javax.swing.JButton;
|
import javax.swing.JButton;
|
||||||
import javax.swing.JFileChooser;
|
import javax.swing.JFileChooser;
|
||||||
@@ -38,13 +37,13 @@ public class CardPanelHeavy extends CardPanelBase {
|
|||||||
|
|
||||||
// Controls to show card details
|
// Controls to show card details
|
||||||
/** The detail. */
|
/** The detail. */
|
||||||
private CardDetailPanel detail = new CardDetailPanel(null);
|
private final CardDetailPanel detail = new CardDetailPanel(null);
|
||||||
|
|
||||||
/** The picture. */
|
/** The picture. */
|
||||||
private CardPanel picture = new CardPanel(null);
|
private final CardPanel picture = new CardPanel(null);
|
||||||
|
|
||||||
/** The picture view panel. */
|
/** The picture view panel. */
|
||||||
private ViewPanel pictureViewPanel = new ViewPanel();
|
private final ViewPanel pictureViewPanel = new ViewPanel();
|
||||||
|
|
||||||
// fake card to allow picture changes
|
// fake card to allow picture changes
|
||||||
/** The c card hq. */
|
/** The c card hq. */
|
||||||
@@ -149,14 +148,13 @@ public class CardPanelHeavy extends CardPanelBase {
|
|||||||
*/
|
*/
|
||||||
final void changeStateButtonActionPerformed(final ActionEvent e) {
|
final void changeStateButtonActionPerformed(final ActionEvent e) {
|
||||||
final Card cur = this.picture.getCard();
|
final Card cur = this.picture.getCard();
|
||||||
if(cur.isInAlternateState()) {
|
if (cur.isInAlternateState()) {
|
||||||
cur.setState("Original");
|
cur.setState("Original");
|
||||||
}
|
} else {
|
||||||
else {
|
if (cur.isFlip()) {
|
||||||
if(cur.isFlip()) {
|
|
||||||
cur.setState("Flipped");
|
cur.setState("Flipped");
|
||||||
}
|
}
|
||||||
if(cur.isDoubleFaced()) {
|
if (cur.isDoubleFaced()) {
|
||||||
cur.setState("Transformed");
|
cur.setState("Transformed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -165,35 +163,6 @@ public class CardPanelHeavy extends CardPanelBase {
|
|||||||
this.detail.setCard(cur);
|
this.detail.setCard(cur);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* changePictureButton_actionPerformed. Removed Oct 25 2011 - Hellfish
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @param e
|
|
||||||
* a {@link java.awt.event.ActionEvent} object.
|
|
||||||
*/
|
|
||||||
private void changePictureButtonActionPerformed(final ActionEvent e) {
|
|
||||||
if (this.cCardHQ != null) {
|
|
||||||
final File file = this.getImportFilename();
|
|
||||||
if (file != null) {
|
|
||||||
final String fileName = GuiDisplayUtil.cleanString(this.cCardHQ.getName()) + ".jpg";
|
|
||||||
final File base = ForgeProps.getFile(NewConstants.IMAGE_BASE);
|
|
||||||
final File f = new File(base, fileName);
|
|
||||||
f.delete();
|
|
||||||
|
|
||||||
try {
|
|
||||||
org.apache.commons.io.FileUtils.copyFile(file, f);
|
|
||||||
} catch (final IOException e1) {
|
|
||||||
// TODO Auto-generated catch block ignores the exception,
|
|
||||||
// but sends it to System.err and probably forge.log.
|
|
||||||
e1.printStackTrace();
|
|
||||||
}
|
|
||||||
this.setCard(this.cCardHQ);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* getImportFilename.
|
* getImportFilename.
|
||||||
@@ -220,7 +189,7 @@ public class CardPanelHeavy extends CardPanelBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** The dck filter. */
|
/** The dck filter. */
|
||||||
private FileFilter dckFilter = new FileFilter() {
|
private final FileFilter dckFilter = new FileFilter() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean accept(final File f) {
|
public boolean accept(final File f) {
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ public class CardPanelLite extends CardPanelBase {
|
|||||||
|
|
||||||
// Controls to show card details
|
// Controls to show card details
|
||||||
/** The detail. */
|
/** The detail. */
|
||||||
private CardDetailPanel detail = new CardDetailPanel(null);
|
private final CardDetailPanel detail = new CardDetailPanel(null);
|
||||||
private final CardPicturePanel picture = new CardPicturePanel(null);
|
private final CardPicturePanel picture = new CardPicturePanel(null);
|
||||||
private final JButton bChangeState = new JButton();
|
private final JButton bChangeState = new JButton();
|
||||||
|
|
||||||
@@ -110,12 +110,10 @@ public class CardPanelLite extends CardPanelBase {
|
|||||||
private void bChangeStateActionPerformed(final ActionEvent e) {
|
private void bChangeStateActionPerformed(final ActionEvent e) {
|
||||||
final Card cur = this.detail.getCard();
|
final Card cur = this.detail.getCard();
|
||||||
if (cur != null) {
|
if (cur != null) {
|
||||||
if(cur.isDoubleFaced()) {
|
if (cur.isDoubleFaced()) {
|
||||||
if(cur.getCurState().equals("Transformed"))
|
if (cur.getCurState().equals("Transformed")) {
|
||||||
{
|
|
||||||
cur.setState("Original");
|
cur.setState("Original");
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
cur.setState("Transformed");
|
cur.setState("Transformed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -282,8 +282,8 @@ public final class DeckEditorCommon extends DeckEditorBase {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected Predicate<InventoryItem> buildFilter() {
|
protected Predicate<InventoryItem> buildFilter() {
|
||||||
final Predicate<CardPrinted> cardFilter =
|
final Predicate<CardPrinted> cardFilter = Predicate.and(this.getFilterBoxes().buildFilter(),
|
||||||
Predicate.and(this.getFilterBoxes().buildFilter(), this.filterNameTypeSet.buildFilter());
|
this.filterNameTypeSet.buildFilter());
|
||||||
return Predicate.instanceOf(cardFilter, CardPrinted.class);
|
return Predicate.instanceOf(cardFilter, CardPrinted.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -400,17 +400,20 @@ public final class DeckEditorCommon extends DeckEditorBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Gets the custom menu.
|
||||||
|
*
|
||||||
* @return the customMenu
|
* @return the customMenu
|
||||||
*/
|
*/
|
||||||
public DeckEditorCommonMenu getCustomMenu() {
|
public DeckEditorCommonMenu getCustomMenu() {
|
||||||
return customMenu;
|
return this.customMenu;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param customMenu
|
* Sets the custom menu.
|
||||||
* the customMenu to set
|
*
|
||||||
|
* @param customMenu the customMenu to set
|
||||||
*/
|
*/
|
||||||
public void setCustomMenu(DeckEditorCommonMenu customMenu) {
|
public void setCustomMenu(final DeckEditorCommonMenu customMenu) {
|
||||||
this.customMenu = customMenu; // TODO: Add 0 to parameter's name.
|
this.customMenu = customMenu; // TODO: Add 0 to parameter's name.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -55,12 +55,12 @@ public final class DeckEditorShop extends DeckEditorBase {
|
|||||||
private double multiplier;
|
private double multiplier;
|
||||||
|
|
||||||
private final QuestData questData;
|
private final QuestData questData;
|
||||||
|
|
||||||
// get pricelist:
|
// get pricelist:
|
||||||
private final ReadPriceList r = new ReadPriceList();
|
private final ReadPriceList r = new ReadPriceList();
|
||||||
private final Map<String, Integer> mapPrices = this.r.getPriceList();
|
private final Map<String, Integer> mapPrices = this.r.getPriceList();
|
||||||
private Map<CardPrinted, Integer> decksUsingMyCards;
|
private Map<CardPrinted, Integer> decksUsingMyCards;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show.
|
* Show.
|
||||||
*
|
*
|
||||||
@@ -77,7 +77,7 @@ public final class DeckEditorShop extends DeckEditorBase {
|
|||||||
exitCommand.execute();
|
exitCommand.execute();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// do not change this!!!!
|
// do not change this!!!!
|
||||||
this.addWindowListener(new WindowAdapter() {
|
this.addWindowListener(new WindowAdapter() {
|
||||||
@Override
|
@Override
|
||||||
@@ -98,7 +98,7 @@ public final class DeckEditorShop extends DeckEditorBase {
|
|||||||
forSale = this.questData.getCards().getShopList();
|
forSale = this.questData.getCards().getShopList();
|
||||||
}
|
}
|
||||||
final ItemPoolView<InventoryItem> owned = this.questData.getCards().getCardpool().getView();
|
final ItemPoolView<InventoryItem> owned = this.questData.getCards().getCardpool().getView();
|
||||||
//newCardsList = questData.getCards().getNewCards();
|
// newCardsList = questData.getCards().getNewCards();
|
||||||
|
|
||||||
this.setItems(forSale, owned, GameType.Quest);
|
this.setItems(forSale, owned, GameType.Quest);
|
||||||
|
|
||||||
@@ -131,7 +131,7 @@ public final class DeckEditorShop extends DeckEditorBase {
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* setup.
|
* setup.
|
||||||
@@ -156,7 +156,7 @@ public final class DeckEditorShop extends DeckEditorBase {
|
|||||||
columns.add(new TableColumnInfo<InventoryItem>("Set", 35, PresetColumns.FN_SET_COMPARE,
|
columns.add(new TableColumnInfo<InventoryItem>("Set", 35, PresetColumns.FN_SET_COMPARE,
|
||||||
PresetColumns.FN_SET_GET));
|
PresetColumns.FN_SET_GET));
|
||||||
columns.get(2).setCellRenderer(new ManaCostRenderer());
|
columns.get(2).setCellRenderer(new ManaCostRenderer());
|
||||||
|
|
||||||
final List<TableColumnInfo<InventoryItem>> columnsBelow = new ArrayList<TableColumnInfo<InventoryItem>>(columns);
|
final List<TableColumnInfo<InventoryItem>> columnsBelow = new ArrayList<TableColumnInfo<InventoryItem>>(columns);
|
||||||
columns.add(new TableColumnInfo<InventoryItem>("Price", 36, this.fnPriceCompare, this.fnPriceGet));
|
columns.add(new TableColumnInfo<InventoryItem>("Price", 36, this.fnPriceCompare, this.fnPriceGet));
|
||||||
this.getTopTableWithCards().setup(columns, this.getCardView());
|
this.getTopTableWithCards().setup(columns, this.getCardView());
|
||||||
@@ -212,7 +212,7 @@ public final class DeckEditorShop extends DeckEditorBase {
|
|||||||
// removeButton.setIcon(upIcon);
|
// removeButton.setIcon(upIcon);
|
||||||
if (!Singletons.getModel().getPreferences().isLafFonts()) {
|
if (!Singletons.getModel().getPreferences().isLafFonts()) {
|
||||||
this.sellButton.setFont(new java.awt.Font("Dialog", 0, 13));
|
this.sellButton.setFont(new java.awt.Font("Dialog", 0, 13));
|
||||||
}
|
}
|
||||||
this.sellButton.setText("Sell Card");
|
this.sellButton.setText("Sell Card");
|
||||||
this.sellButton.addActionListener(new java.awt.event.ActionListener() {
|
this.sellButton.addActionListener(new java.awt.event.ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
@@ -250,7 +250,7 @@ public final class DeckEditorShop extends DeckEditorBase {
|
|||||||
}
|
}
|
||||||
this.jLabel1.setText("Click on the column name (like name or color) to sort the cards");
|
this.jLabel1.setText("Click on the column name (like name or color) to sort the cards");
|
||||||
this.jLabel1.setBounds(new Rectangle(20, 1, 400, 19));
|
this.jLabel1.setBounds(new Rectangle(20, 1, 400, 19));
|
||||||
|
|
||||||
this.getContentPane().add(this.getCardView(), null);
|
this.getContentPane().add(this.getCardView(), null);
|
||||||
this.getContentPane().add(this.getTopTableWithCards().getTableDecorated(), null);
|
this.getContentPane().add(this.getTopTableWithCards().getTableDecorated(), null);
|
||||||
this.getContentPane().add(this.getBottomTableWithCards().getTableDecorated(), null);
|
this.getContentPane().add(this.getBottomTableWithCards().getTableDecorated(), null);
|
||||||
@@ -265,7 +265,7 @@ public final class DeckEditorShop extends DeckEditorBase {
|
|||||||
private Integer getCardValue(final InventoryItem card) {
|
private Integer getCardValue(final InventoryItem card) {
|
||||||
if (this.mapPrices.containsKey(card.getName())) {
|
if (this.mapPrices.containsKey(card.getName())) {
|
||||||
return this.mapPrices.get(card.getName());
|
return this.mapPrices.get(card.getName());
|
||||||
} else if (card instanceof CardPrinted) {
|
} else if (card instanceof CardPrinted) {
|
||||||
switch (((CardPrinted) card).getRarity()) {
|
switch (((CardPrinted) card).getRarity()) {
|
||||||
case BasicLand:
|
case BasicLand:
|
||||||
return Integer.valueOf(4);
|
return Integer.valueOf(4);
|
||||||
@@ -366,20 +366,20 @@ public final class DeckEditorShop extends DeckEditorBase {
|
|||||||
return (int) (DeckEditorShop.this.multiplier * DeckEditorShop.this.getCardValue(from.getKey()));
|
return (int) (DeckEditorShop.this.multiplier * DeckEditorShop.this.getCardValue(from.getKey()));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@SuppressWarnings("rawtypes")
|
@SuppressWarnings("rawtypes")
|
||||||
private final Lambda1<Comparable, Entry<InventoryItem, Integer>> fnDeckCompare = new Lambda1<Comparable, Entry<InventoryItem, Integer>>() {
|
private final Lambda1<Comparable, Entry<InventoryItem, Integer>> fnDeckCompare = new Lambda1<Comparable, Entry<InventoryItem, Integer>>() {
|
||||||
@Override
|
@Override
|
||||||
public Comparable apply(final Entry<InventoryItem, Integer> from) {
|
public Comparable apply(final Entry<InventoryItem, Integer> from) {
|
||||||
final Integer iValue = DeckEditorShop.this.decksUsingMyCards.get(from.getKey());
|
final Integer iValue = DeckEditorShop.this.decksUsingMyCards.get(from.getKey());
|
||||||
return iValue == null ? Integer.valueOf(0) : iValue;
|
return iValue == null ? Integer.valueOf(0) : iValue;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
private final Lambda1<Object, Entry<InventoryItem, Integer>> fnDeckGet = new Lambda1<Object, Entry<InventoryItem, Integer>>() {
|
private final Lambda1<Object, Entry<InventoryItem, Integer>> fnDeckGet = new Lambda1<Object, Entry<InventoryItem, Integer>>() {
|
||||||
@Override
|
@Override
|
||||||
public Object apply(final Entry<InventoryItem, Integer> from) {
|
public Object apply(final Entry<InventoryItem, Integer> from) {
|
||||||
final Integer iValue = DeckEditorShop.this.decksUsingMyCards.get(from.getKey());
|
final Integer iValue = DeckEditorShop.this.decksUsingMyCards.get(from.getKey());
|
||||||
return iValue == null ? "" : iValue.toString();
|
return iValue == null ? "" : iValue.toString();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -76,12 +76,12 @@ public class InputPayManaCost extends Input {
|
|||||||
* <p>
|
* <p>
|
||||||
* Constructor for Input_PayManaCost.
|
* Constructor for Input_PayManaCost.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @param sa
|
* @param sa
|
||||||
* a {@link forge.card.spellability.SpellAbility} object.
|
* a {@link forge.card.spellability.SpellAbility} object.
|
||||||
*/
|
*/
|
||||||
public InputPayManaCost(final SpellAbility sa) {
|
public InputPayManaCost(final SpellAbility sa) {
|
||||||
this(sa,new ManaCost(sa.getManaCost()));
|
this(sa, new ManaCost(sa.getManaCost()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -91,7 +91,7 @@ public class InputPayManaCost extends Input {
|
|||||||
*
|
*
|
||||||
* @param sa
|
* @param sa
|
||||||
* a {@link forge.card.spellability.SpellAbility} object.
|
* a {@link forge.card.spellability.SpellAbility} object.
|
||||||
*
|
*
|
||||||
* @param manaCostToPay
|
* @param manaCostToPay
|
||||||
* a {@link forge.card.mana.ManaCost} object.
|
* a {@link forge.card.mana.ManaCost} object.
|
||||||
*/
|
*/
|
||||||
@@ -110,7 +110,9 @@ public class InputPayManaCost extends Input {
|
|||||||
AllZone.getStack().add(this.spell);
|
AllZone.getStack().add(this.spell);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.manaCost = manaCostToPay;//AllZone.getGameAction().getSpellCostChange(sa, new ManaCost(this.originalManaCost));
|
this.manaCost = manaCostToPay; // AllZone.getGameAction().getSpellCostChange(sa,
|
||||||
|
// new
|
||||||
|
// ManaCost(this.originalManaCost));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.manaCost = new ManaCost(sa.getManaCost());
|
this.manaCost = new ManaCost(sa.getManaCost());
|
||||||
@@ -211,21 +213,23 @@ public class InputPayManaCost extends Input {
|
|||||||
}
|
}
|
||||||
AllZone.getInputControl().resetInput();
|
AllZone.getInputControl().resetInput();
|
||||||
}
|
}
|
||||||
|
|
||||||
//If this is a spell with convoke, re-tap all creatures used for it.
|
// If this is a spell with convoke, re-tap all creatures used for
|
||||||
//This is done to make sure Taps triggers go off at the right time
|
// it.
|
||||||
//(i.e. AFTER cost payment, they are tapped previously as well so that
|
// This is done to make sure Taps triggers go off at the right time
|
||||||
//any mana tapabilities can't be used in payment as well as being tapped for convoke)
|
// (i.e. AFTER cost payment, they are tapped previously as well so
|
||||||
|
// that
|
||||||
if(spell.getTappedForConvoke() != null)
|
// any mana tapabilities can't be used in payment as well as being
|
||||||
{
|
// tapped for convoke)
|
||||||
|
|
||||||
|
if (this.spell.getTappedForConvoke() != null) {
|
||||||
AllZone.getTriggerHandler().suppressMode("Untaps");
|
AllZone.getTriggerHandler().suppressMode("Untaps");
|
||||||
for(Card c : spell.getTappedForConvoke()) {
|
for (final Card c : this.spell.getTappedForConvoke()) {
|
||||||
c.untap();
|
c.untap();
|
||||||
c.tap();
|
c.tap();
|
||||||
}
|
}
|
||||||
AllZone.getTriggerHandler().clearSuppression("Untaps");
|
AllZone.getTriggerHandler().clearSuppression("Untaps");
|
||||||
spell.clearTappedForConvoke();
|
this.spell.clearTappedForConvoke();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -233,21 +237,20 @@ public class InputPayManaCost extends Input {
|
|||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@Override
|
@Override
|
||||||
public final void selectButtonCancel() {
|
public final void selectButtonCancel() {
|
||||||
//If this is a spell with convoke, untap all creatures used for it.
|
// If this is a spell with convoke, untap all creatures used for it.
|
||||||
if(spell.getTappedForConvoke() != null)
|
if (this.spell.getTappedForConvoke() != null) {
|
||||||
{
|
|
||||||
AllZone.getTriggerHandler().suppressMode("Untaps");
|
AllZone.getTriggerHandler().suppressMode("Untaps");
|
||||||
for(Card c : spell.getTappedForConvoke()) {
|
for (final Card c : this.spell.getTappedForConvoke()) {
|
||||||
c.untap();
|
c.untap();
|
||||||
}
|
}
|
||||||
AllZone.getTriggerHandler().clearSuppression("Untaps");
|
AllZone.getTriggerHandler().clearSuppression("Untaps");
|
||||||
spell.clearTappedForConvoke();
|
this.spell.clearTappedForConvoke();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.resetManaCost();
|
this.resetManaCost();
|
||||||
AllZone.getHumanPlayer().getManaPool().unpaid(this.spell, true);
|
AllZone.getHumanPlayer().getManaPool().unpaid(this.spell, true);
|
||||||
AllZone.getHumanPlayer().getZone(Zone.Battlefield).updateObservers(); // DO
|
AllZone.getHumanPlayer().getZone(Zone.Battlefield).updateObservers(); // DO
|
||||||
|
|
||||||
this.stop();
|
this.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -78,16 +78,34 @@ public class FPanel extends JPanel {
|
|||||||
this.setOpaque(false);
|
this.setOpaque(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPreferredSize(int w, int h) {
|
/**
|
||||||
setPreferredSize(new Dimension(w,h));
|
* Sets the preferred size.
|
||||||
|
*
|
||||||
|
* @param w the w
|
||||||
|
* @param h the h
|
||||||
|
*/
|
||||||
|
public void setPreferredSize(final int w, final int h) {
|
||||||
|
this.setPreferredSize(new Dimension(w, h));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMaximumSize(int w, int h) {
|
/**
|
||||||
setMaximumSize(new Dimension(w,h));
|
* Sets the maximum size.
|
||||||
|
*
|
||||||
|
* @param w the w
|
||||||
|
* @param h the h
|
||||||
|
*/
|
||||||
|
public void setMaximumSize(final int w, final int h) {
|
||||||
|
this.setMaximumSize(new Dimension(w, h));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMinimumSize(int w, int h) {
|
/**
|
||||||
setMinimumSize(new Dimension(w,h));
|
* Sets the minimum size.
|
||||||
|
*
|
||||||
|
* @param w the w
|
||||||
|
* @param h the h
|
||||||
|
*/
|
||||||
|
public void setMinimumSize(final int w, final int h) {
|
||||||
|
this.setMinimumSize(new Dimension(w, h));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -415,7 +415,7 @@ public class FSkin {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Background of progress bar, "unfilled" state.
|
* Background of progress bar, "unfilled" state.
|
||||||
* @return {@link javax.awt.Color} clrProgress1
|
* @return {@link java.awt.Color} clrProgress1
|
||||||
*/
|
*/
|
||||||
public Color getClrProgress1() {
|
public Color getClrProgress1() {
|
||||||
return clrProgress1;
|
return clrProgress1;
|
||||||
@@ -431,7 +431,7 @@ public class FSkin {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Text of progress bar, "unfilled" state.
|
* Text of progress bar, "unfilled" state.
|
||||||
* @return {@link javax.awt.Color} clrProgress1
|
* @return {@link java.awt.Color} clrProgress1
|
||||||
*/
|
*/
|
||||||
public Color getClrProgress2() {
|
public Color getClrProgress2() {
|
||||||
return clrProgress2;
|
return clrProgress2;
|
||||||
@@ -447,7 +447,7 @@ public class FSkin {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Background of progress bar, "filled" state.
|
* Background of progress bar, "filled" state.
|
||||||
* @return {@link javax.awt.Color} clrProgress1
|
* @return {@link java.awt.Color} clrProgress1
|
||||||
*/
|
*/
|
||||||
public Color getClrProgress3() {
|
public Color getClrProgress3() {
|
||||||
return clrProgress3;
|
return clrProgress3;
|
||||||
@@ -463,7 +463,7 @@ public class FSkin {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Text of progress bar, "filled" state.
|
* Text of progress bar, "filled" state.
|
||||||
* @return {@link javax.awt.Color} clrProgress1
|
* @return {@link java.awt.Color} clrProgress1
|
||||||
*/
|
*/
|
||||||
public Color getClrProgress4() {
|
public Color getClrProgress4() {
|
||||||
return clrProgress4;
|
return clrProgress4;
|
||||||
|
|||||||
@@ -176,10 +176,6 @@ public final class CardPrinted implements Comparable<CardPrinted>, InventoryItem
|
|||||||
* the rare
|
* the rare
|
||||||
* @param index
|
* @param index
|
||||||
* the index
|
* the index
|
||||||
* @param isAlt
|
|
||||||
* the is alt
|
|
||||||
* @param isDF
|
|
||||||
* the is df
|
|
||||||
* @return the card printed
|
* @return the card printed
|
||||||
*/
|
*/
|
||||||
static CardPrinted build(final CardRules c, final String set, final CardRarity rare, final int index) {
|
static CardPrinted build(final CardRules c, final String set, final CardRarity rare, final int index) {
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ import java.util.List;
|
|||||||
public class ForgePreferences extends Preferences {
|
public class ForgePreferences extends Preferences {
|
||||||
|
|
||||||
/** The new gui. */
|
/** The new gui. */
|
||||||
private boolean newGui;
|
private final boolean newGui;
|
||||||
|
|
||||||
/** The stack ai land. */
|
/** The stack ai land. */
|
||||||
private boolean stackAiLand;
|
private boolean stackAiLand;
|
||||||
@@ -59,7 +59,7 @@ public class ForgePreferences extends Preferences {
|
|||||||
|
|
||||||
/** The scale larger than original. */
|
/** The scale larger than original. */
|
||||||
private boolean scaleLargerThanOriginal;
|
private boolean scaleLargerThanOriginal;
|
||||||
|
|
||||||
/** The deck gen rmv artifacts. */
|
/** The deck gen rmv artifacts. */
|
||||||
private boolean deckGenSingletons;
|
private boolean deckGenSingletons;
|
||||||
|
|
||||||
@@ -246,388 +246,515 @@ public class ForgePreferences extends Preferences {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Checks if is stack ai land.
|
||||||
|
*
|
||||||
* @return the stackAiLand
|
* @return the stackAiLand
|
||||||
*/
|
*/
|
||||||
public boolean isStackAiLand() {
|
public boolean isStackAiLand() {
|
||||||
return stackAiLand;
|
return this.stackAiLand;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Sets the stack ai land.
|
||||||
|
*
|
||||||
* @param stackAiLand the stackAiLand to set
|
* @param stackAiLand the stackAiLand to set
|
||||||
*/
|
*/
|
||||||
public void setStackAiLand(boolean stackAiLand) {
|
public void setStackAiLand(final boolean stackAiLand) {
|
||||||
this.stackAiLand = stackAiLand; // TODO: Add 0 to parameter's name.
|
this.stackAiLand = stackAiLand; // TODO: Add 0 to parameter's name.
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Checks if is milling loss condition.
|
||||||
|
*
|
||||||
* @return the millingLossCondition
|
* @return the millingLossCondition
|
||||||
*/
|
*/
|
||||||
public boolean isMillingLossCondition() {
|
public boolean isMillingLossCondition() {
|
||||||
return millingLossCondition;
|
return this.millingLossCondition;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Sets the milling loss condition.
|
||||||
|
*
|
||||||
* @param millingLossCondition the millingLossCondition to set
|
* @param millingLossCondition the millingLossCondition to set
|
||||||
*/
|
*/
|
||||||
public void setMillingLossCondition(boolean millingLossCondition) {
|
public void setMillingLossCondition(final boolean millingLossCondition) {
|
||||||
this.millingLossCondition = millingLossCondition; // TODO: Add 0 to parameter's name.
|
this.millingLossCondition = millingLossCondition; // TODO: Add 0 to
|
||||||
|
// parameter's name.
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Checks if is b ai begin combat.
|
||||||
|
*
|
||||||
* @return the bAIBeginCombat
|
* @return the bAIBeginCombat
|
||||||
*/
|
*/
|
||||||
public boolean isbAIBeginCombat() {
|
public boolean isbAIBeginCombat() {
|
||||||
return bAIBeginCombat;
|
return this.bAIBeginCombat;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Sets the b ai begin combat.
|
||||||
|
*
|
||||||
* @param bAIBeginCombat the bAIBeginCombat to set
|
* @param bAIBeginCombat the bAIBeginCombat to set
|
||||||
*/
|
*/
|
||||||
public void setbAIBeginCombat(boolean bAIBeginCombat) {
|
public void setbAIBeginCombat(final boolean bAIBeginCombat) {
|
||||||
this.bAIBeginCombat = bAIBeginCombat; // TODO: Add 0 to parameter's name.
|
this.bAIBeginCombat = bAIBeginCombat; // TODO: Add 0 to parameter's
|
||||||
|
// name.
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Checks if is b ai end combat.
|
||||||
|
*
|
||||||
* @return the bAIEndCombat
|
* @return the bAIEndCombat
|
||||||
*/
|
*/
|
||||||
public boolean isbAIEndCombat() {
|
public boolean isbAIEndCombat() {
|
||||||
return bAIEndCombat;
|
return this.bAIEndCombat;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Sets the b ai end combat.
|
||||||
|
*
|
||||||
* @param bAIEndCombat the bAIEndCombat to set
|
* @param bAIEndCombat the bAIEndCombat to set
|
||||||
*/
|
*/
|
||||||
public void setbAIEndCombat(boolean bAIEndCombat) {
|
public void setbAIEndCombat(final boolean bAIEndCombat) {
|
||||||
this.bAIEndCombat = bAIEndCombat; // TODO: Add 0 to parameter's name.
|
this.bAIEndCombat = bAIEndCombat; // TODO: Add 0 to parameter's name.
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Checks if is b ai upkeep.
|
||||||
|
*
|
||||||
* @return the bAIUpkeep
|
* @return the bAIUpkeep
|
||||||
*/
|
*/
|
||||||
public boolean isbAIUpkeep() {
|
public boolean isbAIUpkeep() {
|
||||||
return bAIUpkeep;
|
return this.bAIUpkeep;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Sets the b ai upkeep.
|
||||||
|
*
|
||||||
* @param bAIUpkeep the bAIUpkeep to set
|
* @param bAIUpkeep the bAIUpkeep to set
|
||||||
*/
|
*/
|
||||||
public void setbAIUpkeep(boolean bAIUpkeep) {
|
public void setbAIUpkeep(final boolean bAIUpkeep) {
|
||||||
this.bAIUpkeep = bAIUpkeep; // TODO: Add 0 to parameter's name.
|
this.bAIUpkeep = bAIUpkeep; // TODO: Add 0 to parameter's name.
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Checks if is b ai draw.
|
||||||
|
*
|
||||||
* @return the bAIDraw
|
* @return the bAIDraw
|
||||||
*/
|
*/
|
||||||
public boolean isbAIDraw() {
|
public boolean isbAIDraw() {
|
||||||
return bAIDraw;
|
return this.bAIDraw;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Sets the b ai draw.
|
||||||
|
*
|
||||||
* @param bAIDraw the bAIDraw to set
|
* @param bAIDraw the bAIDraw to set
|
||||||
*/
|
*/
|
||||||
public void setbAIDraw(boolean bAIDraw) {
|
public void setbAIDraw(final boolean bAIDraw) {
|
||||||
this.bAIDraw = bAIDraw; // TODO: Add 0 to parameter's name.
|
this.bAIDraw = bAIDraw; // TODO: Add 0 to parameter's name.
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Checks if is b aieot.
|
||||||
|
*
|
||||||
* @return the bAIEOT
|
* @return the bAIEOT
|
||||||
*/
|
*/
|
||||||
public boolean isbAIEOT() {
|
public boolean isbAIEOT() {
|
||||||
return bAIEOT;
|
return this.bAIEOT;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Sets the b aieot.
|
||||||
|
*
|
||||||
* @param bAIEOT the bAIEOT to set
|
* @param bAIEOT the bAIEOT to set
|
||||||
*/
|
*/
|
||||||
public void setbAIEOT(boolean bAIEOT) {
|
public void setbAIEOT(final boolean bAIEOT) {
|
||||||
this.bAIEOT = bAIEOT; // TODO: Add 0 to parameter's name.
|
this.bAIEOT = bAIEOT; // TODO: Add 0 to parameter's name.
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Checks if is b human begin combat.
|
||||||
|
*
|
||||||
* @return the bHumanBeginCombat
|
* @return the bHumanBeginCombat
|
||||||
*/
|
*/
|
||||||
public boolean isbHumanBeginCombat() {
|
public boolean isbHumanBeginCombat() {
|
||||||
return bHumanBeginCombat;
|
return this.bHumanBeginCombat;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Sets the b human begin combat.
|
||||||
|
*
|
||||||
* @param bHumanBeginCombat the bHumanBeginCombat to set
|
* @param bHumanBeginCombat the bHumanBeginCombat to set
|
||||||
*/
|
*/
|
||||||
public void setbHumanBeginCombat(boolean bHumanBeginCombat) {
|
public void setbHumanBeginCombat(final boolean bHumanBeginCombat) {
|
||||||
this.bHumanBeginCombat = bHumanBeginCombat; // TODO: Add 0 to parameter's name.
|
this.bHumanBeginCombat = bHumanBeginCombat; // TODO: Add 0 to
|
||||||
|
// parameter's name.
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Checks if is b human draw.
|
||||||
|
*
|
||||||
* @return the bHumanDraw
|
* @return the bHumanDraw
|
||||||
*/
|
*/
|
||||||
public boolean isbHumanDraw() {
|
public boolean isbHumanDraw() {
|
||||||
return bHumanDraw;
|
return this.bHumanDraw;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Sets the b human draw.
|
||||||
|
*
|
||||||
* @param bHumanDraw the bHumanDraw to set
|
* @param bHumanDraw the bHumanDraw to set
|
||||||
*/
|
*/
|
||||||
public void setbHumanDraw(boolean bHumanDraw) {
|
public void setbHumanDraw(final boolean bHumanDraw) {
|
||||||
this.bHumanDraw = bHumanDraw; // TODO: Add 0 to parameter's name.
|
this.bHumanDraw = bHumanDraw; // TODO: Add 0 to parameter's name.
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Checks if is upload draft ai.
|
||||||
|
*
|
||||||
* @return the uploadDraftAI
|
* @return the uploadDraftAI
|
||||||
*/
|
*/
|
||||||
public boolean isUploadDraftAI() {
|
public boolean isUploadDraftAI() {
|
||||||
return uploadDraftAI;
|
return this.uploadDraftAI;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Sets the upload draft ai.
|
||||||
|
*
|
||||||
* @param uploadDraftAI the uploadDraftAI to set
|
* @param uploadDraftAI the uploadDraftAI to set
|
||||||
*/
|
*/
|
||||||
public void setUploadDraftAI(boolean uploadDraftAI) {
|
public void setUploadDraftAI(final boolean uploadDraftAI) {
|
||||||
this.uploadDraftAI = uploadDraftAI; // TODO: Add 0 to parameter's name.
|
this.uploadDraftAI = uploadDraftAI; // TODO: Add 0 to parameter's name.
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Checks if is b human end combat.
|
||||||
|
*
|
||||||
* @return the bHumanEndCombat
|
* @return the bHumanEndCombat
|
||||||
*/
|
*/
|
||||||
public boolean isbHumanEndCombat() {
|
public boolean isbHumanEndCombat() {
|
||||||
return bHumanEndCombat;
|
return this.bHumanEndCombat;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Sets the b human end combat.
|
||||||
|
*
|
||||||
* @param bHumanEndCombat the bHumanEndCombat to set
|
* @param bHumanEndCombat the bHumanEndCombat to set
|
||||||
*/
|
*/
|
||||||
public void setbHumanEndCombat(boolean bHumanEndCombat) {
|
public void setbHumanEndCombat(final boolean bHumanEndCombat) {
|
||||||
this.bHumanEndCombat = bHumanEndCombat; // TODO: Add 0 to parameter's name.
|
this.bHumanEndCombat = bHumanEndCombat; // TODO: Add 0 to parameter's
|
||||||
|
// name.
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Checks if is b human eot.
|
||||||
|
*
|
||||||
* @return the bHumanEOT
|
* @return the bHumanEOT
|
||||||
*/
|
*/
|
||||||
public boolean isbHumanEOT() {
|
public boolean isbHumanEOT() {
|
||||||
return bHumanEOT;
|
return this.bHumanEOT;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Sets the b human eot.
|
||||||
|
*
|
||||||
* @param bHumanEOT the bHumanEOT to set
|
* @param bHumanEOT the bHumanEOT to set
|
||||||
*/
|
*/
|
||||||
public void setbHumanEOT(boolean bHumanEOT) {
|
public void setbHumanEOT(final boolean bHumanEOT) {
|
||||||
this.bHumanEOT = bHumanEOT; // TODO: Add 0 to parameter's name.
|
this.bHumanEOT = bHumanEOT; // TODO: Add 0 to parameter's name.
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Checks if is b human upkeep.
|
||||||
|
*
|
||||||
* @return the bHumanUpkeep
|
* @return the bHumanUpkeep
|
||||||
*/
|
*/
|
||||||
public boolean isbHumanUpkeep() {
|
public boolean isbHumanUpkeep() {
|
||||||
return bHumanUpkeep;
|
return this.bHumanUpkeep;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Sets the b human upkeep.
|
||||||
|
*
|
||||||
* @param bHumanUpkeep the bHumanUpkeep to set
|
* @param bHumanUpkeep the bHumanUpkeep to set
|
||||||
*/
|
*/
|
||||||
public void setbHumanUpkeep(boolean bHumanUpkeep) {
|
public void setbHumanUpkeep(final boolean bHumanUpkeep) {
|
||||||
this.bHumanUpkeep = bHumanUpkeep; // TODO: Add 0 to parameter's name.
|
this.bHumanUpkeep = bHumanUpkeep; // TODO: Add 0 to parameter's name.
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Gets the bugz name.
|
||||||
|
*
|
||||||
* @return the bugzName
|
* @return the bugzName
|
||||||
*/
|
*/
|
||||||
public String getBugzName() {
|
public String getBugzName() {
|
||||||
return bugzName;
|
return this.bugzName;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Sets the bugz name.
|
||||||
|
*
|
||||||
* @param bugzName the bugzName to set
|
* @param bugzName the bugzName to set
|
||||||
*/
|
*/
|
||||||
public void setBugzName(String bugzName) {
|
public void setBugzName(final String bugzName) {
|
||||||
this.bugzName = bugzName; // TODO: Add 0 to parameter's name.
|
this.bugzName = bugzName; // TODO: Add 0 to parameter's name.
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Gets the bugz pwd.
|
||||||
|
*
|
||||||
* @return the bugzPwd
|
* @return the bugzPwd
|
||||||
*/
|
*/
|
||||||
public String getBugzPwd() {
|
public String getBugzPwd() {
|
||||||
return bugzPwd;
|
return this.bugzPwd;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Sets the bugz pwd.
|
||||||
|
*
|
||||||
* @param bugzPwd the bugzPwd to set
|
* @param bugzPwd the bugzPwd to set
|
||||||
*/
|
*/
|
||||||
public void setBugzPwd(String bugzPwd) {
|
public void setBugzPwd(final String bugzPwd) {
|
||||||
this.bugzPwd = bugzPwd; // TODO: Add 0 to parameter's name.
|
this.bugzPwd = bugzPwd; // TODO: Add 0 to parameter's name.
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Checks if is rand c foil.
|
||||||
|
*
|
||||||
* @return the randCFoil
|
* @return the randCFoil
|
||||||
*/
|
*/
|
||||||
public boolean isRandCFoil() {
|
public boolean isRandCFoil() {
|
||||||
return randCFoil;
|
return this.randCFoil;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Sets the rand c foil.
|
||||||
|
*
|
||||||
* @param randCFoil the randCFoil to set
|
* @param randCFoil the randCFoil to set
|
||||||
*/
|
*/
|
||||||
public void setRandCFoil(boolean randCFoil) {
|
public void setRandCFoil(final boolean randCFoil) {
|
||||||
this.randCFoil = randCFoil; // TODO: Add 0 to parameter's name.
|
this.randCFoil = randCFoil; // TODO: Add 0 to parameter's name.
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Checks if is developer mode.
|
||||||
|
*
|
||||||
* @return the developerMode
|
* @return the developerMode
|
||||||
*/
|
*/
|
||||||
public boolean isDeveloperMode() {
|
public boolean isDeveloperMode() {
|
||||||
return developerMode;
|
return this.developerMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Sets the developer mode.
|
||||||
|
*
|
||||||
* @param developerMode the developerMode to set
|
* @param developerMode the developerMode to set
|
||||||
*/
|
*/
|
||||||
public void setDeveloperMode(boolean developerMode) {
|
public void setDeveloperMode(final boolean developerMode) {
|
||||||
this.developerMode = developerMode; // TODO: Add 0 to parameter's name.
|
this.developerMode = developerMode; // TODO: Add 0 to parameter's name.
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Gets the laf.
|
||||||
|
*
|
||||||
* @return the laf
|
* @return the laf
|
||||||
*/
|
*/
|
||||||
public String getLaf() {
|
public String getLaf() {
|
||||||
return laf;
|
return this.laf;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Sets the laf.
|
||||||
|
*
|
||||||
* @param laf the laf to set
|
* @param laf the laf to set
|
||||||
*/
|
*/
|
||||||
public void setLaf(String laf) {
|
public void setLaf(final String laf) {
|
||||||
this.laf = laf; // TODO: Add 0 to parameter's name.
|
this.laf = laf; // TODO: Add 0 to parameter's name.
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Gets the skin.
|
||||||
|
*
|
||||||
* @return the skin
|
* @return the skin
|
||||||
*/
|
*/
|
||||||
public String getSkin() {
|
public String getSkin() {
|
||||||
return skin;
|
return this.skin;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Sets the skin.
|
||||||
|
*
|
||||||
* @param skin the skin to set
|
* @param skin the skin to set
|
||||||
*/
|
*/
|
||||||
public void setSkin(String skin) {
|
public void setSkin(final String skin) {
|
||||||
this.skin = skin; // TODO: Add 0 to parameter's name.
|
this.skin = skin; // TODO: Add 0 to parameter's name.
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Checks if is laf fonts.
|
||||||
|
*
|
||||||
* @return the lafFonts
|
* @return the lafFonts
|
||||||
*/
|
*/
|
||||||
public boolean isLafFonts() {
|
public boolean isLafFonts() {
|
||||||
return lafFonts;
|
return this.lafFonts;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Sets the laf fonts.
|
||||||
|
*
|
||||||
* @param lafFonts the lafFonts to set
|
* @param lafFonts the lafFonts to set
|
||||||
*/
|
*/
|
||||||
public void setLafFonts(boolean lafFonts) {
|
public void setLafFonts(final boolean lafFonts) {
|
||||||
this.lafFonts = lafFonts; // TODO: Add 0 to parameter's name.
|
this.lafFonts = lafFonts; // TODO: Add 0 to parameter's name.
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Checks if is scale larger than original.
|
||||||
|
*
|
||||||
* @return the scaleLargerThanOriginal
|
* @return the scaleLargerThanOriginal
|
||||||
*/
|
*/
|
||||||
public boolean isScaleLargerThanOriginal() {
|
public boolean isScaleLargerThanOriginal() {
|
||||||
return scaleLargerThanOriginal;
|
return this.scaleLargerThanOriginal;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Sets the scale larger than original.
|
||||||
|
*
|
||||||
* @param scaleLargerThanOriginal the scaleLargerThanOriginal to set
|
* @param scaleLargerThanOriginal the scaleLargerThanOriginal to set
|
||||||
*/
|
*/
|
||||||
public void setScaleLargerThanOriginal(boolean scaleLargerThanOriginal) {
|
public void setScaleLargerThanOriginal(final boolean scaleLargerThanOriginal) {
|
||||||
this.scaleLargerThanOriginal = scaleLargerThanOriginal; // TODO: Add 0 to parameter's name.
|
this.scaleLargerThanOriginal = scaleLargerThanOriginal; // TODO: Add 0
|
||||||
|
// to
|
||||||
|
// parameter's
|
||||||
|
// name.
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Checks if is card overlay.
|
||||||
|
*
|
||||||
* @return the cardOverlay
|
* @return the cardOverlay
|
||||||
*/
|
*/
|
||||||
public boolean isCardOverlay() {
|
public boolean isCardOverlay() {
|
||||||
return cardOverlay;
|
return this.cardOverlay;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Sets the card overlay.
|
||||||
|
*
|
||||||
* @param cardOverlay the cardOverlay to set
|
* @param cardOverlay the cardOverlay to set
|
||||||
*/
|
*/
|
||||||
public void setCardOverlay(boolean cardOverlay) {
|
public void setCardOverlay(final boolean cardOverlay) {
|
||||||
this.cardOverlay = cardOverlay; // TODO: Add 0 to parameter's name.
|
this.cardOverlay = cardOverlay; // TODO: Add 0 to parameter's name.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if is deck gen singletons.
|
||||||
|
*
|
||||||
|
* @return true, if is deck gen singletons
|
||||||
|
*/
|
||||||
public boolean isDeckGenSingletons() {
|
public boolean isDeckGenSingletons() {
|
||||||
return deckGenSingletons;
|
return this.deckGenSingletons;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDeckGenSingletons(boolean deckSingletons) {
|
/**
|
||||||
|
* Sets the deck gen singletons.
|
||||||
|
*
|
||||||
|
* @param deckSingletons the new deck gen singletons
|
||||||
|
*/
|
||||||
|
public void setDeckGenSingletons(final boolean deckSingletons) {
|
||||||
this.deckGenSingletons = deckSingletons;
|
this.deckGenSingletons = deckSingletons;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Checks if is deck gen rmv artifacts.
|
||||||
|
*
|
||||||
* @return the deckGenRmvArtifacts
|
* @return the deckGenRmvArtifacts
|
||||||
*/
|
*/
|
||||||
public boolean isDeckGenRmvArtifacts() {
|
public boolean isDeckGenRmvArtifacts() {
|
||||||
return deckGenRmvArtifacts;
|
return this.deckGenRmvArtifacts;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Sets the deck gen rmv artifacts.
|
||||||
|
*
|
||||||
* @param deckGenRmvArtifacts the deckGenRmvArtifacts to set
|
* @param deckGenRmvArtifacts the deckGenRmvArtifacts to set
|
||||||
*/
|
*/
|
||||||
public void setDeckGenRmvArtifacts(boolean deckGenRmvArtifacts) {
|
public void setDeckGenRmvArtifacts(final boolean deckGenRmvArtifacts) {
|
||||||
this.deckGenRmvArtifacts = deckGenRmvArtifacts; // TODO: Add 0 to parameter's name.
|
this.deckGenRmvArtifacts = deckGenRmvArtifacts; // TODO: Add 0 to
|
||||||
|
// parameter's name.
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Checks if is deck gen rmv small.
|
||||||
|
*
|
||||||
* @return the deckGenRmvSmall
|
* @return the deckGenRmvSmall
|
||||||
*/
|
*/
|
||||||
public boolean isDeckGenRmvSmall() {
|
public boolean isDeckGenRmvSmall() {
|
||||||
return deckGenRmvSmall;
|
return this.deckGenRmvSmall;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Sets the deck gen rmv small.
|
||||||
|
*
|
||||||
* @param deckGenRmvSmall the deckGenRmvSmall to set
|
* @param deckGenRmvSmall the deckGenRmvSmall to set
|
||||||
*/
|
*/
|
||||||
public void setDeckGenRmvSmall(boolean deckGenRmvSmall) {
|
public void setDeckGenRmvSmall(final boolean deckGenRmvSmall) {
|
||||||
this.deckGenRmvSmall = deckGenRmvSmall; // TODO: Add 0 to parameter's name.
|
this.deckGenRmvSmall = deckGenRmvSmall; // TODO: Add 0 to parameter's
|
||||||
|
// name.
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Gets the card size.
|
||||||
|
*
|
||||||
* @return the cardSize
|
* @return the cardSize
|
||||||
*/
|
*/
|
||||||
public CardSizeType getCardSize() {
|
public CardSizeType getCardSize() {
|
||||||
return cardSize;
|
return this.cardSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Sets the card size.
|
||||||
|
*
|
||||||
* @param cardSize the cardSize to set
|
* @param cardSize the cardSize to set
|
||||||
*/
|
*/
|
||||||
public void setCardSize(CardSizeType cardSize) {
|
public void setCardSize(final CardSizeType cardSize) {
|
||||||
this.cardSize = cardSize; // TODO: Add 0 to parameter's name.
|
this.cardSize = cardSize; // TODO: Add 0 to parameter's name.
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Gets the stack offset.
|
||||||
|
*
|
||||||
* @return the stackOffset
|
* @return the stackOffset
|
||||||
*/
|
*/
|
||||||
public StackOffsetType getStackOffset() {
|
public StackOffsetType getStackOffset() {
|
||||||
return stackOffset;
|
return this.stackOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Sets the stack offset.
|
||||||
|
*
|
||||||
* @param stackOffset the stackOffset to set
|
* @param stackOffset the stackOffset to set
|
||||||
*/
|
*/
|
||||||
public void setStackOffset(StackOffsetType stackOffset) {
|
public void setStackOffset(final StackOffsetType stackOffset) {
|
||||||
this.stackOffset = stackOffset; // TODO: Add 0 to parameter's name.
|
this.stackOffset = stackOffset; // TODO: Add 0 to parameter's name.
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Gets the max stack size.
|
||||||
|
*
|
||||||
* @return the maxStackSize
|
* @return the maxStackSize
|
||||||
*/
|
*/
|
||||||
public int getMaxStackSize() {
|
public int getMaxStackSize() {
|
||||||
return maxStackSize;
|
return this.maxStackSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Sets the max stack size.
|
||||||
|
*
|
||||||
* @param maxStackSize the maxStackSize to set
|
* @param maxStackSize the maxStackSize to set
|
||||||
*/
|
*/
|
||||||
public void setMaxStackSize(int maxStackSize) {
|
public void setMaxStackSize(final int maxStackSize) {
|
||||||
this.maxStackSize = maxStackSize; // TODO: Add 0 to parameter's name.
|
this.maxStackSize = maxStackSize; // TODO: Add 0 to parameter's name.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -856,7 +856,8 @@ public final class NewConstants {
|
|||||||
|
|
||||||
/** The TITLE. */
|
/** The TITLE. */
|
||||||
public static final String TITLE = "%s/NewGame/options/generate/title";
|
public static final String TITLE = "%s/NewGame/options/generate/title";
|
||||||
|
|
||||||
|
/** The Constant SINGLETONS. */
|
||||||
public static final String SINGLETONS = "%s/NewGame/options/generate/singletons";
|
public static final String SINGLETONS = "%s/NewGame/options/generate/singletons";
|
||||||
|
|
||||||
/** The REMOV e_ small. */
|
/** The REMOV e_ small. */
|
||||||
|
|||||||
@@ -184,7 +184,7 @@ public final class QuestData {
|
|||||||
public void newGame(final int diff, final String m0de, final boolean standardStart) {
|
public void newGame(final int diff, final String m0de, final boolean standardStart) {
|
||||||
this.setDifficulty(diff);
|
this.setDifficulty(diff);
|
||||||
|
|
||||||
final Predicate<CardPrinted> filter = standardStart
|
final Predicate<CardPrinted> filter = standardStart
|
||||||
? SetUtils.getStandard().getFilterPrinted()
|
? SetUtils.getStandard().getFilterPrinted()
|
||||||
: CardPrinted.Predicates.Presets.IS_TRUE;
|
: CardPrinted.Predicates.Presets.IS_TRUE;
|
||||||
|
|
||||||
|
|||||||
@@ -336,7 +336,7 @@ public class QuestWinLoseHandler extends WinLoseModeHandler {
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (estateValue > 0){
|
if (estateValue > 0) {
|
||||||
credEstates = (int) (estateValue * credTotal);
|
credEstates = (int) (estateValue * credTotal);
|
||||||
sb.append("Estates bonus: ").append((int) (100 * estateValue)).append("%.<br>");
|
sb.append("Estates bonus: ").append((int) (100 * estateValue)).append("%.<br>");
|
||||||
credTotal += credEstates;
|
credTotal += credEstates;
|
||||||
|
|||||||
@@ -49,12 +49,12 @@ import forge.Command;
|
|||||||
import forge.Constant;
|
import forge.Constant;
|
||||||
import forge.ConstantStringArrayList;
|
import forge.ConstantStringArrayList;
|
||||||
import forge.FileUtil;
|
import forge.FileUtil;
|
||||||
import forge.GuiImportPicture;
|
|
||||||
import forge.GuiDisplay;
|
import forge.GuiDisplay;
|
||||||
import forge.GuiDownloadQuestImages;
|
|
||||||
import forge.GuiDownloadPicturesLQ;
|
import forge.GuiDownloadPicturesLQ;
|
||||||
import forge.GuiDownloadPrices;
|
import forge.GuiDownloadPrices;
|
||||||
|
import forge.GuiDownloadQuestImages;
|
||||||
import forge.GuiDownloadSetPicturesLQ;
|
import forge.GuiDownloadSetPicturesLQ;
|
||||||
|
import forge.GuiImportPicture;
|
||||||
import forge.ImageCache;
|
import forge.ImageCache;
|
||||||
import forge.MyRandom;
|
import forge.MyRandom;
|
||||||
import forge.PlayerType;
|
import forge.PlayerType;
|
||||||
@@ -139,7 +139,7 @@ public class OldGuiNewGame extends JFrame {
|
|||||||
|
|
||||||
private static JCheckBoxMenuItem singletons = new JCheckBoxMenuItem(
|
private static JCheckBoxMenuItem singletons = new JCheckBoxMenuItem(
|
||||||
ForgeProps.getLocalized(NewConstants.Lang.OldGuiNewGame.MenuBar.Options.Generate.SINGLETONS));
|
ForgeProps.getLocalized(NewConstants.Lang.OldGuiNewGame.MenuBar.Options.Generate.SINGLETONS));
|
||||||
|
|
||||||
/** Constant <code>removeSmallCreatures</code>. */
|
/** Constant <code>removeSmallCreatures</code>. */
|
||||||
private static JCheckBoxMenuItem removeSmallCreatures = new JCheckBoxMenuItem(
|
private static JCheckBoxMenuItem removeSmallCreatures = new JCheckBoxMenuItem(
|
||||||
ForgeProps.getLocalized(NewConstants.Lang.OldGuiNewGame.MenuBar.Options.Generate.REMOVE_SMALL));
|
ForgeProps.getLocalized(NewConstants.Lang.OldGuiNewGame.MenuBar.Options.Generate.REMOVE_SMALL));
|
||||||
@@ -148,7 +148,8 @@ public class OldGuiNewGame extends JFrame {
|
|||||||
private static JCheckBoxMenuItem removeArtifacts = new JCheckBoxMenuItem(
|
private static JCheckBoxMenuItem removeArtifacts = new JCheckBoxMenuItem(
|
||||||
ForgeProps.getLocalized(NewConstants.Lang.OldGuiNewGame.MenuBar.Options.Generate.REMOVE_ARTIFACTS));
|
ForgeProps.getLocalized(NewConstants.Lang.OldGuiNewGame.MenuBar.Options.Generate.REMOVE_ARTIFACTS));
|
||||||
/** Constant <code>useLAFFonts</code>. */
|
/** Constant <code>useLAFFonts</code>. */
|
||||||
private static JCheckBoxMenuItem useLAFFonts = new JCheckBoxMenuItem(ForgeProps.getLocalized(NewConstants.Lang.OldGuiNewGame.MenuBar.Options.FONT));
|
private static JCheckBoxMenuItem useLAFFonts = new JCheckBoxMenuItem(
|
||||||
|
ForgeProps.getLocalized(NewConstants.Lang.OldGuiNewGame.MenuBar.Options.FONT));
|
||||||
/** Constant <code>cardOverlay</code>. */
|
/** Constant <code>cardOverlay</code>. */
|
||||||
private static JCheckBoxMenuItem cardOverlay = new JCheckBoxMenuItem(
|
private static JCheckBoxMenuItem cardOverlay = new JCheckBoxMenuItem(
|
||||||
ForgeProps.getLocalized(NewConstants.Lang.OldGuiNewGame.MenuBar.Options.CARD_OVERLAY));
|
ForgeProps.getLocalized(NewConstants.Lang.OldGuiNewGame.MenuBar.Options.CARD_OVERLAY));
|
||||||
@@ -245,8 +246,8 @@ public class OldGuiNewGame extends JFrame {
|
|||||||
// CARD_SIZES_ACTION,
|
// CARD_SIZES_ACTION,
|
||||||
lookAndFeelAction, this.dnldPricesAction, this.downloadActionLQ, this.downloadActionSetLQ,
|
lookAndFeelAction, this.dnldPricesAction, this.downloadActionLQ, this.downloadActionSetLQ,
|
||||||
this.downloadActionQuest, this.importPicture, this.cardSizesAction, this.cardStackAction,
|
this.downloadActionQuest, this.importPicture, this.cardSizesAction, this.cardStackAction,
|
||||||
this.cardStackOffsetAction, this.bugzReporterAction, ErrorViewer.ALL_THREADS_ACTION,
|
this.cardStackOffsetAction, this.bugzReporterAction, ErrorViewer.ALL_THREADS_ACTION, this.aboutAction,
|
||||||
this.aboutAction, this.exitAction };
|
this.exitAction };
|
||||||
final JMenu menu = new JMenu(ForgeProps.getLocalized(Menu.TITLE));
|
final JMenu menu = new JMenu(ForgeProps.getLocalized(Menu.TITLE));
|
||||||
for (final Action a : actions) {
|
for (final Action a : actions) {
|
||||||
menu.add(a);
|
menu.add(a);
|
||||||
@@ -259,18 +260,18 @@ public class OldGuiNewGame extends JFrame {
|
|||||||
// useLAFFonts.setSelected(false);
|
// useLAFFonts.setSelected(false);
|
||||||
|
|
||||||
// new stuff
|
// new stuff
|
||||||
final JMenu generatedDeck = new JMenu(ForgeProps.getLocalized(NewConstants.Lang.OldGuiNewGame.MenuBar.Options.Generate.TITLE));
|
final JMenu generatedDeck = new JMenu(
|
||||||
|
ForgeProps.getLocalized(NewConstants.Lang.OldGuiNewGame.MenuBar.Options.Generate.TITLE));
|
||||||
|
|
||||||
generatedDeck.add(OldGuiNewGame.singletons);
|
generatedDeck.add(OldGuiNewGame.singletons);
|
||||||
OldGuiNewGame.singletons.setSelected(Singletons.getModel().getPreferences().isDeckGenSingletons());
|
OldGuiNewGame.singletons.setSelected(Singletons.getModel().getPreferences().isDeckGenSingletons());
|
||||||
OldGuiNewGame.singletons.addActionListener(new ActionListener() {
|
OldGuiNewGame.singletons.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(final ActionEvent arg0) {
|
public void actionPerformed(final ActionEvent arg0) {
|
||||||
Singletons.getModel().getPreferences()
|
Singletons.getModel().getPreferences().setDeckGenSingletons(OldGuiNewGame.singletons.isSelected());
|
||||||
.setDeckGenSingletons(OldGuiNewGame.singletons.isSelected());
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
generatedDeck.add(OldGuiNewGame.removeSmallCreatures);
|
generatedDeck.add(OldGuiNewGame.removeSmallCreatures);
|
||||||
OldGuiNewGame.removeSmallCreatures.setSelected(Singletons.getModel().getPreferences().isDeckGenRmvSmall());
|
OldGuiNewGame.removeSmallCreatures.setSelected(Singletons.getModel().getPreferences().isDeckGenRmvSmall());
|
||||||
OldGuiNewGame.removeSmallCreatures.addActionListener(new ActionListener() {
|
OldGuiNewGame.removeSmallCreatures.addActionListener(new ActionListener() {
|
||||||
@@ -416,7 +417,8 @@ public class OldGuiNewGame extends JFrame {
|
|||||||
|
|
||||||
final String sDeckName = JOptionPane.showInputDialog(null,
|
final String sDeckName = JOptionPane.showInputDialog(null,
|
||||||
ForgeProps.getLocalized(NewConstants.Lang.OldGuiNewGame.NewGameText.SAVE_SEALED_MSG),
|
ForgeProps.getLocalized(NewConstants.Lang.OldGuiNewGame.NewGameText.SAVE_SEALED_MSG),
|
||||||
ForgeProps.getLocalized(NewConstants.Lang.OldGuiNewGame.NewGameText.SAVE_SEALED_TTL), JOptionPane.QUESTION_MESSAGE);
|
ForgeProps.getLocalized(NewConstants.Lang.OldGuiNewGame.NewGameText.SAVE_SEALED_TTL),
|
||||||
|
JOptionPane.QUESTION_MESSAGE);
|
||||||
|
|
||||||
deck.setName(sDeckName);
|
deck.setName(sDeckName);
|
||||||
deck.setPlayerType(PlayerType.HUMAN);
|
deck.setPlayerType(PlayerType.HUMAN);
|
||||||
@@ -501,10 +503,12 @@ public class OldGuiNewGame extends JFrame {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* jPanel2.setBorder(titledBorder1); */
|
/* jPanel2.setBorder(titledBorder1); */
|
||||||
this.setCustomBorder(this.jPanel2, ForgeProps.getLocalized(NewConstants.Lang.OldGuiNewGame.NewGameText.GAMETYPE));
|
this.setCustomBorder(this.jPanel2,
|
||||||
|
ForgeProps.getLocalized(NewConstants.Lang.OldGuiNewGame.NewGameText.GAMETYPE));
|
||||||
this.jPanel2.setLayout(new MigLayout("align center"));
|
this.jPanel2.setLayout(new MigLayout("align center"));
|
||||||
|
|
||||||
this.singleRadioButton.setText(ForgeProps.getLocalized(NewConstants.Lang.OldGuiNewGame.NewGameText.CONSTRUCTED_TEXT));
|
this.singleRadioButton.setText(ForgeProps
|
||||||
|
.getLocalized(NewConstants.Lang.OldGuiNewGame.NewGameText.CONSTRUCTED_TEXT));
|
||||||
this.singleRadioButton.addActionListener(new java.awt.event.ActionListener() {
|
this.singleRadioButton.addActionListener(new java.awt.event.ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(final ActionEvent e) {
|
public void actionPerformed(final ActionEvent e) {
|
||||||
@@ -513,7 +517,8 @@ public class OldGuiNewGame extends JFrame {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// sealedRadioButton.setToolTipText("");
|
// sealedRadioButton.setToolTipText("");
|
||||||
this.sealedRadioButton.setText(ForgeProps.getLocalized(NewConstants.Lang.OldGuiNewGame.NewGameText.SEALED_TEXT));
|
this.sealedRadioButton
|
||||||
|
.setText(ForgeProps.getLocalized(NewConstants.Lang.OldGuiNewGame.NewGameText.SEALED_TEXT));
|
||||||
this.sealedRadioButton.addActionListener(new java.awt.event.ActionListener() {
|
this.sealedRadioButton.addActionListener(new java.awt.event.ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(final ActionEvent e) {
|
public void actionPerformed(final ActionEvent e) {
|
||||||
@@ -522,7 +527,8 @@ public class OldGuiNewGame extends JFrame {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// draftRadioButton.setToolTipText("");
|
// draftRadioButton.setToolTipText("");
|
||||||
this.draftRadioButton.setText(ForgeProps.getLocalized(NewConstants.Lang.OldGuiNewGame.NewGameText.BOOSTER_TEXT));
|
this.draftRadioButton
|
||||||
|
.setText(ForgeProps.getLocalized(NewConstants.Lang.OldGuiNewGame.NewGameText.BOOSTER_TEXT));
|
||||||
this.draftRadioButton.addActionListener(new java.awt.event.ActionListener() {
|
this.draftRadioButton.addActionListener(new java.awt.event.ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(final ActionEvent e) {
|
public void actionPerformed(final ActionEvent e) {
|
||||||
@@ -546,13 +552,16 @@ public class OldGuiNewGame extends JFrame {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* jPanel3.setBorder(titledBorder3); */
|
/* jPanel3.setBorder(titledBorder3); */
|
||||||
this.setCustomBorder(this.jPanel3, ForgeProps.getLocalized(NewConstants.Lang.OldGuiNewGame.NewGameText.SETTINGS));
|
this.setCustomBorder(this.jPanel3,
|
||||||
|
ForgeProps.getLocalized(NewConstants.Lang.OldGuiNewGame.NewGameText.SETTINGS));
|
||||||
this.jPanel3.setLayout(new MigLayout("align center"));
|
this.jPanel3.setLayout(new MigLayout("align center"));
|
||||||
|
|
||||||
// newGuiCheckBox.setText(ForgeProps.getLocalized(NEW_GAME_TEXT.NEW_GUI));
|
// newGuiCheckBox.setText(ForgeProps.getLocalized(NEW_GAME_TEXT.NEW_GUI));
|
||||||
OldGuiNewGame.getSmoothLandCheckBox().setText(ForgeProps.getLocalized(NewConstants.Lang.OldGuiNewGame.NewGameText.AI_LAND));
|
OldGuiNewGame.getSmoothLandCheckBox().setText(
|
||||||
|
ForgeProps.getLocalized(NewConstants.Lang.OldGuiNewGame.NewGameText.AI_LAND));
|
||||||
|
|
||||||
OldGuiNewGame.getDevModeCheckBox().setText(ForgeProps.getLocalized(NewConstants.Lang.OldGuiNewGame.NewGameText.DEV_MODE));
|
OldGuiNewGame.getDevModeCheckBox().setText(
|
||||||
|
ForgeProps.getLocalized(NewConstants.Lang.OldGuiNewGame.NewGameText.DEV_MODE));
|
||||||
OldGuiNewGame.getDevModeCheckBox().addActionListener(new java.awt.event.ActionListener() {
|
OldGuiNewGame.getDevModeCheckBox().addActionListener(new java.awt.event.ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(final ActionEvent e) {
|
public void actionPerformed(final ActionEvent e) {
|
||||||
@@ -563,9 +572,8 @@ public class OldGuiNewGame extends JFrame {
|
|||||||
|
|
||||||
OldGuiNewGame.getUpldDrftCheckBox().setText("Upload Draft Picks");
|
OldGuiNewGame.getUpldDrftCheckBox().setText("Upload Draft Picks");
|
||||||
|
|
||||||
OldGuiNewGame.getUpldDrftCheckBox()
|
OldGuiNewGame.getUpldDrftCheckBox().setToolTipText(
|
||||||
.setToolTipText("Your picks and all other participants' picks will help the Forge AI"
|
"Your picks and all other participants' picks will help the Forge AI" + " make better draft picks.");
|
||||||
+ " make better draft picks.");
|
|
||||||
|
|
||||||
OldGuiNewGame.getUpldDrftCheckBox().addActionListener(new java.awt.event.ActionListener() {
|
OldGuiNewGame.getUpldDrftCheckBox().addActionListener(new java.awt.event.ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
@@ -576,8 +584,8 @@ public class OldGuiNewGame extends JFrame {
|
|||||||
});
|
});
|
||||||
|
|
||||||
OldGuiNewGame.getFoilRandomCheckBox().setText("Random Foiling");
|
OldGuiNewGame.getFoilRandomCheckBox().setText("Random Foiling");
|
||||||
OldGuiNewGame.getFoilRandomCheckBox()
|
OldGuiNewGame.getFoilRandomCheckBox().setToolTipText(
|
||||||
.setToolTipText("Approximately 1:20 cards will appear with foiling effects applied.");
|
"Approximately 1:20 cards will appear with foiling effects applied.");
|
||||||
OldGuiNewGame.getFoilRandomCheckBox().addActionListener(new java.awt.event.ActionListener() {
|
OldGuiNewGame.getFoilRandomCheckBox().addActionListener(new java.awt.event.ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(final ActionEvent e) {
|
public void actionPerformed(final ActionEvent e) {
|
||||||
@@ -1601,8 +1609,8 @@ public class OldGuiNewGame extends JFrame {
|
|||||||
area.setEditable(false);
|
area.setEditable(false);
|
||||||
area.setOpaque(false);
|
area.setOpaque(false);
|
||||||
|
|
||||||
JOptionPane.showMessageDialog(null, new JScrollPane(area), ForgeProps.getLocalized(NewConstants.Lang.HowTo.TITLE),
|
JOptionPane.showMessageDialog(null, new JScrollPane(area),
|
||||||
JOptionPane.INFORMATION_MESSAGE);
|
ForgeProps.getLocalized(NewConstants.Lang.HowTo.TITLE), JOptionPane.INFORMATION_MESSAGE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1883,27 +1891,30 @@ public class OldGuiNewGame extends JFrame {
|
|||||||
* @return the cardOverlay
|
* @return the cardOverlay
|
||||||
*/
|
*/
|
||||||
public static JCheckBoxMenuItem getCardOverlay() {
|
public static JCheckBoxMenuItem getCardOverlay() {
|
||||||
return cardOverlay;
|
return OldGuiNewGame.cardOverlay;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param cardOverlay the cardOverlay to set
|
* @param cardOverlay
|
||||||
|
* the cardOverlay to set
|
||||||
*/
|
*/
|
||||||
public static void setCardOverlay(JCheckBoxMenuItem cardOverlay) {
|
public static void setCardOverlay(final JCheckBoxMenuItem cardOverlay) {
|
||||||
OldGuiNewGame.cardOverlay = cardOverlay; // TODO: Add 0 to parameter's name.
|
OldGuiNewGame.cardOverlay = cardOverlay; // TODO: Add 0 to parameter's
|
||||||
|
// name.
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the cardScale
|
* @return the cardScale
|
||||||
*/
|
*/
|
||||||
public static JCheckBoxMenuItem getCardScale() {
|
public static JCheckBoxMenuItem getCardScale() {
|
||||||
return cardScale;
|
return OldGuiNewGame.cardScale;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param cardScale the cardScale to set
|
* @param cardScale
|
||||||
|
* the cardScale to set
|
||||||
*/
|
*/
|
||||||
public static void setCardScale(JCheckBoxMenuItem cardScale) {
|
public static void setCardScale(final JCheckBoxMenuItem cardScale) {
|
||||||
OldGuiNewGame.cardScale = cardScale; // TODO: Add 0 to parameter's name.
|
OldGuiNewGame.cardScale = cardScale; // TODO: Add 0 to parameter's name.
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1911,70 +1922,82 @@ public class OldGuiNewGame extends JFrame {
|
|||||||
* @return the useLAFFonts
|
* @return the useLAFFonts
|
||||||
*/
|
*/
|
||||||
public static JCheckBoxMenuItem getUseLAFFonts() {
|
public static JCheckBoxMenuItem getUseLAFFonts() {
|
||||||
return useLAFFonts;
|
return OldGuiNewGame.useLAFFonts;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param useLAFFonts the useLAFFonts to set
|
* @param useLAFFonts
|
||||||
|
* the useLAFFonts to set
|
||||||
*/
|
*/
|
||||||
public static void setUseLAFFonts(JCheckBoxMenuItem useLAFFonts) {
|
public static void setUseLAFFonts(final JCheckBoxMenuItem useLAFFonts) {
|
||||||
OldGuiNewGame.useLAFFonts = useLAFFonts; // TODO: Add 0 to parameter's name.
|
OldGuiNewGame.useLAFFonts = useLAFFonts; // TODO: Add 0 to parameter's
|
||||||
|
// name.
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the smoothLandCheckBox
|
* @return the smoothLandCheckBox
|
||||||
*/
|
*/
|
||||||
static JCheckBox getSmoothLandCheckBox() {
|
static JCheckBox getSmoothLandCheckBox() {
|
||||||
return smoothLandCheckBox;
|
return OldGuiNewGame.smoothLandCheckBox;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param smoothLandCheckBox the smoothLandCheckBox to set
|
* @param smoothLandCheckBox
|
||||||
|
* the smoothLandCheckBox to set
|
||||||
*/
|
*/
|
||||||
static void setSmoothLandCheckBox(JCheckBox smoothLandCheckBox) {
|
static void setSmoothLandCheckBox(final JCheckBox smoothLandCheckBox) {
|
||||||
OldGuiNewGame.smoothLandCheckBox = smoothLandCheckBox; // TODO: Add 0 to parameter's name.
|
OldGuiNewGame.smoothLandCheckBox = smoothLandCheckBox; // TODO: Add 0 to
|
||||||
|
// parameter's
|
||||||
|
// name.
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the devModeCheckBox
|
* @return the devModeCheckBox
|
||||||
*/
|
*/
|
||||||
public static JCheckBox getDevModeCheckBox() {
|
public static JCheckBox getDevModeCheckBox() {
|
||||||
return devModeCheckBox;
|
return OldGuiNewGame.devModeCheckBox;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param devModeCheckBox the devModeCheckBox to set
|
* @param devModeCheckBox
|
||||||
|
* the devModeCheckBox to set
|
||||||
*/
|
*/
|
||||||
public static void setDevModeCheckBox(JCheckBox devModeCheckBox) {
|
public static void setDevModeCheckBox(final JCheckBox devModeCheckBox) {
|
||||||
OldGuiNewGame.devModeCheckBox = devModeCheckBox; // TODO: Add 0 to parameter's name.
|
OldGuiNewGame.devModeCheckBox = devModeCheckBox; // TODO: Add 0 to
|
||||||
|
// parameter's name.
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the upldDrftCheckBox
|
* @return the upldDrftCheckBox
|
||||||
*/
|
*/
|
||||||
public static JCheckBox getUpldDrftCheckBox() {
|
public static JCheckBox getUpldDrftCheckBox() {
|
||||||
return upldDrftCheckBox;
|
return OldGuiNewGame.upldDrftCheckBox;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param upldDrftCheckBox the upldDrftCheckBox to set
|
* @param upldDrftCheckBox
|
||||||
|
* the upldDrftCheckBox to set
|
||||||
*/
|
*/
|
||||||
public static void setUpldDrftCheckBox(JCheckBox upldDrftCheckBox) {
|
public static void setUpldDrftCheckBox(final JCheckBox upldDrftCheckBox) {
|
||||||
OldGuiNewGame.upldDrftCheckBox = upldDrftCheckBox; // TODO: Add 0 to parameter's name.
|
OldGuiNewGame.upldDrftCheckBox = upldDrftCheckBox; // TODO: Add 0 to
|
||||||
|
// parameter's name.
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the foilRandomCheckBox
|
* @return the foilRandomCheckBox
|
||||||
*/
|
*/
|
||||||
public static JCheckBox getFoilRandomCheckBox() {
|
public static JCheckBox getFoilRandomCheckBox() {
|
||||||
return foilRandomCheckBox;
|
return OldGuiNewGame.foilRandomCheckBox;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param foilRandomCheckBox the foilRandomCheckBox to set
|
* @param foilRandomCheckBox
|
||||||
|
* the foilRandomCheckBox to set
|
||||||
*/
|
*/
|
||||||
public static void setFoilRandomCheckBox(JCheckBox foilRandomCheckBox) {
|
public static void setFoilRandomCheckBox(final JCheckBox foilRandomCheckBox) {
|
||||||
OldGuiNewGame.foilRandomCheckBox = foilRandomCheckBox; // TODO: Add 0 to parameter's name.
|
OldGuiNewGame.foilRandomCheckBox = foilRandomCheckBox; // TODO: Add 0 to
|
||||||
|
// parameter's
|
||||||
|
// name.
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,10 +49,10 @@ public class WinLoseFrame extends JFrame {
|
|||||||
private FButton btnRestart;
|
private FButton btnRestart;
|
||||||
|
|
||||||
/** The lbl title. */
|
/** The lbl title. */
|
||||||
private JLabel lblTitle;
|
private final JLabel lblTitle;
|
||||||
|
|
||||||
/** The lbl stats. */
|
/** The lbl stats. */
|
||||||
private JLabel lblStats;
|
private final JLabel lblStats;
|
||||||
|
|
||||||
/** The pnl custom. */
|
/** The pnl custom. */
|
||||||
private JPanel pnlCustom;
|
private JPanel pnlCustom;
|
||||||
@@ -283,60 +283,62 @@ public class WinLoseFrame extends JFrame {
|
|||||||
* @return {@link forge.gui.skin.FButton} btnContinue
|
* @return {@link forge.gui.skin.FButton} btnContinue
|
||||||
*/
|
*/
|
||||||
public FButton getBtnContinue() {
|
public FButton getBtnContinue() {
|
||||||
return btnContinue;
|
return this.btnContinue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {@link forge.gui.skin.FButton} btnContinue
|
* @param btnContinue {@link forge.gui.skin.FButton}
|
||||||
*/
|
*/
|
||||||
public void setBtnContinue(FButton btnContinue0) {
|
public void setBtnContinue(final FButton btnContinue) {
|
||||||
this.btnContinue = btnContinue0;
|
this.btnContinue = btnContinue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {@link forge.gui.skin.FButton} btnRestart
|
* @return {@link forge.gui.skin.FButton} btnRestart
|
||||||
*/
|
*/
|
||||||
public FButton getBtnRestart() {
|
public FButton getBtnRestart() {
|
||||||
return btnRestart;
|
return this.btnRestart;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {@link forge.gui.skin.FButton} btnRestart
|
* @param btnRestart {@link forge.gui.skin.FButton}
|
||||||
*/
|
*/
|
||||||
public void setBtnRestart(FButton btnRestart0) {
|
public void setBtnRestart(final FButton btnRestart) {
|
||||||
this.btnRestart = btnRestart0;
|
this.btnRestart = btnRestart;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {@link forge.gui.skin.FButton} btnQuit
|
* @return {@link forge.gui.skin.FButton} btnQuit
|
||||||
*/
|
*/
|
||||||
public FButton getBtnQuit() {
|
public FButton getBtnQuit() {
|
||||||
return btnQuit;
|
return this.btnQuit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {@link forge.gui.skin.FButton} btnQuit
|
* @param btnQuit {@link forge.gui.skin.FButton}
|
||||||
*/
|
*/
|
||||||
public void setBtnQuit(FButton btnQuit0) {
|
public void setBtnQuit(final FButton btnQuit) {
|
||||||
this.btnQuit = btnQuit0;
|
this.btnQuit = btnQuit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The central panel in the win/lose screen, used for
|
* The central panel in the win/lose screen, used for presenting customized
|
||||||
* presenting customized messages and rewards.
|
* messages and rewards.
|
||||||
|
*
|
||||||
* @return {@link javax.swing.JPanel} pnlCustom
|
* @return {@link javax.swing.JPanel} pnlCustom
|
||||||
*/
|
*/
|
||||||
public JPanel getPnlCustom() {
|
public JPanel getPnlCustom() {
|
||||||
return pnlCustom;
|
return this.pnlCustom;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The central panel in the win/lose screen, used for
|
* The central panel in the win/lose screen, used for presenting customized
|
||||||
* presenting customized messages and rewards.
|
* messages and rewards.
|
||||||
* @param {@link javax.swing.JPanel} pnlCustom
|
*
|
||||||
|
* @param pnlCustom {@link javax.swing.JPanel}
|
||||||
*/
|
*/
|
||||||
public void setPnlCustom(JPanel pnlCustom0) {
|
public void setPnlCustom(final JPanel pnlCustom) {
|
||||||
this.pnlCustom = pnlCustom0;
|
this.pnlCustom = pnlCustom;
|
||||||
}
|
}
|
||||||
|
|
||||||
private class WinLoseBorder extends AbstractBorder {
|
private class WinLoseBorder extends AbstractBorder {
|
||||||
|
|||||||
Reference in New Issue
Block a user