mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 18:58:00 +00:00
Quick patch to prevent retrieving cards when you don't have enough shards
This commit is contained in:
@@ -6,7 +6,7 @@
|
|||||||
<packaging.type>jar</packaging.type>
|
<packaging.type>jar</packaging.type>
|
||||||
<build.min.memory>-Xms128m</build.min.memory>
|
<build.min.memory>-Xms128m</build.min.memory>
|
||||||
<build.max.memory>-Xmx1024m</build.max.memory>
|
<build.max.memory>-Xmx1024m</build.max.memory>
|
||||||
<alpha-version>1.5.51.001</alpha-version>
|
<alpha-version>1.5.51.002</alpha-version>
|
||||||
<sign.keystore>keystore</sign.keystore>
|
<sign.keystore>keystore</sign.keystore>
|
||||||
<sign.alias>alias</sign.alias>
|
<sign.alias>alias</sign.alias>
|
||||||
<sign.storepass>storepass</sign.storepass>
|
<sign.storepass>storepass</sign.storepass>
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ import forge.util.FileUtil;
|
|||||||
import forge.util.Utils;
|
import forge.util.Utils;
|
||||||
|
|
||||||
public class Forge implements ApplicationListener {
|
public class Forge implements ApplicationListener {
|
||||||
public static final String CURRENT_VERSION = "1.5.51.001";
|
public static final String CURRENT_VERSION = "1.5.51.002";
|
||||||
|
|
||||||
private static final ApplicationListener app = new Forge();
|
private static final ApplicationListener app = new Forge();
|
||||||
private static Clipboard clipboard;
|
private static Clipboard clipboard;
|
||||||
|
|||||||
@@ -258,8 +258,9 @@ public final class ConquestData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean exileCard(PaperCard card, int value) {
|
public boolean exileCard(PaperCard card, int value) {
|
||||||
|
final String title = "Exile Card";
|
||||||
if (planeswalker == card) {
|
if (planeswalker == card) {
|
||||||
SOptionPane.showMessageDialog("Current planeswalker cannot be exiled.", "Exile Card", SOptionPane.INFORMATION_ICON);
|
SOptionPane.showMessageDialog("Current planeswalker cannot be exiled.", title, SOptionPane.INFORMATION_ICON);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
String commandersUsingCard = "";
|
String commandersUsingCard = "";
|
||||||
@@ -267,7 +268,7 @@ public final class ConquestData {
|
|||||||
for (ConquestCommander commander : commanders) {
|
for (ConquestCommander commander : commanders) {
|
||||||
if (commander.getCard() == card) {
|
if (commander.getCard() == card) {
|
||||||
if (!commander.getDeck().getMain().isEmpty()) {
|
if (!commander.getDeck().getMain().isEmpty()) {
|
||||||
SOptionPane.showMessageDialog("Cannot exile a commander with a defined deck.", "Exile Card", SOptionPane.INFORMATION_ICON);
|
SOptionPane.showMessageDialog("Cannot exile a commander with a defined deck.", title, SOptionPane.INFORMATION_ICON);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
commanderBeingExiled = commander; //cache commander to make it easier to remove later
|
commanderBeingExiled = commander; //cache commander to make it easier to remove later
|
||||||
@@ -277,10 +278,10 @@ public final class ConquestData {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!commandersUsingCard.isEmpty()) {
|
if (!commandersUsingCard.isEmpty()) {
|
||||||
SOptionPane.showMessageDialog("Card is in use by the following commanders and cannot be exiled:\n" + commandersUsingCard, "Exile Card", SOptionPane.INFORMATION_ICON);
|
SOptionPane.showMessageDialog("Card is in use by the following commanders and cannot be exiled:\n" + commandersUsingCard, title, SOptionPane.INFORMATION_ICON);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (SOptionPane.showConfirmDialog("Exile the following card to receive {AE}" + value + "?\n\n" + card.getName(), "Exile Card", "OK", "Cancel")) {
|
if (SOptionPane.showConfirmDialog("Exile the following card to receive {AE}" + value + "?\n\n" + card.getName(), title, "OK", "Cancel")) {
|
||||||
if (exiledCards.add(card)) {
|
if (exiledCards.add(card)) {
|
||||||
if (commanderBeingExiled != null) {
|
if (commanderBeingExiled != null) {
|
||||||
commanders.remove(commanderBeingExiled);
|
commanders.remove(commanderBeingExiled);
|
||||||
@@ -294,7 +295,12 @@ public final class ConquestData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean retrieveCardFromExile(PaperCard card, int cost) {
|
public boolean retrieveCardFromExile(PaperCard card, int cost) {
|
||||||
if (SOptionPane.showConfirmDialog("Spend {AE}" + cost + " to retrieve the following card from exile?\n\n" + card.getName(), "Retrieve Card", "OK", "Cancel")) {
|
final String title = "Retrieve Card";
|
||||||
|
if (aetherShards < cost) {
|
||||||
|
SOptionPane.showMessageDialog("Not enough shards to retrieve card.", title, SOptionPane.INFORMATION_ICON);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (SOptionPane.showConfirmDialog("Spend {AE}" + cost + " to retrieve the following card from exile?\n\n" + card.getName(), title, "OK", "Cancel")) {
|
||||||
if (exiledCards.remove(card)) {
|
if (exiledCards.remove(card)) {
|
||||||
if (card.getRules().canBeCommander()) { //add back commander for card if needed
|
if (card.getRules().canBeCommander()) { //add back commander for card if needed
|
||||||
commanders.add(new ConquestCommander(card));
|
commanders.add(new ConquestCommander(card));
|
||||||
|
|||||||
Reference in New Issue
Block a user