- Added Vasiliy's deck editor filter (which I can't get to work though for some reason).

- Fixed text on a bunch of the land cards (abilities would show up double).
- Added Cabal Coffers, Magus of the Coffers, Riding the Dilu Horse, Fire Bowman, Archivist.
This commit is contained in:
jendave
2011-08-06 02:51:16 +00:00
parent a71f583de2
commit 6484ce036a
11 changed files with 1195 additions and 35 deletions

3
.gitattributes vendored
View File

@@ -82,6 +82,8 @@ src/Deck.java svneol=native#text/plain
src/DeckConverter.java svneol=native#text/plain src/DeckConverter.java svneol=native#text/plain
src/OldDeckIO.java svneol=native#text/plain src/OldDeckIO.java svneol=native#text/plain
src/QuestData_State.java svneol=native#text/plain src/QuestData_State.java svneol=native#text/plain
src/com/cloudgarden/layout/AnchorConstraint.java -text svneol=native#text/plain
src/com/cloudgarden/layout/AnchorLayout.java -text svneol=native#text/plain
src/forge/Ability.java svneol=native#text/plain src/forge/Ability.java svneol=native#text/plain
src/forge/Ability_Activated.java svneol=native#text/plain src/forge/Ability_Activated.java svneol=native#text/plain
src/forge/Ability_Hand.java svneol=native#text/plain src/forge/Ability_Hand.java svneol=native#text/plain
@@ -140,6 +142,7 @@ src/forge/DownloadDeck.java -text svneol=native#text/plain
src/forge/EndOfTurn.java svneol=native#text/plain src/forge/EndOfTurn.java svneol=native#text/plain
src/forge/ExternalPanel.java svneol=native#text/plain src/forge/ExternalPanel.java svneol=native#text/plain
src/forge/FileUtil.java -text svneol=native#text/plain src/forge/FileUtil.java -text svneol=native#text/plain
src/forge/GUI_Filter.java -text svneol=native#text/plain
src/forge/GameAction.java svneol=native#text/plain src/forge/GameAction.java svneol=native#text/plain
src/forge/GameActionUtil.java svneol=native#text/plain src/forge/GameActionUtil.java svneol=native#text/plain
src/forge/GenerateConstructedDeck.java svneol=native#text/plain src/forge/GenerateConstructedDeck.java svneol=native#text/plain

View File

@@ -1,3 +1,31 @@
Archivist
2 U U
Creature Human Advisor
no text
1/1
Fire Bowman
R
Creature Human Soldier Archer
no text
1/1
Riding the Dilu Horse
2 G
Sorcery
Target creature gets +2/+2 and gains horsemanship.
Magus of the Coffers
4 B
Creature Human Wizard
no text
4/4
Cabal Coffers
no cost
Land
no text
Xiahou Dun, the One-Eyed Xiahou Dun, the One-Eyed
2 B B 2 B B
Legendary Creature Human Soldier Legendary Creature Human Soldier

View File

@@ -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=MTG Forge -- official beta: 09/11/25, SVN revision: 101 program/version=MTG Forge -- official beta: 09/11/25, SVN revision: 102
tokens--file=AllTokens.txt tokens--file=AllTokens.txt

View File

@@ -0,0 +1,80 @@
/*
*/
package com.cloudgarden.layout;
/**
* Used by both AnchorLayout (SWT) and AnchorLayoutManager (Swing)
*/
public class AnchorConstraint {
/**
* Meaning: This side is not anchored.
*/
public static final int ANCHOR_NONE = 0;
/**
* (Relative anchor) Meaning: This side is anchored so that it always
* occurs a fixed fraction of
* the distance along it's parent's side. The position is calculated by
* the formula " position = (parent side)*(value)/1000 " so for
* instance if top=100 and topType == ANCHOR_REL then the
* value of y for this side would be (parent height)*top/1000.
*/
public static final int ANCHOR_REL = 1;
/**
* (Absolute anchor) Meaning: This side is anchored a fixed distance
* in pixels (given by the value for this side) from it's parent's respective side.
* For instance, if bottomType == ANCHOR_ABS and bottom = 100 then the
* bottom side of this component will remain fixed 100 pixels from
* the bottom side of it's parent container.
*/
public static final int ANCHOR_ABS = 2;
public int top;
public int bottom;
public int left;
public int right;
public int topType;
public int bottomType;
public int rightType;
public int leftType;
public AnchorConstraint() {
this(0, 0, 0, 0, ANCHOR_NONE, ANCHOR_NONE, ANCHOR_NONE, ANCHOR_NONE);
}
/**
* Creates an AnchorConstraint.
* @param top - value (relative or absolute) for top side
* @param right - like 'top' but for right side
* @param bottom - like 'top' but for bottom side
* @param left - like 'top' but for left side
* @param topType - either ANCHOR_ABS, ANCHOR_REL or ANCHOR_NONE
* to indicate whether the 'top' parameter is an absolute value (in pixels) or
* a fractional value (in 1/1000 ths) of the height of this component's parent,
* denoting where the anchor will be applied (if at all).
* @param rightType - like 'topType' but for right side
* @param bottomType - like 'topType' but for bottom side
* @param leftType - like 'topType' but for left side
*/
public AnchorConstraint(
int top,
int right,
int bottom,
int left,
int topType,
int rightType,
int bottomType,
int leftType) {
this.top = top;
this.bottom = bottom;
this.left = left;
this.right = right;
this.topType = topType;
this.rightType = rightType;
this.bottomType = bottomType;
this.leftType = leftType;
}
}

View File

