mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 19:28:01 +00:00
Chesckstyle fixes in several files
This commit is contained in:
@@ -14,14 +14,14 @@ public class HandSizeOp {
|
|||||||
/**
|
/**
|
||||||
* <p>Constructor for HandSizeOp.</p>
|
* <p>Constructor for HandSizeOp.</p>
|
||||||
*
|
*
|
||||||
* @param M a {@link java.lang.String} object.
|
* @param m a {@link java.lang.String} object.
|
||||||
* @param A a int.
|
* @param a a int.
|
||||||
* @param TS a int.
|
* @param ts a int.
|
||||||
*/
|
*/
|
||||||
public HandSizeOp(String M, int A, int TS) {
|
public HandSizeOp(final String m, final int a, final int ts) {
|
||||||
Mode = M;
|
Mode = m;
|
||||||
Amount = A;
|
Amount = a;
|
||||||
hsTimeStamp = TS;
|
hsTimeStamp = ts;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -29,7 +29,7 @@ public class HandSizeOp {
|
|||||||
*
|
*
|
||||||
* @return a {@link java.lang.String} object.
|
* @return a {@link java.lang.String} object.
|
||||||
*/
|
*/
|
||||||
public String toString() {
|
public final String toString() {
|
||||||
return "Mode(" + Mode + ") Amount(" + Amount + ") Timestamp(" + hsTimeStamp + ")";
|
return "Mode(" + Mode + ") Amount(" + Amount + ") Timestamp(" + hsTimeStamp + ")";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import java.net.URL;
|
|||||||
* @version $Id$
|
* @version $Id$
|
||||||
* @since 1.0.15
|
* @since 1.0.15
|
||||||
*/
|
*/
|
||||||
public class HttpUtil {
|
public class HttpUtil {
|
||||||
|
|
||||||
private static final String Boundary = "--7d021a37605f0";
|
private static final String Boundary = "--7d021a37605f0";
|
||||||
|
|
||||||
@@ -27,15 +27,14 @@ public class HttpUtil {
|
|||||||
* @param sURL a {@link java.lang.String} object.
|
* @param sURL a {@link java.lang.String} object.
|
||||||
* @param file a {@link java.lang.String} object.
|
* @param file a {@link java.lang.String} object.
|
||||||
*/
|
*/
|
||||||
public void upload(String sURL, String file)
|
public final void upload(final String sURL, final String file) {
|
||||||
{
|
|
||||||
URL url = null;
|
URL url = null;
|
||||||
try {
|
try {
|
||||||
url = new URL(sURL);
|
url = new URL(sURL);
|
||||||
} catch (MalformedURLException e) {
|
} catch (MalformedURLException e) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
HttpURLConnection theUrlConnection = null;
|
HttpURLConnection theUrlConnection = null;
|
||||||
try {
|
try {
|
||||||
theUrlConnection = (HttpURLConnection) url.openConnection();
|
theUrlConnection = (HttpURLConnection) url.openConnection();
|
||||||
@@ -44,7 +43,7 @@ public class HttpUtil {
|
|||||||
}
|
}
|
||||||
theUrlConnection.setDoOutput(true);
|
theUrlConnection.setDoOutput(true);
|
||||||
theUrlConnection.setDoInput(true);
|
theUrlConnection.setDoInput(true);
|
||||||
theUrlConnection.setUseCaches(false);
|
theUrlConnection.setUseCaches(false);
|
||||||
theUrlConnection.setChunkedStreamingMode(1024);
|
theUrlConnection.setChunkedStreamingMode(1024);
|
||||||
|
|
||||||
theUrlConnection.setRequestProperty("Content-Type", "multipart/form-data; boundary=" + Boundary);
|
theUrlConnection.setRequestProperty("Content-Type", "multipart/form-data; boundary=" + Boundary);
|
||||||
@@ -53,7 +52,7 @@ public class HttpUtil {
|
|||||||
try {
|
try {
|
||||||
httpOut = new DataOutputStream(theUrlConnection.getOutputStream());
|
httpOut = new DataOutputStream(theUrlConnection.getOutputStream());
|
||||||
} catch (IOException e1) {
|
} catch (IOException e1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
File f = new File(file);
|
File f = new File(file);
|
||||||
@@ -124,17 +123,18 @@ public class HttpUtil {
|
|||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (Constant.Runtime.DevMode[0])
|
if (Constant.Runtime.DevMode[0]) {
|
||||||
System.out.println(response.toString());
|
System.out.println(response.toString());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>getURL.</p>
|
* <p>getURL.</p>
|
||||||
*
|
*
|
||||||
* @param sURL a {@link java.lang.String} object.
|
* @param sURL a {@link java.lang.String} object.
|
||||||
* @return a {@link java.lang.String} object.
|
* @return a {@link java.lang.String} object.
|
||||||
*/
|
*/
|
||||||
public String getURL(String sURL) {
|
public final String getURL(final String sURL) {
|
||||||
URL url = null;
|
URL url = null;
|
||||||
try {
|
try {
|
||||||
url = new URL(sURL);
|
url = new URL(sURL);
|
||||||
@@ -151,12 +151,12 @@ public class HttpUtil {
|
|||||||
StringBuffer buffer = new StringBuffer();
|
StringBuffer buffer = new StringBuffer();
|
||||||
try {
|
try {
|
||||||
while ((ptr = is.read()) != -1) {
|
while ((ptr = is.read()) != -1) {
|
||||||
buffer.append((char)ptr);
|
buffer.append((char) ptr);
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
return "error 3";
|
return "error 3";
|
||||||
}
|
}
|
||||||
|
|
||||||
return buffer.toString();
|
return buffer.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,28 +12,28 @@ interface IPlayerZone {
|
|||||||
*
|
*
|
||||||
* @param b a boolean.
|
* @param b a boolean.
|
||||||
*/
|
*/
|
||||||
public void setUpdate(boolean b);
|
void setUpdate(boolean b);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>getUpdate.</p>
|
* <p>getUpdate.</p>
|
||||||
*
|
*
|
||||||
* @return a boolean.
|
* @return a boolean.
|
||||||
*/
|
*/
|
||||||
public boolean getUpdate();
|
boolean getUpdate();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>size.</p>
|
* <p>size.</p>
|
||||||
*
|
*
|
||||||
* @return a int.
|
* @return a int.
|
||||||
*/
|
*/
|
||||||
public int size();
|
int size();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>add.</p>
|
* <p>add.</p>
|
||||||
*
|
*
|
||||||
* @param o a {@link java.lang.Object} object.
|
* @param o a {@link java.lang.Object} object.
|
||||||
*/
|
*/
|
||||||
public void add(Object o);
|
void add(Object o);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>add.</p>
|
* <p>add.</p>
|
||||||
@@ -41,14 +41,14 @@ interface IPlayerZone {
|
|||||||
* @param c a {@link forge.Card} object.
|
* @param c a {@link forge.Card} object.
|
||||||
* @param index a int.
|
* @param index a int.
|
||||||
*/
|
*/
|
||||||
public void add(Card c, int index);
|
void add(Card c, int index);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>addOnce.</p>
|
* <p>addOnce.</p>
|
||||||
*
|
*
|
||||||
* @param o a {@link java.lang.Object} object.
|
* @param o a {@link java.lang.Object} object.
|
||||||
*/
|
*/
|
||||||
public void addOnce(Object o);
|
void addOnce(Object o);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>get.</p>
|
* <p>get.</p>
|
||||||
@@ -56,34 +56,34 @@ interface IPlayerZone {
|
|||||||
* @param index a int.
|
* @param index a int.
|
||||||
* @return a {@link forge.Card} object.
|
* @return a {@link forge.Card} object.
|
||||||
*/
|
*/
|
||||||
public Card get(int index);
|
Card get(int index);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>remove.</p>
|
* <p>remove.</p>
|
||||||
*
|
*
|
||||||
* @param o a {@link java.lang.Object} object.
|
* @param o a {@link java.lang.Object} object.
|
||||||
*/
|
*/
|
||||||
public void remove(Object o);
|
void remove(Object o);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>setCards.</p>
|
* <p>setCards.</p>
|
||||||
*
|
*
|
||||||
* @param c an array of {@link forge.Card} objects.
|
* @param c an array of {@link forge.Card} objects.
|
||||||
*/
|
*/
|
||||||
public void setCards(Card c[]);
|
void setCards(Card[] c);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>getCards.</p>
|
* <p>getCards.</p>
|
||||||
*
|
*
|
||||||
* @return an array of {@link forge.Card} objects.
|
* @return an array of {@link forge.Card} objects.
|
||||||
*/
|
*/
|
||||||
public Card[] getCards();
|
Card[] getCards();
|
||||||
|
|
||||||
//removes all cards
|
//removes all cards
|
||||||
/**
|
/**
|
||||||
* <p>reset.</p>
|
* <p>reset.</p>
|
||||||
*/
|
*/
|
||||||
public void reset();
|
void reset();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>is.</p>
|
* <p>is.</p>
|
||||||
@@ -91,7 +91,7 @@ interface IPlayerZone {
|
|||||||
* @param zone a {@link java.lang.String} object.
|
* @param zone a {@link java.lang.String} object.
|
||||||
* @return a boolean.
|
* @return a boolean.
|
||||||
*/
|
*/
|
||||||
public boolean is(String zone);
|
boolean is(String zone);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>is.</p>
|
* <p>is.</p>
|
||||||
@@ -100,27 +100,27 @@ interface IPlayerZone {
|
|||||||
* @param player a {@link forge.Player} object.
|
* @param player a {@link forge.Player} object.
|
||||||
* @return a boolean.
|
* @return a boolean.
|
||||||
*/
|
*/
|
||||||
public boolean is(String zone, Player player);
|
boolean is(String zone, Player player);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>getPlayer.</p>
|
* <p>getPlayer.</p>
|
||||||
*
|
*
|
||||||
* @return a {@link forge.Player} object.
|
* @return a {@link forge.Player} object.
|
||||||
*/
|
*/
|
||||||
public Player getPlayer();//the Player that owns this zone
|
Player getPlayer(); //the Player that owns this zone
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>getZoneName.</p>
|
* <p>getZoneName.</p>
|
||||||
*
|
*
|
||||||
* @return a {@link java.lang.String} object.
|
* @return a {@link java.lang.String} object.
|
||||||
*/
|
*/
|
||||||
public String getZoneName();//returns the Zone's name like Graveyard
|
String getZoneName(); //returns the Zone's name like Graveyard
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>toString.</p>
|
* <p>toString.</p>
|
||||||
*
|
*
|
||||||
* @return a {@link java.lang.String} object.
|
* @return a {@link java.lang.String} object.
|
||||||
*/
|
*/
|
||||||
public String toString();
|
String toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,12 +18,12 @@ import java.io.File;
|
|||||||
public class ImagePreviewPanel extends JPanel implements PropertyChangeListener {
|
public class ImagePreviewPanel extends JPanel implements PropertyChangeListener {
|
||||||
|
|
||||||
|
|
||||||
/** Constant <code>serialVersionUID=2163809931940286240L</code> */
|
/** Constant <code>serialVersionUID=2163809931940286240L</code>. */
|
||||||
private static final long serialVersionUID = 2163809931940286240L;
|
private static final long serialVersionUID = 2163809931940286240L;
|
||||||
private int width, height;
|
private int width, height;
|
||||||
private ImageIcon icon;
|
private ImageIcon icon;
|
||||||
private Image image;
|
private Image image;
|
||||||
/** Constant <code>ACCSIZE=155</code> */
|
/** Constant <code>ACCSIZE=155</code>. */
|
||||||
private static final int ACCSIZE = 155;
|
private static final int ACCSIZE = 155;
|
||||||
private Color bg;
|
private Color bg;
|
||||||
|
|
||||||
@@ -36,7 +36,7 @@ public class ImagePreviewPanel extends JPanel implements PropertyChangeListener
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
public void propertyChange(PropertyChangeEvent e) {
|
public final void propertyChange(final PropertyChangeEvent e) {
|
||||||
String propertyName = e.getPropertyName();
|
String propertyName = e.getPropertyName();
|
||||||
|
|
||||||
// Make sure we are responding to the right event.
|
// Make sure we are responding to the right event.
|
||||||
@@ -44,8 +44,11 @@ public class ImagePreviewPanel extends JPanel implements PropertyChangeListener
|
|||||||
File selection = (File) e.getNewValue();
|
File selection = (File) e.getNewValue();
|
||||||
String name;
|
String name;
|
||||||
|
|
||||||
if (selection == null) return;
|
if (selection == null) {
|
||||||
else name = selection.getAbsolutePath();
|
return;
|
||||||
|
} else {
|
||||||
|
name = selection.getAbsolutePath();
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Make reasonably sure we have an image format that AWT can
|
* Make reasonably sure we have an image format that AWT can
|
||||||
@@ -53,7 +56,8 @@ public class ImagePreviewPanel extends JPanel implements PropertyChangeListener
|
|||||||
*/
|
*/
|
||||||
if ((name != null)
|
if ((name != null)
|
||||||
&& (name.toLowerCase().endsWith(".jpg") || name.toLowerCase().endsWith(".jpeg")
|
&& (name.toLowerCase().endsWith(".jpg") || name.toLowerCase().endsWith(".jpeg")
|
||||||
|| name.toLowerCase().endsWith(".gif") || name.toLowerCase().endsWith(".png"))) {
|
|| name.toLowerCase().endsWith(".gif") || name.toLowerCase().endsWith(".png")))
|
||||||
|
{
|
||||||
icon = new ImageIcon(name);
|
icon = new ImageIcon(name);
|
||||||
image = icon.getImage();
|
image = icon.getImage();
|
||||||
scaleImage();
|
scaleImage();
|
||||||
@@ -96,7 +100,7 @@ public class ImagePreviewPanel extends JPanel implements PropertyChangeListener
|
|||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@Override
|
@Override
|
||||||
public void paintComponent(Graphics g) {
|
public final void paintComponent(final Graphics g) {
|
||||||
g.setColor(bg);
|
g.setColor(bg);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import java.util.Random;
|
|||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
public class MyRandom {
|
public class MyRandom {
|
||||||
/** Constant <code>random</code> */
|
/** Constant <code>random</code>. */
|
||||||
public static Random random = new Random();
|
public static Random random = new Random();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -18,7 +18,7 @@ public class MyRandom {
|
|||||||
* @param percent a int.
|
* @param percent a int.
|
||||||
* @return a boolean.
|
* @return a boolean.
|
||||||
*/
|
*/
|
||||||
public static boolean percentTrue(int percent) {
|
public static boolean percentTrue(final int percent) {
|
||||||
return percent > random.nextInt(100);
|
return percent > random.nextInt(100);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ public class NameChanger implements NewConstants {
|
|||||||
*
|
*
|
||||||
* @return a boolean.
|
* @return a boolean.
|
||||||
*/
|
*/
|
||||||
public boolean shouldChangeCardName() {
|
public final boolean shouldChangeCardName() {
|
||||||
return changeCardName;
|
return changeCardName;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -54,7 +54,7 @@ public class NameChanger implements NewConstants {
|
|||||||
*
|
*
|
||||||
* @param b a boolean.
|
* @param b a boolean.
|
||||||
*/
|
*/
|
||||||
public void setShouldChangeCardName(boolean b) {
|
public final void setShouldChangeCardName(final boolean b) {
|
||||||
changeCardName = b;
|
changeCardName = b;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -62,23 +62,23 @@ public class NameChanger implements NewConstants {
|
|||||||
* This change's the inputGenerator's Card instances in place,
|
* This change's the inputGenerator's Card instances in place,
|
||||||
* and returns a generator of those same changed instances.
|
* and returns a generator of those same changed instances.
|
||||||
*
|
*
|
||||||
* TODO: Should this method return void, because it side effects
|
* TODO Should this method return void, because it side effects
|
||||||
* the contents of its inputGenerator?
|
* the contents of its inputGenerator?
|
||||||
*
|
*
|
||||||
* @param inputGenerator a Generator of Card objects
|
* @param inputGenerator a Generator of Card objects
|
||||||
* @return a Generator of side-effected Card objects
|
* @return a Generator of side-effected Card objects
|
||||||
*/
|
*/
|
||||||
public Generator<Card> changeCard(Generator<Card> inputGenerator) {
|
public final Generator<Card> changeCard(final Generator<Card> inputGenerator) {
|
||||||
|
|
||||||
// Create a new Generator by applying a transform to the
|
// Create a new Generator by applying a transform to the
|
||||||
// inputGenerator.
|
// inputGenerator.
|
||||||
|
|
||||||
Lambda1<Card,Card> transform = new Lambda1<Card,Card>() {
|
Lambda1<Card, Card> transform = new Lambda1<Card, Card>() {
|
||||||
public Card apply(Card toChange) {
|
public Card apply(final Card toChange) {
|
||||||
return changeCard(toChange);
|
return changeCard(toChange);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
return GeneratorFunctions.transformGenerator(transform, inputGenerator);
|
return GeneratorFunctions.transformGenerator(transform, inputGenerator);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -89,7 +89,7 @@ public class NameChanger implements NewConstants {
|
|||||||
* @param c a {@link forge.Card} object.
|
* @param c a {@link forge.Card} object.
|
||||||
* @return a {@link forge.Card} object.
|
* @return a {@link forge.Card} object.
|
||||||
*/
|
*/
|
||||||
public Card changeCard(Card c) {
|
public final Card changeCard(final Card c) {
|
||||||
//change name
|
//change name
|
||||||
String newName = changeName(c.getName());
|
String newName = changeName(c.getName());
|
||||||
c.setName(newName);
|
c.setName(newName);
|
||||||
@@ -110,7 +110,7 @@ public class NameChanger implements NewConstants {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return c;
|
return c;
|
||||||
}//getMutatedCard()
|
} //getMutatedCard()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>changeString.</p>
|
* <p>changeString.</p>
|
||||||
@@ -119,9 +119,9 @@ public class NameChanger implements NewConstants {
|
|||||||
* @param in a {@link java.lang.String} object.
|
* @param in a {@link java.lang.String} object.
|
||||||
* @return a {@link java.lang.String} object.
|
* @return a {@link java.lang.String} object.
|
||||||
*/
|
*/
|
||||||
public String changeString(Card c, String in) {
|
public final String changeString(final Card c, final String in) {
|
||||||
//String name = getOriginalName(c.getName()); // unused
|
//String name = getOriginalName(c.getName()); // unused
|
||||||
// in = in.replaceAll(name, changeName(name));
|
// in = in.replaceAll(name, changeName(name));
|
||||||
|
|
||||||
return in;
|
return in;
|
||||||
}
|
}
|
||||||
@@ -131,7 +131,7 @@ public class NameChanger implements NewConstants {
|
|||||||
*
|
*
|
||||||
* If not, we just return list.
|
* If not, we just return list.
|
||||||
*
|
*
|
||||||
* TODO: Should this method return void, because it side effects the
|
* TODO Should this method return void, because it side effects the
|
||||||
* contents of its input list?
|
* contents of its input list?
|
||||||
*
|
*
|
||||||
* @param list
|
* @param list
|
||||||
@@ -141,7 +141,7 @@ public class NameChanger implements NewConstants {
|
|||||||
* @return either list itself or a new list (possibly wasteful) containing
|
* @return either list itself or a new list (possibly wasteful) containing
|
||||||
* the side effected cards
|
* the side effected cards
|
||||||
*/
|
*/
|
||||||
public CardList changeCardsIfNeeded(CardList list) {
|
public final CardList changeCardsIfNeeded(CardList list) {
|
||||||
if (shouldChangeCardName()) {
|
if (shouldChangeCardName()) {
|
||||||
list = new CardList(changeCard(YieldUtils.toGenerator(list)));
|
list = new CardList(changeCard(YieldUtils.toGenerator(list)));
|
||||||
}
|
}
|
||||||
@@ -156,13 +156,15 @@ public class NameChanger implements NewConstants {
|
|||||||
* @param originalName a {@link java.lang.String} object.
|
* @param originalName a {@link java.lang.String} object.
|
||||||
* @return a {@link java.lang.String} object.
|
* @return a {@link java.lang.String} object.
|
||||||
*/
|
*/
|
||||||
public String changeName(String originalName) {
|
public final String changeName(final String originalName) {
|
||||||
Object o = mutatedMap.get(originalName);
|
Object o = mutatedMap.get(originalName);
|
||||||
|
|
||||||
if (o == null) return originalName;
|
if (o == null) {
|
||||||
|
return originalName;
|
||||||
|
}
|
||||||
|
|
||||||
return o.toString();
|
return o.toString();
|
||||||
}//getMutatedName()
|
} //getMutatedName()
|
||||||
|
|
||||||
//always returns the original cardname
|
//always returns the original cardname
|
||||||
//if argument is a original name, it returns the same original name
|
//if argument is a original name, it returns the same original name
|
||||||
@@ -172,13 +174,15 @@ public class NameChanger implements NewConstants {
|
|||||||
* @param mutatedName a {@link java.lang.String} object.
|
* @param mutatedName a {@link java.lang.String} object.
|
||||||
* @return a {@link java.lang.String} object.
|
* @return a {@link java.lang.String} object.
|
||||||
*/
|
*/
|
||||||
public String getOriginalName(String mutatedName) {
|
public final String getOriginalName(final String mutatedName) {
|
||||||
Object o = originalMap.get(mutatedName);
|
Object o = originalMap.get(mutatedName);
|
||||||
|
|
||||||
if (o == null) return mutatedName;
|
if (o == null) {
|
||||||
|
return mutatedName;
|
||||||
|
}
|
||||||
|
|
||||||
return o.toString();
|
return o.toString();
|
||||||
}//getOriginalName()
|
} //getOriginalName()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>readFile.</p>
|
* <p>readFile.</p>
|
||||||
@@ -195,8 +199,8 @@ public class NameChanger implements NewConstants {
|
|||||||
processLine(line.trim());
|
processLine(line.trim());
|
||||||
|
|
||||||
line = in.readLine();
|
line = in.readLine();
|
||||||
}//while
|
} //while
|
||||||
}//try
|
} //try
|
||||||
catch (Exception ex) {
|
catch (Exception ex) {
|
||||||
//~ throw new RuntimeException("NameMutator : readFile() error, " +ex);
|
//~ throw new RuntimeException("NameMutator : readFile() error, " +ex);
|
||||||
|
|
||||||
@@ -210,7 +214,7 @@ public class NameChanger implements NewConstants {
|
|||||||
//stop reading if end of file or blank line is read
|
//stop reading if end of file or blank line is read
|
||||||
while ((line = in.readLine()) != null && (line.trim().length() != 0)) {
|
while ((line = in.readLine()) != null && (line.trim().length() != 0)) {
|
||||||
processLine(line.trim());
|
processLine(line.trim());
|
||||||
}//while
|
} //while
|
||||||
} catch (Exception ex2) {
|
} catch (Exception ex2) {
|
||||||
// Show orig exception
|
// Show orig exception
|
||||||
ErrorViewer.showError(ex2);
|
ErrorViewer.showError(ex2);
|
||||||
@@ -218,7 +222,7 @@ public class NameChanger implements NewConstants {
|
|||||||
}
|
}
|
||||||
//~
|
//~
|
||||||
}
|
}
|
||||||
}//readFile()
|
} //readFile()
|
||||||
|
|
||||||
//line is formated "original card name : alias card name"
|
//line is formated "original card name : alias card name"
|
||||||
/**
|
/**
|
||||||
@@ -226,12 +230,13 @@ public class NameChanger implements NewConstants {
|
|||||||
*
|
*
|
||||||
* @param line a {@link java.lang.String} object.
|
* @param line a {@link java.lang.String} object.
|
||||||
*/
|
*/
|
||||||
private void processLine(String line) {
|
private void processLine(final String line) {
|
||||||
StringTokenizer tok = new StringTokenizer(line, ":");
|
StringTokenizer tok = new StringTokenizer(line, ":");
|
||||||
|
|
||||||
if (tok.countTokens() != 2)
|
if (tok.countTokens() != 2) {
|
||||||
throw new RuntimeException(
|
throw new RuntimeException(
|
||||||
"NameMutator : processLine() error, invalid line in file name-mutator.txt - " + line);
|
"NameMutator : processLine() error, invalid line in file name-mutator.txt - " + line);
|
||||||
|
}
|
||||||
|
|
||||||
String original = tok.nextToken().trim();
|
String original = tok.nextToken().trim();
|
||||||
String mutated = tok.nextToken().trim();
|
String mutated = tok.nextToken().trim();
|
||||||
@@ -247,7 +252,7 @@ public class NameChanger implements NewConstants {
|
|||||||
*/
|
*/
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
// printMap
|
// printMap
|
||||||
private void printMap(Map<String, String> map) {
|
private void printMap(final Map<String, String> map) {
|
||||||
for (Entry<String, String> e : map.entrySet()) {
|
for (Entry<String, String> e : map.entrySet()) {
|
||||||
System.out.println(e.getKey() + " : " + e.getValue());
|
System.out.println(e.getKey() + " : " + e.getValue());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,26 +10,31 @@ import forge.gui.input.Input;
|
|||||||
* @author Forge
|
* @author Forge
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
public class PlayerUtil {
|
public final class PlayerUtil {
|
||||||
|
|
||||||
|
private PlayerUtil() {
|
||||||
|
throw new AssertionError();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>worshipFlag.</p>
|
* <p>worshipFlag.</p>
|
||||||
*
|
*
|
||||||
* @param player a {@link forge.Player} object.
|
* @param player a {@link forge.Player} object.
|
||||||
* @return a boolean.
|
* @return a boolean.
|
||||||
*/
|
*/
|
||||||
public static boolean worshipFlag(Player player) {
|
public static boolean worshipFlag(final Player player) {
|
||||||
// Instead of hardcoded Ali from Cairo like cards, it is now a Keyword
|
// Instead of hardcoded Ali from Cairo like cards, it is now a Keyword
|
||||||
CardList list = AllZoneUtil.getPlayerCardsInPlay(player);
|
CardList list = AllZoneUtil.getPlayerCardsInPlay(player);
|
||||||
list = list.getKeyword("Damage that would reduce your life total to less than 1 reduces it to 1 instead.");
|
list = list.getKeyword("Damage that would reduce your life total to less than 1 reduces it to 1 instead.");
|
||||||
list = list.filter(new CardListFilter() {
|
list = list.filter(new CardListFilter() {
|
||||||
public boolean addCard(Card c) {
|
public boolean addCard(final Card c) {
|
||||||
return !c.isFaceDown();
|
return !c.isFaceDown();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return list.size() > 0;
|
return list.size() > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>input_discardNumUnless.</p>
|
* <p>input_discardNumUnless.</p>
|
||||||
*
|
*
|
||||||
@@ -39,7 +44,7 @@ public class PlayerUtil {
|
|||||||
* @return a {@link forge.gui.input.Input} object.
|
* @return a {@link forge.gui.input.Input} object.
|
||||||
* @since 1.0.15
|
* @since 1.0.15
|
||||||
*/
|
*/
|
||||||
public static Input input_discardNumUnless(final int nCards, final String uType, SpellAbility sa) {
|
public static Input input_discardNumUnless(final int nCards, final String uType, final SpellAbility sa) {
|
||||||
final SpellAbility sp = sa;
|
final SpellAbility sp = sa;
|
||||||
Input target = new Input() {
|
Input target = new Input() {
|
||||||
private static final long serialVersionUID = 8822292413831640944L;
|
private static final long serialVersionUID = 8822292413831640944L;
|
||||||
@@ -48,7 +53,9 @@ public class PlayerUtil {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void showMessage() {
|
public void showMessage() {
|
||||||
if (AllZone.getHumanHand().size() == 0) stop();
|
if (AllZone.getHumanHand().size() == 0) {
|
||||||
|
stop();
|
||||||
|
}
|
||||||
AllZone.getDisplay().showMessage("Select " + (nCards - n) + " cards to discard, unless you discard a "
|
AllZone.getDisplay().showMessage("Select " + (nCards - n) + " cards to discard, unless you discard a "
|
||||||
+ uType + ".");
|
+ uType + ".");
|
||||||
ButtonUtil.disableAll();
|
ButtonUtil.disableAll();
|
||||||
@@ -60,25 +67,27 @@ public class PlayerUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void selectCard(Card card, PlayerZone zone) {
|
public void selectCard(final Card card, final PlayerZone zone) {
|
||||||
if (zone.is(Constant.Zone.Hand)) {
|
if (zone.is(Constant.Zone.Hand)) {
|
||||||
card.getController().discard(card, sp);
|
card.getController().discard(card, sp);
|
||||||
n++;
|
n++;
|
||||||
|
|
||||||
if (card.isType(uType.toString())) stop();
|
if (card.isType(uType.toString())) {
|
||||||
|
stop();
|
||||||
else {
|
} else {
|
||||||
if (n == nCards || AllZone.getHumanHand().size() == 0) stop();
|
if (n == nCards || AllZone.getHumanHand().size() == 0) {
|
||||||
else
|
stop();
|
||||||
|
} else {
|
||||||
showMessage();
|
showMessage();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return target;
|
return target;
|
||||||
}//input_discardNumUnless
|
} //input_discardNumUnless
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>input_discard.</p>
|
* <p>input_discard.</p>
|
||||||
*
|
*
|
||||||
@@ -87,7 +96,7 @@ public class PlayerUtil {
|
|||||||
* @return a {@link forge.gui.input.Input} object.
|
* @return a {@link forge.gui.input.Input} object.
|
||||||
* @since 1.0.15
|
* @since 1.0.15
|
||||||
*/
|
*/
|
||||||
public static Input input_discard(final int nCards, SpellAbility sa) {
|
public static Input input_discard(final int nCards, final SpellAbility sa) {
|
||||||
final SpellAbility sp = sa;
|
final SpellAbility sp = sa;
|
||||||
Input target = new Input() {
|
Input target = new Input() {
|
||||||
private static final long serialVersionUID = -329993322080934435L;
|
private static final long serialVersionUID = -329993322080934435L;
|
||||||
@@ -96,55 +105,62 @@ public class PlayerUtil {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void showMessage() {
|
public void showMessage() {
|
||||||
if (AllZone.getHumanHand().size() == 0) stop();
|
if (AllZone.getHumanHand().size() == 0) {
|
||||||
if (nCards == 0) stop();
|
stop();
|
||||||
|
}
|
||||||
|
if (nCards == 0) {
|
||||||
|
stop();
|
||||||
|
}
|
||||||
|
|
||||||
AllZone.getDisplay().showMessage("Select a card to discard");
|
AllZone.getDisplay().showMessage("Select a card to discard");
|
||||||
ButtonUtil.disableAll();
|
ButtonUtil.disableAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void selectCard(Card card, PlayerZone zone) {
|
public void selectCard(final Card card, final PlayerZone zone) {
|
||||||
if (zone.is(Constant.Zone.Hand)) {
|
if (zone.is(Constant.Zone.Hand)) {
|
||||||
card.getController().discard(card, sp);
|
card.getController().discard(card, sp);
|
||||||
n++;
|
n++;
|
||||||
|
|
||||||
//in case no more cards in hand
|
//in case no more cards in hand
|
||||||
if (n == nCards || AllZone.getHumanHand().size() == 0) stop();
|
if (n == nCards || AllZone.getHumanHand().size() == 0) {
|
||||||
else
|
stop();
|
||||||
|
} else {
|
||||||
showMessage();
|
showMessage();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
return target;
|
return target;
|
||||||
}//input_discard()
|
} //input_discard()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>input_chainsDiscard.</p>
|
* <p>input_chainsDiscard.</p>
|
||||||
*
|
*
|
||||||
* @return a {@link forge.gui.input.Input} object.
|
* @return a {@link forge.gui.input.Input} object.
|
||||||
* @since
|
|
||||||
*/
|
*/
|
||||||
public static Input input_chainsDiscard() {
|
public static Input input_chainsDiscard() {
|
||||||
Input target = new Input() {
|
Input target = new Input() {
|
||||||
private static final long serialVersionUID = 2856894846224546303L;
|
private static final long serialVersionUID = 2856894846224546303L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void showMessage() {
|
public void showMessage() {
|
||||||
if (AllZone.getHumanHand().size() == 0) stop();
|
if (AllZone.getHumanHand().size() == 0) {
|
||||||
|
stop();
|
||||||
|
}
|
||||||
|
|
||||||
AllZone.getDisplay().showMessage("Chains of Mephistopheles:\n"+"Select a card to discard");
|
AllZone.getDisplay().showMessage("Chains of Mephistopheles:\n" + "Select a card to discard");
|
||||||
ButtonUtil.disableAll();
|
ButtonUtil.disableAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void selectCard(Card card, PlayerZone zone) {
|
public void selectCard(final Card card, final PlayerZone zone) {
|
||||||
if (zone.is(Constant.Zone.Hand)) {
|
if (zone.is(Constant.Zone.Hand)) {
|
||||||
card.getController().discard(card, null);
|
card.getController().discard(card, null);
|
||||||
done();
|
done();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void done() {
|
private void done() {
|
||||||
stop();
|
stop();
|
||||||
//hack to not trigger Chains of Mephistopheles recursively
|
//hack to not trigger Chains of Mephistopheles recursively
|
||||||
@@ -152,8 +168,8 @@ public class PlayerUtil {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
return target;
|
return target;
|
||||||
}//input_chainsDiscard()
|
} //input_chainsDiscard()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>input_sacrificePermanent.</p>
|
* <p>input_sacrificePermanent.</p>
|
||||||
*
|
*
|
||||||
@@ -164,7 +180,7 @@ public class PlayerUtil {
|
|||||||
*/
|
*/
|
||||||
public static Input input_sacrificePermanent(final CardList choices, final String message) {
|
public static Input input_sacrificePermanent(final CardList choices, final String message) {
|
||||||
return input_sacrificePermanentsFromList(1, choices, message);
|
return input_sacrificePermanentsFromList(1, choices, message);
|
||||||
}//input_sacrifice()
|
} //input_sacrifice()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>input_sacrificePermanents.</p>
|
* <p>input_sacrificePermanents.</p>
|
||||||
@@ -177,7 +193,7 @@ public class PlayerUtil {
|
|||||||
CardList list = AllZoneUtil.getPlayerCardsInPlay(AllZone.getHumanPlayer());
|
CardList list = AllZoneUtil.getPlayerCardsInPlay(AllZone.getHumanPlayer());
|
||||||
list.remove("Mana Pool"); // is this needed?
|
list.remove("Mana Pool"); // is this needed?
|
||||||
return input_sacrificePermanentsFromList(nCards, list, "Select a permanent to sacrifice");
|
return input_sacrificePermanentsFromList(nCards, list, "Select a permanent to sacrifice");
|
||||||
}//input_sacrificePermanents()
|
} //input_sacrificePermanents()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>input_sacrificePermanents.</p>
|
* <p>input_sacrificePermanents.</p>
|
||||||
@@ -193,7 +209,7 @@ public class PlayerUtil {
|
|||||||
|
|
||||||
list = list.getType(type);
|
list = list.getType(type);
|
||||||
return input_sacrificePermanentsFromList(nCards, list, "Select a " + type + " to sacrifice");
|
return input_sacrificePermanentsFromList(nCards, list, "Select a " + type + " to sacrifice");
|
||||||
}//input_sacrificePermanents()
|
} //input_sacrificePermanents()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>input_sacrificePermanentsFromList.</p>
|
* <p>input_sacrificePermanentsFromList.</p>
|
||||||
@@ -222,7 +238,7 @@ public class PlayerUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void selectCard(Card card, PlayerZone zone) {
|
public void selectCard(final Card card, final PlayerZone zone) {
|
||||||
if (zone.equals(AllZone.getHumanBattlefield()) && list.contains(card)) {
|
if (zone.equals(AllZone.getHumanBattlefield()) && list.contains(card)) {
|
||||||
AllZone.getGameAction().sacrifice(card);
|
AllZone.getGameAction().sacrifice(card);
|
||||||
n++;
|
n++;
|
||||||
@@ -232,14 +248,15 @@ public class PlayerUtil {
|
|||||||
if (n == nCards || list.size() == 0) {
|
if (n == nCards || list.size() == 0) {
|
||||||
stop();
|
stop();
|
||||||
return;
|
return;
|
||||||
} else
|
} else {
|
||||||
showMessage();
|
showMessage();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
return target;
|
return target;
|
||||||
}//input_sacrificePermanents()
|
} //input_sacrificePermanents()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>input_putFromHandToLibrary.</p>
|
* <p>input_putFromHandToLibrary.</p>
|
||||||
*
|
*
|
||||||
@@ -258,7 +275,9 @@ public class PlayerUtil {
|
|||||||
AllZone.getDisplay().showMessage("Select a card to put on the " + TopOrBottom + " of your library.");
|
AllZone.getDisplay().showMessage("Select a card to put on the " + TopOrBottom + " of your library.");
|
||||||
ButtonUtil.disableAll();
|
ButtonUtil.disableAll();
|
||||||
|
|
||||||
if (n == num || AllZone.getHumanHand().size() == 0) stop();
|
if (n == num || AllZone.getHumanHand().size() == 0) {
|
||||||
|
stop();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -267,16 +286,19 @@ public class PlayerUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void selectCard(Card card, PlayerZone zone) {
|
public void selectCard(final Card card, final PlayerZone zone) {
|
||||||
if (zone.is(Constant.Zone.Hand)) {
|
if (zone.is(Constant.Zone.Hand)) {
|
||||||
int position = 0;
|
int position = 0;
|
||||||
if (TopOrBottom.equalsIgnoreCase("bottom"))
|
if (TopOrBottom.equalsIgnoreCase("bottom")) {
|
||||||
position = -1;
|
position = -1;
|
||||||
|
}
|
||||||
|
|
||||||
AllZone.getGameAction().moveToLibrary(card, position);
|
AllZone.getGameAction().moveToLibrary(card, position);
|
||||||
|
|
||||||
n++;
|
n++;
|
||||||
if (n == num) stop();
|
if (n == num) {
|
||||||
|
stop();
|
||||||
|
}
|
||||||
|
|
||||||
showMessage();
|
showMessage();
|
||||||
}
|
}
|
||||||
@@ -285,5 +307,4 @@ public class PlayerUtil {
|
|||||||
return target;
|
return target;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} //end class PlayerUtil
|
||||||
}//end class PlayerUtil
|
|
||||||
|
|||||||
@@ -9,6 +9,6 @@ import java.util.Observer;
|
|||||||
* @author Forge
|
* @author Forge
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
abstract public class PlayerZone extends MyObservable implements IPlayerZone, Observer {
|
public abstract class PlayerZone extends MyObservable implements IPlayerZone, Observer {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import forge.card.spellability.SpellAbility;
|
|||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
public class PlayerZone_ComesIntoPlay extends DefaultPlayerZone {
|
public class PlayerZone_ComesIntoPlay extends DefaultPlayerZone {
|
||||||
/** Constant <code>serialVersionUID=5750837078903423978L</code> */
|
/** Constant <code>serialVersionUID=5750837078903423978L</code>. */
|
||||||
private static final long serialVersionUID = 5750837078903423978L;
|
private static final long serialVersionUID = 5750837078903423978L;
|
||||||
|
|
||||||
private boolean trigger = true;
|
private boolean trigger = true;
|
||||||
@@ -23,24 +23,30 @@ public class PlayerZone_ComesIntoPlay extends DefaultPlayerZone {
|
|||||||
* @param zone a {@link java.lang.String} object.
|
* @param zone a {@link java.lang.String} object.
|
||||||
* @param player a {@link forge.Player} object.
|
* @param player a {@link forge.Player} object.
|
||||||
*/
|
*/
|
||||||
public PlayerZone_ComesIntoPlay(String zone, Player player) {
|
public PlayerZone_ComesIntoPlay(final String zone, final Player player) {
|
||||||
super(zone, player);
|
super(zone, player);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@Override
|
@Override
|
||||||
public void add(Object o) {
|
public final void add(final Object o) {
|
||||||
if (o == null) throw new RuntimeException("PlayerZone_ComesInto Play : add() object is null");
|
if (o == null) {
|
||||||
|
throw new RuntimeException("PlayerZone_ComesInto Play : add() object is null");
|
||||||
|
}
|
||||||
|
|
||||||
super.add(o);
|
super.add(o);
|
||||||
|
|
||||||
final Card c = (Card) o;
|
final Card c = (Card) o;
|
||||||
final Player player = c.getController();
|
final Player player = c.getController();
|
||||||
|
|
||||||
if (trigger && ((CardFactoryUtil.oppHasKismet(c.getController()) && (c.isLand() || c.isCreature() || c.isArtifact()))
|
if (trigger && ((CardFactoryUtil.oppHasKismet(c.getController())
|
||||||
|
&& (c.isLand() || c.isCreature() || c.isArtifact()))
|
||||||
|| (AllZoneUtil.isCardInPlay("Urabrask the Hidden", c.getController().getOpponent()) && c.isCreature())
|
|| (AllZoneUtil.isCardInPlay("Urabrask the Hidden", c.getController().getOpponent()) && c.isCreature())
|
||||||
|| (AllZoneUtil.isCardInPlay("Root Maze") && (c.isLand() || c.isArtifact()))
|
|| (AllZoneUtil.isCardInPlay("Root Maze") && (c.isLand() || c.isArtifact()))
|
||||||
|| (AllZoneUtil.isCardInPlay("Orb of Dreams") && c.isPermanent()))) c.tap();
|
|| (AllZoneUtil.isCardInPlay("Orb of Dreams") && c.isPermanent())))
|
||||||
|
{
|
||||||
|
c.tap();
|
||||||
|
}
|
||||||
|
|
||||||
//cannot use addComesIntoPlayCommand - trigger might be set to false;
|
//cannot use addComesIntoPlayCommand - trigger might be set to false;
|
||||||
// Keep track of max lands can play per turn
|
// Keep track of max lands can play per turn
|
||||||
@@ -67,12 +73,13 @@ public class PlayerZone_ComesIntoPlay extends DefaultPlayerZone {
|
|||||||
if (eachPlayer) {
|
if (eachPlayer) {
|
||||||
AllZone.getHumanPlayer().addMaxLandsToPlay(addMax);
|
AllZone.getHumanPlayer().addMaxLandsToPlay(addMax);
|
||||||
AllZone.getComputerPlayer().addMaxLandsToPlay(addMax);
|
AllZone.getComputerPlayer().addMaxLandsToPlay(addMax);
|
||||||
} else
|
} else {
|
||||||
c.getController().addMaxLandsToPlay(addMax);
|
c.getController().addMaxLandsToPlay(addMax);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (trigger) {
|
if (trigger) {
|
||||||
c.setSickness(true);// summoning sickness
|
c.setSickness(true); // summoning sickness
|
||||||
c.comesIntoPlay();
|
c.comesIntoPlay();
|
||||||
|
|
||||||
if (c.isLand()) {
|
if (c.isLand()) {
|
||||||
@@ -85,7 +92,7 @@ public class PlayerZone_ComesIntoPlay extends DefaultPlayerZone {
|
|||||||
});*/
|
});*/
|
||||||
|
|
||||||
list = list.filter(new CardListFilter() {
|
list = list.filter(new CardListFilter() {
|
||||||
public boolean addCard(Card c) {
|
public boolean addCard(final Card c) {
|
||||||
return c.hasKeyword("Landfall")
|
return c.hasKeyword("Landfall")
|
||||||
|| c.hasKeyword("Landfall - Whenever a land enters the battlefield under your control, CARDNAME gets +2/+2 until end of turn.");
|
|| c.hasKeyword("Landfall - Whenever a land enters the battlefield under your control, CARDNAME gets +2/+2 until end of turn.");
|
||||||
}
|
}
|
||||||
@@ -97,8 +104,8 @@ public class PlayerZone_ComesIntoPlay extends DefaultPlayerZone {
|
|||||||
/*
|
/*
|
||||||
// Check for a mountain
|
// Check for a mountain
|
||||||
if (!listValakut.isEmpty() && c.isType("Mountain") ) {
|
if (!listValakut.isEmpty() && c.isType("Mountain") ) {
|
||||||
for (int i = 0; i < listValakut.size(); i++) {
|
for (int i = 0; i < listValakut.size(); i++) {
|
||||||
boolean b = GameActionUtil.executeValakutEffect(listValakut.get(i),c);
|
boolean b = GameActionUtil.executeValakutEffect(listValakut.get(i),c);
|
||||||
if (!b) {
|
if (!b) {
|
||||||
// Not enough mountains to activate Valakut -- stop the loop
|
// Not enough mountains to activate Valakut -- stop the loop
|
||||||
break;
|
break;
|
||||||
@@ -116,7 +123,9 @@ public class PlayerZone_ComesIntoPlay extends DefaultPlayerZone {
|
|||||||
public void resolve() {
|
public void resolve() {
|
||||||
CardList lands = AllZoneUtil.getPlayerCardsInPlay(tisLand.getController());
|
CardList lands = AllZoneUtil.getPlayerCardsInPlay(tisLand.getController());
|
||||||
lands = lands.filter(AllZoneUtil.lands);
|
lands = lands.filter(AllZoneUtil.lands);
|
||||||
for (Card land : lands) land.tap();
|
for (Card land : lands) {
|
||||||
|
land.tap();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
@@ -136,7 +145,8 @@ public class PlayerZone_ComesIntoPlay extends DefaultPlayerZone {
|
|||||||
@Override
|
@Override
|
||||||
public void resolve() {
|
public void resolve() {
|
||||||
CardList lands = AllZoneUtil.getPlayerLandsInPlay(lesLand.getOwner());
|
CardList lands = AllZoneUtil.getPlayerLandsInPlay(lesLand.getOwner());
|
||||||
lesLand.getOwner().sacrificePermanent(source.getName() + " - Select a land to sacrifice", lands);
|
lesLand.getOwner().sacrificePermanent(
|
||||||
|
source.getName() + " - Select a land to sacrifice", lands);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
@@ -152,7 +162,7 @@ public class PlayerZone_ComesIntoPlay extends DefaultPlayerZone {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}//isLand()
|
} //isLand()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (AllZone.getStaticEffects().getCardToEffectsList().containsKey(c.getName())) {
|
if (AllZone.getStaticEffects().getCardToEffectsList().containsKey(c.getName())) {
|
||||||
@@ -175,18 +185,19 @@ public class PlayerZone_ComesIntoPlay extends DefaultPlayerZone {
|
|||||||
if (GameActionUtil.showYesNoDialog(crd, "Attach " + crd + " to " + c + "?")) {
|
if (GameActionUtil.showYesNoDialog(crd, "Attach " + crd + " to " + c + "?")) {
|
||||||
if (AllZoneUtil.isCardInPlayerGraveyard(player, crd)
|
if (AllZoneUtil.isCardInPlayerGraveyard(player, crd)
|
||||||
&& AllZoneUtil.isCardInPlay(c) && c.isCreature()
|
&& AllZoneUtil.isCardInPlay(c) && c.isCreature()
|
||||||
&& c.getNetAttack() == 1 && c.getNetDefense() == 1) {
|
&& c.getNetAttack() == 1 && c.getNetDefense() == 1)
|
||||||
|
{
|
||||||
AllZone.getGameAction().moveToPlay(crd);
|
AllZone.getGameAction().moveToPlay(crd);
|
||||||
|
|
||||||
crd.equipCard(c);
|
crd.equipCard(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else //computer
|
} else {
|
||||||
{
|
|
||||||
if (AllZoneUtil.isCardInPlayerGraveyard(player, crd)
|
if (AllZoneUtil.isCardInPlayerGraveyard(player, crd)
|
||||||
&& AllZoneUtil.isCardInPlay(c) && c.isCreature()
|
&& AllZoneUtil.isCardInPlay(c) && c.isCreature()
|
||||||
&& c.getNetAttack() == 1 && c.getNetDefense() == 1) {
|
&& c.getNetAttack() == 1 && c.getNetDefense() == 1)
|
||||||
|
{
|
||||||
AllZone.getGameAction().moveToPlay(crd);
|
AllZone.getGameAction().moveToPlay(crd);
|
||||||
|
|
||||||
crd.equipCard(c);
|
crd.equipCard(c);
|
||||||
@@ -196,8 +207,10 @@ public class PlayerZone_ComesIntoPlay extends DefaultPlayerZone {
|
|||||||
};
|
};
|
||||||
|
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.append("Sword of the Meek - Whenever a 1/1 creature enters the battlefield under your control, you may ");
|
sb.append(crd);
|
||||||
sb.append("return Sword of the Meek from your graveyard to the battlefield, then attach it to that creature.");
|
sb.append(" - Whenever a 1/1 creature enters the battlefield under your control, you may ");
|
||||||
|
sb.append("return Sword of the Meek from your graveyard to the battlefield, ");
|
||||||
|
sb.append("then attach it to that creature.");
|
||||||
ability.setStackDescription(sb.toString());
|
ability.setStackDescription(sb.toString());
|
||||||
|
|
||||||
AllZone.getStack().addSimultaneousStackEntry(ability);
|
AllZone.getStack().addSimultaneousStackEntry(ability);
|
||||||
@@ -205,11 +218,11 @@ public class PlayerZone_ComesIntoPlay extends DefaultPlayerZone {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}// end add()
|
} // end add()
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@Override
|
@Override
|
||||||
public void remove(Object o) {
|
public final void remove(final Object o) {
|
||||||
|
|
||||||
super.remove(o);
|
super.remove(o);
|
||||||
|
|
||||||
@@ -239,8 +252,9 @@ public class PlayerZone_ComesIntoPlay extends DefaultPlayerZone {
|
|||||||
if (eachPlayer) {
|
if (eachPlayer) {
|
||||||
AllZone.getHumanPlayer().addMaxLandsToPlay(addMax);
|
AllZone.getHumanPlayer().addMaxLandsToPlay(addMax);
|
||||||
AllZone.getComputerPlayer().addMaxLandsToPlay(addMax);
|
AllZone.getComputerPlayer().addMaxLandsToPlay(addMax);
|
||||||
} else
|
} else {
|
||||||
c.getController().addMaxLandsToPlay(addMax);
|
c.getController().addMaxLandsToPlay(addMax);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -273,7 +287,7 @@ public class PlayerZone_ComesIntoPlay extends DefaultPlayerZone {
|
|||||||
*
|
*
|
||||||
* @param b a boolean.
|
* @param b a boolean.
|
||||||
*/
|
*/
|
||||||
public void setTrigger(boolean b) {
|
public final void setTrigger(final boolean b) {
|
||||||
trigger = b;
|
trigger = b;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -282,7 +296,7 @@ public class PlayerZone_ComesIntoPlay extends DefaultPlayerZone {
|
|||||||
*
|
*
|
||||||
* @param b a boolean.
|
* @param b a boolean.
|
||||||
*/
|
*/
|
||||||
public void setLeavesTrigger(boolean b) {
|
public final void setLeavesTrigger(final boolean b) {
|
||||||
leavesTrigger = b;
|
leavesTrigger = b;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -291,7 +305,7 @@ public class PlayerZone_ComesIntoPlay extends DefaultPlayerZone {
|
|||||||
*
|
*
|
||||||
* @param b a boolean.
|
* @param b a boolean.
|
||||||
*/
|
*/
|
||||||
public void setTriggers(boolean b) {
|
public final void setTriggers(final boolean b) {
|
||||||
trigger = b;
|
trigger = b;
|
||||||
leavesTrigger = b;
|
leavesTrigger = b;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user