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