- Umezawa's Jitte is now Legendary, Auramancer a Wizard.

- Fixed an issue with the AI countering spells that trigger on cast (Sigil of the Empty Throne, Standstill, etc.).
- Timetwister shouldn't show up in both graveyards anymore.
- Figure of Destiny's 2nd and 3rd abilities should work if the creature has changeling, plus a check for the prerequisites is performed on resolution.
- Fixed Dryad Arbor / Mutavault / Mishra's Factory summoning sickness issues.
- Fixed Umara Raptor manacost.
- Added Vasiliy's Deck editor filter, and it works now! It's much easier to find cards now with the card text search feature.
- Fetching Bound in Silence with a rebel should be allowed to be attached to any creature.
- Demonic Tutor shouldn't be castable with other spells on the stack anymore.
- Added a property for token images (currently set to 'pics/tokens' - just set to 'pics' to keep it the way it always was).
This commit is contained in:
jendave
2011-08-06 02:51:31 +00:00
parent 6484ce036a
commit ca510897b0
19 changed files with 1227 additions and 90 deletions

2
.gitattributes vendored
View File

@@ -106,6 +106,7 @@ src/forge/CardFactory_Creatures.java -text svneol=native#text/plain
src/forge/CardFactory_Equipment.java -text svneol=native#text/plain src/forge/CardFactory_Equipment.java -text svneol=native#text/plain
src/forge/CardFactory_Lands.java -text svneol=native#text/plain src/forge/CardFactory_Lands.java -text svneol=native#text/plain
src/forge/CardFactory_Planeswalkers.java -text svneol=native#text/plain src/forge/CardFactory_Planeswalkers.java -text svneol=native#text/plain
src/forge/CardFilter.java -text svneol=native#text/plain
src/forge/CardList.java svneol=native#text/plain src/forge/CardList.java svneol=native#text/plain
src/forge/CardListFilter.java svneol=native#text/plain src/forge/CardListFilter.java svneol=native#text/plain
src/forge/CardListUtil.java svneol=native#text/plain src/forge/CardListUtil.java svneol=native#text/plain
@@ -143,6 +144,7 @@ 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/GUI_Filter.java -text svneol=native#text/plain
src/forge/GUI_Quest_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

@@ -164,7 +164,7 @@ no text
Umezawa's Jitte Umezawa's Jitte
2 2
Artifact Equipment Legendary Artifact Equipment
Whenever equipped creature deals combat damage, put two charge counters on Umezawa's Jitte. Whenever equipped creature deals combat damage, put two charge counters on Umezawa's Jitte.
Vendilion Clique Vendilion Clique
@@ -404,7 +404,7 @@ This card can't be the target of spells or abilities your opponents control.
Auramancer Auramancer
2 W 2 W
Creature Human Creature Human Wizard
When Auramancer enters the battlefield, you may return target card from your graveyard to your hand. When Auramancer enters the battlefield, you may return target card from your graveyard to your hand.
2/2 2/2
@@ -1407,7 +1407,7 @@ no text
tap: add U tap: add U
Umara Raptor Umara Raptor
1 U 2 U
Creature Bird Ally Creature Bird Ally
Whenever Umara Raptor or another Ally enters the battlefield under your control, you may put a +1/+1 counter on Umara Raptor. Whenever Umara Raptor or another Ally enters the battlefield under your control, you may put a +1/+1 counter on Umara Raptor.
1/1 1/1
@@ -12071,8 +12071,8 @@ no cost
Land Creature Forest Dryad Land Creature Forest Dryad
no text no text
1/1 1/1
tap: add G
Dryad Arbor is green. Dryad Arbor is green.
tap: add G
Sliversmith Sliversmith
2 2

View File

@@ -28,7 +28,7 @@
<int>0</int> <int>0</int>
<int>0</int> <int>0</int>
<int>244</int> <int>244</int>
<int>144</int> <int>143</int>
</object> </object>
</void> </void>
<void property="name"> <void property="name">
@@ -47,7 +47,7 @@
<void property="bounds"> <void property="bounds">
<object class="java.awt.Rectangle"> <object class="java.awt.Rectangle">
<int>0</int> <int>0</int>
<int>144</int> <int>143</int>
<int>244</int> <int>244</int>
<int>10</int> <int>10</int>
</object> </object>
@@ -62,9 +62,9 @@
<void property="bounds"> <void property="bounds">
<object class="java.awt.Rectangle"> <object class="java.awt.Rectangle">
<int>0</int> <int>0</int>
<int>154</int> <int>153</int>
<int>244</int> <int>244</int>
<int>175</int> <int>176</int>
</object> </object>
</void> </void>
<void property="name"> <void property="name">

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: 102 program/version=MTG Forge -- official beta: 09/11/25, SVN revision: 103
tokens--file=AllTokens.txt tokens--file=AllTokens.txt
@@ -24,3 +24,4 @@ quest--properties=quest/quest.properties
lang--transparent-properties=lang/lang.properties lang--transparent-properties=lang/lang.properties
image/base--file=pics image/base--file=pics
image/token--file=pics/tokens