@@ -0,0 +1,263 @@
/*
*/
package com.cloudgarden.layout;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.LayoutManager2;
import java.awt.Rectangle;
import java.util.HashMap;
/**
* Lays out components, using a combination of their "bounds" property
* and their AnchorConstraints layout constraint objects.
* <P>
* Sides of the components can be anchored either absolutely (eg, if the
* right side is anchored absolutely then it will always be a fixed number
* of pixels from the right side of it's parent container) or relatively (ie,
* if any side is anchored relatively then it will always occur a fixed
* fraction of the way along it's parent's side). Or they can be not anchored,
* at all in which case they will occur at places determined by their
* component's "bounds" property and the anchoring of the component's
* other sides.
*/
public class AnchorLayout implements LayoutManager2 {
private int preferredWidth, preferredHeight, minHeight, minWidth;
private HashMap<Component, Object> constraintMap = new HashMap<Component, Object>();
private boolean sizesCalculated = false;
private Container container;
public AnchorLayout() {
super();
}
void initialize(Container parent) {
if (sizesCalculated)
return;
Component[] children = parent.getComponents();
preferredWidth = 10000;
preferredHeight = 10000;
minWidth = 0;
minHeight = 0;
Rectangle pb = parent.getBounds();
for (int i = 0; i < children.length; i++) {
Component child = children[i];
if (child != null) {
Object ld = constraintMap.get(child);
Rectangle b = child.getBounds();
Dimension pref = child.getPreferredSize();
Dimension min = child.getMaximumSize();
if (pref == null)
pref = child.getSize();
if (min == null)
min = child.getSize();
int minX = b.x + b.width;
int minY = b.y + b.height;
int maxX = b.x + b.width;
int maxY = b.y + b.height;
if (ld instanceof AnchorConstraint) {
AnchorConstraint ac = (AnchorConstraint) ld;
int acl = ac.left;
int acr = ac.right;
int aclt = ac.leftType;
int acrt = ac.rightType;
if (aclt == AnchorConstraint.ANCHOR_REL)
acl = acl * pb.width / 1000;
if (acrt == AnchorConstraint.ANCHOR_REL)
acr = pb.width - acr * pb.width / 1000;
if (aclt != AnchorConstraint.ANCHOR_NONE
&& acrt != AnchorConstraint.ANCHOR_NONE)
maxX = acl + pref.width + acr;
if (aclt == AnchorConstraint.ANCHOR_NONE)
acl = 0;
if (acrt == AnchorConstraint.ANCHOR_NONE)
acr = 0;
minX = acl + min.width + acr;
int act = ac.top;
int acb = ac.bottom;
int actt = ac.topType;
int acbt = ac.bottomType;
if (actt == AnchorConstraint.ANCHOR_REL)
act = act * pb.height / 1000;
if (acbt == AnchorConstraint.ANCHOR_REL)
acb = pb.height - acb * pb.height / 1000;
if (actt != AnchorConstraint.ANCHOR_NONE
&& acbt != AnchorConstraint.ANCHOR_NONE)
maxY = act + pref.height + acb;
if (actt == AnchorConstraint.ANCHOR_NONE)
act = 0;
if (acbt == AnchorConstraint.ANCHOR_NONE)
acb = 0;
minY = act + min.height + acb;
}
if (minX > minWidth)
minWidth = minX;
if (maxX > minWidth)
preferredWidth = maxX;
if (minY > minHeight)
minHeight = minY;
if (maxY > preferredHeight)
preferredHeight = maxY;
}
}
}
/* (non-Javadoc)
* @see org.eclipse.swt.widgets.Layout#layout(org.eclipse.swt.widgets.Composite, boolean)
*/
public void layoutContainer(Container container) {
this.setContainer(container);
Component children[] = container.getComponents();
Rectangle rect = container.getBounds();
int width = rect.width;
int height = rect.height;
for (int i = 0; i < children.length; i++) {
Component child = children[i];
if (child != null) {
Object ld = constraintMap.get(child);
Rectangle b = child.getBounds();
Dimension pref = child.getPreferredSize();
if (pref == null)
pref = child.getSize();
if (ld instanceof AnchorConstraint) {
AnchorConstraint ac = (AnchorConstraint) ld;
int acl = ac.left;
int acr = ac.right;
int aclt = ac.leftType;
int acrt = ac.rightType;
if (aclt == AnchorConstraint.ANCHOR_REL)
acl = acl * width / 1000;
if (acrt == AnchorConstraint.ANCHOR_REL)
acr = width - acr * width / 1000;
if (aclt != AnchorConstraint.ANCHOR_NONE) {
if (acrt != AnchorConstraint.ANCHOR_NONE) {
b.width = width - acr - acl;
b.x = acl;
} else {
b.width = pref.width;
if (b.width + acl > width)
b.width = width - acl;
b.x = acl;
}
} else {
if (acrt != AnchorConstraint.ANCHOR_NONE) {
b.x = width - acr - pref.width;
}
b.width = pref.width;
if (b.width + b.x > width)
b.width = width - b.x;
}
int act = ac.top;
int acb = ac.bottom;
int actt = ac.topType;
int acbt = ac.bottomType;
if (actt == AnchorConstraint.ANCHOR_REL)
act = act * height / 1000;
if (acbt == AnchorConstraint.ANCHOR_REL)
acb = height - acb * height / 1000;
if (actt != AnchorConstraint.ANCHOR_NONE) {
if (acbt != AnchorConstraint.ANCHOR_NONE) {
b.height = height - acb - act;
b.y = act;
} else {
b.height = pref.height;
if (b.height + act > height)
b.height = height - act;
b.y = act;
}
} else {
if (acbt != AnchorConstraint.ANCHOR_NONE) {
b.y = height - acb - pref.height;
}
b.height = pref.height;
if (b.height + b.y > height)
b.height = height - b.y;
}
child.setBounds(b);
}
}
}
}
/* (non-Javadoc)
* @see java.awt.LayoutManager#addLayoutComponent(java.lang.String, java.awt.Component)
*/
public void addLayoutComponent(String name, Component comp) {}
/* (non-Javadoc)
* @see java.awt.LayoutManager#removeLayoutComponent(java.awt.Component)
*/
public void removeLayoutComponent(Component comp) {
constraintMap.remove(comp);
}
/* (non-Javadoc)
* @see java.awt.LayoutManager#preferredLayoutSize(java.awt.Container)
*/
public Dimension preferredLayoutSize(Container parent) {
initialize(parent);
return new Dimension(preferredWidth, preferredHeight);
}
/* (non-Javadoc)
* @see java.awt.LayoutManager#minimumLayoutSize(java.awt.Container)
*/
public Dimension minimumLayoutSize(Container parent) {
initialize(parent);
return new Dimension(minWidth, minHeight);
}
/* (non-Javadoc)
* @see java.awt.LayoutManager2#addLayoutComponent(java.awt.Component, java.lang.Object)
*/
public void addLayoutComponent(Component comp, Object constraints) {
constraintMap.put(comp, constraints);
}
/* (non-Javadoc)
* @see java.awt.LayoutManager2#maximumLayoutSize(java.awt.Container)
*/
public Dimension maximumLayoutSize(Container target) {
return preferredLayoutSize(target);
}
/* (non-Javadoc)
* @see java.awt.LayoutManager2#getLayoutAlignmentX(java.awt.Container)
*/
public float getLayoutAlignmentX(Container target) {
return 0;
}
/* (non-Javadoc)
* @see java.awt.LayoutManager2#getLayoutAlignmentY(java.awt.Container)
*/
public float getLayoutAlignmentY(Container target) {
return 0;
}
/* (non-Javadoc)
* @see java.awt.LayoutManager2#invalidateLayout(java.awt.Container)
*/
public void invalidateLayout(Container target) {
sizesCalculated = false;
}
public void setContainer(Container container) {
this.container = container;
}
public Container getContainer() {
return container;
}
}

View File

