mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-14 17:58:01 +00:00
- Made many performance improvements (using FindBugs).
- Ability of Chainer, Dementia Master shouldn't be castable from hand anymore, also added ability text.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
program/mail=mtgerror@yahoo.com
|
||||
program/forum=http://www.slightlymagic.net/forum/viewforum.php?f=26
|
||||
program/version=Forge -- official beta: 10/01/01, SVN revision: 269
|
||||
program/version=Forge -- official beta: 10/01/01, SVN revision: 271
|
||||
|
||||
tokens--file=AllTokens.txt
|
||||
|
||||
|
||||
@@ -116,7 +116,7 @@ public class AnchorLayout implements LayoutManager2 {
|
||||
* @see org.eclipse.swt.widgets.Layout#layout(org.eclipse.swt.widgets.Composite, boolean)
|
||||
*/
|
||||
public void layoutContainer(Container container) {
|
||||
this.container = container;
|
||||
//this.container = container;
|
||||
Component children[] = container.getComponents();
|
||||
Rectangle rect = container.getBounds();
|
||||
int width = rect.width;
|
||||
|
||||
@@ -126,9 +126,9 @@ abstract public class Ability_Mana extends SpellAbility implements java.io.Seria
|
||||
if (!divider.equals(".")) divider=".";
|
||||
while (copy.startsWith(":") || copy.startsWith(divider) ) copy=copy.substring(1);
|
||||
String current=copy.substring(0, copy.indexOf(","));
|
||||
if (current.startsWith("Sacrifice a")){
|
||||
/*if (current.startsWith("Sacrifice a")){
|
||||
|
||||
}
|
||||
}*/
|
||||
copy=copy.substring(current.length());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -190,7 +190,7 @@ public class BoosterDraftAI
|
||||
|
||||
HashSet<Integer> set = new HashSet<Integer>();
|
||||
for(int i = 0; i < nDecks; i++)
|
||||
set.add(new Integer(n[i]));
|
||||
set.add(Integer.valueOf(n[i]));
|
||||
|
||||
if(set.size() != nDecks)
|
||||
throw new RuntimeException("BoosterDraftAI : testColors error, numbers not unique");
|
||||
|
||||
@@ -195,7 +195,7 @@ public class Card extends MyObservable
|
||||
}
|
||||
else
|
||||
{
|
||||
counters.put(counterName, new Integer(n));
|
||||
counters.put(counterName, Integer.valueOf(n));
|
||||
}
|
||||
this.updateObservers();
|
||||
}
|
||||
@@ -220,7 +220,7 @@ public class Card extends MyObservable
|
||||
}
|
||||
|
||||
public void setCounter(Counters counterName, int n) {
|
||||
counters.put(counterName,new Integer(n));
|
||||
counters.put(counterName, Integer.valueOf(n));
|
||||
this.updateObservers();
|
||||
}
|
||||
|
||||
@@ -283,11 +283,15 @@ public class Card extends MyObservable
|
||||
if(isInstant() || isSorcery())
|
||||
{
|
||||
String s = getSpellText();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(s);
|
||||
|
||||
SpellAbility[] sa = getSpellAbility();
|
||||
for(int i = 0; i < sa.length; i++)
|
||||
s += sa[i].toString() +"\r\n";
|
||||
|
||||
return s;
|
||||
sb.append(sa[i].toString() + "\r\n");
|
||||
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
String s = "";
|
||||
|
||||
@@ -20,9 +20,7 @@ import forge.properties.NewConstants;
|
||||
public class CardFactory implements NewConstants {
|
||||
// String cardname is the key, Card is the value
|
||||
private Map<String, Card> map = new HashMap<String, Card>();
|
||||
@SuppressWarnings("unused")
|
||||
// random
|
||||
private Random random = new Random();
|
||||
|
||||
private CardList allCards = new CardList();
|
||||
|
||||
private HashSet<String> removedCardList;
|
||||
@@ -1650,7 +1648,7 @@ public class CardFactory implements NewConstants {
|
||||
public void resolve()
|
||||
{
|
||||
damage = getNumDamage();
|
||||
String tgtP = new String();
|
||||
String tgtP = "";
|
||||
|
||||
if (TgtOpp[0] == true)
|
||||
setTargetPlayer(AllZone.GameAction.getOpponent(card.getController()));
|
||||
@@ -1996,7 +1994,7 @@ public class CardFactory implements NewConstants {
|
||||
final String manaCost = tmpCost;
|
||||
//System.out.println("manaCost is " + manaCost + " for " + card.getName());
|
||||
|
||||
String tmpDesc = new String();
|
||||
String tmpDesc = "";
|
||||
tmpDesc = "Target creature gets ";
|
||||
if (attack[0] > 0)
|
||||
tmpDesc = tmpDesc + "+" + attack[0];
|
||||
@@ -2244,7 +2242,7 @@ public class CardFactory implements NewConstants {
|
||||
String tmpDesc = card.getText().substring(15);
|
||||
int i = tmpDesc.indexOf(".");
|
||||
tmpDesc = tmpDesc.substring(0, i);
|
||||
final String Selec = new String("Select target " + tmpDesc + " to destroy.");
|
||||
final String Selec = "Select target " + tmpDesc + " to destroy.";
|
||||
|
||||
final boolean NoRegen = (k.length == 3);
|
||||
|
||||
@@ -4519,8 +4517,6 @@ public class CardFactory implements NewConstants {
|
||||
CardList tempList = new CardList();
|
||||
tempList.addAll(AllZone.Human_Play.getCards());
|
||||
|
||||
@SuppressWarnings("unused") // list
|
||||
CardList list = new CardList();
|
||||
for (int i=0;i<tempList.size();i++)
|
||||
{
|
||||
if(tempList.get(i).isPermanent() && !tempList.get(i).isLand() && CardFactoryUtil.canTarget(card, tempList.get(i)) &&
|
||||
@@ -12050,14 +12046,13 @@ public class CardFactory implements NewConstants {
|
||||
return false;
|
||||
//should check if computer has land in hand, or if computer has more basic land types than human.
|
||||
}
|
||||
@SuppressWarnings("unchecked") // computerBasic
|
||||
|
||||
public void resolve()
|
||||
{
|
||||
//add computer's lands to target
|
||||
@SuppressWarnings("unused") // computerCountBasic
|
||||
int computerCountBase = 0;
|
||||
@SuppressWarnings("unused") // computerBasic
|
||||
Vector<?> computerBasic = new Vector();
|
||||
|
||||
//int computerCountBase = 0;
|
||||
//Vector<?> computerBasic = new Vector();
|
||||
|
||||
//figure out which basic land types the computer has
|
||||
CardList land = new CardList(AllZone.Computer_Play.getCards());
|
||||
@@ -15615,7 +15610,7 @@ return land.size() > 1 && CardFactoryUtil.AI_isMainPhase();
|
||||
//list = list.getName("Mana Pool");
|
||||
Card mp = AllZone.ManaPool;//list.getCard(0);
|
||||
|
||||
String color = new String();
|
||||
String color = "";
|
||||
|
||||
Object o = AllZone.Display.getChoice("Choose mana color",Constant.Color.Colors);
|
||||
color = (String)o;
|
||||
|
||||
@@ -95,7 +95,7 @@ public class CardFactoryUtil
|
||||
|
||||
// if no non-basic lands, target the least represented basic land type
|
||||
String names[] = {"Plains", "Island", "Swamp", "Mountain", "Forest"};
|
||||
String sminBL = new String();
|
||||
String sminBL = "";
|
||||
int iminBL = 20000; // hopefully no one will ever have more than 20000 lands of one type....
|
||||
int n = 0;
|
||||
for (int i = 0; i < 5; i++)
|
||||
@@ -213,26 +213,26 @@ public class CardFactoryUtil
|
||||
//Object[1] has to be an Object like Integer and not just an int
|
||||
private static Object[][] AbilityLimits =
|
||||
{
|
||||
{"Azimaet Drake" , new Integer(1)},
|
||||
{"Drake Hatchling" , new Integer(1)},
|
||||
{"Fire Drake" , new Integer(1)},
|
||||
{"Plated Rootwalla" , new Integer(1)},
|
||||
{"Rootwalla" , new Integer(1)},
|
||||
{"Spitting Drake" , new Integer(1)},
|
||||
{"Ghor-Clan Bloodscale", new Integer(1)},
|
||||
{"Wild Aesthir", new Integer(1)},
|
||||
{"Viashino Slaughtermaster", new Integer(1)},
|
||||
{"Twinblade Slasher", new Integer(1)},
|
||||
{"Boreal Centaur", new Integer(1)},
|
||||
{"Knight of the Skyward Eye", new Integer(1)},
|
||||
{"Chronatog", new Integer(1)},
|
||||
{"Azimaet Drake" , Integer.valueOf(1)},
|
||||
{"Drake Hatchling" , Integer.valueOf(1)},
|
||||
{"Fire Drake" , Integer.valueOf(1)},
|
||||
{"Plated Rootwalla" , Integer.valueOf(1)},
|
||||
{"Rootwalla" , Integer.valueOf(1)},
|
||||
{"Spitting Drake" , Integer.valueOf(1)},
|
||||
{"Ghor-Clan Bloodscale", Integer.valueOf(1)},
|
||||
{"Wild Aesthir", Integer.valueOf(1)},
|
||||
{"Viashino Slaughtermaster", Integer.valueOf(1)},
|
||||
{"Twinblade Slasher", Integer.valueOf(1)},
|
||||
{"Boreal Centaur", Integer.valueOf(1)},
|
||||
{"Knight of the Skyward Eye", Integer.valueOf(1)},
|
||||
{"Chronatog", Integer.valueOf(1)},
|
||||
|
||||
{"Phyrexian Battleflies" , new Integer(2)},
|
||||
{"Pit Imp" , new Integer(2)},
|
||||
{"Roterothopter" , new Integer(2)},
|
||||
{"Vampire Bats" , new Integer(2)},
|
||||
{"Fire-Belly Changeling" , new Integer(2)},
|
||||
{"Azusa, Lost but Seeking" , new Integer(2)}
|
||||
{"Phyrexian Battleflies" , Integer.valueOf(2)},
|
||||
{"Pit Imp" , Integer.valueOf(2)},
|
||||
{"Roterothopter" , Integer.valueOf(2)},
|
||||
{"Vampire Bats" , Integer.valueOf(2)},
|
||||
{"Fire-Belly Changeling" , Integer.valueOf(2)},
|
||||
{"Azusa, Lost but Seeking" , Integer.valueOf(2)}
|
||||
};
|
||||
|
||||
public static boolean canUseAbility(Card card)
|
||||
@@ -622,14 +622,8 @@ public class CardFactoryUtil
|
||||
|
||||
SpellAbility[] sa = sourceCard.getSpellAbility();
|
||||
|
||||
if (sourceCard.getController().equals(Constant.Player.Human)) {
|
||||
//AllZone.GameAction.playSpellAbility(sa[0]);
|
||||
AllZone.Stack.add(sa[0]);
|
||||
}
|
||||
else {
|
||||
//ComputerUtil.playNoStack(sa[0]);
|
||||
AllZone.Stack.add(sa[0]);
|
||||
}
|
||||
AllZone.Stack.add(sa[0]);
|
||||
|
||||
grave.remove(sourceCard);
|
||||
removed.add(sourceCard);
|
||||
|
||||
@@ -2144,30 +2138,31 @@ public class CardFactoryUtil
|
||||
if (multiplier == 1)
|
||||
return manacost;
|
||||
|
||||
String result = "";
|
||||
String tokenized[] = manacost.split("\\s");
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
if (Character.isDigit(tokenized[0].charAt(0))) //manacost starts with "colorless" number cost
|
||||
{
|
||||
int cost = Integer.parseInt(tokenized[0]);
|
||||
cost = multiplier * cost;
|
||||
tokenized[0] = "" + cost;
|
||||
result = result + " " + tokenized[0];
|
||||
sb.append(tokenized[0]);
|
||||
}
|
||||
else {
|
||||
for (int i=0; i<multiplier; i++)
|
||||
//tokenized[0] = tokenized[0] + " " + tokenized[0];
|
||||
result = result + " " + tokenized[0];
|
||||
sb.append(tokenized[0]);
|
||||
}
|
||||
|
||||
for (int i=1;i<tokenized.length;i++){
|
||||
for (int j=0;j<multiplier;j++)
|
||||
{
|
||||
//tokenized[i] = tokenized[i] + " " + tokenized[i];
|
||||
result = result + " " + tokenized[i];
|
||||
sb.append(tokenized[0]);
|
||||
}
|
||||
}
|
||||
|
||||
String result = sb.toString();
|
||||
result = result.trim();
|
||||
return result;
|
||||
}
|
||||
@@ -2760,7 +2755,7 @@ public class CardFactoryUtil
|
||||
else
|
||||
X = Integer.parseInt(d[1]);
|
||||
|
||||
String dbPlayer = new String();
|
||||
String dbPlayer = "";
|
||||
if (d[0].contains("You"))
|
||||
dbPlayer = cardController;
|
||||
else if (d[0].contains("Opp"))
|
||||
|
||||
@@ -5812,7 +5812,7 @@ public class CardFactory_Creatures {
|
||||
}
|
||||
});//CardListFilter()
|
||||
|
||||
return new Integer(list.size());
|
||||
return Integer.valueOf(list.size());
|
||||
}
|
||||
};
|
||||
|
||||
@@ -5924,7 +5924,7 @@ public class CardFactory_Creatures {
|
||||
(c.getType().contains("Zubera") || c.getKeyword().contains("Changeling") );
|
||||
}
|
||||
});//CardListFilter()
|
||||
return new Integer(list.size());
|
||||
return Integer.valueOf(list.size());
|
||||
}
|
||||
};//CommandReturn
|
||||
|
||||
@@ -5981,7 +5981,7 @@ public class CardFactory_Creatures {
|
||||
(c.getType().contains("Zubera") || c.getKeyword().contains("Changeling") );
|
||||
}
|
||||
});//CardListFilter()
|
||||
return new Integer(list.size());
|
||||
return Integer.valueOf(list.size());
|
||||
}
|
||||
};//CommandReturn
|
||||
|
||||
@@ -6034,7 +6034,7 @@ public class CardFactory_Creatures {
|
||||
(c.getType().contains("Zubera") || c.getKeyword().contains("Changeling") );
|
||||
}
|
||||
});//CardListFilter()
|
||||
return new Integer(list.size());
|
||||
return Integer.valueOf(list.size());
|
||||
}
|
||||
};//CommandReturn
|
||||
|
||||
@@ -6087,7 +6087,7 @@ public class CardFactory_Creatures {
|
||||
(c.getType().contains("Zubera") || c.getKeyword().contains("Changeling") );
|
||||
}
|
||||
});//CardListFilter()
|
||||
return new Integer(list.size());
|
||||
return Integer.valueOf(list.size());
|
||||
}
|
||||
};//CommandReturn
|
||||
|
||||
@@ -12341,12 +12341,7 @@ public class CardFactory_Creatures {
|
||||
CardList creats = new CardList(play.getCards());
|
||||
creats = creats.getType("Creature");
|
||||
|
||||
@SuppressWarnings("unused") // saps
|
||||
CardList saps = new CardList();
|
||||
|
||||
Card c = getTargetCard();
|
||||
@SuppressWarnings("unused") // hand
|
||||
PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, c.getOwner());
|
||||
|
||||
if(AllZone.GameAction.isCardInPlay(c))
|
||||
{
|
||||
@@ -18250,7 +18245,7 @@ public class CardFactory_Creatures {
|
||||
public void resolve()
|
||||
{
|
||||
Card c = getTargetCard();
|
||||
String color = new String();
|
||||
String color = "";
|
||||
if (AllZone.GameAction.isCardInPlay(c) && CardFactoryUtil.canTarget(card,c)){
|
||||
|
||||
Object o = AllZone.Display.getChoice("Choose mana color",Constant.Color.Colors);
|
||||
@@ -18789,7 +18784,7 @@ public class CardFactory_Creatures {
|
||||
{
|
||||
if (card.getController().equals(Constant.Player.Human)) {
|
||||
|
||||
String color = new String();
|
||||
String color = "";
|
||||
String[] colors = Constant.Color.Colors;
|
||||
colors[colors.length-1] = null;
|
||||
|
||||
@@ -18987,11 +18982,12 @@ public class CardFactory_Creatures {
|
||||
creatures.addAll(hGrave.getCards());
|
||||
creatures.addAll(cGrave.getCards());
|
||||
creatures = creatures.getType("Creature");
|
||||
return creatures.size() > 0;
|
||||
return creatures.size() > 0 && super.canPlay();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
ability.setDescription(cardName + " - B B B, Pay 3 life: Put target creature card from a graveyard onto the battlefield under your control. That creature is black and is a Nightmare in addition to its other creature types.");
|
||||
ability.setStackDescription(card + "Put target creature card from a graveyard onto the battlefield under your control. That creature is black and is a Nightmare in addition to its other creature types.");
|
||||
card.addSpellAbility(ability);
|
||||
|
||||
final Command leavesPlay = new Command()
|
||||
@@ -19331,29 +19327,6 @@ public class CardFactory_Creatures {
|
||||
return kithkin.size();
|
||||
|
||||
}
|
||||
@SuppressWarnings("unused") // makeToken
|
||||
public void makeToken()
|
||||
{
|
||||
Card c = new Card();
|
||||
|
||||
c.setOwner(card.getController());
|
||||
c.setController(card.getController());
|
||||
|
||||
c.setName("Kithkin Soldier");
|
||||
c.setImageName("W 1 1 Kithkin Soldier");
|
||||
c.setManaCost("W");
|
||||
c.setToken(true);
|
||||
|
||||
c.addType("Creature");
|
||||
c.addType("Kithkin");
|
||||
c.addType("Soldier");
|
||||
|
||||
c.setBaseAttack(1);
|
||||
c.setBaseDefense(1);
|
||||
|
||||
PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController());
|
||||
play.add(c);
|
||||
}
|
||||
};
|
||||
Command intoPlay = new Command()
|
||||
{
|
||||
|
||||
@@ -1521,7 +1521,7 @@ class CardFactory_Planeswalkers {
|
||||
Object choice[] = new Object[size];
|
||||
|
||||
for(int i = 0; i < choice.length; i++)
|
||||
choice[i] = new Integer(i + 1);
|
||||
choice[i] = Integer.valueOf(i + 1);
|
||||
|
||||
Integer damage = (Integer) AllZone.Display.getChoice("Select X", choice);
|
||||
return damage.intValue();
|
||||
@@ -2378,7 +2378,7 @@ class CardFactory_Planeswalkers {
|
||||
Object choice[] = new Object[size];
|
||||
|
||||
for(int i = 0; i < choice.length; i++)
|
||||
choice[i] = new Integer(i);
|
||||
choice[i] = Integer.valueOf(i);
|
||||
|
||||
Integer damage = (Integer) AllZone.Display.getChoice("Select X", choice);
|
||||
final int dam = damage.intValue();
|
||||
|
||||
@@ -101,7 +101,7 @@ public class CardFilter {
|
||||
|
||||
}}
|
||||
|
||||
if(name=="colorless"){
|
||||
if(name.equals("colorless")){
|
||||
for(int i=0;i<all.size();i++){
|
||||
CardName = all.getCard(i);
|
||||
if(CardUtil.getColors(CardName).contains(Constant.Color.Colorless)==false)
|
||||
@@ -179,7 +179,7 @@ public class CardFilter {
|
||||
|
||||
}}
|
||||
|
||||
if(name=="sorcery"){
|
||||
if(name.equals("sorcery")){
|
||||
for(int i=0;i<all.size();i++){
|
||||
CardName = all.getCard(i);
|
||||
if(CardName.isSorcery()==false)
|
||||
|
||||
@@ -236,7 +236,7 @@ public class CombatPlaneswalker
|
||||
*/
|
||||
if (b.getKillDamage() <= damage)
|
||||
{
|
||||
damage -= b.getKillDamage();
|
||||
//damage -= b.getKillDamage();
|
||||
b.addAssignedDamage(b.getKillDamage(), a);
|
||||
}
|
||||
|
||||
|
||||
@@ -504,7 +504,7 @@ public class CombatUtil
|
||||
|
||||
Card attack[] = AllZone.Combat.getAttackers();
|
||||
Card defend[] = null;
|
||||
String display = "";
|
||||
StringBuilder display = new StringBuilder();
|
||||
String attackerName = "";
|
||||
String blockerName = "";
|
||||
|
||||
@@ -516,7 +516,14 @@ public class CombatUtil
|
||||
attackerName = attack[i].getName();
|
||||
if (attack[i].isFaceDown())
|
||||
attackerName = "Morph";
|
||||
display += attackerName +" (" +attack[i].getUniqueNumber() +") " +attack[i].getNetAttack() +"/" +attack[i].getNetDefense() +" is attacking \n";
|
||||
display.append(attackerName);
|
||||
display.append(" (");
|
||||
display.append(attack[i].getUniqueNumber());
|
||||
display.append(") ");
|
||||
display.append(attack[i].getNetAttack());
|
||||
display.append("/");
|
||||
display.append(attack[i].getNetDefense());
|
||||
display.append(" is attacking \n");
|
||||
|
||||
defend = AllZone.Combat.getBlockers(attack[i]).toArray();
|
||||
|
||||
@@ -527,10 +534,20 @@ public class CombatUtil
|
||||
blockerName = defend[inner].getName();
|
||||
if(defend[inner].isFaceDown())
|
||||
blockerName = "Morph";
|
||||
display += " " +blockerName +" (" +defend[inner].getUniqueNumber() +") " +defend[inner].getNetAttack() +"/" +defend[inner].getNetDefense() +" is blocking \n";
|
||||
|
||||
display.append(" ");
|
||||
display.append(blockerName);
|
||||
display.append(" (");
|
||||
display.append(defend[inner].getUniqueNumber());
|
||||
display.append(") ");
|
||||
display.append(defend[inner].getNetAttack());
|
||||
display.append("/");
|
||||
display.append(defend[inner].getNetDefense());
|
||||
display.append(" is blocking \n");
|
||||
|
||||
}
|
||||
}//while - loop through attackers
|
||||
String s = display + getPlaneswalkerBlockers();
|
||||
String s = display.toString() + getPlaneswalkerBlockers();
|
||||
AllZone.Display.showCombat(s.trim());
|
||||
|
||||
}//showBlockers()
|
||||
@@ -539,10 +556,10 @@ public class CombatUtil
|
||||
{
|
||||
Card attack[] = AllZone.pwCombat.getAttackers();
|
||||
Card defend[] = null;
|
||||
String display = "";
|
||||
StringBuilder display = new StringBuilder();
|
||||
|
||||
if(attack.length != 0)
|
||||
display = "Planeswalker Combat\r\n";
|
||||
display.append("Planeswalker Combat\r\n");
|
||||
|
||||
String attackerName = "";
|
||||
String blockerName = "";
|
||||
@@ -554,8 +571,16 @@ public class CombatUtil
|
||||
attackerName = attack[i].getName();
|
||||
if (attack[i].isFaceDown())
|
||||
attackerName = "Morph";
|
||||
|
||||
display += attackerName +" (" +attack[i].getUniqueNumber() +") " +attack[i].getNetAttack() +"/" +attack[i].getNetDefense() +" is attacking \n";
|
||||
|
||||
display.append(attackerName);
|
||||
display.append(" (");
|
||||
display.append(attack[i].getUniqueNumber());
|
||||
display.append(") ");
|
||||
display.append(attack[i].getNetAttack());
|
||||
display.append("/");
|
||||
display.append(attack[i].getNetDefense());
|
||||
display.append(" is attacking \n");
|
||||
//display += attackerName +" (" +attack[i].getUniqueNumber() +") " +attack[i].getNetAttack() +"/" +attack[i].getNetDefense() +" is attacking \n";
|
||||
|
||||
defend = AllZone.pwCombat.getBlockers(attack[i]).toArray();
|
||||
|
||||
@@ -566,11 +591,22 @@ public class CombatUtil
|
||||
blockerName = defend[inner].getName();
|
||||
if(defend[inner].isFaceDown())
|
||||
blockerName = "Morph";
|
||||
display += " " +blockerName +" (" +defend[inner].getUniqueNumber() +") " +defend[inner].getNetAttack() +"/" +defend[inner].getNetDefense() +" is blocking \n";
|
||||
|
||||
display.append(" ");
|
||||
display.append(blockerName);
|
||||
display.append(" (");
|
||||
display.append(defend[inner].getUniqueNumber());
|
||||
display.append(") ");
|
||||
display.append(defend[inner].getNetAttack());
|
||||
display.append("/");
|
||||
display.append(defend[inner].getNetDefense());
|
||||
display.append(" is blocking \n");
|
||||
|
||||
//display += " " +blockerName +" (" +defend[inner].getUniqueNumber() +") " +defend[inner].getNetAttack() +"/" +defend[inner].getNetDefense() +" is blocking \n";
|
||||
}
|
||||
}//while - loop through attackers
|
||||
|
||||
return display;
|
||||
return display.toString();
|
||||
}//getPlaneswalkerBlockers()
|
||||
|
||||
public static void executeCombatDamageEffects(Card c)
|
||||
|
||||
@@ -28,9 +28,7 @@ public class ComputerAI_Burn2 implements Computer {
|
||||
if(AllZone.Stack.size() == 0
|
||||
&& AllZone.Phase.is(Constant.Phase.Main1, Constant.Player.Computer)) {
|
||||
SpellAbilityList list = null; //Move3.getBestMove();
|
||||
if(list.toString().trim().length() != 0) {
|
||||
// System.out.println("Spell List - " +list);
|
||||
}
|
||||
|
||||
if(list.size() != 0) {
|
||||
SpellAbility sa = list.get(0);
|
||||
if(ComputerUtil.canPlay(sa) && sa.canPlay()) {
|
||||
|
||||
@@ -134,7 +134,7 @@ public class Deck implements java.io.Serializable {
|
||||
}
|
||||
|
||||
|
||||
class DeckSort implements Comparator<Object> {
|
||||
class DeckSort implements Comparator<Object>, java.io.Serializable {
|
||||
public int compare(Object a, Object b) {
|
||||
String a1 = ((Deck) a).getName();
|
||||
String b1 = ((Deck) b).getName();
|
||||
|
||||
@@ -891,7 +891,7 @@ public class GUI_DeckAnalysis extends javax.swing.JDialog {
|
||||
jTable1.setValueAt(cardsName[0], 0, 0);
|
||||
cCount = 1;
|
||||
for (int i=1; i< cardsName.length;i++ ){
|
||||
if(cardsName[i]==cardsName[i-1]){
|
||||
if(cardsName[i].equals(cardsName[i-1])){
|
||||
cCount = cCount+1;
|
||||
|
||||
}else
|
||||
|
||||
@@ -842,7 +842,7 @@ private Card getCurrentCard(int ID)
|
||||
public void newGame(Deck humanDeck, Deck computerDeck)
|
||||
{
|
||||
// AllZone.Computer = new ComputerAI_Input(new ComputerAI_General());
|
||||
System.gc(); //garbage collection... does it make a difference though?
|
||||
//System.gc(); //garbage collection... does it make a difference though?
|
||||
lastPlayerToDraw = Constant.Player.Human;
|
||||
|
||||
Input_Main.canPlayNumberOfLands = 1;
|
||||
|
||||
@@ -1725,7 +1725,7 @@ public class GameActionUtil
|
||||
|
||||
}
|
||||
}; // ability2
|
||||
if (!(card.getController() == c.getController())) {
|
||||
if (!(card.getController().equals(c.getController()))) {
|
||||
ability2.setStackDescription(card.getName() + " - "
|
||||
+ c.getController() + " played a spell, " + drawer
|
||||
+ " draws seven cards.");
|
||||
@@ -1820,7 +1820,7 @@ public class GameActionUtil
|
||||
|
||||
}
|
||||
}; // ability2
|
||||
if (!(card.getController() == c.getController())) {
|
||||
if (!(card.getController().equals(c.getController()))) {
|
||||
ability2.setStackDescription(card.getName() + " - "
|
||||
+ c.getController() + " played a spell, " + drawer
|
||||
+ " puts the top two cards of his or her library into his or her graveyard.");
|
||||
@@ -3924,7 +3924,7 @@ public class GameActionUtil
|
||||
{
|
||||
public void resolve()
|
||||
{
|
||||
String color = new String();
|
||||
String color = "";
|
||||
|
||||
Object o = AllZone.Display.getChoice("Choose mana color",Constant.Color.Colors);
|
||||
color = (String)o;
|
||||
|
||||
@@ -475,37 +475,74 @@ public class GuiDisplay3 extends JFrame implements Display, NewConstants, NewCon
|
||||
//if (c.getCounters(Counters.SPORE) != 0)
|
||||
// cdLabel6.setText("Spore counters: " + c.getCounters(Counters.SPORE));
|
||||
|
||||
|
||||
String tokenText = "";
|
||||
if(c.isToken()) tokenText = tokenText + "Token\r\n";
|
||||
|
||||
String counterText = "\r\n";
|
||||
StringBuilder counterText = new StringBuilder();
|
||||
counterText.append("\r\n");
|
||||
|
||||
if(c.getCounters(Counters.AGE) != 0) counterText = counterText + "Age counters: "
|
||||
+ c.getCounters(Counters.AGE) + "\r\n";
|
||||
if(c.getCounters(Counters.BLAZE) != 0) counterText = counterText + "Blaze counters: "
|
||||
+ c.getCounters(Counters.BLAZE) + "\r\n";
|
||||
if(c.getCounters(Counters.CHARGE) != 0) counterText = counterText + "Charge counters: "
|
||||
+ c.getCounters(Counters.CHARGE) + "\r\n";
|
||||
if(c.getCounters(Counters.DIVINITY) != 0) counterText = counterText + "Divinity counters: "
|
||||
+ c.getCounters(Counters.DIVINITY) + "\r\n";
|
||||
if(c.getCounters(Counters.FADE) != 0) counterText = counterText + "Fade counters: "
|
||||
+ c.getCounters(Counters.FADE) + "\r\n";
|
||||
if(c.getCounters(Counters.HOOFPRINT) != 0) counterText = counterText + "Hoofprint counters: "
|
||||
+ c.getCounters(Counters.HOOFPRINT) + "\r\n";
|
||||
if(c.getCounters(Counters.ICE) != 0) counterText = counterText + "Ice counters: "
|
||||
+ c.getCounters(Counters.ICE) + "\r\n";
|
||||
if(c.getCounters(Counters.LOYALTY) != 0) counterText = counterText + "Loyalty counters: "
|
||||
+ c.getCounters(Counters.LOYALTY) + "\r\n";
|
||||
if(c.getCounters(Counters.MANA) != 0) counterText = counterText + "Mana counters: "
|
||||
+ c.getCounters(Counters.MANA) + "\r\n";
|
||||
if(c.getCounters(Counters.P0M1) != 0) counterText = counterText + "0/-1 counters: "
|
||||
+ c.getCounters(Counters.P0M1) + "\r\n";
|
||||
if(c.getCounters(Counters.AGE) != 0) {
|
||||
counterText.append("Age counters: ");
|
||||
counterText.append(c.getCounters(Counters.AGE));
|
||||
counterText.append("\r\n");
|
||||
}
|
||||
if(c.getCounters(Counters.BLAZE) != 0) {
|
||||
counterText.append("Blaze counters: ");
|
||||
counterText.append(c.getCounters(Counters.BLAZE));
|
||||
counterText.append("\r\n");
|
||||
}
|
||||
if(c.getCounters(Counters.CHARGE) != 0) {
|
||||
counterText.append("Charge counters: ");
|
||||
counterText.append(c.getCounters(Counters.CHARGE));
|
||||
counterText.append("\r\n");
|
||||
}
|
||||
if(c.getCounters(Counters.DIVINITY) != 0) {
|
||||
counterText.append("Divinity counters: ");
|
||||
counterText.append(c.getCounters(Counters.DIVINITY));
|
||||
counterText.append("\r\n");
|
||||
}
|
||||
if(c.getCounters(Counters.FADE) != 0) {
|
||||
counterText.append("Fade counters: ");
|
||||
counterText.append(c.getCounters(Counters.FADE));
|
||||
counterText.append("\r\n");
|
||||
}
|
||||
if(c.getCounters(Counters.HOOFPRINT) != 0) {
|
||||
counterText.append("Hoofprint counters: ");
|
||||
counterText.append(c.getCounters(Counters.HOOFPRINT));
|
||||
counterText.append("\r\n");
|
||||
}
|
||||
if(c.getCounters(Counters.ICE) != 0) {
|
||||
counterText.append("Ice counters: ");
|
||||
counterText.append(c.getCounters(Counters.ICE));
|
||||
counterText.append("\r\n");
|
||||
}
|
||||
if(c.getCounters(Counters.LOYALTY) != 0) {
|
||||
counterText.append("Loyalty counters: ");
|
||||
counterText.append(c.getCounters(Counters.LOYALTY));
|
||||
counterText.append("\r\n");
|
||||
}
|
||||
if(c.getCounters(Counters.MANA) != 0){
|
||||
counterText.append("Mana counters: ");
|
||||
counterText.append(c.getCounters(Counters.MANA));
|
||||
counterText.append("\r\n");
|
||||
}
|
||||
if(c.getCounters(Counters.P0M1) != 0) {
|
||||
counterText.append("+0/-1 counters: ");
|
||||
counterText.append(c.getCounters(Counters.P0M1));
|
||||
counterText.append("\r\n");
|
||||
}
|
||||
if(c.getNetPTCounters() != 0) { //+1/+1 and -1/-1 counters should cancel each other out:
|
||||
if(c.getNetPTCounters() > 0) counterText = counterText + "+1/+1 counters: " + c.getNetPTCounters()
|
||||
+ "\r\n";
|
||||
if(c.getNetPTCounters() > 0) {
|
||||
counterText.append("+1/+1 counters: ");
|
||||
counterText.append(c.getNetPTCounters());
|
||||
counterText.append("\r\n");
|
||||
}
|
||||
else {
|
||||
int m1m1Counters = -1 * c.getNetPTCounters();
|
||||
counterText = counterText + "-1/-1 counters: " + m1m1Counters + "\r\n";
|
||||
counterText.append("-1/-1 counters: ");
|
||||
counterText.append(m1m1Counters);
|
||||
counterText.append("\r\n");
|
||||
}
|
||||
}
|
||||
/*if (c.getCounters(Counters.P1P1) != 0)
|
||||
@@ -513,10 +550,16 @@ public class GuiDisplay3 extends JFrame implements Display, NewConstants, NewCon
|
||||
if (c.getCounters(Counters.M1M1) != 0)
|
||||
counterText = counterText + "-1/-1 counters: " + c.getCounters(Counters.M1M1) + "\r\n";
|
||||
*/
|
||||
if(c.getCounters(Counters.QUEST) != 0) counterText = counterText + "Quest counters: "
|
||||
+ c.getCounters(Counters.QUEST) + "\r\n";
|
||||
if(c.getCounters(Counters.SPORE) != 0) counterText = counterText + "Spore counters: "
|
||||
+ c.getCounters(Counters.SPORE) + "\r\n";
|
||||
if(c.getCounters(Counters.QUEST) != 0) {
|
||||
counterText.append("Quest counters: ");
|
||||
counterText.append(c.getCounters(Counters.QUEST));
|
||||
counterText.append("\r\n");
|
||||
}
|
||||
if(c.getCounters(Counters.SPORE) != 0) {
|
||||
counterText.append("Spore counters: ");
|
||||
counterText.append(c.getCounters(Counters.SPORE));
|
||||
counterText.append("\r\n");
|
||||
}
|
||||
|
||||
String chosenTypeText = "";
|
||||
if(c.getChosenType() != "") chosenTypeText = "(chosen type: " + c.getChosenType() + ")";
|
||||
@@ -531,13 +574,15 @@ public class GuiDisplay3 extends JFrame implements Display, NewConstants, NewCon
|
||||
if(c.getEquipping().size() > 0) equippingText = "=Equipping " + c.getEquipping().get(0) + "=";
|
||||
|
||||
|
||||
String equippedByText = "";
|
||||
StringBuilder equippedByText = new StringBuilder();
|
||||
if(c.getEquippedBy().size() > 0) {
|
||||
equippedByText = "=Equipped by " + c.getEquippedBy().get(0);
|
||||
equippedByText.append("=Equipped by ");
|
||||
equippedByText.append(c.getEquippedBy().get(0));
|
||||
for(int i = 1; i < c.getEquippedBy().size(); i++) {
|
||||
equippedByText += ", " + c.getEquippedBy().get(i);
|
||||
equippedByText.append(", ");
|
||||
equippedByText.append(c.getEquippedBy().get(i));
|
||||
}
|
||||
equippedByText += "=";
|
||||
equippedByText.append("=");
|
||||
}
|
||||
|
||||
String enchantingText = "";
|
||||
@@ -545,22 +590,36 @@ public class GuiDisplay3 extends JFrame implements Display, NewConstants, NewCon
|
||||
enchantingText = "*Enchanting " + c.getEnchanting().get(0) + "*";
|
||||
}
|
||||
|
||||
String enchantedByText = "";
|
||||
StringBuilder enchantedByText = new StringBuilder();
|
||||
if(c.getEnchantedBy().size() > 0) {
|
||||
enchantedByText = "*Enchanted by " + c.getEnchantedBy().get(0);
|
||||
enchantedByText.append("*Enchanted by ");
|
||||
enchantedByText.append(c.getEnchantedBy().get(0));
|
||||
for(int i = 1; i < c.getEnchantedBy().size(); i++) {
|
||||
enchantedByText += ", " + c.getEnchantedBy().get(i);
|
||||
enchantedByText.append(", ");
|
||||
enchantedByText.append(c.getEnchantedBy().get(i));
|
||||
}
|
||||
enchantedByText += "*";
|
||||
enchantedByText.append("*");
|
||||
}
|
||||
|
||||
String uncastableText = "";
|
||||
if (c.isUnCastable())
|
||||
uncastableText = "This card can't be cast.";
|
||||
|
||||
if(!c.isFaceDown()) this.cdArea.setText(tokenText + c.getText() + counterText + chosenTypeText
|
||||
+chosenColorText + namedCardText + equippingText + equippedByText + enchantingText + enchantedByText + uncastableText);
|
||||
else this.cdArea.setText(tokenText + counterText);
|
||||
StringBuilder textBuilder = new StringBuilder();
|
||||
textBuilder.append(tokenText);
|
||||
textBuilder.append(c.getText());
|
||||
textBuilder.append(counterText.toString());
|
||||
textBuilder.append(chosenTypeText);
|
||||
textBuilder.append(chosenColorText);
|
||||
textBuilder.append(namedCardText);
|
||||
textBuilder.append(equippingText);
|
||||
textBuilder.append(equippedByText.toString());
|
||||
textBuilder.append(enchantingText);
|
||||
textBuilder.append(enchantedByText.toString());
|
||||
textBuilder.append(uncastableText);
|
||||
|
||||
if(!c.isFaceDown()) this.cdArea.setText(textBuilder.toString());
|
||||
else this.cdArea.setText(tokenText + counterText.toString());
|
||||
|
||||
cdPanel.setBorder(GuiDisplayUtil.getBorder(c));
|
||||
cCardHQ = c;
|
||||
@@ -580,7 +639,7 @@ public class GuiDisplay3 extends JFrame implements Display, NewConstants, NewCon
|
||||
pic.setSize(300, 300);
|
||||
picturePanel.add(pic);
|
||||
picturePanel.revalidate();
|
||||
System.gc();
|
||||
|
||||
*/
|
||||
|
||||
current_picture = c.getImageName();
|
||||
|
||||
@@ -191,19 +191,17 @@ public class GuiDisplayUtil implements NewConstants {
|
||||
public static String formatCardType(Card card) {
|
||||
|
||||
ArrayList<String> list = card.getType();
|
||||
String returnString = "";
|
||||
String s;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
String s = "";
|
||||
|
||||
for(int i = 0; i < list.size(); i++) {
|
||||
s = list.get(i).toString();
|
||||
sb.append(s);
|
||||
if(s.equals("Creature") || s.equals("Land")) {
|
||||
s += " - ";
|
||||
} else s += " ";
|
||||
|
||||
returnString += s;
|
||||
sb.append(" - ");
|
||||
} else sb.append(" ");
|
||||
}
|
||||
|
||||
return returnString;
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static ImageIcon getImageIcon(Card c)
|
||||
|
||||
@@ -973,13 +973,12 @@ public class Gui_DeckEditor_Menu extends JMenuBar implements NewConstants {
|
||||
|
||||
//only accepts numbers, letters or dashes up to 10 characters in length
|
||||
private String cleanString(String in) {
|
||||
String out = "";
|
||||
char[] c = in.toCharArray();
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for(int i = 0; i < c.length && i < 20; i++)
|
||||
if(Character.isLetterOrDigit(c[i]) || c[i] == '-') out += c[i];
|
||||
|
||||
return out;
|
||||
if(Character.isLetterOrDigit(c[i]) || c[i] == '-') sb.append(c[i]);
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -450,11 +450,8 @@ public class Gui_Quest_DeckEditor extends JFrame implements CardDetail, DeckDisp
|
||||
}
|
||||
|
||||
private void jbInit() throws Exception {
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
CardList stCardList=new CardList();
|
||||
|
||||
border1 = new EtchedBorder(EtchedBorder.RAISED, Color.white, new Color(148, 145, 140));
|
||||
|
||||
border1 = new EtchedBorder(EtchedBorder.RAISED, Color.white, new Color(148, 145, 140));
|
||||
titledBorder1 = new TitledBorder(BorderFactory.createEtchedBorder(Color.white, new Color(148, 145, 140)),
|
||||
"All Cards");
|
||||
border2 = BorderFactory.createEtchedBorder(Color.white, new Color(148, 145, 140));
|
||||
|
||||
@@ -11,16 +11,16 @@ public class Input_PayManaCostUtil
|
||||
if(card instanceof ManaPool) return ((ManaPool)card).subtractMana(manaCost);
|
||||
ArrayList<Ability_Mana> abilities = getManaAbilities(card);
|
||||
|
||||
String cneeded="";
|
||||
StringBuilder cneeded = new StringBuilder();
|
||||
for(String color : Constant.Color.ManaColors)
|
||||
if(manaCost.isNeeded(color))
|
||||
cneeded+=getColor2(color);
|
||||
cneeded.append(getColor2(color));
|
||||
Iterator<Ability_Mana> it = abilities.iterator();//you can't remove unneded abilitie inside a for(am:abilities) loop :(
|
||||
while(it.hasNext())
|
||||
{
|
||||
Ability_Mana ma = it.next();
|
||||
if (!ma.canPlay()) it.remove();
|
||||
else if (!canMake(ma, cneeded)) it.remove();
|
||||
else if (!canMake(ma, cneeded.toString())) it.remove();
|
||||
}
|
||||
if(abilities.isEmpty())
|
||||
return manaCost;
|
||||
|
||||
@@ -6,7 +6,7 @@ public class ManaPool extends Card
|
||||
{
|
||||
private ArrayList<Ability_Mana> used = new ArrayList<Ability_Mana>();
|
||||
//boolean[] spendAsCless ={true,true,true,true,true,true};
|
||||
boolean spendAll = true;
|
||||
//boolean spendAll = true;
|
||||
/* private int cIndex(String s)
|
||||
{
|
||||
//String c =(s.length()==1 ? s : Input_PayManaCostUtil.getColor2(s));
|
||||
@@ -82,25 +82,30 @@ public class ManaPool extends Card
|
||||
{
|
||||
//empty = true;
|
||||
String res=(isSnow() ? "Snow " : "") + "Mana available:\r\n";
|
||||
if (isEmpty())res+="None\r\n";
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(res);
|
||||
if (isEmpty())sb.append("None\r\n");
|
||||
//if(has[0]>0) {res+=Integer.toString(has[0]); empty = false;}
|
||||
else for(char c : mcolors.toCharArray())//int j=0; j<colors.length();j++){char c=colors.charAt(j);
|
||||
{
|
||||
int n = containsColor(c);//has[cIndex(c+"")];
|
||||
if(n == 0) continue;
|
||||
if(c == '1') res += n;
|
||||
if(c == '1') sb.append(n);
|
||||
else
|
||||
{
|
||||
for(int i = 0; i< n ; i++)
|
||||
res +=c;//(c+"");
|
||||
sb.append(c);//(c+"");
|
||||
//if (n > 0) {
|
||||
res+="("+n/*(Integer.toString(n)*/+")";// empty = false;}
|
||||
//res+="("+n/*(Integer.toString(n)*/+")";// empty = false;}
|
||||
sb.append("(");
|
||||
sb.append(n);
|
||||
sb.append(")");
|
||||
}
|
||||
res += "\r\n";
|
||||
sb.append("\r\n");
|
||||
}
|
||||
if(!isSnow())
|
||||
res += smp.getText();
|
||||
return res;
|
||||
sb.append(smp.getText());
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public final static String colors = "WUBRG";
|
||||
@@ -118,11 +123,11 @@ public class ManaPool extends Card
|
||||
}
|
||||
String sortContents(String mana)
|
||||
{
|
||||
String res = "";
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for(char color : mcolors.toCharArray())
|
||||
for(char c : mana.toCharArray())
|
||||
if(c == color) res += c;
|
||||
return res;
|
||||
if(c == color) sb.append(c);
|
||||
return sb.toString();
|
||||
}
|
||||
int containsColor(String color)
|
||||
{
|
||||
@@ -144,16 +149,16 @@ public class ManaPool extends Card
|
||||
public static String oraclize(String manaCost){
|
||||
//if(!manaCost.contains(" ")) return manaCost;
|
||||
String[] parts = manaCost.split(" ");
|
||||
String res="";
|
||||
StringBuilder res = new StringBuilder();
|
||||
for (String s : parts)
|
||||
{
|
||||
if (s.length()==2 && colors.contains(s.charAt(1) + "")) s=s.charAt(0)+"/"+s.charAt(1);
|
||||
if (s.length()==3) s="(" + s + ")";
|
||||
if (s.equals("S")) s="(S)";//for if/when we implement snow mana
|
||||
if (s.equals("X")) s="(X)";//X costs?
|
||||
res +=s;
|
||||
res.append(s);
|
||||
}
|
||||
return res;
|
||||
return res.toString();
|
||||
}
|
||||
public ArrayList<String> getColors()
|
||||
{
|
||||
@@ -275,7 +280,7 @@ public class ManaPool extends Card
|
||||
{
|
||||
if(mabilities.length == 0)
|
||||
{
|
||||
spendAll = true;//TODO:check something? GUI?
|
||||
//spendAll = true;//TODO:check something? GUI?
|
||||
if (m.isPaid() || ( isEmpty() && (isSnow() || smp.isEmpty()) ) )
|
||||
return m;
|
||||
else if (isEmpty()) return smp.subtractMana(m, mabilities);
|
||||
@@ -359,7 +364,10 @@ public class ManaPool extends Card
|
||||
chosen = choices.get(0);
|
||||
if (choices.size()> 1)
|
||||
chosen = (String)AllZone.Display.getChoiceOptional("Choose "+ (isSnow()? "snow " : "")+"mana to pay " + Mana, choices.toArray());
|
||||
if (chosen == null) {spendAll = false; return manaCost;}
|
||||
if (chosen == null) {
|
||||
//spendAll = false;
|
||||
return manaCost;
|
||||
}
|
||||
if(chosen.equals(Constant.Color.Snow))
|
||||
manaCost.subtractMana(chosen);
|
||||
else manaCost=subtractOne(manaCost,getColor2(chosen));
|
||||
|
||||
@@ -61,15 +61,17 @@ public class Mana_PayCost
|
||||
}
|
||||
public String toString()
|
||||
{
|
||||
String s = "";
|
||||
StringBuilder sb = new StringBuilder();
|
||||
ArrayList<Object> list = new ArrayList<Object>(manaPart);
|
||||
//need to reverse everything since the colored mana is stored first
|
||||
Collections.reverse(list);
|
||||
|
||||
for(int i = 0; i < list.size(); i++)
|
||||
s = s +" " +list.get(i).toString();
|
||||
for(int i = 0; i < list.size(); i++) {
|
||||
sb.append(" ");
|
||||
sb.append(list.get(i).toString());
|
||||
}
|
||||
|
||||
return s.trim();
|
||||
return sb.toString().trim();
|
||||
}
|
||||
|
||||
private ArrayList<Object> split(String cost)
|
||||
|
||||
@@ -83,18 +83,24 @@ class SimpleCombat
|
||||
}//combatDamage()
|
||||
public String toString()
|
||||
{
|
||||
String s = "";
|
||||
CardList attack = this.getAttackers();
|
||||
CardList block;
|
||||
for(int i = 0; i < attack.size(); i++)
|
||||
{
|
||||
block = this.getBlockers(attack.get(i));
|
||||
if(block.isEmpty())
|
||||
s +=attack.get(i) +" ";
|
||||
else
|
||||
s += attack.get(i) +" - " +block.get(0) +" ";
|
||||
}
|
||||
|
||||
return s;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
CardList attack = this.getAttackers();
|
||||
CardList block;
|
||||
for(int i = 0; i < attack.size(); i++)
|
||||
{
|
||||
block = this.getBlockers(attack.get(i));
|
||||
if(block.isEmpty()) {
|
||||
sb.append(attack.get(i));
|
||||
sb.append(" ");
|
||||
}
|
||||
else {
|
||||
sb.append(attack.get(i));
|
||||
sb.append(" - ");
|
||||
sb.append(block.get(0));
|
||||
sb.append(" ");
|
||||
}
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
}//Combat
|
||||
@@ -37,18 +37,20 @@ public class SpellAbilityList
|
||||
}//execute()
|
||||
public String toString()
|
||||
{
|
||||
String s = "";
|
||||
for(int i = 0; i < size(); i++)
|
||||
{
|
||||
s += get(i).getSourceCard().toString();
|
||||
s += " - ";
|
||||
s += get(i).getStackDescription();
|
||||
s += "\r\n";
|
||||
}
|
||||
return s;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for(int i = 0; i < size(); i++)
|
||||
{
|
||||
sb.append(get(i).getSourceCard().toString());
|
||||
sb.append(" - ");
|
||||
sb.append(get(i).getStackDescription());
|
||||
sb.append("\r\n");
|
||||
}
|
||||
return sb.toString();
|
||||
}//toString()
|
||||
public boolean equals(Object o)
|
||||
{
|
||||
return toString().equals(o.toString());
|
||||
if (o == null)
|
||||
return false;
|
||||
return toString().equals(o.toString());
|
||||
}
|
||||
}
|
||||
@@ -170,7 +170,7 @@ class TableModel extends AbstractTableModel
|
||||
{
|
||||
switch(column)
|
||||
{
|
||||
case 0: return new Integer(countQuantity(c));
|
||||
case 0: return Integer.valueOf(countQuantity(c));
|
||||
case 1: return c.getName();
|
||||
case 2: return c.getManaCost();
|
||||
case 3: return TableSorter.getColor(c);
|
||||
|
||||
@@ -41,7 +41,7 @@ public class TableSorter implements Comparator, NewConstants
|
||||
ArrayList list = FileUtil.readFile(ForgeProps.getFile(CARDS));
|
||||
|
||||
for(int i = 0; i < list.size(); i++)
|
||||
map.put(list.get(i).toString().trim(), new Integer(i));
|
||||
map.put(list.get(i).toString().trim(), Integer.valueOf(i));
|
||||
|
||||
return map;
|
||||
}
|
||||
@@ -54,8 +54,8 @@ public class TableSorter implements Comparator, NewConstants
|
||||
|
||||
if(column == 0)//Qty
|
||||
{
|
||||
aCom = new Integer(countCardName(a.getName(), all));
|
||||
bCom = new Integer(countCardName(b.getName(), all));
|
||||
aCom = Integer.valueOf(countCardName(a.getName(), all));
|
||||
bCom = Integer.valueOf(countCardName(b.getName(), all));
|
||||
}
|
||||
else if (column == 1)//Name
|
||||
{
|
||||
@@ -64,13 +64,13 @@ public class TableSorter implements Comparator, NewConstants
|
||||
}
|
||||
else if (column == 2)//Cost
|
||||
{
|
||||
aCom = new Integer(CardUtil.getConvertedManaCost(a.getManaCost()));
|
||||
bCom = new Integer(CardUtil.getConvertedManaCost(b.getManaCost()));
|
||||
aCom = Integer.valueOf(CardUtil.getConvertedManaCost(a.getManaCost()));
|
||||
bCom = Integer.valueOf(CardUtil.getConvertedManaCost(b.getManaCost()));
|
||||
|
||||
if(a.isLand())
|
||||
aCom = new Integer(-1);
|
||||
aCom = Integer.valueOf(-1);
|
||||
if(b.isLand())
|
||||
bCom = new Integer(-1);
|
||||
bCom = Integer.valueOf(-1);
|
||||
}
|
||||
else if (column == 3)//Color
|
||||
{
|
||||
@@ -122,15 +122,15 @@ public class TableSorter implements Comparator, NewConstants
|
||||
final private Integer getRarity(Card c)
|
||||
{
|
||||
if(c.getRarity().equals("Common"))
|
||||
return new Integer(1);
|
||||
return Integer.valueOf(1);
|
||||
else if(c.getRarity().equals("Uncommon"))
|
||||
return new Integer(2);
|
||||
return Integer.valueOf(2);
|
||||
else if(c.getRarity().equals("Rare"))
|
||||
return new Integer(3);
|
||||
return Integer.valueOf(3);
|
||||
else if(c.getRarity().equals("Land"))
|
||||
return new Integer(4);
|
||||
return Integer.valueOf(4);
|
||||
else
|
||||
return new Integer(5);
|
||||
return Integer.valueOf(5);
|
||||
}
|
||||
|
||||
final public static String getColor(Card c)
|
||||
|
||||
@@ -83,7 +83,7 @@ public class WaveFileObuffer extends Obuffer
|
||||
/**
|
||||
* Write the samples to the file (Random Acces).
|
||||
*/
|
||||
short[] myBuffer = new short[2];
|
||||
//short[] myBuffer = new short[2];
|
||||
public void write_buffer(int val)
|
||||
{
|
||||
|
||||
|
||||
@@ -119,9 +119,9 @@ public class jlc
|
||||
public boolean processArgs(String[] argv)
|
||||
{
|
||||
filename = null;
|
||||
@SuppressWarnings("unused")
|
||||
Crc16[] crc;
|
||||
crc = new Crc16[1];
|
||||
|
||||
//Crc16[] crc;
|
||||
//crc = new Crc16[1];
|
||||
int i;
|
||||
int argc = argv.length;
|
||||
|
||||
|
||||
@@ -57,8 +57,8 @@ final class BitReserve
|
||||
|
||||
private int offset, totbit, buf_byte_idx;
|
||||
private final int[] buf = new int[BUFSIZE];
|
||||
@SuppressWarnings("unused")
|
||||
private int buf_bit_idx;
|
||||
|
||||
//private int buf_bit_idx;
|
||||
|
||||
BitReserve()
|
||||
{
|
||||
|
||||
@@ -49,8 +49,7 @@ final class huffcodetab
|
||||
|
||||
private char tablename0 = ' '; /* string, containing table_description */
|
||||
private char tablename1 = ' '; /* string, containing table_description */
|
||||
@SuppressWarnings("unused")
|
||||
private char tablename2 = ' '; /* string, containing table_description */
|
||||
//private char tablename2 = ' '; /* string, containing table_description */
|
||||
|
||||
private int xlen; /* max. x-index+ */
|
||||
private int ylen; /* max. y-index+ */
|
||||
@@ -59,10 +58,10 @@ final class huffcodetab
|
||||
private int linmax; /* max number to be stored in linbits */
|
||||
@SuppressWarnings("unused")
|
||||
private int ref; /* a positive value indicates a reference */
|
||||
@SuppressWarnings("unused")
|
||||
private int[] table=null; /* pointer to array[xlen][ylen] */
|
||||
@SuppressWarnings("unused")
|
||||
private int[] hlen=null; /* pointer to array[xlen][ylen] */
|
||||
|
||||
//private int[] table=null; /* pointer to array[xlen][ylen] */
|
||||
|
||||
//private int[] hlen=null; /* pointer to array[xlen][ylen] */
|
||||
private int[][] val=null; /* decoder tree */
|
||||
private int treelen; /* length of decoder tree */
|
||||
|
||||
@@ -433,14 +432,14 @@ final class huffcodetab
|
||||
{
|
||||
tablename0 = S.charAt(0);
|
||||
tablename1 = S.charAt(1);
|
||||
tablename2 = S.charAt(2);
|
||||
//tablename2 = S.charAt(2);
|
||||
xlen = XLEN;
|
||||
ylen = YLEN;
|
||||
linbits = LINBITS;
|
||||
linmax = LINMAX;
|
||||
ref = REF;
|
||||
table = TABLE;
|
||||
hlen = HLEN;
|
||||
//linmax = LINMAX;
|
||||
//ref = REF;
|
||||
//table = TABLE;
|
||||
//hlen = HLEN;
|
||||
val = VAL;
|
||||
treelen = TREELEN;
|
||||
}
|
||||
|
||||
@@ -44,8 +44,7 @@ public class Player
|
||||
/**
|
||||
* The current frame number.
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
private int frame = 0;
|
||||
//private int frame = 0;
|
||||
|
||||
/**
|
||||
* The MPEG audio bitstream.
|
||||
|
||||
@@ -45,10 +45,10 @@ public class AdvancedPlayer
|
||||
/** Has the player been closed? */
|
||||
private boolean closed = false;
|
||||
/** Has the player played back all frames from the stream? */
|
||||
@SuppressWarnings("unused")
|
||||
private boolean complete = false;
|
||||
@SuppressWarnings("unused")
|
||||
private int lastPosition = 0;
|
||||
|
||||
//private boolean complete = false;
|
||||
|
||||
//private int lastPosition = 0;
|
||||
/** Listener for the playback process */
|
||||
private PlaybackListener listener;
|
||||
|
||||
@@ -104,7 +104,7 @@ public class AdvancedPlayer
|
||||
// System.out.println(audio.getPosition());
|
||||
synchronized (this)
|
||||
{
|
||||
complete = (!closed);
|
||||
//complete = (!closed);
|
||||
close();
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ public class AdvancedPlayer
|
||||
// this may fail, so ensure object state is set up before
|
||||
// calling this method.
|
||||
out.close();
|
||||
lastPosition = out.getPosition();
|
||||
//lastPosition = out.getPosition();
|
||||
try
|
||||
{
|
||||
bitstream.close();
|
||||
|
||||
Reference in New Issue
Block a user