View File

@@ -156,6 +156,9 @@ abstract public class Ability_Mana extends SpellAbility implements java.io.Seria
if(card.isCreature() && (!card.hasSickness() || !isTapAbility())) if(card.isCreature() && (!card.hasSickness() || !isTapAbility()))
return true; return true;
//Dryad Arbor, Mishra's Factory, Mutavault, ...
else if (card.isCreature() && card.isLand() && card.hasSickness())
return false;
else if(card.isArtifact() || card.isGlobalEnchantment() || card.isLand()) else if(card.isArtifact() || card.isGlobalEnchantment() || card.isLand())
return true; return true;
} }

View File

@@ -3307,9 +3307,11 @@ public class CardFactory implements NewConstants {
for(int i = 0; i < 7; i++) for(int i = 0; i < 7; i++)
AllZone.GameAction.drawCard(player); AllZone.GameAction.drawCard(player);
if (card.getController().equals(player)) {
library.remove(card); library.remove(card);
grave.add(card); grave.add(card);
} }
}
// Simple, If computer has two or less playable cards remaining in hand play Timetwister // Simple, If computer has two or less playable cards remaining in hand play Timetwister
public boolean canPlayAI() public boolean canPlayAI()
@@ -5424,7 +5426,7 @@ public class CardFactory implements NewConstants {
PlayerZone library = AllZone.getZone(Constant.Zone.Library, card.getController()); PlayerZone library = AllZone.getZone(Constant.Zone.Library, card.getController());
return library.getCards().length != 0 && AllZone.Phase.getActivePlayer().equals(card.getController()) return library.getCards().length != 0 && AllZone.Phase.getActivePlayer().equals(card.getController())
&& !AllZone.Phase.getPhase().equals("End of Turn"); && !AllZone.Phase.getPhase().equals("End of Turn") && super.canPlay();
} }
public boolean canPlayAI() public boolean canPlayAI()
{ {

View File

@@ -1139,6 +1139,26 @@ public class CardFactoryUtil
Card rebel = (Card)o; Card rebel = (Card)o;
lib.remove(rebel); lib.remove(rebel);
play.add(rebel); play.add(rebel);
if (rebel.isAura())
{
Object obj = null;
if (rebel.getKeyword().contains("Enchant creature"))
{
PlayerZone oppPlay = AllZone.getZone(Constant.Zone.Play, Constant.Player.Computer);
CardList creats = new CardList(play.getCards());
creats.addAll(oppPlay.getCards());
creats = creats.getType("Creature");
obj = AllZone.Display.getChoiceOptional("Pick a creature to attach "+rebel.getName() + " to",creats.toArray() );
}
if (obj != null)
{
Card target = (Card)obj;
if(AllZone.GameAction.isCardInPlay(target)) {
rebel.enchantCard(target);
}
}
}
} }
} }
AllZone.GameAction.shuffle(sourceCard.getController()); AllZone.GameAction.shuffle(sourceCard.getController());

View File