@@ -17067,9 +17067,6 @@ return land.size() > 1 && CardFactoryUtil.AI_isMainPhase();
{ {
final Spell spell = new Spell(card) final Spell spell = new Spell(card)
{ {
/**
*
*/
private static final long serialVersionUID = 2626237206744317044L; private static final long serialVersionUID = 2626237206744317044L;
public void resolve() public void resolve()
@@ -17145,6 +17142,53 @@ return land.size() > 1 && CardFactoryUtil.AI_isMainPhase();
card.addSpellAbility(spell); card.addSpellAbility(spell);
}//*************** END ************ END ************************** }//*************** END ************ END **************************
//*************** START *********** START **************************
else if(cardName.equals("Riding the Dilu Horse"))
{
SpellAbility spell = new Spell(card)
{
private static final long serialVersionUID = -620930445462994580L;
public boolean canPlayAI()
{
PlayerZone play = AllZone.getZone(Constant.Zone.Play, Constant.Player.Computer);
CardList list = new CardList(play.getCards());
list = list.filter(new CardListFilter()
{
public boolean addCard(Card c)
{
return c.isCreature() && !c.getKeyword().contains("Horsemanship") && !c.getKeyword().contains("Defender");
}
});
Card c = CardFactoryUtil.AI_getBestCreature(list, card);
setTargetCard(c);
return list.size() > 0;
}
public void resolve()
{
final Card[] target = new Card[1];
target[0] = getTargetCard();
if(AllZone.GameAction.isCardInPlay(target[0]) && CardFactoryUtil.canTarget(card, target[0]))
{
target[0].addTempAttackBoost(2);
target[0].addTempDefenseBoost(2);
target[0].addExtrinsicKeyword("Horsemanship");
//String s = target[0].getText();
target[0].setText("(+2/+2 and Horsemanship from " +card+")");
}
}//resolve()
};
spell.setBeforePayMana(CardFactoryUtil.input_targetCreature(spell));
card.clearSpellAbility();
card.addSpellAbility(spell);
}//*************** END ************ END **************************
// Cards with Cycling abilities // Cards with Cycling abilities
// -1 means keyword "Cycling" not found // -1 means keyword "Cycling" not found
if (hasKeyword(card, "Cycling") != -1) if (hasKeyword(card, "Cycling") != -1)

View File

@@ -17068,6 +17068,119 @@ public class CardFactory_Creatures {
card.addSpellAbility(ability); card.addSpellAbility(ability);
}//*************** END ************ END ************************** }//*************** END ************ END **************************
//*************** START *********** START **************************
if (cardName.equals("Magus of the Coffers"))
{
final SpellAbility ability = new Ability_Tap(card, "2")
{
private static final long serialVersionUID = 138661285416402582L;
public void resolve()
{
Card mp = AllZone.ManaPool;//list.getCard(0);
CardList swamps = new CardList(AllZone.getZone(Constant.Zone.Play, card.getController()).getCards());
swamps = swamps.getType("Swamp");
for(int i=0;i<swamps.size();i++)
{
mp.addExtrinsicKeyword("ManaPool:B");
}
}
public boolean canPlayAI()
{
return false;
}
};
ability.setDescription("2, tap: Add B to your mana pool for each Swamp you control.");
ability.setStackDescription(cardName + " adds B to your mana pool for each Swamp you control.");
//card.clearSpellAbility();
//card.setText(card.getText() + ability.toString());
card.addSpellAbility(ability);
return card;
}//*************** END ************ END **************************
//*************** START *********** START **************************
else if(cardName.equals("Fire Bowman"))
{
final Ability ability = new Ability(card, "0")
{
public boolean canPlayAI() {return getCreature().size() != 0;}
public void chooseTargetAI()
{
if(AllZone.Human_Life.getLife() < 3)
setTargetPlayer(Constant.Player.Human);
else
{
CardList list = getCreature();
list.shuffle();
setTargetCard(list.get(0));
}
AllZone.GameAction.sacrifice(card);
}//chooseTargetAI()
CardList getCreature()
{
//toughness of 1
CardList list = CardFactoryUtil.AI_getHumanCreature(1, card, true);
list = list.filter(new CardListFilter()
{
public boolean addCard(Card c)
{
//only get 1/1 flyers or 2/1 creatures
return (2 <= c.getNetAttack()) || c.getKeyword().contains("Flying");
}
});
return list;
}//getCreature()
public void resolve()
{
if(getTargetCard() != null)
{
if(AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card, getTargetCard()) )
getTargetCard().addDamage(1);
}
else
AllZone.GameAction.getPlayerLife(getTargetPlayer()).subtractLife(1);
}//resolve()
};//SpellAbility
card.addSpellAbility(ability);
ability.setDescription("Sacrifice Fire Bowman: Fire Bowman deals 1 damage to target creature or player. Activate this ability only during your turn, before attackers are declared.");
ability.setBeforePayMana(CardFactoryUtil.input_targetCreaturePlayer(ability, new Command()
{
private static final long serialVersionUID = -3283051501556347775L;
public void execute()
{
AllZone.GameAction.sacrifice(card);
}
}, true));
}//*************** END ************ END **************************
//*************** START *********** START **************************
else if(cardName.equals("Archivist"))
{
final SpellAbility ability = new Ability_Tap(card, "0")
{
private static final long serialVersionUID = -3630015833049495309L;
public boolean canPlayAI() {return AllZone.Phase.getPhase().equals(Constant.Phase.Main2);}
public void resolve()
{
AllZone.GameAction.drawCard(card.getController());
}
};//SpellAbility
card.addSpellAbility(ability);
ability.setDescription("tap: Draw a card.");
ability.setStackDescription(card.getName() + " - draw a card.");
}//*************** END ************ END **************************
// Cards with Cycling abilities // Cards with Cycling abilities
// -1 means keyword "Cycling" not found // -1 means keyword "Cycling" not found
if (shouldCycle(card) != -1) if (shouldCycle(card) != -1)

View File

@@ -23,9 +23,7 @@ class CardFactory_Lands {
}; };
Ability_Tap ability = new Ability_Tap(card) Ability_Tap ability = new Ability_Tap(card)
{ {
/**
*
*/
private static final long serialVersionUID = 1416258136308898492L; private static final long serialVersionUID = 1416258136308898492L;
CardList inPlay = new CardList(); CardList inPlay = new CardList();
@@ -933,7 +931,7 @@ class CardFactory_Lands {
//not sure what's going on here, maybe because it's a land it doesn't add the ability to the text? //not sure what's going on here, maybe because it's a land it doesn't add the ability to the text?
//anyway, this does the trick: //anyway, this does the trick:
//card.removeIntrinsicKeyword("tap: add G"); //card.removeIntrinsicKeyword("tap: add G");
card.setText(card.getSpellText() + "\r\ntap: Return target legendary creature to its owner's hand."); //card.setText(card.getSpellText() + "\r\ntap: Return target legendary creature to its owner's hand.");
//card.addIntrinsicKeyword("tap: add G"); //card.addIntrinsicKeyword("tap: add G");
}//*************** END ************ END ************************** }//*************** END ************ END **************************
@@ -1035,7 +1033,7 @@ class CardFactory_Lands {
//not sure what's going on here, maybe because it's a land it doesn't add the ability to the text? //not sure what's going on here, maybe because it's a land it doesn't add the ability to the text?
//anyway, this does the trick: //anyway, this does the trick:
//card.removeIntrinsicKeyword("tap: add G"); //card.removeIntrinsicKeyword("tap: add G");
card.setText(card.getSpellText() + "\r\ntap: Target 1/1 creature gets +1/+2 until end of turn."); //card.setText(card.getSpellText() + "\r\ntap: Target 1/1 creature gets +1/+2 until end of turn.");
//card.addIntrinsicKeyword("tap: add G"); //card.addIntrinsicKeyword("tap: add G");
}//*************** END ************ END ************************** }//*************** END ************ END **************************
@@ -1137,7 +1135,7 @@ class CardFactory_Lands {
//not sure what's going on here, maybe because it's a land it doesn't add the ability to the text? //not sure what's going on here, maybe because it's a land it doesn't add the ability to the text?
//anyway, this does the trick: //anyway, this does the trick:
//card.removeIntrinsicKeyword("tap: add G"); //card.removeIntrinsicKeyword("tap: add G");
card.setText(card.getSpellText() + "\r\nG, tap: Target legendary creature gets +1/+1 until end of turn."); //card.setText(card.getSpellText() + "\r\nG, tap: Target legendary creature gets +1/+1 until end of turn.");
//card.addIntrinsicKeyword("tap: add G"); //card.addIntrinsicKeyword("tap: add G");
}//*************** END ************ END ************************** }//*************** END ************ END **************************
@@ -1203,7 +1201,7 @@ class CardFactory_Lands {
//not sure what's going on here, maybe because it's a land it doesn't add the ability to the text? //not sure what's going on here, maybe because it's a land it doesn't add the ability to the text?
//anyway, this does the trick: //anyway, this does the trick:
//card.removeIntrinsicKeyword("tap: add 1"); //card.removeIntrinsicKeyword("tap: add 1");
card.setText(card.getSpellText() + "\r\nG, tap: Untap target Elf."); //card.setText(card.getSpellText() + "\r\nG, tap: Untap target Elf.");
//card.addIntrinsicKeyword("tap: add 1"); //card.addIntrinsicKeyword("tap: add 1");
}//*************** END ************ END ************************** }//*************** END ************ END **************************
@@ -1307,7 +1305,7 @@ class CardFactory_Lands {
//not sure what's going on here, maybe because it's a land it doesn't add the ability to the text? //not sure what's going on here, maybe because it's a land it doesn't add the ability to the text?
//anyway, this does the trick: //anyway, this does the trick:
//card.removeIntrinsicKeyword("tap: add 1"); //card.removeIntrinsicKeyword("tap: add 1");
card.setText(card.getSpellText() + "\r\n1 U, tap: Put target artifact card in your graveyard on top of your library."); //card.setText(card.getSpellText() + "\r\n1 U, tap: Put target artifact card in your graveyard on top of your library.");
//card.addExtrinsicKeyword("tap: add 1"); //card.addExtrinsicKeyword("tap: add 1");
}//*************** END ************ END ************************** }//*************** END ************ END **************************
@@ -1412,7 +1410,7 @@ class CardFactory_Lands {
//not sure what's going on here, maybe because it's a land it doesn't add the ability to the text? //not sure what's going on here, maybe because it's a land it doesn't add the ability to the text?
//anyway, this does the trick: //anyway, this does the trick:
//card.removeIntrinsicKeyword("tap: add 1"); //card.removeIntrinsicKeyword("tap: add 1");
card.setText(card.getSpellText() + "\r\n1 B, tap: Put target creature card in your graveyard on top of your library."); //card.setText(card.getSpellText() + "\r\n1 B, tap: Put target creature card in your graveyard on top of your library.");
//card.addExtrinsicKeyword("tap: add 1"); //card.addExtrinsicKeyword("tap: add 1");
}//*************** END ************ END ************************** }//*************** END ************ END **************************
@@ -1443,7 +1441,7 @@ class CardFactory_Lands {
//not sure what's going on here, maybe because it's a land it doesn't add the ability to the text? //not sure what's going on here, maybe because it's a land it doesn't add the ability to the text?
//anyway, this does the trick: //anyway, this does the trick:
//card.removeIntrinsicKeyword("tap: add 1"); //card.removeIntrinsicKeyword("tap: add 1");
card.setText(card.getSpellText() + "\r\n1: Return Oboro, Palace in the Clouds to your hand."); //card.setText(card.getSpellText() + "\r\n1: Return Oboro, Palace in the Clouds to your hand.");
//card.addExtrinsicKeyword("tap: add 1"); //card.addExtrinsicKeyword("tap: add 1");
}//*************** END ************ END ************************** }//*************** END ************ END **************************
@@ -1528,7 +1526,7 @@ class CardFactory_Lands {
//not sure what's going on here, maybe because it's a land it doesn't add the ability to the text? //not sure what's going on here, maybe because it's a land it doesn't add the ability to the text?
//anyway, this does the trick: //anyway, this does the trick:
//card.removeIntrinsicKeyword("tap: add 1"); //card.removeIntrinsicKeyword("tap: add 1");
card.setText(card.getSpellText() + "\r\n5, tap, sacrifice Gargoyle Castle: Put a 3/4 colorless Gargoyle artifact creature token with flying onto the battlefield."); //card.setText(card.getSpellText() + "\r\n5, tap, sacrifice Gargoyle Castle: Put a 3/4 colorless Gargoyle artifact creature token with flying onto the battlefield.");
//card.addIntrinsicKeyword("tap: add 1"); //card.addIntrinsicKeyword("tap: add 1");
}//*************** END ************ END ************************** }//*************** END ************ END **************************
@@ -1581,7 +1579,7 @@ class CardFactory_Lands {
//not sure what's going on here, maybe because it's a land it doesn't add the ability to the text? //not sure what's going on here, maybe because it's a land it doesn't add the ability to the text?
//anyway, this does the trick: //anyway, this does the trick:
//card.removeIntrinsicKeyword("tap: add 1"); //card.removeIntrinsicKeyword("tap: add 1");
card.setText(card.getSpellText() + "\r\n1 R, tap: Put a 0/1 red Kobold creature token named Kobolds of Kher Keep into play."); //card.setText(card.getSpellText() + "\r\n1 R, tap: Put a 0/1 red Kobold creature token named Kobolds of Kher Keep into play.");
//card.addIntrinsicKeyword("tap: add 1"); //card.addIntrinsicKeyword("tap: add 1");
}//*************** END ************ END ************************** }//*************** END ************ END **************************
@@ -1635,7 +1633,7 @@ class CardFactory_Lands {
//not sure what's going on here, maybe because it's a land it doesn't add the ability to the text? //not sure what's going on here, maybe because it's a land it doesn't add the ability to the text?
//anyway, this does the trick: //anyway, this does the trick:
//card.removeIntrinsicKeyword("tap: add 1"); //card.removeIntrinsicKeyword("tap: add 1");
card.setText(card.getSpellText() + "\r\n 2 G W, tap: Put a 1/1 green Saproling creature token into play."); //card.setText(card.getSpellText() + "\r\n 2 G W, tap: Put a 1/1 green Saproling creature token into play.");
//card.addIntrinsicKeyword("tap: add 1"); //card.addIntrinsicKeyword("tap: add 1");
}//*************** END ************ END ************************** }//*************** END ************ END **************************
@@ -1799,7 +1797,7 @@ class CardFactory_Lands {
//not sure what's going on here, maybe because it's a land it doesn't add the ability to the text? //not sure what's going on here, maybe because it's a land it doesn't add the ability to the text?
//anyway, this does the trick: //anyway, this does the trick:
card.removeIntrinsicKeyword("tap: add 1"); card.removeIntrinsicKeyword("tap: add 1");
card.setText(card.getText() + "\r\n1: Mutavault becomes a 2/2 creature with all creature types until end of turn. It's still a land."); //card.setText(card.getText() + "\r\n1: Mutavault becomes a 2/2 creature with all creature types until end of turn. It's still a land.");
card.addIntrinsicKeyword("tap: add 1"); card.addIntrinsicKeyword("tap: add 1");
}//*************** END ************ END ************************** }//*************** END ************ END **************************
@@ -1834,7 +1832,7 @@ class CardFactory_Lands {
ability.setDescription("tap: Add G to your mana pool for each creature you control."); ability.setDescription("tap: Add G to your mana pool for each creature you control.");
ability.setStackDescription(cardName + " adds G to your mana pool for each creature you control."); ability.setStackDescription(cardName + " adds G to your mana pool for each creature you control.");
//card.clearSpellAbility(); //card.clearSpellAbility();
card.setText(card.getText() + ability.toString()); //card.setText(card.getText() + ability.toString());
card.addSpellAbility(ability); card.addSpellAbility(ability);
return card; return card;
@@ -1870,7 +1868,7 @@ class CardFactory_Lands {
ability.setDescription("tap: Add U to your mana pool for each artifact you control."); ability.setDescription("tap: Add U to your mana pool for each artifact you control.");
ability.setStackDescription(cardName + " adds U to your mana pool for each artifact you control."); ability.setStackDescription(cardName + " adds U to your mana pool for each artifact you control.");
//card.clearSpellAbility(); //card.clearSpellAbility();
card.setText(card.getText() + ability.toString()); //card.setText(card.getText() + ability.toString());
card.addSpellAbility(ability); card.addSpellAbility(ability);
return card; return card;
@@ -1906,7 +1904,42 @@ class CardFactory_Lands {
ability.setDescription("tap: Add W to your mana pool for each enchantment you control."); ability.setDescription("tap: Add W to your mana pool for each enchantment you control.");
ability.setStackDescription(cardName + " adds W to your mana pool for each enchantment you control."); ability.setStackDescription(cardName + " adds W to your mana pool for each enchantment you control.");
//card.clearSpellAbility(); //card.clearSpellAbility();
card.setText(card.getText() + ability.toString()); //card.setText(card.getText() + ability.toString());
card.addSpellAbility(ability);
return card;
}//*************** END ************ END **************************
//*************** START *********** START **************************
if (cardName.equals("Cabal Coffers"))
{
final SpellAbility ability = new Ability_Tap(card, "2")
{
private static final long serialVersionUID = -3561865824450791583L;
public void resolve()
{
/*CardList list = new CardList(AllZone.getZone(Constant.Zone.Play, Constant.Player.Human).getCards());
list = list.getName("Mana Pool");*/
Card mp = AllZone.ManaPool;//list.getCard(0);
CardList swamps = new CardList(AllZone.getZone(Constant.Zone.Play, card.getController()).getCards());
swamps = swamps.getType("Swamp");
for(int i=0;i<swamps.size();i++)
{
mp.addExtrinsicKeyword("ManaPool:B");
}
}
public boolean canPlayAI()
{
return false;
}
};
ability.setDescription("2, tap: Add B to your mana pool for each Swamp you control.");
ability.setStackDescription(cardName + " adds B to your mana pool for each Swamp you control.");
//card.clearSpellAbility();
//card.setText(card.getText() + ability.toString());
card.addSpellAbility(ability); card.addSpellAbility(ability);
return card; return card;
@@ -1914,4 +1947,7 @@ class CardFactory_Lands {
return card; return card;
} }
} }

528
src/forge/GUI_Filter.java Normal file
View File

@@ -0,0 +1,528 @@
package forge;
import java.awt.Dimension;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import com.cloudgarden.layout.AnchorConstraint;
import com.cloudgarden.layout.AnchorLayout;
import javax.swing.BorderFactory;
//import javax.swing.ButtonGroup;
//import javax.swing.DebugGraphics;
import javax.swing.JButton;
import javax.swing.JCheckBox;
//import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JSeparator;
//import javax.swing.JTabbedPane;
import javax.swing.JTextField;
import javax.swing.SwingConstants;
//import javax.swing.SwingUtilities;
import javax.swing.border.BevelBorder;
//import javax.swing.border.LineBorder;
/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class GUI_Filter extends javax.swing.JDialog {
private static final long serialVersionUID = -8475271235196182185L;
private JLabel jLabel1;
private JTextField NameText;
private JPanel jPanel1;
private JCheckBox jCheckBoxColorless;
private JCheckBox jCheckBoxWhite;
private JCheckBox jCheckBoxRed;
private JCheckBox jCheckBoxGreen;
private JCheckBox jCheckBoxBlue;
private JSeparator jSeparator1;
private JLabel jLabel2;
private JLabel jLabel3;
private JLabel jLabel4;
private JCheckBox jCheckBoxPlaneswalker;
private JCheckBox jCheckBoxArtifact;
private JCheckBox jCheckBoxCreature;
private JCheckBox jCheckBoxEnchant;
private JCheckBox jCheckBoxInstant;
private JCheckBox jCheckBoxLand;
private JCheckBox jCheckBoxSorcery;
private JSeparator jSeparator2;
private JPanel jPanel2;
private JCheckBox jCheckBoxBlack;
private JButton jButtonOk;
//private ButtonGroup buttonGroup1;
private DeckDisplay deckDisplay;
public CardList filterCardList;
public GUI_Filter(DeckDisplay display) {
deckDisplay = display;
initGUI();
}
private void initGUI() {
try {
AnchorLayout thisLayout = new AnchorLayout();
getContentPane().setLayout(thisLayout);
{
NameText = new JTextField();
getContentPane().add(getJPanel2(), new AnchorConstraint(152, 969, 825, 530, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL));
getContentPane().add(getJButtonOk(), new AnchorConstraint(873, 638, 965, 384, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL));
getContentPane().add(getJPanel1(), new AnchorConstraint(152, 481, 825, 43, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL));
getContentPane().add(NameText, new AnchorConstraint(38, 969, 126, 362, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL));
NameText.setPreferredSize(new java.awt.Dimension(148, 24));
}
{
jLabel1 = new JLabel();
//AnchorLayout jLabel1Layout = new AnchorLayout();
getContentPane().add(jLabel1, new AnchorConstraint(5, 318, 152, 44, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL));
jLabel1.setText("Name:");
jLabel1.setPreferredSize(new java.awt.Dimension(108, 40));
jLabel1.setLayout(null);
jLabel1.setFont(new java.awt.Font("Segoe UI",0,16));
jLabel1.setHorizontalAlignment(SwingConstants.CENTER);
}
setVisible(true);
this.setPreferredSize(new java.awt.Dimension(280, 300));
Dimension screen = getToolkit().getScreenSize();
int x = (screen.width - 280) / 2;
int y = (screen.height - 300) / 2;
this.setBounds(x, y, 280, 300);
this.setResizable(false);
this.setTitle("Filter");
pack();
this.setIconImage(null);
} catch (Exception e) {
e.printStackTrace();
}
}
/*
private ButtonGroup getButtonGroup1() {
if(buttonGroup1 == null) {
buttonGroup1 = new ButtonGroup();
}
return buttonGroup1;
}
*/
private JPanel getJPanel1() {
if(jPanel1 == null) {
jPanel1 = new JPanel();
AnchorLayout jPanel1Layout = new AnchorLayout();
jPanel1.setPreferredSize(new java.awt.Dimension(107, 183));
jPanel1.setLayout(jPanel1Layout);
jPanel1.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED));
jPanel1.setBackground(new java.awt.Color(192,192,192));
jPanel1.add(getJCheckBoxBlack(), new AnchorConstraint(134, 985, 240, 79, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL));
jPanel1.add(getJCheckBoxColorless(), new AnchorConstraint(878, 983, 950, 84, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL));
jPanel1.add(getJCheckBoxWhite(), new AnchorConstraint(726, 987, 798, 79, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL));
jPanel1.add(getJCheckBoxRed(), new AnchorConstraint(577, 987, 654, 79, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL));
jPanel1.add(getJCheckBoxGreen(), new AnchorConstraint(428, 987, 494, 79, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL));
jPanel1.add(getJCheckBoxBlue(), new AnchorConstraint(279, 987, 356, 79, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL));
jPanel1.add(getJSeparator1(), new AnchorConstraint(107, 987, 139, 12, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL));
jPanel1.add(getJLabel2(), new AnchorConstraint(-20, 990, 123, 16, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL));
}
return jPanel1;
}
private JLabel getJLabel2() {
if(jLabel2 == null) {
jLabel2 = new JLabel();
jLabel2.setText("Color");
jLabel2.setHorizontalAlignment(SwingConstants.CENTER);
jLabel2.setFont(new java.awt.Font("Segoe UI",0,14));
jLabel2.setPreferredSize(new java.awt.Dimension(152, 39));
jLabel2.setLayout(null);
}
return jLabel2;
}
private JSeparator getJSeparator1() {
if(jSeparator1 == null) {
jSeparator1 = new JSeparator();
//AnchorLayout jSeparator1Layout = new AnchorLayout();
jSeparator1.setPreferredSize(new java.awt.Dimension(117, 6));
jSeparator1.setLayout(null);
}
return jSeparator1;
}
private JCheckBox getJCheckBoxBlue() {
if(jCheckBoxBlue == null) {
jCheckBoxBlue = new JCheckBox();
//AnchorLayout jCheckBoxBlueLayout = new AnchorLayout();
jCheckBoxBlue.setLayout(null);
jCheckBoxBlue.setText("Blue");
jCheckBoxBlue.setPreferredSize(new java.awt.Dimension(109, 14));
jCheckBoxBlue.setSelected(true);
jCheckBoxBlue.setBackground(new java.awt.Color(192,192,192));
}
return jCheckBoxBlue;
}
private JCheckBox getJCheckBoxGreen() {
if(jCheckBoxGreen == null) {
jCheckBoxGreen = new JCheckBox();
//AnchorLayout jCheckBoxGreenLayout = new AnchorLayout();
jCheckBoxGreen.setLayout(null);
jCheckBoxGreen.setText("Green");
jCheckBoxGreen.setPreferredSize(new java.awt.Dimension(109, 12));
jCheckBoxGreen.setSelected(true);
jCheckBoxGreen.setBackground(new java.awt.Color(192,192,192));
}
return jCheckBoxGreen;
}
private JCheckBox getJCheckBoxRed() {
if(jCheckBoxRed == null) {
jCheckBoxRed = new JCheckBox();
//AnchorLayout jCheckBoxRedLayout = new AnchorLayout();
jCheckBoxRed.setLayout(null);
jCheckBoxRed.setText("Red");
jCheckBoxRed.setPreferredSize(new java.awt.Dimension(109, 14));
jCheckBoxRed.setSelected(true);
jCheckBoxRed.setBackground(new java.awt.Color(192,192,192));
}
return jCheckBoxRed;
}
private JCheckBox getJCheckBoxWhite() {
if(jCheckBoxWhite == null) {
jCheckBoxWhite = new JCheckBox();
//AnchorLayout jCheckBoxWhiteLayout = new AnchorLayout();
jCheckBoxWhite.setLayout(null);
jCheckBoxWhite.setText("White");
jCheckBoxWhite.setPreferredSize(new java.awt.Dimension(109, 13));
jCheckBoxWhite.setSelected(true);
jCheckBoxWhite.setBackground(new java.awt.Color(192,192,192));
}
return jCheckBoxWhite;
}
private JCheckBox getJCheckBoxColorless() {
if(jCheckBoxColorless == null) {
jCheckBoxColorless = new JCheckBox();
//AnchorLayout jCheckBoxColorlessLayout = new AnchorLayout();
jCheckBoxColorless.setLayout(null);
jCheckBoxColorless.setText("Colorless");
jCheckBoxColorless.setPreferredSize(new java.awt.Dimension(80, 15));
jCheckBoxColorless.setSelected(true);
jCheckBoxColorless.setBackground(new java.awt.Color(192,192,192));
}
return jCheckBoxColorless;
}
private JButton getJButtonOk() {
if(jButtonOk == null) {
jButtonOk = new JButton();
//AnchorLayout jButtonOkLayout = new AnchorLayout();
jButtonOk.setLayout(null);
jButtonOk.setText("OK");
jButtonOk.setPreferredSize(new java.awt.Dimension(100, 25));
jButtonOk.addMouseListener(new CustomListener());
}
return jButtonOk;
}
private JCheckBox getJCheckBoxBlack() {
if(jCheckBoxBlack == null) {
jCheckBoxBlack = new JCheckBox();
//AnchorLayout jCheckBoxBlackLayout = new AnchorLayout();
jCheckBoxBlack.setLayout(null);
jCheckBoxBlack.setText("Black");
jCheckBoxBlack.setPreferredSize(new java.awt.Dimension(97, 20));
jCheckBoxBlack.setBackground(new java.awt.Color(192,192,192));
jCheckBoxBlack.setSelected(true);
}
return jCheckBoxBlack;
}
private JPanel getJPanel2() {
if(jPanel2 == null) {
jPanel2 = new JPanel();
AnchorLayout jPanel2Layout = new AnchorLayout();
jPanel2.setPreferredSize(new java.awt.Dimension(107, 183));
jPanel2.setLayout(jPanel2Layout);
jPanel2.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED));
jPanel2.setBackground(new java.awt.Color(192,192,192));
jPanel2.add(getJSeparator2(), new AnchorConstraint(112, 987, 166, 20, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL));
jPanel2.add(getJLabel3(), new AnchorConstraint(-200, 951, -61, -166, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL));
jPanel2.add(getJLabel4(), new AnchorConstraint(-19, 985, 128, 4, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL));
jPanel2.add(getJCheckBox1(), new AnchorConstraint(877, 948, 948, 79, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL));
jPanel2.add(getJCheckBox2(), new AnchorConstraint(751, 948, 827, 79, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL));
jPanel2.add(getJCheckBox3(), new AnchorConstraint(625, 948, 702, 79, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL));
jPanel2.add(getJCheckBox4(), new AnchorConstraint(505, 948, 581, 79, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL));
jPanel2.add(getJCheckBox5(), new AnchorConstraint(379, 948, 450, 79, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL));
jPanel2.add(getJCheckBox6(), new AnchorConstraint(254, 948, 325, 79, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL));
jPanel2.add(getJCheckBox7(), new AnchorConstraint(133, 948, 232, 79, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL));
}
return jPanel2;
}
private JLabel getJLabel3() {
if(jLabel3 == null) {
jLabel3 = new JLabel();
jLabel3.setText("Color");
jLabel3.setHorizontalAlignment(SwingConstants.CENTER);
jLabel3.setFont(new java.awt.Font("Segoe UI",0,14));
jLabel3.setPreferredSize(new java.awt.Dimension(152,39));
jLabel3.setLayout(null);
}
return jLabel3;
}
private JLabel getJLabel4() {
if(jLabel4 == null) {
jLabel4 = new JLabel();
jLabel4.setText("Type");
jLabel4.setHorizontalAlignment(SwingConstants.CENTER);
jLabel4.setFont(new java.awt.Font("Segoe UI",0,14));
jLabel4.setPreferredSize(new java.awt.Dimension(105, 27));
jLabel4.setLayout(null);
}
return jLabel4;
}
private JSeparator getJSeparator2() {
if(jSeparator2 == null) {
jSeparator2 = new JSeparator();
//AnchorLayout jSeparator2Layout = new AnchorLayout();
jSeparator2.setPreferredSize(new java.awt.Dimension(116, 10));
jSeparator2.setLayout(null);
}
return jSeparator2;
}
private JCheckBox getJCheckBox1() {
if(jCheckBoxSorcery == null) {
jCheckBoxSorcery = new JCheckBox();
jCheckBoxSorcery.setLayout(null);
jCheckBoxSorcery.setText("Sorcery");
jCheckBoxSorcery.setSelected(true);
jCheckBoxSorcery.setBackground(new java.awt.Color(192,192,192));
jCheckBoxSorcery.setPreferredSize(new java.awt.Dimension(93, 13));
}
return jCheckBoxSorcery;
}
private JCheckBox getJCheckBox2() {
if(jCheckBoxPlaneswalker == null) {
jCheckBoxPlaneswalker = new JCheckBox();
jCheckBoxPlaneswalker.setLayout(null);
jCheckBoxPlaneswalker.setText("Planeswalker");
jCheckBoxPlaneswalker.setSelected(true);
jCheckBoxPlaneswalker.setBackground(new java.awt.Color(192,192,192));
jCheckBoxPlaneswalker.setPreferredSize(new java.awt.Dimension(93, 14));
}
return jCheckBoxPlaneswalker;
}
private JCheckBox getJCheckBox3() {
if(jCheckBoxLand == null) {
jCheckBoxLand = new JCheckBox();
jCheckBoxLand.setLayout(null);
jCheckBoxLand.setText("Land");
jCheckBoxLand.setSelected(true);
jCheckBoxLand.setBackground(new java.awt.Color(192,192,192));
jCheckBoxLand.setPreferredSize(new java.awt.Dimension(93, 14));
}
return jCheckBoxLand;
}
private JCheckBox getJCheckBox4() {
if(jCheckBoxInstant == null) {
jCheckBoxInstant = new JCheckBox();
jCheckBoxInstant.setLayout(null);
jCheckBoxInstant.setText("Instant");
jCheckBoxInstant.setSelected(true);
jCheckBoxInstant.setBackground(new java.awt.Color(192,192,192));
jCheckBoxInstant.setPreferredSize(new java.awt.Dimension(93, 14));
}
return jCheckBoxInstant;
}
private JCheckBox getJCheckBox5() {
if(jCheckBoxEnchant == null) {
jCheckBoxEnchant = new JCheckBox();
jCheckBoxEnchant.setLayout(null);
jCheckBoxEnchant.setText("Enchant");
jCheckBoxEnchant.setSelected(true);
jCheckBoxEnchant.setBackground(new java.awt.Color(192,192,192));
jCheckBoxEnchant.setPreferredSize(new java.awt.Dimension(93, 13));
}
return jCheckBoxEnchant;
}
private JCheckBox getJCheckBox6() {
if(jCheckBoxCreature == null) {
jCheckBoxCreature = new JCheckBox();
jCheckBoxCreature.setLayout(null);
jCheckBoxCreature.setText("Creature");
jCheckBoxCreature.setSelected(true);
jCheckBoxCreature.setBackground(new java.awt.Color(192,192,192));
jCheckBoxCreature.setPreferredSize(new java.awt.Dimension(93, 13));
}
return jCheckBoxCreature;
}
private JCheckBox getJCheckBox7() {
if(jCheckBoxArtifact == null) {
jCheckBoxArtifact = new JCheckBox();
jCheckBoxArtifact.setLayout(null);
jCheckBoxArtifact.setText("Artifact");
jCheckBoxArtifact.setSelected(true);
jCheckBoxArtifact.setBackground(new java.awt.Color(192,192,192));
jCheckBoxArtifact.setPreferredSize(new java.awt.Dimension(93, 18));
}
return jCheckBoxArtifact;
}
public class CustomListener implements MouseListener {
public void mouseClicked(MouseEvent e) {
String name = NameText.getText();
CardList filterCardList = AllZone.CardFactory.getAllCards();
CardFilter filter = new CardFilter();
Gui_DeckEditor g = (Gui_DeckEditor) deckDisplay;
g.blackCheckBox.setSelected(true);
g.blackCheckBox.setEnabled(true);
g.blueCheckBox.setSelected(true);
g.blueCheckBox.setEnabled(true);
g.greenCheckBox.setSelected(true);
g.greenCheckBox.setEnabled(true);
g.redCheckBox.setSelected(true);
g.redCheckBox.setEnabled(true);
g.whiteCheckBox.setSelected(true);
g.whiteCheckBox.setEnabled(true);
g.colorlessCheckBox.setSelected(true);
g.colorlessCheckBox.setEnabled(true);
g.artifactCheckBox.setSelected(true);
g.artifactCheckBox.setEnabled(true);
g.creatureCheckBox.setSelected(true);
g.creatureCheckBox.setEnabled(true);
g.enchantmentCheckBox.setSelected(true);
g.enchantmentCheckBox.setEnabled(true);
g.instantCheckBox.setSelected(true);
g.instantCheckBox.setEnabled(true);
g.landCheckBox.setSelected(true);
g.landCheckBox.setEnabled(true);
g.planeswalkerCheckBox.setSelected(true);
g.planeswalkerCheckBox.setEnabled(true);
g.sorceryCheckBox.setSelected(true);
g.sorceryCheckBox.setEnabled(true);
if(name!="")
{
filterCardList = filter.CardListNameFilter(filterCardList, name);
if(filterCardList.size()==0){
JOptionPane.showMessageDialog(null, "Sorry, cards with name: "+name+" not found.", "Filter", JOptionPane.INFORMATION_MESSAGE );
}else{
if(jCheckBoxBlack.isSelected()==false){
filterCardList = filter.CardListColorFilter(filterCardList, "black");
g.blackCheckBox.setSelected(false);
g.blackCheckBox.setEnabled(false);
}
if(jCheckBoxBlue.isSelected()==false){
filterCardList = filter.CardListColorFilter(filterCardList, "blue");
g.blueCheckBox.setSelected(false);
g.blueCheckBox.setEnabled(false);
}
if(jCheckBoxGreen.isSelected()==false){
filterCardList = filter.CardListColorFilter(filterCardList, "green");
g.greenCheckBox.setSelected(false);
g.greenCheckBox.setEnabled(false);
}
if(jCheckBoxRed.isSelected()==false){
filterCardList = filter.CardListColorFilter(filterCardList, "red");
g.redCheckBox.setSelected(false);
g.redCheckBox.setEnabled(false);
}
if(jCheckBoxWhite.isSelected()==false){
filterCardList = filter.CardListColorFilter(filterCardList, "white");
g.whiteCheckBox.setSelected(false);
g.whiteCheckBox.setEnabled(false);
}
if(jCheckBoxColorless.isSelected()==false){
filterCardList = filter.CardListColorFilter(filterCardList, "colorless");
g.colorlessCheckBox.setSelected(false);
g.colorlessCheckBox.setEnabled(false);
}
if(jCheckBoxArtifact.isSelected()==false){
filterCardList = filter.CardListTypeFilter(filterCardList, "artifact");
g.artifactCheckBox.setSelected(false);
g.artifactCheckBox.setEnabled(false);
}
if(jCheckBoxCreature.isSelected()==false){
filterCardList = filter.CardListTypeFilter(filterCardList, "creature");
g.creatureCheckBox.setSelected(false);
g.creatureCheckBox.setEnabled(false);
}
if(jCheckBoxEnchant.isSelected()==false){
filterCardList = filter.CardListTypeFilter(filterCardList, "enchantment");
g.enchantmentCheckBox.setSelected(false);
g.enchantmentCheckBox.setEnabled(false);
}
if(jCheckBoxInstant.isSelected()==false){
filterCardList = filter.CardListTypeFilter(filterCardList, "instant");
g.instantCheckBox.setSelected(false);
g.instantCheckBox.setEnabled(false);
}
if(jCheckBoxLand.isSelected()==false){
filterCardList = filter.CardListTypeFilter(filterCardList, "land");
g.landCheckBox.setSelected(false);
g.landCheckBox.setEnabled(false);
}
if(jCheckBoxPlaneswalker.isSelected()==false){
filterCardList = filter.CardListTypeFilter(filterCardList, "planeswalker");
g.planeswalkerCheckBox.setSelected(false);
g.planeswalkerCheckBox.setEnabled(false);
}
if(jCheckBoxSorcery.isSelected()==false){
filterCardList = filter.CardListTypeFilter(filterCardList, "sorcery");
g.sorceryCheckBox.setSelected(false);
g.sorceryCheckBox.setEnabled(false);
}
deckDisplay.updateDisplay(filterCardList, deckDisplay.getBottom()) ;
}
}
dispose();
}
public void mouseEntered(MouseEvent e) {
}
public void mouseExited(MouseEvent e) {
}
public void mousePressed(MouseEvent e) {
}
public void mouseReleased(MouseEvent e) {
}
}
}

