mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 20:58:03 +00:00
checkstyle and refactor
This commit is contained in:
@@ -2186,7 +2186,7 @@ public class CombatUtil {
|
||||
// we have to have cards like glorious anthem take
|
||||
// effect immediately:
|
||||
for (String effect : AllZone.getStaticEffects().getStateBasedMap().keySet()) {
|
||||
Command com = GameActionUtil.commands.get(effect);
|
||||
Command com = GameActionUtil.getCommands().get(effect);
|
||||
com.execute();
|
||||
}
|
||||
|
||||
|
||||
@@ -67,8 +67,8 @@ public class EndOfTurn implements java.io.Serializable {
|
||||
// Pyrohemia and Pestilence
|
||||
CardList all = AllZoneUtil.getCardsIn(Zone.Battlefield);
|
||||
|
||||
GameActionUtil.endOfTurn_Wall_Of_Reverence();
|
||||
GameActionUtil.endOfTurn_Lighthouse_Chronologist();
|
||||
GameActionUtil.endOfTurnWallOfReverence();
|
||||
GameActionUtil.endOfTurnLighthouseChronologist();
|
||||
|
||||
// reset mustAttackEntity for me
|
||||
AllZone.getPhase().getPlayerTurn().setMustAttackEntity(null);
|
||||
|
||||
@@ -840,7 +840,7 @@ public class GameAction {
|
||||
|
||||
// card state effects like Glorious Anthem
|
||||
for (String effect : AllZone.getStaticEffects().getStateBasedMap().keySet()) {
|
||||
Command com = GameActionUtil.commands.get(effect);
|
||||
Command com = GameActionUtil.getCommands().get(effect);
|
||||
com.execute();
|
||||
}
|
||||
|
||||
@@ -946,7 +946,7 @@ public class GameAction {
|
||||
destroyLegendaryCreatures();
|
||||
destroyPlaneswalkers();
|
||||
|
||||
GameActionUtil.stLandManaAbilities.execute();
|
||||
GameActionUtil.getStLandManaAbilities().execute();
|
||||
|
||||
if (!refreeze) {
|
||||
AllZone.getStack().unfreezeStack();
|
||||
|
||||
@@ -45,8 +45,8 @@ public final class GameActionUtil {
|
||||
// (called in MagicStack.java)
|
||||
Card c = sa.getSourceCard();
|
||||
|
||||
playCard_Cascade(c);
|
||||
playCard_Ripple(c);
|
||||
playCardCascade(c);
|
||||
playCardRipple(c);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -57,7 +57,7 @@ public final class GameActionUtil {
|
||||
* @param c
|
||||
* a {@link forge.Card} object.
|
||||
*/
|
||||
public static void playCard_Cascade(final Card c) {
|
||||
public static void playCardCascade(final Card c) {
|
||||
Command cascade = new Command() {
|
||||
private static final long serialVersionUID = -845154812215847505L;
|
||||
|
||||
@@ -174,7 +174,7 @@ public final class GameActionUtil {
|
||||
* @param c
|
||||
* a {@link forge.Card} object.
|
||||
*/
|
||||
public static void playCard_Ripple(final Card c) {
|
||||
public static void playCardRipple(final Card c) {
|
||||
Command ripple = new Command() {
|
||||
private static final long serialVersionUID = -845154812215847505L;
|
||||
|
||||
@@ -323,7 +323,7 @@ public final class GameActionUtil {
|
||||
* endOfTurn_Wall_Of_Reverence.
|
||||
* </p>
|
||||
*/
|
||||
public static void endOfTurn_Wall_Of_Reverence() {
|
||||
public static void endOfTurnWallOfReverence() {
|
||||
final Player player = AllZone.getPhase().getPlayerTurn();
|
||||
CardList list = player.getCardsIn(Zone.Battlefield, "Wall of Reverence");
|
||||
|
||||
@@ -371,7 +371,7 @@ public final class GameActionUtil {
|
||||
* endOfTurn_Lighthouse_Chronologist.
|
||||
* </p>
|
||||
*/
|
||||
public static void endOfTurn_Lighthouse_Chronologist() {
|
||||
public static void endOfTurnLighthouseChronologist() {
|
||||
final Player player = AllZone.getPhase().getPlayerTurn();
|
||||
final Player opponent = player.getOpponent();
|
||||
CardList list = opponent.getCardsIn(Zone.Battlefield);
|
||||
@@ -534,7 +534,7 @@ public final class GameActionUtil {
|
||||
*/
|
||||
public static void executeLandfallEffects(final Card c) {
|
||||
if (c.getName().equals("Lotus Cobra")) {
|
||||
landfall_Lotus_Cobra(c);
|
||||
landfallLotusCobra(c);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -570,7 +570,7 @@ public final class GameActionUtil {
|
||||
* @param c
|
||||
* a {@link forge.Card} object.
|
||||
*/
|
||||
private static void landfall_Lotus_Cobra(final Card c) {
|
||||
private static void landfallLotusCobra(final Card c) {
|
||||
Ability ability = new Ability(c, "0") {
|
||||
@Override
|
||||
public void resolve() {
|
||||
@@ -825,7 +825,7 @@ public final class GameActionUtil {
|
||||
}
|
||||
|
||||
if (c.getName().equals("Whirling Dervish") || c.getName().equals("Dunerider Outlaw")) {
|
||||
playerCombatDamage_Whirling_Dervish(c);
|
||||
playerCombatDamageWhirlingDervish(c);
|
||||
}
|
||||
|
||||
if (player.isPlayer(AllZone.getHumanPlayer())) {
|
||||
@@ -917,18 +917,18 @@ public final class GameActionUtil {
|
||||
|
||||
if (CardFactoryUtil.hasNumberEquipments(c, "Quietus Spike") > 0 && c.getNetAttack() > 0) {
|
||||
for (int k = 0; k < CardFactoryUtil.hasNumberEquipments(c, "Quietus Spike"); k++) {
|
||||
playerCombatDamage_lose_halflife_up(c);
|
||||
playerCombatDamageLoseHalfLifeUp(c);
|
||||
}
|
||||
}
|
||||
|
||||
if (c.getName().equals("Scalpelexis")) {
|
||||
playerCombatDamage_Scalpelexis(c);
|
||||
playerCombatDamageScalpelexis(c);
|
||||
} else if (c.getName().equals("Spawnwrithe")) {
|
||||
playerCombatDamage_Spawnwrithe(c);
|
||||
playerCombatDamageSpawnwrithe(c);
|
||||
} else if (c.getName().equals("Treva, the Renewer")) {
|
||||
playerCombatDamage_Treva(c);
|
||||
playerCombatDamageTreva(c);
|
||||
} else if (c.isEnchantedBy("Celestial Mantle")) {
|
||||
execute_Celestial_Mantle(c);
|
||||
executeCelestialMantle(c);
|
||||
}
|
||||
|
||||
} // executeCombatDamageToPlayerEffects
|
||||
@@ -941,7 +941,7 @@ public final class GameActionUtil {
|
||||
* @param enchanted
|
||||
* a {@link forge.Card} object.
|
||||
*/
|
||||
private static void execute_Celestial_Mantle(final Card enchanted) {
|
||||
private static void executeCelestialMantle(final Card enchanted) {
|
||||
ArrayList<Card> auras = enchanted.getEnchantedBy();
|
||||
for (final Card aura : auras) {
|
||||
if (aura.getName().equals("Celestial Mantle")) {
|
||||
@@ -968,7 +968,7 @@ public final class GameActionUtil {
|
||||
* @param c
|
||||
* a {@link forge.Card} object.
|
||||
*/
|
||||
private static void playerCombatDamage_Treva(final Card c) {
|
||||
private static void playerCombatDamageTreva(final Card c) {
|
||||
SpellAbility[] sa = c.getSpellAbility();
|
||||
if (c.getController().isHuman()) {
|
||||
AllZone.getGameAction().playSpellAbility(sa[1]);
|
||||
@@ -986,7 +986,7 @@ public final class GameActionUtil {
|
||||
* @param c
|
||||
* a {@link forge.Card} object.
|
||||
*/
|
||||
private static void playerCombatDamage_Whirling_Dervish(final Card c) {
|
||||
private static void playerCombatDamageWhirlingDervish(final Card c) {
|
||||
final int power = c.getNetAttack();
|
||||
final Card card = c;
|
||||
|
||||
@@ -1023,7 +1023,7 @@ public final class GameActionUtil {
|
||||
* @param c
|
||||
* a {@link forge.Card} object.
|
||||
*/
|
||||
private static void playerCombatDamage_lose_halflife_up(final Card c) {
|
||||
private static void playerCombatDamageLoseHalfLifeUp(final Card c) {
|
||||
final Player player = c.getController();
|
||||
final Player opponent = player.getOpponent();
|
||||
final Card fCard = c;
|
||||
@@ -1075,7 +1075,7 @@ public final class GameActionUtil {
|
||||
* @param c
|
||||
* a {@link forge.Card} object.
|
||||
*/
|
||||
private static void playerCombatDamage_Scalpelexis(final Card c) {
|
||||
private static void playerCombatDamageScalpelexis(final Card c) {
|
||||
final Player player = c.getController();
|
||||
final Player opponent = player.getOpponent();
|
||||
|
||||
@@ -1155,7 +1155,7 @@ public final class GameActionUtil {
|
||||
* @param c
|
||||
* a {@link forge.Card} object.
|
||||
*/
|
||||
private static void playerCombatDamage_Spawnwrithe(final Card c) {
|
||||
private static void playerCombatDamageSpawnwrithe(final Card c) {
|
||||
final Player player = c.getController();
|
||||
final Card crd = c;
|
||||
|
||||
@@ -1182,10 +1182,10 @@ public final class GameActionUtil {
|
||||
}
|
||||
|
||||
/** Constant <code>Elspeth_Emblem</code>. */
|
||||
public static Command Elspeth_Emblem = new Command() {
|
||||
private static Command elspethEmblem = new Command() {
|
||||
|
||||
private static final long serialVersionUID = 7414127991531889390L;
|
||||
CardList gloriousAnthemList = new CardList();
|
||||
private CardList gloriousAnthemList = new CardList();
|
||||
|
||||
public void execute() {
|
||||
String keyword = "Indestructible";
|
||||
@@ -1449,7 +1449,7 @@ public final class GameActionUtil {
|
||||
}
|
||||
|
||||
/** Constant <code>stLandManaAbilities</code>. */
|
||||
public static Command stLandManaAbilities = new Command() {
|
||||
private static Command stLandManaAbilities = new Command() {
|
||||
private static final long serialVersionUID = 8005448956536998277L;
|
||||
|
||||
public void execute() {
|
||||
@@ -1529,10 +1529,10 @@ public final class GameActionUtil {
|
||||
}; // stLandManaAbilities
|
||||
|
||||
/** Constant <code>Coat_of_Arms</code>. */
|
||||
public static Command Coat_of_Arms = new Command() {
|
||||
private static Command coatOfArms = new Command() {
|
||||
private static final long serialVersionUID = 583505612126735693L;
|
||||
|
||||
CardList gloriousAnthemList = new CardList();
|
||||
private CardList gloriousAnthemList = new CardList();
|
||||
|
||||
public void execute() {
|
||||
CardList list = gloriousAnthemList;
|
||||
@@ -1580,7 +1580,7 @@ public final class GameActionUtil {
|
||||
} // execute
|
||||
}; // Coat of Arms
|
||||
|
||||
private static Command Alpha_Status = new Command() {
|
||||
private static Command alphaStatus = new Command() {
|
||||
private static final long serialVersionUID = -3213793711304934358L;
|
||||
|
||||
private CardList previouslyPumped = new CardList();
|
||||
@@ -1743,7 +1743,7 @@ public final class GameActionUtil {
|
||||
}; // Liu_Bei
|
||||
|
||||
/** Constant <code>Sound_the_Call_Wolf</code>. */
|
||||
public static Command Sound_the_Call_Wolf = new Command() {
|
||||
private static Command soundTheCallWolf = new Command() {
|
||||
private static final long serialVersionUID = 4614281706799537283L;
|
||||
|
||||
public void execute() {
|
||||
@@ -1848,9 +1848,9 @@ public final class GameActionUtil {
|
||||
};
|
||||
|
||||
/** Constant <code>Muraganda_Petroglyphs</code>. */
|
||||
public static Command Muraganda_Petroglyphs = new Command() {
|
||||
private static Command muragandaPetroglyphs = new Command() {
|
||||
private static final long serialVersionUID = -6715848091817213517L;
|
||||
CardList gloriousAnthemList = new CardList();
|
||||
private CardList gloriousAnthemList = new CardList();
|
||||
|
||||
public void execute() {
|
||||
CardList list = gloriousAnthemList;
|
||||
@@ -1914,27 +1914,27 @@ public final class GameActionUtil {
|
||||
}
|
||||
|
||||
/** Constant <code>commands</code>. */
|
||||
public static HashMap<String, Command> commands = new HashMap<String, Command>();
|
||||
private static HashMap<String, Command> commands = new HashMap<String, Command>();
|
||||
|
||||
static {
|
||||
// Please add cards in alphabetical order so they are easier to find
|
||||
|
||||
commands.put("Ajani_Avatar_Token", ajaniAvatarToken);
|
||||
commands.put("Alpha_Status", Alpha_Status);
|
||||
commands.put("Coat_of_Arms", Coat_of_Arms);
|
||||
commands.put("Elspeth_Emblem", Elspeth_Emblem);
|
||||
commands.put("Homarid", homarid);
|
||||
getCommands().put("Ajani_Avatar_Token", ajaniAvatarToken);
|
||||
getCommands().put("Alpha_Status", alphaStatus);
|
||||
getCommands().put("Coat_of_Arms", coatOfArms);
|
||||
getCommands().put("Elspeth_Emblem", elspethEmblem);
|
||||
getCommands().put("Homarid", homarid);
|
||||
|
||||
commands.put("Liu_Bei", liuBei);
|
||||
getCommands().put("Liu_Bei", liuBei);
|
||||
|
||||
commands.put("Muraganda_Petroglyphs", Muraganda_Petroglyphs);
|
||||
getCommands().put("Muraganda_Petroglyphs", muragandaPetroglyphs);
|
||||
|
||||
commands.put("Old_Man_of_the_Sea", oldManOfTheSea);
|
||||
getCommands().put("Old_Man_of_the_Sea", oldManOfTheSea);
|
||||
|
||||
commands.put("Sound_the_Call_Wolf", Sound_the_Call_Wolf);
|
||||
commands.put("Tarmogoyf", tarmogoyf);
|
||||
getCommands().put("Sound_the_Call_Wolf", soundTheCallWolf);
|
||||
getCommands().put("Tarmogoyf", tarmogoyf);
|
||||
|
||||
commands.put("Umbra_Stalker", umbraStalker);
|
||||
getCommands().put("Umbra_Stalker", umbraStalker);
|
||||
|
||||
// /The commands above are in alphabetical order by cardname.
|
||||
}
|
||||
@@ -1964,4 +1964,32 @@ public final class GameActionUtil {
|
||||
p.getManaPool().clearPool();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the commands
|
||||
*/
|
||||
public static HashMap<String, Command> getCommands() {
|
||||
return commands;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param commands the commands to set
|
||||
*/
|
||||
public static void setCommands(HashMap<String, Command> commands) {
|
||||
GameActionUtil.commands = commands; // TODO: Add 0 to parameter's name.
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the stLandManaAbilities
|
||||
*/
|
||||
public static Command getStLandManaAbilities() {
|
||||
return stLandManaAbilities;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param stLandManaAbilities the stLandManaAbilities to set
|
||||
*/
|
||||
public static void setStLandManaAbilities(Command stLandManaAbilities) {
|
||||
GameActionUtil.stLandManaAbilities = stLandManaAbilities; // TODO: Add 0 to parameter's name.
|
||||
}
|
||||
|
||||
} // end class GameActionUtil
|
||||
|
||||
@@ -541,8 +541,8 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
||||
if (c != null) {
|
||||
|
||||
if (c.isTapped()
|
||||
&& (inputControl.input instanceof Input_PayManaCost
|
||||
|| inputControl.input instanceof Input_PayManaCost_Ability)) {
|
||||
&& (inputControl.getInput() instanceof Input_PayManaCost
|
||||
|| inputControl.getInput() instanceof Input_PayManaCost_Ability)) {
|
||||
arcane.ui.CardPanel cardPanel = playerPlayPanel.getCardPanel(c.getUniqueNumber());
|
||||
for (arcane.ui.CardPanel cp : cardPanel.getAttachedPanels()) {
|
||||
if (cp.getCard().isUntapped()) {
|
||||
@@ -553,7 +553,7 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
||||
|
||||
CardList att = new CardList(AllZone.getCombat().getAttackers());
|
||||
if ((c.isTapped() || c.hasSickness() || ((c.hasKeyword("Vigilance")) && att.contains(c)))
|
||||
&& (inputControl.input instanceof Input_Attack)) {
|
||||
&& (inputControl.getInput() instanceof Input_Attack)) {
|
||||
arcane.ui.CardPanel cardPanel = playerPlayPanel.getCardPanel(c.getUniqueNumber());
|
||||
for (arcane.ui.CardPanel cp : cardPanel.getAttachedPanels()) {
|
||||
if (cp.getCard().isUntapped() && !cp.getCard().hasSickness()) {
|
||||
@@ -563,15 +563,15 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
||||
}
|
||||
|
||||
if (e.isMetaDown()) {
|
||||
if (att.contains(c) && (inputControl.input instanceof Input_Attack)
|
||||
if (att.contains(c) && (inputControl.getInput() instanceof Input_Attack)
|
||||
&& !c.hasKeyword("CARDNAME attacks each turn if able.")) {
|
||||
c.untap();
|
||||
AllZone.getCombat().removeFromCombat(c);
|
||||
} else if (inputControl.input instanceof Input_Block) {
|
||||
} else if (inputControl.getInput() instanceof Input_Block) {
|
||||
if (c.getController().isHuman()) {
|
||||
AllZone.getCombat().removeFromCombat(c);
|
||||
}
|
||||
((Input_Block) inputControl.input).removeFromAllBlocking(c);
|
||||
((Input_Block) inputControl.getInput()).removeFromAllBlocking(c);
|
||||
}
|
||||
} else {
|
||||
inputControl.selectCard(c, AllZone.getHumanPlayer().getZone(Zone.Battlefield));
|
||||
|
||||
@@ -49,7 +49,7 @@ public class GuiDownloadQuestImages extends GuiDownloader {
|
||||
File file;
|
||||
File dir = ForgeProps.getFile(QUEST.OPPONENT_DIR);
|
||||
for (int i = 0; i < questOpponents.length; i++) {
|
||||
file = new File(dir, questOpponents[i].name.replace("%20", " "));
|
||||
file = new File(dir, questOpponents[i].getName().replace("%20", " "));
|
||||
if (!file.exists()) {
|
||||
urls.add(questOpponents[i]);
|
||||
}
|
||||
@@ -57,7 +57,7 @@ public class GuiDownloadQuestImages extends GuiDownloader {
|
||||
|
||||
dir = ForgeProps.getFile(PICS_BOOSTER);
|
||||
for (int i = 0; i < boosterImages.length; i++) {
|
||||
file = new File(dir, boosterImages[i].name.replace("%20", " "));
|
||||
file = new File(dir, boosterImages[i].getName().replace("%20", " "));
|
||||
if (!file.exists()) {
|
||||
urls.add(boosterImages[i]);
|
||||
}
|
||||
@@ -65,7 +65,7 @@ public class GuiDownloadQuestImages extends GuiDownloader {
|
||||
|
||||
dir = ForgeProps.getFile(IMAGE_ICON);
|
||||
for (int i = 0; i < petIcons.length; i++) {
|
||||
file = new File(dir, petIcons[i].name.replace("%20", " "));
|
||||
file = new File(dir, petIcons[i].getName().replace("%20", " "));
|
||||
if (!file.exists()) {
|
||||
urls.add(petIcons[i]);
|
||||
}
|
||||
@@ -73,7 +73,7 @@ public class GuiDownloadQuestImages extends GuiDownloader {
|
||||
|
||||
dir = ForgeProps.getFile(IMAGE_TOKEN);
|
||||
for (int i = 0; i < questPets.length; i++) {
|
||||
file = new File(dir, questPets[i].name.replace("%20", " "));
|
||||
file = new File(dir, questPets[i].getName().replace("%20", " "));
|
||||
if (!file.exists()) {
|
||||
urls.add(questPets[i]);
|
||||
}
|
||||
|
||||
@@ -59,42 +59,42 @@ public abstract class GuiDownloader extends DefaultBoundedRangeModel implements
|
||||
private static final long serialVersionUID = -8596808503046590349L;
|
||||
|
||||
/** Constant <code>types</code>. */
|
||||
public static final Proxy.Type[] types = Proxy.Type.values();
|
||||
public static final Proxy.Type[] TYPES = Proxy.Type.values();
|
||||
|
||||
// proxy
|
||||
/** The type. */
|
||||
protected int type;
|
||||
private int type;
|
||||
|
||||
/** The port. */
|
||||
protected JTextField addr, port;
|
||||
private JTextField addr, port;
|
||||
|
||||
// progress
|
||||
/** The cards. */
|
||||
protected DownloadObject[] cards;
|
||||
private DownloadObject[] cards;
|
||||
|
||||
/** The card. */
|
||||
protected int card;
|
||||
private int card;
|
||||
|
||||
/** The cancel. */
|
||||
protected boolean cancel;
|
||||
private boolean cancel;
|
||||
|
||||
/** The bar. */
|
||||
protected JProgressBar bar;
|
||||
private JProgressBar bar;
|
||||
|
||||
/** The dlg. */
|
||||
protected JOptionPane dlg;
|
||||
private JOptionPane dlg;
|
||||
|
||||
/** The close. */
|
||||
protected JButton close;
|
||||
private JButton close;
|
||||
|
||||
/** The times. */
|
||||
protected long[] times = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
private long[] times = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
|
||||
/** The tptr. */
|
||||
protected int tptr = 0;
|
||||
private int tptr = 0;
|
||||
|
||||
/** The l time. */
|
||||
protected long lTime = System.currentTimeMillis();
|
||||
private long lTime = System.currentTimeMillis();
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -156,7 +156,7 @@ public abstract class GuiDownloader extends DefaultBoundedRangeModel implements
|
||||
ButtonGroup bg = new ButtonGroup();
|
||||
String[] labels = { ForgeProps.getLocalized(NO_PROXY), ForgeProps.getLocalized(HTTP_PROXY),
|
||||
ForgeProps.getLocalized(SOCKS_PROXY) };
|
||||
for (int i = 0; i < types.length; i++) {
|
||||
for (int i = 0; i < TYPES.length; i++) {
|
||||
JRadioButton rb = new JRadioButton(labels[i]);
|
||||
rb.addChangeListener(new ProxyHandler(i));
|
||||
bg.add(rb);
|
||||
@@ -194,7 +194,8 @@ public abstract class GuiDownloader extends DefaultBoundedRangeModel implements
|
||||
bar.setPreferredSize(d);
|
||||
|
||||
// JOptionPane
|
||||
Object[] options = { b, close = new JButton(ForgeProps.getLocalized(BUTTONS.CANCEL)) };
|
||||
close = new JButton(ForgeProps.getLocalized(BUTTONS.CANCEL));
|
||||
Object[] options = { b, close };
|
||||
dlg = new JOptionPane(p0, DEFAULT_OPTION, PLAIN_MESSAGE, null, options, options[1]);
|
||||
|
||||
JDialog jdlg = getDlg(frame);
|
||||
@@ -238,13 +239,26 @@ public abstract class GuiDownloader extends DefaultBoundedRangeModel implements
|
||||
private void update(final int card) {
|
||||
this.card = card;
|
||||
|
||||
/**
|
||||
*
|
||||
* TODO: Write javadoc for this type.
|
||||
*
|
||||
*/
|
||||
final class Worker implements Runnable {
|
||||
private int card;
|
||||
|
||||
/**
|
||||
*
|
||||
* TODO: Write javadoc for Constructor.
|
||||
* @param card int
|
||||
*/
|
||||
Worker(final int card) {
|
||||
this.card = card;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public void run() {
|
||||
fireStateChanged();
|
||||
|
||||
@@ -331,7 +345,7 @@ public abstract class GuiDownloader extends DefaultBoundedRangeModel implements
|
||||
p = Proxy.NO_PROXY;
|
||||
} else {
|
||||
try {
|
||||
p = new Proxy(types[type], new InetSocketAddress(addr.getText(), parseInt(port.getText())));
|
||||
p = new Proxy(TYPES[type], new InetSocketAddress(addr.getText(), parseInt(port.getText())));
|
||||
} catch (Exception ex) {
|
||||
ErrorViewer
|
||||
.showError(ex, ForgeProps.getLocalized(ERRORS.PROXY_CONNECT), addr.getText(), port.getText());
|
||||
@@ -346,7 +360,7 @@ public abstract class GuiDownloader extends DefaultBoundedRangeModel implements
|
||||
try {
|
||||
String url = cards[card].url;
|
||||
String cName;
|
||||
cName = cards[card].name;
|
||||
cName = cards[card].getName();
|
||||
cName = cName.replace("%20", " ");
|
||||
|
||||
File base = new File(cards[card].dir);
|
||||
@@ -375,10 +389,10 @@ public abstract class GuiDownloader extends DefaultBoundedRangeModel implements
|
||||
f.delete();
|
||||
|
||||
return;
|
||||
}// if - cancel
|
||||
} // if - cancel
|
||||
|
||||
out.write(buf, 0, len);
|
||||
}// while - read and write file
|
||||
} // while - read and write file
|
||||
|
||||
in.close();
|
||||
out.flush();
|
||||
@@ -386,10 +400,10 @@ public abstract class GuiDownloader extends DefaultBoundedRangeModel implements
|
||||
} catch (ConnectException ce) {
|
||||
System.out.println("Connection refused for url: " + url);
|
||||
} catch (MalformedURLException mURLe) {
|
||||
System.out.println("Error - possibly missing URL for: " + cards[card].name);
|
||||
System.out.println("Error - possibly missing URL for: " + cards[card].getName());
|
||||
}
|
||||
} catch (FileNotFoundException fnfe) {
|
||||
System.out.println("Error - the LQ picture for " + cards[card].name
|
||||
System.out.println("Error - the LQ picture for " + cards[card].getName()
|
||||
+ " could not be found on the server. [" + cards[card].url + "] - " + fnfe.getMessage());
|
||||
} catch (Exception ex) {
|
||||
Log.error("LQ Pictures", "Error downloading pictures", ex);
|
||||
@@ -401,10 +415,10 @@ public abstract class GuiDownloader extends DefaultBoundedRangeModel implements
|
||||
} catch (InterruptedException e) {
|
||||
Log.error("GuiDownloader", "Sleep Error", e);
|
||||
}
|
||||
}// for
|
||||
} // for
|
||||
}
|
||||
close.setText(ForgeProps.getLocalized(BUTTONS.CLOSE));
|
||||
}// run
|
||||
} // run
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -458,7 +472,7 @@ public abstract class GuiDownloader extends DefaultBoundedRangeModel implements
|
||||
ErrorViewer.showError(ex, "GuiDownloader: readFile() error");
|
||||
throw new RuntimeException("GuiDownloader : readFile() error");
|
||||
}
|
||||
}// readFile()
|
||||
} // readFile()
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -510,7 +524,7 @@ public abstract class GuiDownloader extends DefaultBoundedRangeModel implements
|
||||
ErrorViewer.showError(ex, "GuiDownloader: readFile() error");
|
||||
throw new RuntimeException("GuiDownloader : readFile() error");
|
||||
}
|
||||
}// readFile()
|
||||
} // readFile()
|
||||
|
||||
/**
|
||||
* The Class ProxyHandler.
|
||||
@@ -534,6 +548,9 @@ public abstract class GuiDownloader extends DefaultBoundedRangeModel implements
|
||||
* @see javax.swing.event.ChangeListener#stateChanged(javax.swing.event.
|
||||
* ChangeEvent)
|
||||
*/
|
||||
/**
|
||||
* @param e ChangeEvent
|
||||
*/
|
||||
public final void stateChanged(final ChangeEvent e) {
|
||||
if (((AbstractButton) e.getSource()).isSelected()) {
|
||||
GuiDownloader.this.type = type;
|
||||
@@ -549,13 +566,13 @@ public abstract class GuiDownloader extends DefaultBoundedRangeModel implements
|
||||
protected static class DownloadObject {
|
||||
|
||||
/** The name. */
|
||||
public final String name;
|
||||
private final String name;
|
||||
|
||||
/** The url. */
|
||||
public final String url;
|
||||
private final String url;
|
||||
|
||||
/** The dir. */
|
||||
public final String dir;
|
||||
private final String dir;
|
||||
|
||||
/**
|
||||
* Instantiates a new download object.
|
||||
@@ -573,5 +590,12 @@ public abstract class GuiDownloader extends DefaultBoundedRangeModel implements
|
||||
dir = dirIn;
|
||||
// System.out.println("Created download object: "+name+" "+url+" "+dir);
|
||||
}
|
||||
}// DownloadObject
|
||||
|
||||
/**
|
||||
* @return the name
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
} // DownloadObject
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ import forge.gui.input.Input;
|
||||
public class GuiInput extends MyObservable implements Observer {
|
||||
|
||||
/** The input. */
|
||||
Input input;
|
||||
private Input input;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -56,7 +56,7 @@ public class GuiInput extends MyObservable implements Observer {
|
||||
* </p>
|
||||
*/
|
||||
public final void showMessage() {
|
||||
input.showMessage();
|
||||
getInput().showMessage();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -65,7 +65,7 @@ public class GuiInput extends MyObservable implements Observer {
|
||||
* </p>
|
||||
*/
|
||||
public final void selectButtonOK() {
|
||||
input.selectButtonOK();
|
||||
getInput().selectButtonOK();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -74,7 +74,7 @@ public class GuiInput extends MyObservable implements Observer {
|
||||
* </p>
|
||||
*/
|
||||
public final void selectButtonCancel() {
|
||||
input.selectButtonCancel();
|
||||
getInput().selectButtonCancel();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -86,7 +86,7 @@ public class GuiInput extends MyObservable implements Observer {
|
||||
* a {@link forge.Player} object.
|
||||
*/
|
||||
public final void selectPlayer(final Player player) {
|
||||
input.selectPlayer(player);
|
||||
getInput().selectPlayer(player);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -100,12 +100,19 @@ public class GuiInput extends MyObservable implements Observer {
|
||||
* a {@link forge.PlayerZone} object.
|
||||
*/
|
||||
public final void selectCard(final Card card, final PlayerZone zone) {
|
||||
input.selectCard(card, zone);
|
||||
getInput().selectCard(card, zone);
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final String toString() {
|
||||
return input.toString();
|
||||
return getInput().toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the input
|
||||
*/
|
||||
public Input getInput() {
|
||||
return input;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ public class Gui_DownloadPictures_LQ extends GuiDownloader {
|
||||
DownloadObject[] cardPlay = cList.toArray(a);
|
||||
// check to see which cards we already have
|
||||
for (int i = 0; i < cardPlay.length; i++) {
|
||||
file = new File(base, cardPlay[i].name);
|
||||
file = new File(base, cardPlay[i].getName());
|
||||
if (!file.exists()) {
|
||||
list.add(cardPlay[i]);
|
||||
}
|
||||
@@ -72,7 +72,7 @@ public class Gui_DownloadPictures_LQ extends GuiDownloader {
|
||||
// add missing tokens to the list of things to download
|
||||
File filebase = ForgeProps.getFile(IMAGE_TOKEN);
|
||||
for (int i = 0; i < cardTokenLQ.length; i++) {
|
||||
file = new File(filebase, cardTokenLQ[i].name);
|
||||
file = new File(filebase, cardTokenLQ[i].getName());
|
||||
if (!file.exists()) {
|
||||
list.add(cardTokenLQ[i]);
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ public class Gui_DownloadSetPictures_LQ extends GuiDownloader {
|
||||
File file;
|
||||
File filebase = ForgeProps.getFile(IMAGE_TOKEN);
|
||||
for (int i = 0; i < cardTokenLQ.length; i++) {
|
||||
file = new File(filebase, cardTokenLQ[i].name);
|
||||
file = new File(filebase, cardTokenLQ[i].getName());
|
||||
if (!file.exists()) {
|
||||
cList.add(cardTokenLQ[i]);
|
||||
}
|
||||
|
||||
@@ -11,13 +11,13 @@ package forge;
|
||||
public class HandSizeOp {
|
||||
|
||||
/** The Mode. */
|
||||
public String Mode;
|
||||
private String mode;
|
||||
|
||||
/** The hs time stamp. */
|
||||
public int hsTimeStamp;
|
||||
private int hsTimeStamp;
|
||||
|
||||
/** The Amount. */
|
||||
public int Amount;
|
||||
private int amount;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -32,9 +32,9 @@ public class HandSizeOp {
|
||||
* a int.
|
||||
*/
|
||||
public HandSizeOp(final String m, final int a, final int ts) {
|
||||
Mode = m;
|
||||
Amount = a;
|
||||
hsTimeStamp = ts;
|
||||
setMode(m);
|
||||
setAmount(a);
|
||||
setHsTimeStamp(ts);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -45,6 +45,48 @@ public class HandSizeOp {
|
||||
* @return a {@link java.lang.String} object.
|
||||
*/
|
||||
public final String toString() {
|
||||
return "Mode(" + Mode + ") Amount(" + Amount + ") Timestamp(" + hsTimeStamp + ")";
|
||||
return "Mode(" + getMode() + ") Amount(" + getAmount() + ") Timestamp(" + getHsTimeStamp() + ")";
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the amount
|
||||
*/
|
||||
public int getAmount() {
|
||||
return amount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param amount the amount to set
|
||||
*/
|
||||
public void setAmount(int amount) {
|
||||
this.amount = amount; // TODO: Add 0 to parameter's name.
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the mode
|
||||
*/
|
||||
public String getMode() {
|
||||
return mode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mode the mode to set
|
||||
*/
|
||||
public void setMode(String mode) {
|
||||
this.mode = mode; // TODO: Add 0 to parameter's name.
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the hsTimeStamp
|
||||
*/
|
||||
public int getHsTimeStamp() {
|
||||
return hsTimeStamp;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param hsTimeStamp the hsTimeStamp to set
|
||||
*/
|
||||
public void setHsTimeStamp(int hsTimeStamp) {
|
||||
this.hsTimeStamp = hsTimeStamp; // TODO: Add 0 to parameter's name.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ import java.net.URL;
|
||||
*/
|
||||
public class HttpUtil {
|
||||
|
||||
private static final String Boundary = "--7d021a37605f0";
|
||||
private static final String BOUNDARY = "--7d021a37605f0";
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -52,7 +52,7 @@ public class HttpUtil {
|
||||
theUrlConnection.setUseCaches(false);
|
||||
theUrlConnection.setChunkedStreamingMode(1024);
|
||||
|
||||
theUrlConnection.setRequestProperty("Content-Type", "multipart/form-data; boundary=" + Boundary);
|
||||
theUrlConnection.setRequestProperty("Content-Type", "multipart/form-data; boundary=" + BOUNDARY);
|
||||
|
||||
DataOutputStream httpOut = null;
|
||||
try {
|
||||
@@ -62,7 +62,7 @@ public class HttpUtil {
|
||||
}
|
||||
|
||||
File f = new File(file);
|
||||
String str = "--" + Boundary + "\r\n" + "Content-Disposition: form-data;name=\"data\"; filename=\""
|
||||
String str = "--" + BOUNDARY + "\r\n" + "Content-Disposition: form-data;name=\"data\"; filename=\""
|
||||
+ f.getName() + "\"\r\n" + "Content-Type: text/plain\r\n\r\n";
|
||||
|
||||
try {
|
||||
@@ -92,7 +92,7 @@ public class HttpUtil {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
httpOut.write(("--" + Boundary + "--\r\n").getBytes());
|
||||
httpOut.write(("--" + BOUNDARY + "--\r\n").getBytes());
|
||||
} catch (IOException e) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -152,6 +152,9 @@ public class HumanPlayer extends Player {
|
||||
*
|
||||
* @see forge.Player#discard_Chains_of_Mephistopheles()
|
||||
*/
|
||||
/**
|
||||
*
|
||||
*/
|
||||
protected final void discardChainsOfMephistopheles() {
|
||||
AllZone.getInputControl().setInput(PlayerUtil.input_chainsDiscard(), true);
|
||||
}
|
||||
@@ -220,4 +223,4 @@ public class HumanPlayer extends Player {
|
||||
}
|
||||
}
|
||||
|
||||
}// end HumanPlayer class
|
||||
} // end HumanPlayer class
|
||||
|
||||
@@ -43,7 +43,7 @@ import forge.properties.NewConstants;
|
||||
*/
|
||||
public class ImageCache implements NewConstants {
|
||||
/** Constant <code>imageCache</code>. */
|
||||
private static final Map<String, BufferedImage> imageCache;
|
||||
private static final Map<String, BufferedImage> IMAGE_CACHE;
|
||||
/** Constant <code>FULL_SIZE</code>. */
|
||||
private static final Pattern FULL_SIZE = Pattern.compile("(.*)#(\\d+.\\d+)");
|
||||
/** Constant <code>TOKEN="#Token"</code> */
|
||||
@@ -54,10 +54,10 @@ public class ImageCache implements NewConstants {
|
||||
private static final String TOKEN = "#Token", NORMAL = "#Normal", TAPPED = "#Tapped";
|
||||
|
||||
/** Constant <code>scaleLargerThanOriginal=true</code>. */
|
||||
public static boolean scaleLargerThanOriginal = true;
|
||||
private static boolean scaleLargerThanOriginal = true;
|
||||
|
||||
static {
|
||||
imageCache = new MapMaker().softValues().makeComputingMap(new Function<String, BufferedImage>() {
|
||||
IMAGE_CACHE = new MapMaker().softValues().makeComputingMap(new Function<String, BufferedImage>() {
|
||||
public BufferedImage apply(String key) {
|
||||
try {
|
||||
// DEBUG
|
||||
@@ -71,18 +71,18 @@ public class ImageCache implements NewConstants {
|
||||
if (key.endsWith(NORMAL)) {
|
||||
// normal
|
||||
key = key.substring(0, key.length() - NORMAL.length());
|
||||
return getNormalSizeImage(imageCache.get(key));
|
||||
return getNormalSizeImage(IMAGE_CACHE.get(key));
|
||||
} else if (key.endsWith(TAPPED)) {
|
||||
// tapped
|
||||
key = key.substring(0, key.length() - TAPPED.length());
|
||||
return getTappedSizeImage(imageCache.get(key));
|
||||
return getTappedSizeImage(IMAGE_CACHE.get(key));
|
||||
}
|
||||
Matcher m = FULL_SIZE.matcher(key);
|
||||
|
||||
if (m.matches()) {
|
||||
// full size
|
||||
key = m.group(1);
|
||||
return getFullSizeImage(imageCache.get(key), parseDouble(m.group(2)));
|
||||
return getFullSizeImage(IMAGE_CACHE.get(key), parseDouble(m.group(2)));
|
||||
} else {
|
||||
// original
|
||||
File path;
|
||||
@@ -156,7 +156,7 @@ public class ImageCache implements NewConstants {
|
||||
double scale = min((double) width / original.getWidth(), (double) height / original.getHeight());
|
||||
// here would be the place to limit the scaling, scaling option in menu
|
||||
// ?
|
||||
if (scale > 1 && !scaleLargerThanOriginal) {
|
||||
if (scale > 1 && !isScaleLargerThanOriginal()) {
|
||||
scale = 1;
|
||||
}
|
||||
|
||||
@@ -184,7 +184,7 @@ public class ImageCache implements NewConstants {
|
||||
double scale = min((double) width / original.getWidth(), (double) height / original.getHeight());
|
||||
// here would be the place to limit the scaling, scaling option in menu
|
||||
// ?
|
||||
if (scale > 1 && !scaleLargerThanOriginal) {
|
||||
if (scale > 1 && !isScaleLargerThanOriginal()) {
|
||||
scale = 1;
|
||||
}
|
||||
|
||||
@@ -206,7 +206,7 @@ public class ImageCache implements NewConstants {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Image corresponding to the key
|
||||
* Returns the Image corresponding to the key.
|
||||
*
|
||||
* @param key
|
||||
* a {@link java.lang.String} object.
|
||||
@@ -214,12 +214,12 @@ public class ImageCache implements NewConstants {
|
||||
*/
|
||||
private static BufferedImage getImage(final String key) {
|
||||
try {
|
||||
BufferedImage image = imageCache.get(key);
|
||||
BufferedImage image = IMAGE_CACHE.get(key);
|
||||
// if an image is still cached and it was not the expected size,
|
||||
// drop it
|
||||
if (!isExpectedSize(key, image)) {
|
||||
imageCache.remove(key);
|
||||
image = imageCache.get(key);
|
||||
IMAGE_CACHE.remove(key);
|
||||
image = IMAGE_CACHE.get(key);
|
||||
}
|
||||
return image;
|
||||
} catch (NullPointerException ex) {
|
||||
@@ -276,7 +276,7 @@ public class ImageCache implements NewConstants {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an image scaled to the size given in {@link Constant.Runtime}
|
||||
* Returns an image scaled to the size given in {@link Constant.Runtime}.
|
||||
*
|
||||
* @param original
|
||||
* a {@link java.awt.image.BufferedImage} object.
|
||||
@@ -317,7 +317,7 @@ public class ImageCache implements NewConstants {
|
||||
|
||||
/**
|
||||
* Returns an image scaled to the size given in {@link Constant.Runtime},
|
||||
* but rotated
|
||||
* but rotated.
|
||||
*
|
||||
* @param original
|
||||
* a {@link java.awt.image.BufferedImage} object.
|
||||
@@ -361,7 +361,7 @@ public class ImageCache implements NewConstants {
|
||||
|
||||
/**
|
||||
* Returns an image scaled to the size appropriate for the card picture
|
||||
* panel
|
||||
* panel.
|
||||
*
|
||||
* @param original
|
||||
* a {@link java.awt.image.BufferedImage} object.
|
||||
@@ -398,6 +398,20 @@ public class ImageCache implements NewConstants {
|
||||
* </p>
|
||||
*/
|
||||
public static void clear() {
|
||||
imageCache.clear();
|
||||
IMAGE_CACHE.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the scaleLargerThanOriginal
|
||||
*/
|
||||
public static boolean isScaleLargerThanOriginal() {
|
||||
return scaleLargerThanOriginal;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param scaleLargerThanOriginal the scaleLargerThanOriginal to set
|
||||
*/
|
||||
public static void setScaleLargerThanOriginal(boolean scaleLargerThanOriginal) {
|
||||
ImageCache.scaleLargerThanOriginal = scaleLargerThanOriginal; // TODO: Add 0 to parameter's name.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ public class MagicStack extends MyObservable {
|
||||
private boolean bResolving = false;
|
||||
private int splitSecondOnStack = 0;
|
||||
|
||||
private CardList thisTurnCast = new CardList();
|
||||
private final CardList thisTurnCast = new CardList();
|
||||
private CardList lastTurnCast = new CardList();
|
||||
|
||||
/**
|
||||
@@ -54,7 +54,7 @@ public class MagicStack extends MyObservable {
|
||||
* @return a boolean.
|
||||
*/
|
||||
public final boolean isFrozen() {
|
||||
return frozen;
|
||||
return this.frozen;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -75,10 +75,10 @@ public class MagicStack extends MyObservable {
|
||||
* </p>
|
||||
*/
|
||||
public final void reset() {
|
||||
getStack().clear();
|
||||
frozen = false;
|
||||
splitSecondOnStack = 0;
|
||||
getFrozenStack().clear();
|
||||
this.getStack().clear();
|
||||
this.frozen = false;
|
||||
this.splitSecondOnStack = 0;
|
||||
this.getFrozenStack().clear();
|
||||
this.updateObservers();
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ public class MagicStack extends MyObservable {
|
||||
* @return a boolean.
|
||||
*/
|
||||
public final boolean isSplitSecondOnStack() {
|
||||
return splitSecondOnStack > 0;
|
||||
return this.splitSecondOnStack > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -103,7 +103,7 @@ public class MagicStack extends MyObservable {
|
||||
*/
|
||||
public final void incrementSplitSecond(final SpellAbility sp) {
|
||||
if (sp.getSourceCard().hasKeyword("Split second")) {
|
||||
splitSecondOnStack++;
|
||||
this.splitSecondOnStack++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,11 +117,11 @@ public class MagicStack extends MyObservable {
|
||||
*/
|
||||
public final void decrementSplitSecond(final SpellAbility sp) {
|
||||
if (sp.getSourceCard().hasKeyword("Split second")) {
|
||||
splitSecondOnStack--;
|
||||
this.splitSecondOnStack--;
|
||||
}
|
||||
|
||||
if (splitSecondOnStack < 0) {
|
||||
splitSecondOnStack = 0;
|
||||
if (this.splitSecondOnStack < 0) {
|
||||
this.splitSecondOnStack = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -131,7 +131,7 @@ public class MagicStack extends MyObservable {
|
||||
* </p>
|
||||
*/
|
||||
public final void freezeStack() {
|
||||
frozen = true;
|
||||
this.frozen = true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -144,14 +144,14 @@ public class MagicStack extends MyObservable {
|
||||
*/
|
||||
public final void addAndUnfreeze(final SpellAbility ability) {
|
||||
ability.getRestrictions().abilityActivated();
|
||||
if (ability.getRestrictions().getActivationNumberSacrifice() != -1
|
||||
&& ability.getRestrictions().getNumberTurnActivations() >= ability.getRestrictions()
|
||||
.getActivationNumberSacrifice()) {
|
||||
if ((ability.getRestrictions().getActivationNumberSacrifice() != -1)
|
||||
&& (ability.getRestrictions().getNumberTurnActivations() >= ability.getRestrictions()
|
||||
.getActivationNumberSacrifice())) {
|
||||
ability.getSourceCard().addExtrinsicKeyword("At the beginning of the end step, sacrifice CARDNAME.");
|
||||
}
|
||||
// triggered abilities should go on the frozen stack
|
||||
if (!ability.isTrigger()) {
|
||||
frozen = false;
|
||||
this.frozen = false;
|
||||
}
|
||||
|
||||
this.add(ability);
|
||||
@@ -159,14 +159,14 @@ public class MagicStack extends MyObservable {
|
||||
// if the ability is a spell, but not a copied spell and its not already
|
||||
// on the stack zone, move there
|
||||
if (ability.isSpell()) {
|
||||
Card source = ability.getSourceCard();
|
||||
final Card source = ability.getSourceCard();
|
||||
if (!source.isCopiedSpell() && !AllZone.getZoneOf(source).is(Constant.Zone.Stack)) {
|
||||
AllZone.getGameAction().moveToStack(source);
|
||||
}
|
||||
}
|
||||
|
||||
if (ability.isTrigger()) {
|
||||
unfreezeStack();
|
||||
this.unfreezeStack();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -176,10 +176,10 @@ public class MagicStack extends MyObservable {
|
||||
* </p>
|
||||
*/
|
||||
public final void unfreezeStack() {
|
||||
frozen = false;
|
||||
boolean checkState = !getFrozenStack().isEmpty();
|
||||
while (!getFrozenStack().isEmpty()) {
|
||||
SpellAbility sa = getFrozenStack().pop().getSpellAbility();
|
||||
this.frozen = false;
|
||||
final boolean checkState = !this.getFrozenStack().isEmpty();
|
||||
while (!this.getFrozenStack().isEmpty()) {
|
||||
final SpellAbility sa = this.getFrozenStack().pop().getSpellAbility();
|
||||
this.add(sa);
|
||||
}
|
||||
if (checkState) {
|
||||
@@ -195,8 +195,8 @@ public class MagicStack extends MyObservable {
|
||||
public final void clearFrozen() {
|
||||
// TODO: frozen triggered abilities and undoable costs have nasty
|
||||
// consequences
|
||||
frozen = false;
|
||||
getFrozenStack().clear();
|
||||
this.frozen = false;
|
||||
this.getFrozenStack().clear();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -208,9 +208,9 @@ public class MagicStack extends MyObservable {
|
||||
* a boolean.
|
||||
*/
|
||||
public final void setResolving(final boolean b) {
|
||||
bResolving = b;
|
||||
if (!bResolving) {
|
||||
chooseOrderOfSimultaneousStackEntryAll();
|
||||
this.bResolving = b;
|
||||
if (!this.bResolving) {
|
||||
this.chooseOrderOfSimultaneousStackEntryAll();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -222,7 +222,7 @@ public class MagicStack extends MyObservable {
|
||||
* @return a boolean.
|
||||
*/
|
||||
public final boolean getResolving() {
|
||||
return bResolving;
|
||||
return this.bResolving;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -241,10 +241,10 @@ public class MagicStack extends MyObservable {
|
||||
} else {
|
||||
|
||||
// TODO: make working triggered abilities!
|
||||
if (sp instanceof Ability_Mana || sp instanceof Ability_Triggered) {
|
||||
if ((sp instanceof Ability_Mana) || (sp instanceof Ability_Triggered)) {
|
||||
sp.resolve();
|
||||
} else {
|
||||
push(sp);
|
||||
this.push(sp);
|
||||
/*
|
||||
* if (sp.getTargetCard() != null)
|
||||
* CardFactoryUtil.checkTargetingEffects(sp,
|
||||
@@ -264,8 +264,8 @@ public class MagicStack extends MyObservable {
|
||||
* @return a {@link forge.card.mana.ManaCost} object.
|
||||
*/
|
||||
public final ManaCost getMultiKickerSpellCostChange(final SpellAbility sa) {
|
||||
int max = 25;
|
||||
String[] numbers = new String[max];
|
||||
final int max = 25;
|
||||
final String[] numbers = new String[max];
|
||||
for (int no = 0; no < max; no++) {
|
||||
numbers[no] = String.valueOf(no);
|
||||
}
|
||||
@@ -290,7 +290,7 @@ public class MagicStack extends MyObservable {
|
||||
for (int check = 0; check < max; check++) {
|
||||
if (numberManaCost.equals(numbers[check])) {
|
||||
|
||||
if (check - multiKickerPaid < 0) {
|
||||
if ((check - multiKickerPaid) < 0) {
|
||||
multiKickerPaid = multiKickerPaid - check;
|
||||
AllZone.getGameAction().CostCutting_GetMultiMickerManaCostPaid = multiKickerPaid;
|
||||
mana = mana.replaceFirst(String.valueOf(check), "0");
|
||||
@@ -306,14 +306,15 @@ public class MagicStack extends MyObservable {
|
||||
}
|
||||
manaCost = new ManaCost(mana);
|
||||
}
|
||||
String colorCut = AllZone.getGameAction().CostCutting_GetMultiMickerManaCostPaid_Colored;
|
||||
final String colorCut = AllZone.getGameAction().CostCutting_GetMultiMickerManaCostPaid_Colored;
|
||||
|
||||
for (int colorCutIx = 0; colorCutIx < colorCut.length(); colorCutIx++) {
|
||||
if ("WUGRB".contains(colorCut.substring(colorCutIx, colorCutIx + 1))
|
||||
&& !mana.equals(mana.replaceFirst((colorCut.substring(colorCutIx, colorCutIx + 1)), ""))) {
|
||||
mana = mana.replaceFirst(colorCut.substring(colorCutIx, colorCutIx + 1), "");
|
||||
|
||||
AllZone.getGameAction().CostCutting_GetMultiMickerManaCostPaid_Colored = AllZone.getGameAction().CostCutting_GetMultiMickerManaCostPaid_Colored
|
||||
AllZone.getGameAction().CostCutting_GetMultiMickerManaCostPaid_Colored
|
||||
= AllZone.getGameAction().CostCutting_GetMultiMickerManaCostPaid_Colored
|
||||
.replaceFirst(colorCut.substring(colorCutIx, colorCutIx + 1), "");
|
||||
|
||||
mana = mana.trim();
|
||||
@@ -338,7 +339,7 @@ public class MagicStack extends MyObservable {
|
||||
* @return a {@link forge.card.mana.ManaCost} object.
|
||||
*/
|
||||
public final ManaCost getReplicateSpellCostChange(final SpellAbility sa) {
|
||||
ManaCost manaCost = new ManaCost(sa.getManaCost());
|
||||
final ManaCost manaCost = new ManaCost(sa.getManaCost());
|
||||
// String Mana = manaCost.toString();
|
||||
return manaCost;
|
||||
}
|
||||
@@ -352,7 +353,7 @@ public class MagicStack extends MyObservable {
|
||||
* a {@link forge.card.spellability.SpellAbility} object.
|
||||
*/
|
||||
public final void add(final SpellAbility sp) {
|
||||
ArrayList<Target_Choices> chosenTargets = sp.getAllTargetChoices();
|
||||
final ArrayList<Target_Choices> chosenTargets = sp.getAllTargetChoices();
|
||||
|
||||
if (sp instanceof Ability_Mana) { // Mana Abilities go straight through
|
||||
sp.resolve();
|
||||
@@ -360,9 +361,9 @@ public class MagicStack extends MyObservable {
|
||||
return;
|
||||
}
|
||||
|
||||
if (frozen) {
|
||||
SpellAbility_StackInstance si = new SpellAbility_StackInstance(sp);
|
||||
getFrozenStack().push(si);
|
||||
if (this.frozen) {
|
||||
final SpellAbility_StackInstance si = new SpellAbility_StackInstance(sp);
|
||||
this.getFrozenStack().push(si);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -381,18 +382,18 @@ public class MagicStack extends MyObservable {
|
||||
}
|
||||
|
||||
// TODO: triggered abilities need to be fixed
|
||||
if (!(sp instanceof Ability_Triggered || sp instanceof Ability_Static)) {
|
||||
if (!((sp instanceof Ability_Triggered) || (sp instanceof Ability_Static))) {
|
||||
// when something is added we need to setPriority
|
||||
AllZone.getPhase().setPriority(sp.getActivatingPlayer());
|
||||
}
|
||||
|
||||
if (sp instanceof Ability_Triggered || sp instanceof Ability_Static) {
|
||||
if ((sp instanceof Ability_Triggered) || (sp instanceof Ability_Static)) {
|
||||
// TODO: make working triggered ability
|
||||
sp.resolve();
|
||||
} else {
|
||||
if (sp.isKickerAbility()) {
|
||||
sp.getSourceCard().setKicked(true);
|
||||
SpellAbility[] sa = sp.getSourceCard().getSpellAbility();
|
||||
final SpellAbility[] sa = sp.getSourceCard().getSpellAbility();
|
||||
int abilityNumber = 0;
|
||||
|
||||
for (int i = 0; i < sa.length; i++) {
|
||||
@@ -404,17 +405,18 @@ public class MagicStack extends MyObservable {
|
||||
sp.getSourceCard().setAbilityUsed(abilityNumber);
|
||||
}
|
||||
if (sp.getSourceCard().isCopiedSpell()) {
|
||||
push(sp);
|
||||
this.push(sp);
|
||||
} else if (!sp.isMultiKicker() && !sp.isReplicate() && !sp.isXCost()) {
|
||||
push(sp);
|
||||
} else if (sp.getPayCosts() != null && !sp.isMultiKicker() && !sp.isReplicate()) {
|
||||
push(sp);
|
||||
this.push(sp);
|
||||
} else if ((sp.getPayCosts() != null) && !sp.isMultiKicker() && !sp.isReplicate()) {
|
||||
this.push(sp);
|
||||
} else if (sp.isXCost()) {
|
||||
// TODO: convert any X costs to use abCost so it happens earlier
|
||||
final SpellAbility sa = sp;
|
||||
final Ability ability = new Ability(sp.getSourceCard(), sa.getXManaCost()) {
|
||||
@Override
|
||||
public void resolve() {
|
||||
Card crd = this.getSourceCard();
|
||||
final Card crd = this.getSourceCard();
|
||||
crd.addXManaCostPaid(1);
|
||||
}
|
||||
};
|
||||
@@ -422,17 +424,19 @@ public class MagicStack extends MyObservable {
|
||||
final Command unpaidCommand = new Command() {
|
||||
private static final long serialVersionUID = -3342222770086269767L;
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
push(sa);
|
||||
MagicStack.this.push(sa);
|
||||
}
|
||||
};
|
||||
|
||||
final Command paidCommand = new Command() {
|
||||
private static final long serialVersionUID = -2224875229611007788L;
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
ability.resolve();
|
||||
Card crd = sa.getSourceCard();
|
||||
final Card crd = sa.getSourceCard();
|
||||
AllZone.getInputControl().setInput(
|
||||
new Input_PayManaCost_Ability("Pay X cost for " + crd.getName() + " (X="
|
||||
+ crd.getXManaCostPaid() + ")\r\n", ability.getManaCost(), this, unpaidCommand,
|
||||
@@ -440,7 +444,7 @@ public class MagicStack extends MyObservable {
|
||||
}
|
||||
};
|
||||
|
||||
Card crd = sa.getSourceCard();
|
||||
final Card crd = sa.getSourceCard();
|
||||
if (sp.getSourceCard().getController().isHuman()) {
|
||||
AllZone.getInputControl().setInput(
|
||||
new Input_PayManaCost_Ability("Pay X cost for " + sp.getSourceCard().getName() + " (X="
|
||||
@@ -448,12 +452,13 @@ public class MagicStack extends MyObservable {
|
||||
unpaidCommand, true));
|
||||
} else {
|
||||
// computer
|
||||
int neededDamage = CardFactoryUtil.getNeededXDamage(sa);
|
||||
final int neededDamage = CardFactoryUtil.getNeededXDamage(sa);
|
||||
|
||||
while (ComputerUtil.canPayCost(ability) && neededDamage != sa.getSourceCard().getXManaCostPaid()) {
|
||||
while (ComputerUtil.canPayCost(ability)
|
||||
&& (neededDamage != sa.getSourceCard().getXManaCostPaid())) {
|
||||
ComputerUtil.playNoStack(ability);
|
||||
}
|
||||
push(sa);
|
||||
this.push(sa);
|
||||
}
|
||||
} else if (sp.isMultiKicker()) {
|
||||
// TODO: convert multikicker support in abCost so this doesn't
|
||||
@@ -462,6 +467,7 @@ public class MagicStack extends MyObservable {
|
||||
|
||||
final SpellAbility sa = sp;
|
||||
final Ability ability = new Ability(sp.getSourceCard(), sp.getMultiKickerManaCost()) {
|
||||
@Override
|
||||
public void resolve() {
|
||||
this.getSourceCard().addMultiKickerMagnitude(1);
|
||||
}
|
||||
@@ -470,21 +476,23 @@ public class MagicStack extends MyObservable {
|
||||
final Command unpaidCommand = new Command() {
|
||||
private static final long serialVersionUID = -3342222770086269767L;
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
push(sa);
|
||||
MagicStack.this.push(sa);
|
||||
}
|
||||
};
|
||||
|
||||
final Command paidCommand = new Command() {
|
||||
private static final long serialVersionUID = -6037161763374971106L;
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
ability.resolve();
|
||||
ManaCost manaCost = getMultiKickerSpellCostChange(ability);
|
||||
final ManaCost manaCost = MagicStack.this.getMultiKickerSpellCostChange(ability);
|
||||
if (manaCost.isPaid()) {
|
||||
this.execute();
|
||||
} else {
|
||||
if (AllZone.getGameAction().CostCutting_GetMultiMickerManaCostPaid == 0
|
||||
if ((AllZone.getGameAction().CostCutting_GetMultiMickerManaCostPaid == 0)
|
||||
&& AllZone.getGameAction().CostCutting_GetMultiMickerManaCostPaid_Colored
|
||||
.equals("")) {
|
||||
|
||||
@@ -500,10 +508,14 @@ public class MagicStack extends MyObservable {
|
||||
+ sa.getSourceCard()
|
||||
+ "\r\n"
|
||||
+ "Mana in Reserve: "
|
||||
+ ((AllZone.getGameAction().CostCutting_GetMultiMickerManaCostPaid != 0) ? AllZone
|
||||
.getGameAction().CostCutting_GetMultiMickerManaCostPaid
|
||||
+ ((AllZone.getGameAction()
|
||||
.CostCutting_GetMultiMickerManaCostPaid != 0)
|
||||
? AllZone
|
||||
.getGameAction()
|
||||
.CostCutting_GetMultiMickerManaCostPaid
|
||||
: "")
|
||||
+ AllZone.getGameAction().CostCutting_GetMultiMickerManaCostPaid_Colored
|
||||
+ AllZone.getGameAction()
|
||||
.CostCutting_GetMultiMickerManaCostPaid_Colored
|
||||
+ "\r\n" + "Times Kicked: "
|
||||
+ sa.getSourceCard().getMultiKickerMagnitude() + "\r\n",
|
||||
manaCost.toString(), this, unpaidCommand));
|
||||
@@ -513,12 +525,12 @@ public class MagicStack extends MyObservable {
|
||||
};
|
||||
|
||||
if (sp.getActivatingPlayer().isHuman()) {
|
||||
ManaCost manaCost = getMultiKickerSpellCostChange(ability);
|
||||
final ManaCost manaCost = this.getMultiKickerSpellCostChange(ability);
|
||||
|
||||
if (manaCost.isPaid()) {
|
||||
paidCommand.execute();
|
||||
} else {
|
||||
if (AllZone.getGameAction().CostCutting_GetMultiMickerManaCostPaid == 0
|
||||
if ((AllZone.getGameAction().CostCutting_GetMultiMickerManaCostPaid == 0)
|
||||
&& AllZone.getGameAction().CostCutting_GetMultiMickerManaCostPaid_Colored.equals("")) {
|
||||
AllZone.getInputControl().setInput(
|
||||
new Input_PayManaCost_Ability("Multikicker for " + sa.getSourceCard() + "\r\n"
|
||||
@@ -532,10 +544,14 @@ public class MagicStack extends MyObservable {
|
||||
+ sa.getSourceCard()
|
||||
+ "\r\n"
|
||||
+ "Mana in Reserve: "
|
||||
+ ((AllZone.getGameAction().CostCutting_GetMultiMickerManaCostPaid != 0) ? AllZone
|
||||
.getGameAction().CostCutting_GetMultiMickerManaCostPaid
|
||||
+ ((AllZone.getGameAction()
|
||||
.CostCutting_GetMultiMickerManaCostPaid != 0)
|
||||
? AllZone
|
||||
.getGameAction()
|
||||
.CostCutting_GetMultiMickerManaCostPaid
|
||||
: "")
|
||||
+ AllZone.getGameAction().CostCutting_GetMultiMickerManaCostPaid_Colored
|
||||
+ AllZone.getGameAction()
|
||||
.CostCutting_GetMultiMickerManaCostPaid_Colored
|
||||
+ "\r\n" + "Times Kicked: "
|
||||
+ sa.getSourceCard().getMultiKickerMagnitude() + "\r\n",
|
||||
manaCost.toString(), paidCommand, unpaidCommand));
|
||||
@@ -548,7 +564,7 @@ public class MagicStack extends MyObservable {
|
||||
ComputerUtil.playNoStack(ability);
|
||||
}
|
||||
|
||||
push(sa);
|
||||
this.push(sa);
|
||||
}
|
||||
} else if (sp.isReplicate()) {
|
||||
// TODO: convert multikicker/replicate support in abCost so this
|
||||
@@ -557,6 +573,7 @@ public class MagicStack extends MyObservable {
|
||||
|
||||
final SpellAbility sa = sp;
|
||||
final Ability ability = new Ability(sp.getSourceCard(), sp.getReplicateManaCost()) {
|
||||
@Override
|
||||
public void resolve() {
|
||||
this.getSourceCard().addReplicateMagnitude(1);
|
||||
}
|
||||
@@ -565,8 +582,9 @@ public class MagicStack extends MyObservable {
|
||||
final Command unpaidCommand = new Command() {
|
||||
private static final long serialVersionUID = -3180458633098297855L;
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
push(sa);
|
||||
MagicStack.this.push(sa);
|
||||
for (int i = 0; i < sp.getSourceCard().getReplicateMagnitude(); i++) {
|
||||
AllZone.getCardFactory().copySpellontoStack(sp.getSourceCard(), sp.getSourceCard(), false);
|
||||
}
|
||||
@@ -576,9 +594,10 @@ public class MagicStack extends MyObservable {
|
||||
final Command paidCommand = new Command() {
|
||||
private static final long serialVersionUID = 132624005072267304L;
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
ability.resolve();
|
||||
ManaCost manaCost = getReplicateSpellCostChange(ability);
|
||||
final ManaCost manaCost = MagicStack.this.getReplicateSpellCostChange(ability);
|
||||
if (manaCost.isPaid()) {
|
||||
this.execute();
|
||||
} else {
|
||||
@@ -592,7 +611,7 @@ public class MagicStack extends MyObservable {
|
||||
};
|
||||
|
||||
if (sp.getSourceCard().getController().equals(AllZone.getHumanPlayer())) {
|
||||
ManaCost manaCost = getMultiKickerSpellCostChange(ability);
|
||||
final ManaCost manaCost = this.getMultiKickerSpellCostChange(ability);
|
||||
|
||||
if (manaCost.isPaid()) {
|
||||
paidCommand.execute();
|
||||
@@ -608,18 +627,18 @@ public class MagicStack extends MyObservable {
|
||||
ComputerUtil.playNoStack(ability);
|
||||
}
|
||||
|
||||
push(sa);
|
||||
this.push(sa);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!sp.getSourceCard().isCopiedSpell()) // Copied spells aren't cast
|
||||
// per se so triggers shouldn't
|
||||
// run for them.
|
||||
{
|
||||
// Copied spells aren't cast
|
||||
// per se so triggers shouldn't
|
||||
// run for them.
|
||||
if (!sp.getSourceCard().isCopiedSpell()) {
|
||||
// Run SpellAbilityCast triggers
|
||||
HashMap<String, Object> runParams = new HashMap<String, Object>();
|
||||
final HashMap<String, Object> runParams = new HashMap<String, Object>();
|
||||
runParams.put("Cost", sp.getPayCosts());
|
||||
runParams.put("Player", sp.getSourceCard().getController());
|
||||
runParams.put("Activator", sp.getActivatingPlayer());
|
||||
@@ -647,9 +666,9 @@ public class MagicStack extends MyObservable {
|
||||
runParams.clear();
|
||||
runParams.put("SourceSA", sp);
|
||||
if (chosenTargets.size() > 0) {
|
||||
for (Target_Choices tc : chosenTargets) {
|
||||
if (tc != null && tc.getTargetCards() != null) {
|
||||
for (Object tgt : tc.getTargets()) {
|
||||
for (final Target_Choices tc : chosenTargets) {
|
||||
if ((tc != null) && (tc.getTargetCards() != null)) {
|
||||
for (final Object tgt : tc.getTargets()) {
|
||||
runParams.put("Target", tgt);
|
||||
|
||||
AllZone.getTriggerHandler().runTrigger("BecomesTarget", runParams);
|
||||
@@ -664,8 +683,8 @@ public class MagicStack extends MyObservable {
|
||||
runParams.put("Target", sp.getTargetCard());
|
||||
|
||||
AllZone.getTriggerHandler().runTrigger("BecomesTarget", runParams);
|
||||
} else if (sp.getTargetList() != null && sp.getTargetList().size() > 0) {
|
||||
for (Card ctgt : sp.getTargetList()) {
|
||||
} else if ((sp.getTargetList() != null) && (sp.getTargetList().size() > 0)) {
|
||||
for (final Card ctgt : sp.getTargetList()) {
|
||||
runParams.put("Target", ctgt);
|
||||
|
||||
AllZone.getTriggerHandler().runTrigger("BecomesTarget", runParams);
|
||||
@@ -677,11 +696,11 @@ public class MagicStack extends MyObservable {
|
||||
}
|
||||
}
|
||||
|
||||
if (sp instanceof Spell_Permanent && sp.getSourceCard().getName().equals("Mana Vortex")) {
|
||||
if ((sp instanceof Spell_Permanent) && sp.getSourceCard().getName().equals("Mana Vortex")) {
|
||||
final SpellAbility counter = new Ability(sp.getSourceCard(), "0") {
|
||||
@Override
|
||||
public void resolve() {
|
||||
Input in = new Input() {
|
||||
final Input in = new Input() {
|
||||
private static final long serialVersionUID = -2042489457719935420L;
|
||||
|
||||
@Override
|
||||
@@ -694,23 +713,23 @@ public class MagicStack extends MyObservable {
|
||||
public void selectButtonCancel() {
|
||||
AllZone.getStack().pop();
|
||||
AllZone.getGameAction().moveToGraveyard(sp.getSourceCard());
|
||||
stop();
|
||||
this.stop();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void selectCard(final Card c, final PlayerZone zone) {
|
||||
if (zone.is(Constant.Zone.Battlefield) && c.getController().isHuman() && c.isLand()) {
|
||||
AllZone.getGameAction().sacrifice(c);
|
||||
stop();
|
||||
this.stop();
|
||||
}
|
||||
}
|
||||
};
|
||||
SpellAbility_StackInstance prev = peekInstance();
|
||||
final SpellAbility_StackInstance prev = MagicStack.this.peekInstance();
|
||||
if (prev.isSpell() && prev.getSourceCard().getName().equals("Mana Vortex")) {
|
||||
if (sp.getSourceCard().getController().isHuman()) {
|
||||
AllZone.getInputControl().setInput(in);
|
||||
} else { // Computer
|
||||
CardList lands = AllZoneUtil.getPlayerLandsInPlay(AllZone.getComputerPlayer());
|
||||
final CardList lands = AllZoneUtil.getPlayerLandsInPlay(AllZone.getComputerPlayer());
|
||||
if (!lands.isEmpty()) {
|
||||
AllZone.getComputerPlayer().sacrificePermanent("prompt", lands);
|
||||
} else {
|
||||
@@ -726,7 +745,7 @@ public class MagicStack extends MyObservable {
|
||||
counter.setStackDescription(sp.getSourceCard().getName()
|
||||
+ " - counter Mana Vortex unless you sacrifice a land.");
|
||||
|
||||
add(counter);
|
||||
this.add(counter);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -738,20 +757,20 @@ public class MagicStack extends MyObservable {
|
||||
boolean found = false;
|
||||
CardList all = AllZoneUtil.getCardsIn(Zone.Battlefield);
|
||||
all = all.filter(CardListFilter.NON_TOKEN);
|
||||
CardList graves = AllZoneUtil.getCardsIn(Zone.Graveyard);
|
||||
final CardList graves = AllZoneUtil.getCardsIn(Zone.Graveyard);
|
||||
all.addAll(graves);
|
||||
|
||||
for (Card c : all) {
|
||||
for (final Card c : all) {
|
||||
if (sp.getSourceCard().getName().equals(c.getName())) {
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (found) {
|
||||
CardList bazaars = AllZoneUtil.getCardsIn(Zone.Battlefield, "Bazaar of Wonders"); // should
|
||||
// only
|
||||
// be
|
||||
// 1...
|
||||
final CardList bazaars = AllZoneUtil.getCardsIn(Zone.Battlefield, "Bazaar of Wonders"); // should
|
||||
// only
|
||||
// be
|
||||
// 1...
|
||||
for (final Card bazaar : bazaars) {
|
||||
final SpellAbility counter = new Ability(bazaar, "0") {
|
||||
@Override
|
||||
@@ -762,7 +781,7 @@ public class MagicStack extends MyObservable {
|
||||
} // resolve()
|
||||
}; // SpellAbility
|
||||
counter.setStackDescription(bazaar.getName() + " - counter " + sp.getSourceCard().getName() + ".");
|
||||
add(counter);
|
||||
this.add(counter);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -772,7 +791,7 @@ public class MagicStack extends MyObservable {
|
||||
* CardFactoryUtil.checkTargetingEffects(sp, sp.getTargetCard());
|
||||
*/
|
||||
|
||||
if (getSimultaneousStackEntryList().size() > 0) {
|
||||
if (this.getSimultaneousStackEntryList().size() > 0) {
|
||||
AllZone.getPhase().passPriority();
|
||||
}
|
||||
}
|
||||
@@ -785,7 +804,7 @@ public class MagicStack extends MyObservable {
|
||||
* @return a int.
|
||||
*/
|
||||
public final int size() {
|
||||
return getStack().size();
|
||||
return this.getStack().size();
|
||||
}
|
||||
|
||||
// Push should only be used by add.
|
||||
@@ -803,15 +822,15 @@ public class MagicStack extends MyObservable {
|
||||
System.out.println(sp.getSourceCard().getName() + " - activatingPlayer not set before adding to stack.");
|
||||
}
|
||||
|
||||
incrementSplitSecond(sp);
|
||||
this.incrementSplitSecond(sp);
|
||||
|
||||
SpellAbility_StackInstance si = new SpellAbility_StackInstance(sp);
|
||||
getStack().push(si);
|
||||
final SpellAbility_StackInstance si = new SpellAbility_StackInstance(sp);
|
||||
this.getStack().push(si);
|
||||
|
||||
this.updateObservers();
|
||||
|
||||
if (sp.isSpell() && !sp.getSourceCard().isCopiedSpell()) {
|
||||
thisTurnCast.add(sp.getSourceCard());
|
||||
this.thisTurnCast.add(sp.getSourceCard());
|
||||
|
||||
GameActionUtil.executePlayCardEffects(sp);
|
||||
}
|
||||
@@ -830,29 +849,29 @@ public class MagicStack extends MyObservable {
|
||||
|
||||
this.freezeStack(); // freeze the stack while we're in the middle of
|
||||
// resolving
|
||||
setResolving(true);
|
||||
this.setResolving(true);
|
||||
|
||||
SpellAbility sa = AllZone.getStack().pop();
|
||||
final SpellAbility sa = AllZone.getStack().pop();
|
||||
|
||||
AllZone.getPhase().resetPriority(); // ActivePlayer gains priority first
|
||||
// after Resolve
|
||||
final Card source = sa.getSourceCard();
|
||||
|
||||
if (hasFizzled(sa, source)) { // Fizzle
|
||||
if (this.hasFizzled(sa, source)) { // Fizzle
|
||||
// TODO: Spell fizzles, what's the best way to alert player?
|
||||
Log.debug(source.getName() + " ability fizzles.");
|
||||
finishResolving(sa, true);
|
||||
this.finishResolving(sa, true);
|
||||
} else if (sa.getAbilityFactory() != null) {
|
||||
AbilityFactory.handleRemembering(sa.getAbilityFactory());
|
||||
AbilityFactory.resolve(sa, true);
|
||||
} else {
|
||||
sa.resolve();
|
||||
finishResolving(sa, false);
|
||||
this.finishResolving(sa, false);
|
||||
}
|
||||
|
||||
if (source.hasStartOfKeyword("Haunt") && !source.isCreature()
|
||||
&& AllZone.getZoneOf(source).is(Constant.Zone.Graveyard)) {
|
||||
CardList creats = AllZoneUtil.getCreaturesInPlay();
|
||||
final CardList creats = AllZoneUtil.getCreaturesInPlay();
|
||||
for (int i = 0; i < creats.size(); i++) {
|
||||
if (!CardFactoryUtil.canTarget(source, creats.get(i))) {
|
||||
creats.remove(i);
|
||||
@@ -860,14 +879,14 @@ public class MagicStack extends MyObservable {
|
||||
}
|
||||
}
|
||||
if (creats.size() != 0) {
|
||||
final Ability haunterDies_Work = new Ability(source, "0") {
|
||||
final Ability haunterDiesWork = new Ability(source, "0") {
|
||||
@Override
|
||||
public void resolve() {
|
||||
AllZone.getGameAction().exile(source);
|
||||
getTargetCard().addHauntedBy(source);
|
||||
this.getTargetCard().addHauntedBy(source);
|
||||
}
|
||||
};
|
||||
haunterDies_Work.setDescription("");
|
||||
haunterDiesWork.setDescription("");
|
||||
|
||||
final Input target = new Input() {
|
||||
private static final long serialVersionUID = 1981791992623774490L;
|
||||
@@ -884,9 +903,9 @@ public class MagicStack extends MyObservable {
|
||||
return;
|
||||
}
|
||||
if (CardFactoryUtil.canTarget(source, c)) {
|
||||
haunterDies_Work.setTargetCard(c);
|
||||
add(haunterDies_Work);
|
||||
stop();
|
||||
haunterDiesWork.setTargetCard(c);
|
||||
MagicStack.this.add(haunterDiesWork);
|
||||
this.stop();
|
||||
} else {
|
||||
AllZone.getDisplay().showMessage("Cannot target this card (Shroud? Protection?).");
|
||||
}
|
||||
@@ -897,13 +916,13 @@ public class MagicStack extends MyObservable {
|
||||
AllZone.getInputControl().setInput(target);
|
||||
} else {
|
||||
// AI choosing what to haunt
|
||||
CardList oppCreats = creats.getController(AllZone.getHumanPlayer());
|
||||
final CardList oppCreats = creats.getController(AllZone.getHumanPlayer());
|
||||
if (oppCreats.size() != 0) {
|
||||
haunterDies_Work.setTargetCard(CardFactoryUtil.AI_getWorstCreature(oppCreats));
|
||||
haunterDiesWork.setTargetCard(CardFactoryUtil.AI_getWorstCreature(oppCreats));
|
||||
} else {
|
||||
haunterDies_Work.setTargetCard(CardFactoryUtil.AI_getWorstCreature(creats));
|
||||
haunterDiesWork.setTargetCard(CardFactoryUtil.AI_getWorstCreature(creats));
|
||||
}
|
||||
add(haunterDies_Work);
|
||||
this.add(haunterDiesWork);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -922,7 +941,7 @@ public class MagicStack extends MyObservable {
|
||||
* @since 1.0.15
|
||||
*/
|
||||
public final void removeCardFromStack(final SpellAbility sa, final boolean fizzle) {
|
||||
Card source = sa.getSourceCard();
|
||||
final Card source = sa.getSourceCard();
|
||||
|
||||
// do nothing
|
||||
if (sa.getSourceCard().isCopiedSpell() || sa.isAbility()) {
|
||||
@@ -957,10 +976,10 @@ public class MagicStack extends MyObservable {
|
||||
public final void finishResolving(final SpellAbility sa, final boolean fizzle) {
|
||||
|
||||
// remove card from the stack
|
||||
removeCardFromStack(sa, fizzle);
|
||||
this.removeCardFromStack(sa, fizzle);
|
||||
|
||||
// After SA resolves we have to do a handful of things
|
||||
setResolving(false);
|
||||
this.setResolving(false);
|
||||
this.unfreezeStack();
|
||||
sa.resetOnceResolved();
|
||||
|
||||
@@ -978,9 +997,9 @@ public class MagicStack extends MyObservable {
|
||||
// TODO: this is a huge hack. Why is this necessary?
|
||||
// hostCard in AF is not the same object that's on the battlefield
|
||||
// verified by System.identityHashCode(card);
|
||||
Card tmp = sa.getSourceCard();
|
||||
final Card tmp = sa.getSourceCard();
|
||||
if (tmp.getClones().size() > 0) {
|
||||
for (Card c : AllZoneUtil.getCardsIn(Zone.Battlefield)) {
|
||||
for (final Card c : AllZoneUtil.getCardsIn(Zone.Battlefield)) {
|
||||
if (c.equals(tmp)) {
|
||||
c.setClones(tmp.getClones());
|
||||
}
|
||||
@@ -1009,12 +1028,12 @@ public class MagicStack extends MyObservable {
|
||||
SpellAbility fizzSA = sa;
|
||||
|
||||
while (true) {
|
||||
Target tgt = fizzSA.getTarget();
|
||||
if (tgt != null && tgt.getMinTargets(source, fizzSA) == 0 && tgt.getNumTargeted() == 0) {
|
||||
final Target tgt = fizzSA.getTarget();
|
||||
if ((tgt != null) && (tgt.getMinTargets(source, fizzSA) == 0) && (tgt.getNumTargeted() == 0)) {
|
||||
// Don't assume fizzled for minTargets == 0 and nothing is
|
||||
// targeted
|
||||
} else if (firstTarget
|
||||
&& (tgt != null || fizzSA.getTargetCard() != null || fizzSA.getTargetPlayer() != null)) {
|
||||
&& ((tgt != null) || (fizzSA.getTargetCard() != null) || (fizzSA.getTargetPlayer() != null))) {
|
||||
// If there is at least 1 target, fizzle switches because ALL
|
||||
// targets need to be invalid
|
||||
fizzle = true;
|
||||
@@ -1024,18 +1043,18 @@ public class MagicStack extends MyObservable {
|
||||
if (tgt != null) {
|
||||
// With multi-targets, as long as one target is still legal,
|
||||
// we'll try to go through as much as possible
|
||||
ArrayList<Object> tgts = tgt.getTargets();
|
||||
for (Object o : tgts) {
|
||||
final ArrayList<Object> tgts = tgt.getTargets();
|
||||
for (final Object o : tgts) {
|
||||
if (o instanceof Player) {
|
||||
Player p = (Player) o;
|
||||
final Player p = (Player) o;
|
||||
fizzle &= !(p.canTarget(fizzSA));
|
||||
}
|
||||
if (o instanceof Card) {
|
||||
Card card = (Card) o;
|
||||
final Card card = (Card) o;
|
||||
fizzle &= !(CardFactoryUtil.isTargetStillValid(fizzSA, card));
|
||||
}
|
||||
if (o instanceof SpellAbility) {
|
||||
SpellAbility tgtSA = (SpellAbility) o;
|
||||
final SpellAbility tgtSA = (SpellAbility) o;
|
||||
fizzle &= !(Target_Selection.matchSpellAbility(fizzSA, tgtSA, tgt));
|
||||
}
|
||||
}
|
||||
@@ -1066,8 +1085,8 @@ public class MagicStack extends MyObservable {
|
||||
* @return a {@link forge.card.spellability.SpellAbility} object.
|
||||
*/
|
||||
public final SpellAbility pop() {
|
||||
SpellAbility sp = getStack().pop().getSpellAbility();
|
||||
decrementSplitSecond(sp);
|
||||
final SpellAbility sp = this.getStack().pop().getSpellAbility();
|
||||
this.decrementSplitSecond(sp);
|
||||
this.updateObservers();
|
||||
return sp;
|
||||
}
|
||||
@@ -1085,7 +1104,7 @@ public class MagicStack extends MyObservable {
|
||||
* object.
|
||||
*/
|
||||
public final SpellAbility_StackInstance peekInstance(final int index) {
|
||||
return getStack().get(index);
|
||||
return this.getStack().get(index);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1098,7 +1117,7 @@ public class MagicStack extends MyObservable {
|
||||
* @return a {@link forge.card.spellability.SpellAbility} object.
|
||||
*/
|
||||
public final SpellAbility peekAbility(final int index) {
|
||||
return getStack().get(index).getSpellAbility();
|
||||
return this.getStack().get(index).getSpellAbility();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1110,7 +1129,7 @@ public class MagicStack extends MyObservable {
|
||||
* object.
|
||||
*/
|
||||
public final SpellAbility_StackInstance peekInstance() {
|
||||
return getStack().peek();
|
||||
return this.getStack().peek();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1121,7 +1140,7 @@ public class MagicStack extends MyObservable {
|
||||
* @return a {@link forge.card.spellability.SpellAbility} object.
|
||||
*/
|
||||
public final SpellAbility peekAbility() {
|
||||
return getStack().peek().getSpellAbility();
|
||||
return this.getStack().peek().getSpellAbility();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1133,13 +1152,13 @@ public class MagicStack extends MyObservable {
|
||||
* a {@link forge.card.spellability.SpellAbility} object.
|
||||
*/
|
||||
public final void remove(final SpellAbility sa) {
|
||||
SpellAbility_StackInstance si = getInstanceFromSpellAbility(sa);
|
||||
final SpellAbility_StackInstance si = this.getInstanceFromSpellAbility(sa);
|
||||
|
||||
if (si == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
remove(si);
|
||||
this.remove(si);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1152,10 +1171,10 @@ public class MagicStack extends MyObservable {
|
||||
* object.
|
||||
*/
|
||||
public final void remove(final SpellAbility_StackInstance si) {
|
||||
if (getStack().remove(si)) {
|
||||
decrementSplitSecond(si.getSpellAbility());
|
||||
if (this.getStack().remove(si)) {
|
||||
this.decrementSplitSecond(si.getSpellAbility());
|
||||
}
|
||||
getFrozenStack().remove(si);
|
||||
this.getFrozenStack().remove(si);
|
||||
this.updateObservers();
|
||||
}
|
||||
|
||||
@@ -1171,7 +1190,7 @@ public class MagicStack extends MyObservable {
|
||||
*/
|
||||
public final SpellAbility_StackInstance getInstanceFromSpellAbility(final SpellAbility sa) {
|
||||
// TODO: Confirm this works!
|
||||
for (SpellAbility_StackInstance si : getStack()) {
|
||||
for (final SpellAbility_StackInstance si : this.getStack()) {
|
||||
if (si.getSpellAbility().equals(sa)) {
|
||||
return si;
|
||||
}
|
||||
@@ -1187,7 +1206,7 @@ public class MagicStack extends MyObservable {
|
||||
* @return a boolean.
|
||||
*/
|
||||
public final boolean hasSimultaneousStackEntries() {
|
||||
return getSimultaneousStackEntryList().size() > 0;
|
||||
return this.getSimultaneousStackEntryList().size() > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1199,7 +1218,7 @@ public class MagicStack extends MyObservable {
|
||||
* a {@link forge.card.spellability.SpellAbility} object.
|
||||
*/
|
||||
public final void addSimultaneousStackEntry(final SpellAbility sa) {
|
||||
getSimultaneousStackEntryList().add(sa);
|
||||
this.getSimultaneousStackEntryList().add(sa);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1210,10 +1229,10 @@ public class MagicStack extends MyObservable {
|
||||
public final void chooseOrderOfSimultaneousStackEntryAll() {
|
||||
final Player playerTurn = AllZone.getPhase().getPlayerTurn();
|
||||
|
||||
chooseOrderOfSimultaneousStackEntry(playerTurn);
|
||||
this.chooseOrderOfSimultaneousStackEntry(playerTurn);
|
||||
|
||||
if (playerTurn != null) {
|
||||
chooseOrderOfSimultaneousStackEntry(playerTurn.getOpponent());
|
||||
this.chooseOrderOfSimultaneousStackEntry(playerTurn.getOpponent());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1226,22 +1245,22 @@ public class MagicStack extends MyObservable {
|
||||
* a {@link forge.Player} object.
|
||||
*/
|
||||
public final void chooseOrderOfSimultaneousStackEntry(final Player activePlayer) {
|
||||
if (getSimultaneousStackEntryList().size() == 0) {
|
||||
if (this.getSimultaneousStackEntryList().size() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
ArrayList<SpellAbility> activePlayerSAs = new ArrayList<SpellAbility>();
|
||||
for (int i = 0; i < getSimultaneousStackEntryList().size(); i++) {
|
||||
if (getSimultaneousStackEntryList().get(i).getActivatingPlayer() == null) {
|
||||
if (getSimultaneousStackEntryList().get(i).getSourceCard().getController().equals(activePlayer)) {
|
||||
activePlayerSAs.add(getSimultaneousStackEntryList().get(i));
|
||||
getSimultaneousStackEntryList().remove(i);
|
||||
final ArrayList<SpellAbility> activePlayerSAs = new ArrayList<SpellAbility>();
|
||||
for (int i = 0; i < this.getSimultaneousStackEntryList().size(); i++) {
|
||||
if (this.getSimultaneousStackEntryList().get(i).getActivatingPlayer() == null) {
|
||||
if (this.getSimultaneousStackEntryList().get(i).getSourceCard().getController().equals(activePlayer)) {
|
||||
activePlayerSAs.add(this.getSimultaneousStackEntryList().get(i));
|
||||
this.getSimultaneousStackEntryList().remove(i);
|
||||
i--;
|
||||
}
|
||||
} else {
|
||||
if (getSimultaneousStackEntryList().get(i).getActivatingPlayer().equals(activePlayer)) {
|
||||
activePlayerSAs.add(getSimultaneousStackEntryList().get(i));
|
||||
getSimultaneousStackEntryList().remove(i);
|
||||
if (this.getSimultaneousStackEntryList().get(i).getActivatingPlayer().equals(activePlayer)) {
|
||||
activePlayerSAs.add(this.getSimultaneousStackEntryList().get(i));
|
||||
this.getSimultaneousStackEntryList().remove(i);
|
||||
i--;
|
||||
}
|
||||
}
|
||||
@@ -1251,14 +1270,14 @@ public class MagicStack extends MyObservable {
|
||||
}
|
||||
|
||||
if (activePlayer.isComputer()) {
|
||||
for (SpellAbility sa : activePlayerSAs) {
|
||||
for (final SpellAbility sa : activePlayerSAs) {
|
||||
sa.doTrigger(sa.isMandatory());
|
||||
ComputerUtil.playStack(sa);
|
||||
}
|
||||
} else {
|
||||
while (activePlayerSAs.size() > 1) {
|
||||
|
||||
SpellAbility next = (SpellAbility) GuiUtils.getChoice(
|
||||
final SpellAbility next = (SpellAbility) GuiUtils.getChoice(
|
||||
"Choose which spell or ability to put on the stack next.", activePlayerSAs.toArray());
|
||||
|
||||
activePlayerSAs.remove(next);
|
||||
@@ -1268,14 +1287,14 @@ public class MagicStack extends MyObservable {
|
||||
AllZone.getGameAction().playSpellAbility(next);
|
||||
} else {
|
||||
System.out.println("Stack order: AllZone.getStack().add(next)");
|
||||
add(next);
|
||||
this.add(next);
|
||||
}
|
||||
}
|
||||
|
||||
if (activePlayerSAs.get(0).isTrigger()) {
|
||||
AllZone.getGameAction().playSpellAbility(activePlayerSAs.get(0));
|
||||
} else {
|
||||
add(activePlayerSAs.get(0));
|
||||
this.add(activePlayerSAs.get(0));
|
||||
}
|
||||
// AllZone.getGameAction().playSpellAbility(activePlayerSAs.get(0));
|
||||
}
|
||||
@@ -1289,13 +1308,13 @@ public class MagicStack extends MyObservable {
|
||||
* @return true, if successful
|
||||
*/
|
||||
public final boolean hasStateTrigger(final int triggerID) {
|
||||
for (SpellAbility_StackInstance sasi : getStack()) {
|
||||
for (final SpellAbility_StackInstance sasi : this.getStack()) {
|
||||
if (sasi.isStateTrigger(triggerID)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
for (SpellAbility sa : simultaneousStackEntryList) {
|
||||
for (final SpellAbility sa : this.simultaneousStackEntryList) {
|
||||
if (sa.getSourceTrigger() == triggerID) {
|
||||
return true;
|
||||
}
|
||||
@@ -1310,7 +1329,7 @@ public class MagicStack extends MyObservable {
|
||||
* @return the simultaneousStackEntryList
|
||||
*/
|
||||
public final List<SpellAbility> getSimultaneousStackEntryList() {
|
||||
return simultaneousStackEntryList;
|
||||
return this.simultaneousStackEntryList;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1319,7 +1338,7 @@ public class MagicStack extends MyObservable {
|
||||
* @return the stack
|
||||
*/
|
||||
public final Stack<SpellAbility_StackInstance> getStack() {
|
||||
return stack;
|
||||
return this.stack;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1328,7 +1347,7 @@ public class MagicStack extends MyObservable {
|
||||
* @return the frozenStack
|
||||
*/
|
||||
public final Stack<SpellAbility_StackInstance> getFrozenStack() {
|
||||
return frozenStack;
|
||||
return this.frozenStack;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1337,14 +1356,14 @@ public class MagicStack extends MyObservable {
|
||||
* @return a CardList.
|
||||
*/
|
||||
public final CardList getCardsCastThisTurn() {
|
||||
return thisTurnCast;
|
||||
return this.thisTurnCast;
|
||||
}
|
||||
|
||||
/**
|
||||
* clearCardsCastThisTurn.
|
||||
*/
|
||||
public final void clearCardsCastThisTurn() {
|
||||
thisTurnCast.clear();
|
||||
this.thisTurnCast.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1352,7 +1371,7 @@ public class MagicStack extends MyObservable {
|
||||
* setCardsCastLastTurn.
|
||||
*/
|
||||
public final void setCardsCastLastTurn() {
|
||||
lastTurnCast = new CardList(thisTurnCast);
|
||||
this.lastTurnCast = new CardList(this.thisTurnCast);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1361,6 +1380,6 @@ public class MagicStack extends MyObservable {
|
||||
* @return a CardList.
|
||||
*/
|
||||
public final CardList getCardsCastLastTurn() {
|
||||
return lastTurnCast;
|
||||
return this.lastTurnCast;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -430,7 +430,7 @@ public class Phase extends MyObservable implements java.io.Serializable {
|
||||
public final void nextPhase() {
|
||||
// experimental, add executeCardStateEffects() here:
|
||||
for (String effect : AllZone.getStaticEffects().getStateBasedMap().keySet()) {
|
||||
Command com = GameActionUtil.commands.get(effect);
|
||||
Command com = GameActionUtil.getCommands().get(effect);
|
||||
com.execute();
|
||||
}
|
||||
|
||||
|
||||
@@ -2196,12 +2196,12 @@ public abstract class Player extends GameEntity {
|
||||
|
||||
int ret = 7;
|
||||
for (int i = 0; i < handSizeOperations.size(); i++) {
|
||||
if (handSizeOperations.get(i).Mode.equals("=")) {
|
||||
ret = handSizeOperations.get(i).Amount;
|
||||
} else if (handSizeOperations.get(i).Mode.equals("+") && ret >= 0) {
|
||||
ret = ret + handSizeOperations.get(i).Amount;
|
||||
} else if (handSizeOperations.get(i).Mode.equals("-") && ret >= 0) {
|
||||
ret = ret - handSizeOperations.get(i).Amount;
|
||||
if (handSizeOperations.get(i).getMode().equals("=")) {
|
||||
ret = handSizeOperations.get(i).getAmount();
|
||||
} else if (handSizeOperations.get(i).getMode().equals("+") && ret >= 0) {
|
||||
ret = ret + handSizeOperations.get(i).getAmount();
|
||||
} else if (handSizeOperations.get(i).getMode().equals("-") && ret >= 0) {
|
||||
ret = ret - handSizeOperations.get(i).getAmount();
|
||||
if (ret < 0) {
|
||||
ret = 0;
|
||||
}
|
||||
@@ -2225,7 +2225,7 @@ public abstract class Player extends GameEntity {
|
||||
while (changes > 0) {
|
||||
changes = 0;
|
||||
for (int i = 1; i < handSizeOperations.size(); i++) {
|
||||
if (handSizeOperations.get(i).hsTimeStamp < handSizeOperations.get(i - 1).hsTimeStamp) {
|
||||
if (handSizeOperations.get(i).getHsTimeStamp() < handSizeOperations.get(i - 1).getHsTimeStamp()) {
|
||||
HandSizeOp tmp = handSizeOperations.get(i);
|
||||
handSizeOperations.set(i, handSizeOperations.get(i - 1));
|
||||
handSizeOperations.set(i - 1, tmp);
|
||||
@@ -2257,7 +2257,7 @@ public abstract class Player extends GameEntity {
|
||||
*/
|
||||
public final void removeHandSizeOperation(final int timestamp) {
|
||||
for (int i = 0; i < handSizeOperations.size(); i++) {
|
||||
if (handSizeOperations.get(i).hsTimeStamp == timestamp) {
|
||||
if (handSizeOperations.get(i).getHsTimeStamp() == timestamp) {
|
||||
handSizeOperations.remove(i);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -277,7 +277,7 @@ public class PlayerZoneComesIntoPlay extends DefaultPlayerZone {
|
||||
for (String effect : effects) {
|
||||
tempEffect = effect;
|
||||
AllZone.getStaticEffects().removeStateBasedEffect(effect);
|
||||
Command comm = GameActionUtil.commands.get(tempEffect); // this
|
||||
Command comm = GameActionUtil.getCommands().get(tempEffect); // this
|
||||
// is to
|
||||
// make
|
||||
// sure
|
||||
@@ -290,7 +290,7 @@ public class PlayerZoneComesIntoPlay extends DefaultPlayerZone {
|
||||
}
|
||||
|
||||
for (String effect : AllZone.getStaticEffects().getStateBasedMap().keySet()) {
|
||||
Command com = GameActionUtil.commands.get(effect);
|
||||
Command com = GameActionUtil.getCommands().get(effect);
|
||||
com.execute();
|
||||
}
|
||||
|
||||
|
||||
@@ -48,8 +48,7 @@ public class Input_Attack extends Input {
|
||||
for (int i = 0; i < possibleAttackers.size(); i++) {
|
||||
Card c = possibleAttackers.get(i);
|
||||
if (c.hasKeyword("CARDNAME attacks each turn if able.") && CombatUtil.canAttack(c, AllZone.getCombat())
|
||||
&& !c.isAttacking())
|
||||
{
|
||||
&& !c.isAttacking()) {
|
||||
AllZone.getCombat().addAttacker(c);
|
||||
}
|
||||
}
|
||||
@@ -79,8 +78,7 @@ public class Input_Attack extends Input {
|
||||
}
|
||||
|
||||
if (zone.is(Constant.Zone.Battlefield, AllZone.getHumanPlayer())
|
||||
&& CombatUtil.canAttack(card, AllZone.getCombat()))
|
||||
{
|
||||
&& CombatUtil.canAttack(card, AllZone.getCombat())) {
|
||||
|
||||
// TODO add the propaganda code here and remove it in
|
||||
// Phase.nextPhase()
|
||||
@@ -100,7 +98,7 @@ public class Input_Attack extends Input {
|
||||
|
||||
// for Castle Raptors, since it gets a bonus if untapped
|
||||
for (String effect : AllZone.getStaticEffects().getStateBasedMap().keySet()) {
|
||||
Command com = GameActionUtil.commands.get(effect);
|
||||
Command com = GameActionUtil.getCommands().get(effect);
|
||||
com.execute();
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ public class Input_Block extends Input {
|
||||
public final void showMessage() {
|
||||
// for Castle Raptors, since it gets a bonus if untapped
|
||||
for (String effect : AllZone.getStaticEffects().getStateBasedMap().keySet()) {
|
||||
Command com = GameActionUtil.commands.get(effect);
|
||||
Command com = GameActionUtil.getCommands().get(effect);
|
||||
com.execute();
|
||||
}
|
||||
|
||||
|
||||
@@ -101,7 +101,7 @@ public class ApplicationView implements FView {
|
||||
OldGuiNewGame.cardOverlay.setSelected(preferences.cardOverlay);
|
||||
|
||||
// FindBugs doesn't like the next line.
|
||||
ImageCache.scaleLargerThanOriginal = preferences.scaleLargerThanOriginal;
|
||||
ImageCache.setScaleLargerThanOriginal(preferences.scaleLargerThanOriginal);
|
||||
|
||||
OldGuiNewGame.cardScale.setSelected(preferences.scaleLargerThanOriginal);
|
||||
CardStackOffsetAction.set(preferences.stackOffset);
|
||||
|
||||
@@ -284,7 +284,7 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
|
||||
|
||||
cardScale.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(final ActionEvent arg0) {
|
||||
ImageCache.scaleLargerThanOriginal = cardScale.isSelected();
|
||||
ImageCache.setScaleLargerThanOriginal(cardScale.isSelected());
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1628,7 +1628,7 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
|
||||
preferences.millingLossCondition = Constant.Runtime.MILL[0];
|
||||
preferences.developerMode = Constant.Runtime.DEV_MODE[0];
|
||||
preferences.cardOverlay = cardOverlay.isSelected();
|
||||
preferences.scaleLargerThanOriginal = ImageCache.scaleLargerThanOriginal;
|
||||
preferences.scaleLargerThanOriginal = ImageCache.isScaleLargerThanOriginal();
|
||||
preferences.uploadDraftAI = Constant.Runtime.UPLOAD_DRAFT[0];
|
||||
preferences.save();
|
||||
} catch (Exception ex) {
|
||||
|
||||
Reference in New Issue
Block a user