@@ -14886,6 +14886,7 @@ public class CardFactory_Creatures {
{ {
public void resolve() public void resolve()
{ {
if (card.getType().contains("Spirit") || card.getKeyword().contains("Changeling")) {
boolean artifact = false; boolean artifact = false;
card.setBaseAttack(4); card.setBaseAttack(4);
card.setBaseDefense(4); card.setBaseDefense(4);
@@ -14904,10 +14905,11 @@ public class CardFactory_Creatures {
card.addType("Spirit"); card.addType("Spirit");
card.addType("Warrior"); card.addType("Warrior");
} }
}
public boolean canPlay() public boolean canPlay()
{ {
return card.getType().contains("Spirit"); return card.getType().contains("Spirit") || card.getKeyword().contains("Changeling");
} }
public boolean canPlayAI() public boolean canPlayAI()
@@ -14926,6 +14928,7 @@ public class CardFactory_Creatures {
{ {
public void resolve() public void resolve()
{ {
if (card.getType().contains("Warrior") || card.getKeyword().contains("Changeling")) {
boolean artifact = false; boolean artifact = false;
card.setBaseAttack(8); card.setBaseAttack(8);
card.setBaseDefense(8); card.setBaseDefense(8);
@@ -14945,9 +14948,10 @@ public class CardFactory_Creatures {
card.addType("Warrior"); card.addType("Warrior");
card.addType("Avatar"); card.addType("Avatar");
} }
}
public boolean canPlay() public boolean canPlay()
{ {
return card.getType().contains("Warrior"); return card.getType().contains("Warrior") || card.getKeyword().contains("Changeling");
} }
public boolean canPlayAI() public boolean canPlayAI()
{ {

197
src/forge/CardFilter.java Normal file
View File

@@ -0,0 +1,197 @@
package forge;
public class CardFilter {
public CardList CardListNameFilter(CardList all, String name)
{
Card CardName = new Card();
String s;
s="";
CardList listFilter = new CardList();
for(int i=0;i<all.size();i++){
CardName = all.getCard(i);
s=CardName.getName().toLowerCase();
if(s.indexOf(name.toLowerCase())>=0)
{
listFilter.add(CardName);
}
}
return listFilter;
}
public CardList CardListTextFilter(CardList all, String name)
{
Card CardName = new Card();
String s;
s="";
CardList listFilter = new CardList();
for(int i=0;i<all.size();i++){
CardName = all.getCard(i);
s=CardName.getText().toLowerCase();
if(s.indexOf(name.toLowerCase())>=0)
{
listFilter.add(CardName);
}
}
return listFilter;
}
public CardList CardListColorFilter(CardList all, String name)
{
Card CardName = new Card();
CardList listFilter = new CardList();
if(name=="black"){
for(int i=0;i<all.size();i++){
CardName = all.getCard(i);
if(CardUtil.getColors(CardName).contains(Constant.Color.Black)==false)
{
listFilter.add(CardName);
}
}}
if(name=="blue"){
for(int i=0;i<all.size();i++){
CardName = all.getCard(i);
if(CardUtil.getColors(CardName).contains(Constant.Color.Blue)==false)
{
listFilter.add(CardName);
}
}}
if(name=="green"){
for(int i=0;i<all.size();i++){
CardName = all.getCard(i);
if(CardUtil.getColors(CardName).contains(Constant.Color.Green)==false)
{
listFilter.add(CardName);
}
}}
if(name=="red"){
for(int i=0;i<all.size();i++){
CardName = all.getCard(i);
if(CardUtil.getColors(CardName).contains(Constant.Color.Red)==false)
{
listFilter.add(CardName);
}
}}
if(name=="white"){
for(int i=0;i<all.size();i++){
CardName = all.getCard(i);
if(CardUtil.getColors(CardName).contains(Constant.Color.White)==false)
{
listFilter.add(CardName);
}
}}
if(name=="colorless"){
for(int i=0;i<all.size();i++){
CardName = all.getCard(i);
if(CardUtil.getColors(CardName).contains(Constant.Color.Colorless)==false)
{
listFilter.add(CardName);
}
}}
return listFilter;
}
public CardList CardListTypeFilter(CardList all, String name)
{
Card CardName = new Card();
CardList listFilter = new CardList();
if(name=="artifact"){
for(int i=0;i<all.size();i++){
CardName = all.getCard(i);
if(CardName.isArtifact()==false)
{
listFilter.add(CardName);
}
}}
if(name=="creature"){
for(int i=0;i<all.size();i++){
CardName = all.getCard(i);
if(CardName.isCreature()==false)
{
listFilter.add(CardName);
}
}}
if(name=="enchantment"){
for(int i=0;i<all.size();i++){
CardName = all.getCard(i);
if(CardName.isEnchantment()==false)
{
listFilter.add(CardName);
}
}}
if(name=="instant"){
for(int i=0;i<all.size();i++){
CardName = all.getCard(i);
if(CardName.isInstant()==false)
{
listFilter.add(CardName);
}
}}
if(name=="land"){
for(int i=0;i<all.size();i++){
CardName = all.getCard(i);
if(CardName.isLand()==false)
{
listFilter.add(CardName);
}
}}
if(name=="planeswalker"){
for(int i=0;i<all.size();i++){
CardName = all.getCard(i);
if(CardName.isPlaneswalker()==false)
{
listFilter.add(CardName);
}
}}
if(name=="sorcery"){
for(int i=0;i<all.size();i++){
CardName = all.getCard(i);
if(CardName.isSorcery()==false)
{
listFilter.add(CardName);
}
}}
return listFilter;
}
}

View File

@@ -2,6 +2,8 @@ package forge;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.awt.event.MouseListener; import java.awt.event.MouseListener;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import com.cloudgarden.layout.AnchorConstraint; import com.cloudgarden.layout.AnchorConstraint;
import com.cloudgarden.layout.AnchorLayout; import com.cloudgarden.layout.AnchorLayout;
@@ -12,6 +14,7 @@ import javax.swing.BorderFactory;
import javax.swing.JButton; import javax.swing.JButton;
import javax.swing.JCheckBox; import javax.swing.JCheckBox;
//import javax.swing.JFrame; //import javax.swing.JFrame;
import javax.swing.JFrame;
import javax.swing.JLabel; import javax.swing.JLabel;
import javax.swing.JOptionPane; import javax.swing.JOptionPane;
import javax.swing.JPanel; import javax.swing.JPanel;
@@ -40,6 +43,8 @@ public class GUI_Filter extends javax.swing.JDialog {
private static final long serialVersionUID = -8475271235196182185L; private static final long serialVersionUID = -8475271235196182185L;
private JLabel jLabel1; private JLabel jLabel1;
private JTextField NameText; private JTextField NameText;
private JLabel jLabel5;
private JTextField cardText;
private JPanel jPanel1; private JPanel jPanel1;
private JCheckBox jCheckBoxColorless; private JCheckBox jCheckBoxColorless;
private JCheckBox jCheckBoxWhite; private JCheckBox jCheckBoxWhite;
@@ -66,32 +71,33 @@ public class GUI_Filter extends javax.swing.JDialog {
public CardList filterCardList; public CardList filterCardList;
public GUI_Filter(DeckDisplay display) { public GUI_Filter(JFrame g,DeckDisplay display) {
super(g);
deckDisplay = display; deckDisplay = display;
initGUI(); initGUI();
} }
private void initGUI() { private void initGUI() {
try { try {
AnchorLayout thisLayout = new AnchorLayout(); AnchorLayout thisLayout = new AnchorLayout();
getContentPane().setLayout(thisLayout); getContentPane().setLayout(thisLayout);
{ {
NameText = new JTextField(); 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(getJPanel2(), new AnchorConstraint(293, 972, 837, 534, 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(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(getJPanel1(), new AnchorConstraint(293, 483, 837, 45, 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)); 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)); NameText.setPreferredSize(new java.awt.Dimension(148, 24));
} }
{ {
jLabel1 = new JLabel(); jLabel1 = new JLabel();
//AnchorLayout jLabel1Layout = new AnchorLayout(); //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)); getContentPane().add(jLabel1, new AnchorConstraint(4, 313, 153, 41, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL));
getContentPane().add(getJTextField1(), new AnchorConstraint(159, 969, 248, 360, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL));
getContentPane().add(getJLabel5(), new AnchorConstraint(126, 313, 275, 41, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL));
jLabel1.setText("Name:"); jLabel1.setText("Name:");
jLabel1.setPreferredSize(new java.awt.Dimension(108, 40)); jLabel1.setPreferredSize(new java.awt.Dimension(75, 50));
jLabel1.setLayout(null); jLabel1.setLayout(null);
jLabel1.setFont(new java.awt.Font("Segoe UI",0,16)); jLabel1.setFont(new java.awt.Font("Segoe UI",0,16));
jLabel1.setHorizontalAlignment(SwingConstants.CENTER); jLabel1.setHorizontalAlignment(SwingConstants.CENTER);
@@ -107,11 +113,18 @@ public class GUI_Filter extends javax.swing.JDialog {
this.setTitle("Filter"); this.setTitle("Filter");
pack(); pack();
this.setIconImage(null); this.setIconImage(null);
this.addWindowListener(new WListener());
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
/* /*
private ButtonGroup getButtonGroup1() { private ButtonGroup getButtonGroup1() {
if(buttonGroup1 == null) { if(buttonGroup1 == null) {
@@ -125,7 +138,7 @@ public class GUI_Filter extends javax.swing.JDialog {
if(jPanel1 == null) { if(jPanel1 == null) {
jPanel1 = new JPanel(); jPanel1 = new JPanel();
AnchorLayout jPanel1Layout = new AnchorLayout(); AnchorLayout jPanel1Layout = new AnchorLayout();
jPanel1.setPreferredSize(new java.awt.Dimension(107, 183)); jPanel1.setPreferredSize(new java.awt.Dimension(121, 183));
jPanel1.setLayout(jPanel1Layout); jPanel1.setLayout(jPanel1Layout);
jPanel1.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED)); jPanel1.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED));
jPanel1.setBackground(new java.awt.Color(192,192,192)); jPanel1.setBackground(new java.awt.Color(192,192,192));
@@ -257,7 +270,7 @@ public class GUI_Filter extends javax.swing.JDialog {
if(jPanel2 == null) { if(jPanel2 == null) {
jPanel2 = new JPanel(); jPanel2 = new JPanel();
AnchorLayout jPanel2Layout = new AnchorLayout(); AnchorLayout jPanel2Layout = new AnchorLayout();
jPanel2.setPreferredSize(new java.awt.Dimension(107, 183)); jPanel2.setPreferredSize(new java.awt.Dimension(121, 183));
jPanel2.setLayout(jPanel2Layout); jPanel2.setLayout(jPanel2Layout);
jPanel2.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED)); jPanel2.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED));
jPanel2.setBackground(new java.awt.Color(192,192,192)); jPanel2.setBackground(new java.awt.Color(192,192,192));
@@ -393,11 +406,32 @@ public class GUI_Filter extends javax.swing.JDialog {
return jCheckBoxArtifact; return jCheckBoxArtifact;
} }
private JTextField getJTextField1() {
if(cardText == null) {
cardText = new JTextField();
cardText.setPreferredSize(new java.awt.Dimension(168, 30));
}
return cardText;
}
private JLabel getJLabel5() {
if(jLabel5 == null) {
jLabel5 = new JLabel();
jLabel5.setText("Card Text:");
jLabel5.setHorizontalAlignment(SwingConstants.CENTER);
jLabel5.setFont(new java.awt.Font("Segoe UI",0,16));
jLabel5.setPreferredSize(new java.awt.Dimension(75, 50));
jLabel5.setLayout(null);
}
return jLabel5;
}
public class CustomListener implements MouseListener { public class CustomListener implements MouseListener {
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
String name = NameText.getText(); String name = NameText.getText();
String cText = cardText.getText();
CardList filterCardList = AllZone.CardFactory.getAllCards(); CardList filterCardList = AllZone.CardFactory.getAllCards();
CardFilter filter = new CardFilter(); CardFilter filter = new CardFilter();
Gui_DeckEditor g = (Gui_DeckEditor) deckDisplay; Gui_DeckEditor g = (Gui_DeckEditor) deckDisplay;
@@ -427,11 +461,17 @@ public class GUI_Filter extends javax.swing.JDialog {
g.planeswalkerCheckBox.setEnabled(true); g.planeswalkerCheckBox.setEnabled(true);
g.sorceryCheckBox.setSelected(true); g.sorceryCheckBox.setSelected(true);
g.sorceryCheckBox.setEnabled(true); g.sorceryCheckBox.setEnabled(true);
g.setEnabled(true);
if(name!="") if(name!="")
{ {
if(cText!=""){
filterCardList = filter.CardListNameFilter(filterCardList, name); filterCardList = filter.CardListNameFilter(filterCardList, name);
if(filterCardList.size()==0){ if(filterCardList.size()==0){
JOptionPane.showMessageDialog(null, "Sorry, cards with name: "+name+" not found.", "Filter", JOptionPane.INFORMATION_MESSAGE ); JOptionPane.showMessageDialog(null, "Sorry, cards with name: "+name+" not found.", "Filter", JOptionPane.INFORMATION_MESSAGE );
}else{
filterCardList = filter.CardListTextFilter(filterCardList, cText);
if(filterCardList.size()==0){
JOptionPane.showMessageDialog(null, "Sorry, cards with text: "+cText+" not found.", "Filter", JOptionPane.INFORMATION_MESSAGE );
}else{ }else{
if(jCheckBoxBlack.isSelected()==false){ if(jCheckBoxBlack.isSelected()==false){
filterCardList = filter.CardListColorFilter(filterCardList, "black"); filterCardList = filter.CardListColorFilter(filterCardList, "black");
@@ -499,7 +539,7 @@ public class GUI_Filter extends javax.swing.JDialog {
g.sorceryCheckBox.setEnabled(false); g.sorceryCheckBox.setEnabled(false);
} }
deckDisplay.updateDisplay(filterCardList, deckDisplay.getBottom()) ; deckDisplay.updateDisplay(filterCardList, deckDisplay.getBottom()) ;
} }}}
} }
@@ -523,6 +563,44 @@ public class GUI_Filter extends javax.swing.JDialog {
} }
} }
public class WListener implements WindowListener {
public void windowActivated(WindowEvent arg0) {
// TODO Auto-generated method stub
}
public void windowClosed(WindowEvent arg0) {
// TODO Auto-generated method stub
}
public void windowClosing(WindowEvent arg0) {
// TODO Auto-generated method stub
Gui_DeckEditor g = (Gui_DeckEditor) deckDisplay;
g.setEnabled(true);
}
public void windowDeactivated(WindowEvent arg0) {
// TODO Auto-generated method stub
}
public void windowDeiconified(WindowEvent arg0) {
// TODO Auto-generated method stub
}
public void windowIconified(WindowEvent arg0) {
// TODO Auto-generated method stub
}
public void windowOpened(WindowEvent arg0) {
// TODO Auto-generated method stub
}
}
} }

View File

@@ -0,0 +1,587 @@
package forge;
import java.awt.Dimension;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
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.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_Quest_Filter extends javax.swing.JDialog {
private static final long serialVersionUID = -8475271235196182185L;
private JLabel jLabel1;
private JTextField NameText;
private JLabel jLabel5;
private JTextField cardText;
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_Quest_Filter(JFrame g,DeckDisplay display) {
super(g);
deckDisplay = display;
initGUI();
}
private void initGUI() {
try {
AnchorLayout thisLayout = new AnchorLayout();
getContentPane().setLayout(thisLayout);
{
NameText = new JTextField();
getContentPane().add(getJPanel2(), new AnchorConstraint(293, 972, 837, 534, 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(293, 483, 837, 45, 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(4, 313, 153, 41, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL));
getContentPane().add(getJTextField1(), new AnchorConstraint(159, 969, 248, 360, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL));
getContentPane().add(getJLabel5(), new AnchorConstraint(126, 313, 275, 41, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL));
jLabel1.setText("Name:");
jLabel1.setPreferredSize(new java.awt.Dimension(75, 50));
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);
this.addWindowListener(new WListener());
} 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(121, 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(121, 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;
}
private JTextField getJTextField1() {
if(cardText == null) {
cardText = new JTextField();
cardText.setPreferredSize(new java.awt.Dimension(168, 30));
}
return cardText;
}
private JLabel getJLabel5() {
if(jLabel5 == null) {
jLabel5 = new JLabel();
jLabel5.setText("Card Text:");
jLabel5.setHorizontalAlignment(SwingConstants.CENTER);
jLabel5.setFont(new java.awt.Font("Segoe UI",0,16));
jLabel5.setPreferredSize(new java.awt.Dimension(75, 50));
jLabel5.setLayout(null);
}
return jLabel5;
}
public class CustomListener implements MouseListener {
public void mouseClicked(MouseEvent e) {
String name = NameText.getText();
String cText = cardText.getText();
Gui_Quest_DeckEditor g = (Gui_Quest_DeckEditor) deckDisplay;
CardFilter filter = new CardFilter();
g.setEnabled(true);
CardList filterCardList=g.stCardList;
if(name!="")
{
if(cText!=""){
filterCardList = filter.CardListNameFilter(filterCardList, name);
if(filterCardList.size()==0){
JOptionPane.showMessageDialog(null, "Sorry, cards with name: "+name+" not found.", "Filter", JOptionPane.INFORMATION_MESSAGE );
g.filterUsed=false;
deckDisplay.updateDisplay(g.stCardList, deckDisplay.getBottom()) ;
}else{
filterCardList = filter.CardListTextFilter(filterCardList, cText);
if(filterCardList.size()==0){
JOptionPane.showMessageDialog(null, "Sorry, cards with text: "+cText+" not found.", "Filter", JOptionPane.INFORMATION_MESSAGE );
g.filterUsed=false;
deckDisplay.updateDisplay(g.stCardList, deckDisplay.getBottom()) ;
}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) {
}
}
public class WListener implements WindowListener {
public void windowActivated(WindowEvent arg0) {
// TODO Auto-generated method stub
}
public void windowClosed(WindowEvent arg0) {
// TODO Auto-generated method stub
}
public void windowClosing(WindowEvent arg0) {
// TODO Auto-generated method stub
Gui_Quest_DeckEditor g = (Gui_Quest_DeckEditor) deckDisplay;
deckDisplay.updateDisplay(g.stCardList, deckDisplay.getBottom());
g.setEnabled(true);
}
public void windowDeactivated(WindowEvent arg0) {
// TODO Auto-generated method stub
}
public void windowDeiconified(WindowEvent arg0) {
// TODO Auto-generated method stub
}
public void windowIconified(WindowEvent arg0) {
// TODO Auto-generated method stub
}
public void windowOpened(WindowEvent arg0) {
// TODO Auto-generated method stub
}
}
}

View File

@@ -1312,6 +1312,37 @@ private int getDifferentLand(CardList list, String land)
card.addDamage(damageToAdd); card.addDamage(damageToAdd);
} }
/*
public void counterSpell()
{
SpellAbility s;
boolean spellOnStack = false;
for (int i=0; i<AllZone.Stack.size(); i++)
{
s = AllZone.Stack.peek(i);
if (s.isSpell()) {
spellOnStack = true;
break;
}
}
if (!spellOnStack)
return;
SpellAbility sa = AllZone.Stack.peek();
//SpellAbility sa = AllZone.Stack.pop();
while (!sa.isSpell() || AllZone.Stack.size() == 0)
{
sa = AllZone.Stack.peek();
sa.resolve();
}
if (sa.isSpell())
AllZone.GameAction.moveToGraveyard(sa.getSourceCard());
}
*/
public void addLife(String player, int life) public void addLife(String player, int life)
{ {
// place holder for future life gain modification rules // place holder for future life gain modification rules

View File

@@ -188,7 +188,14 @@ public class GuiDisplayUtil implements NewConstants {
filename = cleanString(c.getImageName()) + basicLandSuffix + suffix; filename = cleanString(c.getImageName()) + basicLandSuffix + suffix;
} else filename = "morph" + suffix; } else filename = "morph" + suffix;
File file = new File(ForgeProps.getFile(IMAGE_BASE), filename);
String loc = "";
if (!c.isToken())
loc = IMAGE_BASE;
else
loc = IMAGE_TOKEN;
File file = new File(ForgeProps.getFile(loc), filename);
//try current directory //try current directory
if(!file.exists()) { if(!file.exists()) {

View File

@@ -100,9 +100,10 @@ public class Gui_DeckEditor_Menu extends JMenuBar implements NewConstants {
filter.addActionListener(new ActionListener() { filter.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ev) { public void actionPerformed(ActionEvent ev) {
Gui_DeckEditor g = (Gui_DeckEditor) deckDisplay;
//GUI_Filter filt = new GUI_Filter( deckDisplay); GUI_Filter filt = new GUI_Filter( g,deckDisplay);
g.setEnabled(false);
filt.setVisible(true);
} }
}); });
clearfilter.addActionListener(new ActionListener() { clearfilter.addActionListener(new ActionListener() {

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;
@@ -72,21 +73,22 @@ public class Gui_Quest_DeckEditor extends JFrame implements CardDetail, DeckDisp
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);
private JCheckBox creatureCheckBox = new JCheckBox("Creature", true);
private JCheckBox sorceryCheckBox = new JCheckBox("Sorcery", true);
private JCheckBox instantCheckBox = new JCheckBox("Instant", true);
private JCheckBox planeswalkerCheckBox = new JCheckBox("Planeswalker", true);
private JCheckBox artifactCheckBox = new JCheckBox("Artifact", true);
private JCheckBox enchantmentCheckBox = new JCheckBox("Enchant", true);
public JCheckBox landCheckBox = new JCheckBox("Land", true);
public JCheckBox creatureCheckBox = new JCheckBox("Creature", true);
public JCheckBox sorceryCheckBox = new JCheckBox("Sorcery", true);
public JCheckBox instantCheckBox = new JCheckBox("Instant", true);
public JCheckBox planeswalkerCheckBox = new JCheckBox("Planeswalker", true);
public JCheckBox artifactCheckBox = new JCheckBox("Artifact", true);
public JCheckBox enchantmentCheckBox = new JCheckBox("Enchant", true);
public CardList stCardList;
public boolean filterUsed;
private CardList top; private CardList top;
private CardList bottom; private CardList bottom;
@@ -337,6 +339,8 @@ public class Gui_Quest_DeckEditor extends JFrame implements CardDetail, DeckDisp
//show cards, makes this user friendly, lol, well may, ha //show cards, makes this user friendly, lol, well may, ha
updateDisplay(cardpool, bottom); updateDisplay(cardpool, bottom);
//this affects the card pool //this affects the card pool
topModel.sort(4, true);//sort by type topModel.sort(4, true);//sort by type
topModel.sort(3, true);//then sort by color topModel.sort(3, true);//then sort by color
@@ -381,6 +385,17 @@ public class Gui_Quest_DeckEditor extends JFrame implements CardDetail, DeckDisp
}); });
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);
@@ -402,6 +417,7 @@ public class Gui_Quest_DeckEditor extends JFrame implements CardDetail, DeckDisp
public Gui_Quest_DeckEditor() { public Gui_Quest_DeckEditor() {
try { try {
filterUsed=false;
jbInit(); jbInit();
} catch(Exception ex) { } catch(Exception ex) {
ErrorViewer.showError(ex); ErrorViewer.showError(ex);
@@ -418,6 +434,10 @@ 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");
@@ -562,6 +582,7 @@ public class Gui_Quest_DeckEditor extends JFrame implements CardDetail, DeckDisp
colorlessCheckBox.addItemListener(new ItemListener() { colorlessCheckBox.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) { public void itemStateChanged(ItemEvent e) {
updateDisplay(); updateDisplay();
} }
}); });
@@ -639,6 +660,7 @@ public class Gui_Quest_DeckEditor extends JFrame implements CardDetail, DeckDisp
this.getContentPane().add(redCheckBox, null); this.getContentPane().add(redCheckBox, null);
this.getContentPane().add(greenCheckBox, null); this.getContentPane().add(greenCheckBox, null);
this.getContentPane().add(colorlessCheckBox, null); this.getContentPane().add(colorlessCheckBox, null);
} }
void addButton_actionPerformed(ActionEvent e) { void addButton_actionPerformed(ActionEvent e) {
@@ -649,9 +671,18 @@ public class Gui_Quest_DeckEditor extends JFrame implements CardDetail, DeckDisp
Card c = topModel.rowToCard(n); Card c = topModel.rowToCard(n);
bottomModel.addCard(c); bottomModel.addCard(c);
bottomModel.resort(); bottomModel.resort();
if(filterUsed==true){
stCardList.remove(c.getName());
stCardList.shuffle();
}
if(!Constant.GameType.Constructed.equals(customMenu.getGameType())) { if(!Constant.GameType.Constructed.equals(customMenu.getGameType())) {
topModel.removeCard(c); topModel.removeCard(c);
if(filterUsed==false){
stCardList=this.getTop();
}
} }
//3 conditions" 0 cards left, select the same row, select next row //3 conditions" 0 cards left, select the same row, select next row
@@ -661,6 +692,10 @@ public class Gui_Quest_DeckEditor extends JFrame implements CardDetail, DeckDisp
topTable.addRowSelectionInterval(n, n); topTable.addRowSelectionInterval(n, n);
} }
}//if(valid row) }//if(valid row)
}//addButton_actionPerformed }//addButton_actionPerformed
void removeButton_actionPerformed(ActionEvent e) { void removeButton_actionPerformed(ActionEvent e) {
@@ -670,10 +705,16 @@ public class Gui_Quest_DeckEditor extends JFrame implements CardDetail, DeckDisp
if(n != -1) { if(n != -1) {
Card c = bottomModel.rowToCard(n); Card c = bottomModel.rowToCard(n);
bottomModel.removeCard(c); bottomModel.removeCard(c);
if(filterUsed==true){
stCardList.add(c);
}
if(!Constant.GameType.Constructed.equals(customMenu.getGameType())) { if(!Constant.GameType.Constructed.equals(customMenu.getGameType())) {
topModel.addCard(c); topModel.addCard(c);
topModel.resort(); topModel.resort();
if(filterUsed==false){
stCardList=this.getTop();
}
} }
//3 conditions" 0 cards left, select the same row, select next row //3 conditions" 0 cards left, select the same row, select next row
@@ -683,6 +724,9 @@ public class Gui_Quest_DeckEditor extends JFrame implements CardDetail, DeckDisp
bottomTable.addRowSelectionInterval(n, n); bottomTable.addRowSelectionInterval(n, n);
} }
}//if(valid row) }//if(valid row)
}//removeButton_actionPerformed }//removeButton_actionPerformed
@SuppressWarnings("unused") @SuppressWarnings("unused")

View File

@@ -62,10 +62,159 @@ public class Gui_Quest_DeckEditor_Menu extends JMenuBar {
exitCommand = exit; exitCommand = exit;
setupMenu(); setupMenu();
setupFilterMenu();
if(canEditComputerDecks) setupComputerMenu(); if(canEditComputerDecks) setupComputerMenu();
} }
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_Quest_DeckEditor g = (Gui_Quest_DeckEditor) deckDisplay;
if(g.stCardList==null){
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);
g.stCardList = g.getTop();
GUI_Quest_Filter filt = new GUI_Quest_Filter(g, deckDisplay);
g.setEnabled(false);
g.filterUsed=true;
filt.setVisible(true);
}else
{
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);
GUI_Quest_Filter filt = new GUI_Quest_Filter(g, deckDisplay);
g.filterUsed=true;
g.setEnabled(false);
filt.setVisible(true);
}
}
});
clearfilter.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ev) {
Gui_Quest_DeckEditor g = (Gui_Quest_DeckEditor) deckDisplay;
if(g.stCardList==null){
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);
g.filterUsed=false;
}else{
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);
g.filterUsed=false;
deckDisplay.updateDisplay(g.stCardList, deckDisplay.getBottom()) ;
}
}
});
}
private void addImportExport(JMenu menu, final boolean isHumanMenu) { private void addImportExport(JMenu menu, final boolean isHumanMenu) {
JMenuItem import2 = new JMenuItem("Import"); JMenuItem import2 = new JMenuItem("Import");

View File

@@ -109,7 +109,14 @@ public class ImageCache implements NewConstants {
} }
filename = GuiDisplayUtil.cleanString(c.getImageName()) + basicLandSuffix + suffix; filename = GuiDisplayUtil.cleanString(c.getImageName()) + basicLandSuffix + suffix;
} else filename = "morph" + suffix; } else filename = "morph" + suffix;
File file = new File(ForgeProps.getFile(IMAGE_BASE), filename);
String loc = "";
if (!c.isToken())
loc = IMAGE_BASE;
else
loc = IMAGE_TOKEN;
File file = new File(ForgeProps.getFile(loc), filename);
/** /**
* try current directory * try current directory

View File

@@ -26,12 +26,15 @@ public class MagicStack extends MyObservable
this.updateObservers(); this.updateObservers();
if(sp.isSpell()) if(sp.isSpell())
{ {
//put code for Standstill here
GameActionUtil.executePlayCardEffects(sp);
//attempt to counter human spell //attempt to counter human spell
if (sp.getSourceCard().getController().equals(Constant.Player.Human) && if (sp.getSourceCard().getController().equals(Constant.Player.Human) &&
CardFactoryUtil.isCounterable(sp.getSourceCard()) ) CardFactoryUtil.isCounterable(sp.getSourceCard()) )
ComputerAI_counterSpells.counter_Spell(sp); ComputerAI_counterSpells.counter_Spell(sp);
//put code for Standstill here
GameActionUtil.executePlayCardEffects(sp);
} }
} }
public SpellAbility pop() public SpellAbility pop()

View File

@@ -32,6 +32,7 @@ public interface NewConstants {
public static final String NAME_MUTATOR = "name-mutator"; public static final String NAME_MUTATOR = "name-mutator";
public static final String IMAGE_BASE = "image/base"; public static final String IMAGE_BASE = "image/base";
public static final String IMAGE_TOKEN = "image/token";
/** /**
* properties for regular game * properties for regular game