View File

@@ -1,6 +1,7 @@
package forge; package forge;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Color; import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font; import java.awt.Font;
import java.awt.GridLayout; import java.awt.GridLayout;
import java.awt.Rectangle; import java.awt.Rectangle;
@@ -71,20 +72,20 @@ public class Gui_DeckEditor extends JFrame implements CardDetail, DeckDisplay {
private JLabel statsLabel2 = new JLabel(); private JLabel statsLabel2 = new JLabel();
private JLabel jLabel1 = new JLabel(); private JLabel jLabel1 = new JLabel();
private JCheckBox whiteCheckBox = new JCheckBox("W", true); public JCheckBox whiteCheckBox = new JCheckBox("W", true);
private JCheckBox blueCheckBox = new JCheckBox("U", true); public JCheckBox blueCheckBox = new JCheckBox("U", true);
private JCheckBox blackCheckBox = new JCheckBox("B", true); public JCheckBox blackCheckBox = new JCheckBox("B", true);
private JCheckBox redCheckBox = new JCheckBox("R", true); public JCheckBox redCheckBox = new JCheckBox("R", true);
private JCheckBox greenCheckBox = new JCheckBox("G", true); public JCheckBox greenCheckBox = new JCheckBox("G", true);
private JCheckBox colorlessCheckBox = new JCheckBox("C", true); public JCheckBox colorlessCheckBox = new JCheckBox("C", true);
private JCheckBox landCheckBox = new JCheckBox("Land", true); public JCheckBox landCheckBox = new JCheckBox("Land", true);
private JCheckBox creatureCheckBox = new JCheckBox("Creature", true); public JCheckBox creatureCheckBox = new JCheckBox("Creature", true);
private JCheckBox sorceryCheckBox = new JCheckBox("Sorcery", true); public JCheckBox sorceryCheckBox = new JCheckBox("Sorcery", true);
private JCheckBox instantCheckBox = new JCheckBox("Instant", true); public JCheckBox instantCheckBox = new JCheckBox("Instant", true);
private JCheckBox planeswalkerCheckBox = new JCheckBox("Planeswalker", true); public JCheckBox planeswalkerCheckBox = new JCheckBox("Planeswalker", true);
private JCheckBox artifactCheckBox = new JCheckBox("Artifact", true); public JCheckBox artifactCheckBox = new JCheckBox("Artifact", true);
private JCheckBox enchantmentCheckBox = new JCheckBox("Enchant", true); public JCheckBox enchantmentCheckBox = new JCheckBox("Enchant", true);
private CardList top; private CardList top;
private CardList bottom; private CardList bottom;
@@ -355,7 +356,14 @@ public class Gui_DeckEditor extends JFrame implements CardDetail, DeckDisplay {
}); });
setSize(1024, 768); setSize(1024, 768);
this.setResizable(false);
Dimension screen = getToolkit().getScreenSize();
Rectangle bounds = getBounds();
bounds.width = 1024;
bounds.height = 768;
bounds.x = (screen.width - bounds.width) / 2;
bounds.y = (screen.height - bounds.height) / 2;
setBounds(bounds);
//TODO use this as soon the deck editor has resizable GUI //TODO use this as soon the deck editor has resizable GUI
// //Use both so that when "un"maximizing, the frame isn't tiny // //Use both so that when "un"maximizing, the frame isn't tiny
// setSize(1024, 740); // setSize(1024, 740);

View File

@@ -22,6 +22,7 @@ import java.util.Collections;
import java.util.Iterator; import java.util.Iterator;
import javax.swing.JFileChooser; import javax.swing.JFileChooser;
//import javax.swing.JFrame;
import javax.swing.JMenu; import javax.swing.JMenu;
import javax.swing.JMenuBar; import javax.swing.JMenuBar;
import javax.swing.JMenuItem; import javax.swing.JMenuItem;
@@ -85,9 +86,64 @@ public class Gui_DeckEditor_Menu extends JMenuBar implements NewConstants {
setDeckData("", false); setDeckData("", false);
setupMenu(); setupMenu();
setupFilterMenu();
setupSortMenu(); setupSortMenu();
} }
private void setupFilterMenu(){
JMenuItem filter = new JMenuItem("New filter");
JMenuItem clearfilter = new JMenuItem("Clear filter");
JMenu menu = new JMenu("Filter");
menu.add(filter);
menu.add(clearfilter);
this.add(menu);
filter.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ev) {
//GUI_Filter filt = new GUI_Filter( deckDisplay);
}
});
clearfilter.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ev) {
CardList all = AllZone.CardFactory.getAllCards();
deckDisplay.updateDisplay(all, deckDisplay.getBottom()) ;
Gui_DeckEditor g = (Gui_DeckEditor) deckDisplay;
g.blackCheckBox.setSelected(true);
g.blackCheckBox.setEnabled(true);
g.blueCheckBox.setSelected(true);
g.blueCheckBox.setEnabled(true);
g.greenCheckBox.setSelected(true);
g.greenCheckBox.setEnabled(true);
g.redCheckBox.setSelected(true);
g.redCheckBox.setEnabled(true);
g.whiteCheckBox.setSelected(true);
g.whiteCheckBox.setEnabled(true);
g.colorlessCheckBox.setSelected(true);
g.colorlessCheckBox.setEnabled(true);
g.artifactCheckBox.setSelected(true);
g.artifactCheckBox.setEnabled(true);
g.creatureCheckBox.setSelected(true);
g.creatureCheckBox.setEnabled(true);
g.enchantmentCheckBox.setSelected(true);
g.enchantmentCheckBox.setEnabled(true);
g.instantCheckBox.setSelected(true);
g.instantCheckBox.setEnabled(true);
g.landCheckBox.setSelected(true);
g.landCheckBox.setEnabled(true);
g.planeswalkerCheckBox.setSelected(true);
g.planeswalkerCheckBox.setEnabled(true);
g.sorceryCheckBox.setSelected(true);
g.sorceryCheckBox.setEnabled(true);
}
});
}
private void setupSortMenu() { private void setupSortMenu() {
JMenuItem name = new JMenuItem("Card Name"); JMenuItem name = new JMenuItem("Card Name");
JMenuItem cost = new JMenuItem("Cost"); JMenuItem cost = new JMenuItem("Cost");
@@ -118,6 +174,7 @@ public class Gui_DeckEditor_Menu extends JMenuBar implements NewConstants {
//private String column[] = {"Qty", "Name", "Cost", "Color", "Type", "Stats", "Rarity"}; //private String column[] = {"Qty", "Name", "Cost", "Color", "Type", "Stats", "Rarity"};
Gui_DeckEditor g = (Gui_DeckEditor) deckDisplay; Gui_DeckEditor g = (Gui_DeckEditor) deckDisplay;
g.getTopTableModel().sort(1, true); g.getTopTableModel().sort(1, true);
} }
}); });