- Fixed Ajani Vengeant (second ability).

- Added some tweaks to AI counterspells. 
- Added various Look and Feel options (for some of them, make sure to toggle on options-> use LAF fonts). When using this SVN version, be sure to add all external JAR files found in /res/lib to your project. Do this by right clicking on your project in the Package Explorer of Eclipse. Then go to Build Path -> add External Archives...-> add the JARs in /res/lib.
This commit is contained in:
jendave
2011-08-06 03:11:11 +00:00
parent 9a38de4f43
commit c6e7e5c045
19 changed files with 367 additions and 90 deletions

7
.gitattributes vendored
View File

@@ -17,7 +17,12 @@ res/lang/en.properties svneol=native#text/plain
res/lang/howTo/de.properties svneol=native#text/plain
res/lang/howTo/en.properties svneol=native#text/plain
res/lang/lang.properties svneol=native#text/plain
res/lib/jdom-1.0.jar -text svneol=unset#unset
res/lib/jl1.0.1.jar -text svneol=unset#unset
res/lib/napkinlaf-1.2.jar -text svneol=unset#unset
res/lib/napkinlaf-swingset-1.2.jar -text svneol=unset#unset
res/lib/nimrodlf.jar -text svneol=unset#unset
res/lib/substance.jar -text svneol=unset#unset
res/main.properties svneol=native#text/plain
res/pics_link/card-pictures_a.txt -text svneol=native#text/plain
res/pics_link/card-pictures_b.txt -text svneol=native#text/plain
@@ -109,6 +114,7 @@ src/forge/ComputerAI_Rats2.java svneol=native#text/plain
src/forge/ComputerAI_StackNotEmpty.java svneol=native#text/plain
src/forge/ComputerAI_Testing.java svneol=native#text/plain
src/forge/ComputerAI_counterSpells.java -text svneol=native#text/plain
src/forge/ComputerAI_counterSpells2.java -text svneol=native#text/plain
src/forge/ComputerUtil.java -text svneol=native#text/plain
src/forge/ComputerUtil_Attack2.java svneol=native#text/plain
src/forge/ComputerUtil_Block2.java svneol=native#text/plain
@@ -190,6 +196,7 @@ src/forge/Input_PayManaCost_Ability.java svneol=native#text/plain
src/forge/Input_StackNotEmpty.java svneol=native#text/plain
src/forge/Input_Untap.java svneol=native#text/plain
src/forge/KeyListenerTest.java -text svneol=native#text/plain
src/forge/ListProperties.java -text svneol=native#text/plain
src/forge/MP3Player.java -text svneol=native#text/plain
src/forge/MagicStack.java svneol=native#text/plain
src/forge/ManaCost.java svneol=native#text/plain

View File

@@ -104,6 +104,7 @@ NewGame/menu/importPicture=Import Pictures
NewGame/menu/cardSizes=Specify Card Size
NewGame/menu/about=About
NewGame/options/title=Options
NewGame/options/font=Use LAF Fonts
NewGame/options/generate/title=Generate Deck
NewGame/options/generate/removeSmall=Remove 1/1 and 0/X Creatures
NewGame/options/generate/removeArtifacts=Remove Artifacts

BIN
res/lib/jdom-1.0.jar Normal file

Binary file not shown.

BIN
res/lib/napkinlaf-1.2.jar Normal file

Binary file not shown.

Binary file not shown.

BIN
res/lib/nimrodlf.jar Normal file

Binary file not shown.

BIN
res/lib/substance.jar Normal file

Binary file not shown.

View File

@@ -2165,8 +2165,19 @@ class CardFactory_Planeswalkers {
else
AllZone.GameAction.getPlayerLife(getTargetPlayer()).subtractLife(damage);
AllZone.GameAction.getPlayerLife(card2.getController()).addLife(3);
}
public boolean canPlay()
{
return AllZone.getZone(card2).is(Constant.Zone.Play) &&
card2.getCounters(Counters.LOYALTY) >= 2 &&
turn[0] != AllZone.Phase.getTurn() &&
AllZone.Phase.getActivePlayer().equals(card2.getController()) &&
!AllZone.Phase.getPhase().equals("End of Turn") &&
(AllZone.Phase.getPhase().equals("Main1") || AllZone.Phase.getPhase().equals("Main2"))
&& AllZone.Stack.size() == 0;
}//canPlay()
};//ability2
Input target = new Input()

View File

@@ -0,0 +1,109 @@
package forge;
public class ComputerAI_counterSpells2 {
public static void counter_Spell(SpellAbility sa)
{
CardList counterSpells = getPlayableCounterSpells(sa);
boolean countered = false;
for (Card var:counterSpells)
{
if (countered)
break;
else if (CardUtil.getConvertedManaCost(var.getManaCost()) <= CardUtil.getConvertedManaCost(sa) ||
(var.getName().equals("Overwhelming Intellect") && CardUtil.getConvertedManaCost(sa) >= 3 ))
{
SpellAbility sp = var.getSpellAbility()[0];
//ComputerUtil.playNoStack(sp);
ComputerUtil.playStack(sp);
countered = true;
}
}
}
public static CardList getPlayableCounterSpells(final SpellAbility sa){
final String[] basic = {
"Counterspell", "Remand", "Cancel", "Mystic Snake", "Absorb", "Undermine", "Punish Ignorance",
"Dismiss", "Last Word", "Force of Will", "Thwart"
};
final String[] creature = {
"Exclude", "Overwhelming Intellect", "Preemptive Strike", "Remove Soul", "Essence Scatter", "False Summoning"
};
final String[] nonCreature = {
""
};
final String[] unlessPay1 = {
"Force Spike", "Daze", "Runeboggle", "Spell Snip"
};
final String[] unlessPay3 = {
"Mana Leak"
};
final String[] unlessPay4 = {
"Convolute"
};
final int usableManaSources = CardFactoryUtil.getUsableManaSources(Constant.Player.Human);
PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, Constant.Player.Computer);
CardList list = new CardList(hand.getCards());
list = list.filter(new CardListFilter()
{
public boolean addCard(Card c)
{
if (CardUtil.getConvertedManaCost(sa.getSourceCard().getManaCost()) == 2)
if (c.getName().equals("Spell Snare"))
return true;
if (usableManaSources == 0) {
if (checkArray(c, unlessPay1))
return true;
}
if (usableManaSources < 3) {
if (checkArray(c, unlessPay3))
return true;
}
if (usableManaSources < 4) {
if (checkArray(c, unlessPay4))
return true;
}
if (sa.getSourceCard().isCreature()) {
if (checkArray(c, creature))
return true;
}
else if (!sa.getSourceCard().isCreature()) {
if (checkArray(c, nonCreature))
return true;
}
if (checkArray(c, basic))
return true;
return false;
}
});
return list;
}
public static boolean checkArray(Card c, String[] type)
{
for(String s : type)
{
SpellAbility sa = c.getSpellAbility()[0];
if (s.equals(c.getName()) && ComputerUtil.canPayCost(sa))
return true;
}
return false;
}
}

View File

@@ -10,7 +10,7 @@ import javax.swing.ImageIcon;
public interface Constant {
public static final String ProgramName = "MTG Forge - 10/2009 - http://mtgrares.blogspot.com";
public static final String ProgramName = "Forge - 10/2009 - http://mtgrares.blogspot.com";
//used to pass information between the GUI screens
public interface Runtime {

View File

@@ -73,9 +73,13 @@ public class GuiDisplay3 extends JFrame implements Display, NewConstants, NewCon
private GuiInput inputControl;
Font statFont = new Font("MS Sans Serif", Font.PLAIN, 12);
Font lifeFont = new Font("MS Sans Serif", Font.PLAIN, 40);
Font checkboxFont = new Font("MS Sans Serif", Font.PLAIN, 9);
//Font statFont = new Font("MS Sans Serif", Font.PLAIN, 12);
//Font lifeFont = new Font("MS Sans Serif", Font.PLAIN, 40);
//Font checkboxFont = new Font("MS Sans Serif", Font.PLAIN, 9);
Font statFont = new Font("Dialog", Font.PLAIN, 12);
Font lifeFont = new Font("Dialog", Font.PLAIN, 40);
Font checkboxFont = new Font("Dialog", Font.PLAIN, 9);
/*
public Color c1 = new Color(112,112,112);
@@ -84,7 +88,7 @@ public class GuiDisplay3 extends JFrame implements Display, NewConstants, NewCon
*/
private String current_picture = "";
private int count = 0;
//private int count = 0;
public static Color c1 = new Color(204, 204, 204);
public static Color c2 = new Color(204, 204, 204);
@@ -556,7 +560,7 @@ public class GuiDisplay3 extends JFrame implements Display, NewConstants, NewCon
return;
//picture
System.out.println("UPDATING PICTURE!!! #:" + count++);
//System.out.println("UPDATING PICTURE!!! #:" + count++);
current_picture = c.getImageName();
picturePanel.removeAll();
JPanel pic = GuiDisplayUtil.getPicture(c);
@@ -773,7 +777,7 @@ public class GuiDisplay3 extends JFrame implements Display, NewConstants, NewCon
private void initComponents() {
//Preparing the Frame
setTitle(ForgeProps.getLocalized(LANG.PROGRAM_NAME));
setFont(new Font("Times New Roman", 0, 16));
if (!Gui_NewGame.useLAFFonts.isSelected()) setFont(new Font("Times New Roman", 0, 16));
getContentPane().setLayout(new BorderLayout());
addWindowListener(new WindowAdapter() {
@Override
@@ -828,6 +832,10 @@ public class GuiDisplay3 extends JFrame implements Display, NewConstants, NewCon
getContentPane().add(pane);
//adding the individual parts
if (!Gui_NewGame.useLAFFonts.isSelected())
initFonts(pane);
initMsgYesNo(pane);
initOpp(pane);
initStackCombat(pane);
@@ -836,10 +844,44 @@ public class GuiDisplay3 extends JFrame implements Display, NewConstants, NewCon
initCardPicture(pane);
}
private void initFonts(JPanel pane)
{
messageArea.setFont(getFont());
oppLifeLabel.setFont(lifeFont);
oppPCLabel.setFont(statFont);
oppLibraryLabel.setFont(statFont);
oppHandValue.setFont(statFont);
oppLibraryValue.setFont(statFont);
oppRemovedValue.setFont(statFont);
oppGraveValue.setFont(statFont);
playerLifeLabel.setFont(lifeFont);
playerPCLabel.setFont(statFont);
playerHandValue.setFont(statFont);
playerLibraryValue.setFont(statFont);
playerRemovedValue.setFont(statFont);
playerGraveValue.setFont(statFont);
playerFBValue.setFont(statFont);
combatArea.setFont(getFont());
cdLabel1.setFont(getFont());
cdLabel2.setFont(getFont());
cdLabel3.setFont(getFont());
cdLabel4.setFont(getFont());
cdLabel5.setFont(getFont());
cdLabel6.setFont(getFont());
cdArea.setFont(getFont());
}
private void initMsgYesNo(JPanel pane) {
// messageArea.setBorder(BorderFactory.createEtchedBorder());
messageArea.setEditable(false);
messageArea.setFont(getFont());
messageArea.setLineWrap(true);
messageArea.setWrapStyleWord(true);
@@ -896,26 +938,20 @@ public class GuiDisplay3 extends JFrame implements Display, NewConstants, NewCon
}
private void initOpp(JPanel pane) {
oppLifeLabel.setFont(lifeFont);
//oppLifeLabel.setHorizontalAlignment(SwingConstants.CENTER);
oppPCLabel.setFont(statFont);
//oppPCLabel.setHorizontalAlignment(SwingConstants.TOP);
oppPCLabel.setForeground(c3);
JLabel oppLibraryLabel = new JLabel(ForgeProps.getLocalized(COMPUTER_LIBRARY.TITLE),
SwingConstants.TRAILING);
oppLibraryLabel.setFont(statFont);
JLabel oppHandLabel = new JLabel(ForgeProps.getLocalized(COMPUTER_HAND.TITLE), SwingConstants.TRAILING);
oppHandLabel.setFont(statFont);
if(!Gui_NewGame.useLAFFonts.isSelected()) oppHandLabel.setFont(statFont);
//JLabel oppGraveLabel = new JLabel("Grave:", SwingConstants.TRAILING);
JButton oppGraveButton = new JButton(COMPUTER_GRAVEYARD_ACTION);
oppGraveButton.setText((String) COMPUTER_GRAVEYARD_ACTION.getValue("buttonText"));
oppGraveButton.setMargin(new Insets(0, 0, 0, 0));
oppGraveButton.setHorizontalAlignment(SwingConstants.TRAILING);
oppGraveButton.setFont(statFont);
if(!Gui_NewGame.useLAFFonts.isSelected()) oppGraveButton.setFont(statFont);
JPanel gravePanel = new JPanel(new BorderLayout());
@@ -925,19 +961,12 @@ public class GuiDisplay3 extends JFrame implements Display, NewConstants, NewCon
oppRemovedButton.setText((String) COMPUTER_REMOVED_ACTION.getValue("buttonText"));
oppRemovedButton.setMargin(new Insets(0, 0, 0, 0));
//removedButton.setHorizontalAlignment(SwingConstants.TRAILING);
oppRemovedButton.setFont(statFont);
if(!Gui_NewGame.useLAFFonts.isSelected()) oppRemovedButton.setFont(statFont);
oppHandValue.setFont(statFont);
oppHandValue.setHorizontalAlignment(SwingConstants.LEADING);
oppLibraryValue.setFont(statFont);
oppLibraryValue.setHorizontalAlignment(SwingConstants.LEADING);
oppGraveValue.setFont(statFont);
oppGraveValue.setHorizontalAlignment(SwingConstants.LEADING);
oppRemovedValue.setFont(statFont);
oppRemovedValue.setHorizontalAlignment(SwingConstants.LEADING);
JPanel oppNumbersPanel = new JPanel(new GridLayout(0, 2, 3, 1));
@@ -968,7 +997,6 @@ public class GuiDisplay3 extends JFrame implements Display, NewConstants, NewCon
pane.add(new ExternalPanel(stackPane), "stack");
combatArea.setEditable(false);
combatArea.setFont(getFont());
combatArea.setLineWrap(true);
combatArea.setWrapStyleWord(true);
combatArea.setBackground(c1);
@@ -981,33 +1009,31 @@ public class GuiDisplay3 extends JFrame implements Display, NewConstants, NewCon
}
private void initPlayer(JPanel pane) {
int fontSize = 12;
playerLifeLabel.setFont(lifeFont);
//int fontSize = 12;
playerLifeLabel.setHorizontalAlignment(SwingConstants.CENTER);
playerPCLabel.setFont(statFont);
playerPCLabel.setForeground(c3);
JLabel playerLibraryLabel = new JLabel(ForgeProps.getLocalized(HUMAN_LIBRARY.TITLE),
SwingConstants.TRAILING);
playerLibraryLabel.setFont(statFont);
if(!Gui_NewGame.useLAFFonts.isSelected()) playerLibraryLabel.setFont(statFont);
JLabel playerHandLabel = new JLabel(ForgeProps.getLocalized(HUMAN_HAND.TITLE), SwingConstants.TRAILING);
playerHandLabel.setFont(statFont);
if(!Gui_NewGame.useLAFFonts.isSelected()) playerHandLabel.setFont(statFont);
//JLabel playerGraveLabel = new JLabel("Grave:", SwingConstants.TRAILING);
JButton playerGraveButton = new JButton(HUMAN_GRAVEYARD_ACTION);
playerGraveButton.setText((String) HUMAN_GRAVEYARD_ACTION.getValue("buttonText"));
playerGraveButton.setMargin(new Insets(0, 0, 0, 0));
playerGraveButton.setHorizontalAlignment(SwingConstants.TRAILING);
playerGraveButton.setFont(statFont);
if(!Gui_NewGame.useLAFFonts.isSelected()) playerGraveButton.setFont(statFont);
JButton playerFlashBackButton = new JButton(HUMAN_FLASHBACK_ACTION);
playerFlashBackButton.setText((String) HUMAN_FLASHBACK_ACTION.getValue("buttonText"));
playerFlashBackButton.setMargin(new Insets(0, 0, 0, 0));
playerFlashBackButton.setHorizontalAlignment(SwingConstants.TRAILING);
playerFlashBackButton.setFont(statFont);
if(!Gui_NewGame.useLAFFonts.isSelected()) playerFlashBackButton.setFont(statFont);
JPanel gravePanel = new JPanel(new BorderLayout());
@@ -1020,22 +1046,14 @@ public class GuiDisplay3 extends JFrame implements Display, NewConstants, NewCon
playerRemovedButton.setText((String) HUMAN_REMOVED_ACTION.getValue("buttonText"));
playerRemovedButton.setMargin(new Insets(0, 0, 0, 0));
//removedButton.setHorizontalAlignment(SwingConstants.TRAILING);
playerRemovedButton.setFont(statFont);
if(!Gui_NewGame.useLAFFonts.isSelected()) playerRemovedButton.setFont(statFont);
playerHandValue.setFont(statFont);
playerHandValue.setHorizontalAlignment(SwingConstants.LEADING);
playerLibraryValue.setFont(statFont);
playerLibraryValue.setHorizontalAlignment(SwingConstants.LEADING);
playerGraveValue.setFont(statFont);
playerGraveValue.setHorizontalAlignment(SwingConstants.LEADING);
playerFBValue.setHorizontalAlignment(SwingConstants.LEADING);
playerFBValue.setFont(statFont);
playerGraveValue.setHorizontalAlignment(SwingConstants.LEADING);
playerRemovedValue.setFont(new Font("MS Sans Serif", 0, fontSize));
//playerRemovedValue.setFont(new Font("MS Sans Serif", 0, fontSize));
playerRemovedValue.setHorizontalAlignment(SwingConstants.LEADING);
JPanel playerNumbersPanel = new JPanel(new GridLayout(0, 2, 5, 1));
@@ -1076,25 +1094,25 @@ public class GuiDisplay3 extends JFrame implements Display, NewConstants, NewCon
}
private void initCardPicture(JPanel pane) {
cdLabel1.setFont(getFont());
//cdLabel1.setFont(getFont());
cdLabel1.setHorizontalAlignment(SwingConstants.CENTER);
cdLabel1.setText("jLabel3");
cdLabel2.setFont(getFont());
//cdLabel2.setFont(getFont());
cdLabel2.setHorizontalAlignment(SwingConstants.CENTER);
cdLabel2.setText("jLabel4");
cdLabel3.setFont(getFont());
//cdLabel3.setFont(getFont());
cdLabel3.setHorizontalAlignment(SwingConstants.CENTER);
//~ cdLabel3.setText("jLabel5");
cdLabel4.setFont(getFont());
//cdLabel4.setFont(getFont());
//~ cdLabel4.setText("jLabel6");
cdLabel5.setFont(getFont());
//cdLabel5.setFont(getFont());
//~ cdLabel5.setText("jLabel7");
cdLabel6.setFont(getFont());
//cdLabel6.setFont(getFont());
//~ cdLabel6.setText("jLabel8");
JPanel cdLabels = new JPanel(new GridLayout(6, 0, 0, 5));
@@ -1109,7 +1127,7 @@ public class GuiDisplay3 extends JFrame implements Display, NewConstants, NewCon
//StyledEditorKit se = new StyledEditorKit();
//cdArea.setEditorKit(new StyledEditorKit());
cdArea.setFont(getFont());
//cdArea.setFont(getFont());
cdArea.setLineWrap(true);
cdArea.setWrapStyleWord(true);
@@ -1182,6 +1200,7 @@ public class GuiDisplay3 extends JFrame implements Display, NewConstants, NewCon
JLabel cdLabel4 = new JLabel();
JLabel cdLabel5 = new JLabel();
JLabel cdLabel6 = new JLabel();
JLabel oppLibraryLabel = new JLabel(ForgeProps.getLocalized(COMPUTER_LIBRARY.TITLE), SwingConstants.TRAILING);
JLabel oppHandValue = new JLabel();
JLabel oppLibraryValue = new JLabel();
JLabel oppGraveValue = new JLabel();

View File

@@ -18,7 +18,7 @@ import java.io.FileOutputStream;
import java.io.IOException;
import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
//import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JFileChooser;
@@ -48,8 +48,8 @@ public class Gui_DeckEditor extends JFrame implements CardDetail, DeckDisplay, N
Gui_DeckEditor_Menu customMenu;
private ImageIcon upIcon = Constant.IO.upIcon;
private ImageIcon downIcon = Constant.IO.downIcon;
//private ImageIcon upIcon = Constant.IO.upIcon;
//private ImageIcon downIcon = Constant.IO.downIcon;
private TableModel topModel;
private TableModel bottomModel;
@@ -432,8 +432,8 @@ public class Gui_DeckEditor extends JFrame implements CardDetail, DeckDisplay, N
jScrollPane2.setBorder(titledBorder2);
jScrollPane2.setBounds(new Rectangle(19, 458, 726, 218));
removeButton.setBounds(new Rectangle(180, 403, 146, 49));
removeButton.setIcon(upIcon);
removeButton.setFont(new java.awt.Font("Dialog", 0, 13));
//removeButton.setIcon(upIcon);
if (!Gui_NewGame.useLAFFonts.isSelected()) removeButton.setFont(new java.awt.Font("Dialog", 0, 13));
removeButton.setText("Remove Card");
removeButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(ActionEvent e) {
@@ -446,8 +446,8 @@ public class Gui_DeckEditor extends JFrame implements CardDetail, DeckDisplay, N
addButton_actionPerformed(e);
}
});
addButton.setIcon(downIcon);
addButton.setFont(new java.awt.Font("Dialog", 0, 13));
//addButton.setIcon(downIcon);
if (!Gui_NewGame.useLAFFonts.isSelected()) addButton.setFont(new java.awt.Font("Dialog", 0, 13));
addButton.setBounds(new Rectangle(23, 403, 146, 49));
analysisButton.setText("Deck Analysis");
@@ -456,7 +456,7 @@ public class Gui_DeckEditor extends JFrame implements CardDetail, DeckDisplay, N
analysisButton_actionPerformed(e);
}
});
analysisButton.setFont(new java.awt.Font("Dialog", 0, 13));
if (!Gui_NewGame.useLAFFonts.isSelected()) analysisButton.setFont(new java.awt.Font("Dialog", 0, 13));
analysisButton.setBounds(new Rectangle(578, 426, 166, 25));
changePictureButton.setText("Change picture...");
@@ -465,7 +465,7 @@ public class Gui_DeckEditor extends JFrame implements CardDetail, DeckDisplay, N
changePictureButton_actionPerformed(e);
}
});
changePictureButton.setFont(new java.awt.Font("Dialog", 0, 10));
if (!Gui_NewGame.useLAFFonts.isSelected()) changePictureButton.setFont(new java.awt.Font("Dialog", 0, 10));
changePictureButton.setBounds(new Rectangle(765, 349, 118, 20));
removePictureButton.setText("Remove picture...");
@@ -474,7 +474,7 @@ public class Gui_DeckEditor extends JFrame implements CardDetail, DeckDisplay, N
removePictureButton_actionPerformed(e);
}
});
removePictureButton.setFont(new java.awt.Font("Dialog", 0, 10));
if (!Gui_NewGame.useLAFFonts.isSelected()) removePictureButton.setFont(new java.awt.Font("Dialog", 0, 10));
removePictureButton.setBounds(new Rectangle(885, 349, 118, 20));
/**
@@ -482,7 +482,7 @@ public class Gui_DeckEditor extends JFrame implements CardDetail, DeckDisplay, N
*/
Font f = new Font("Tahoma", Font.PLAIN, 10);
landCheckBox.setBounds(340, 400, 48, 20);
landCheckBox.setFont(f);
if (!Gui_NewGame.useLAFFonts.isSelected()) landCheckBox.setFont(f);
landCheckBox.setOpaque(false);
landCheckBox.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
@@ -490,7 +490,7 @@ public class Gui_DeckEditor extends JFrame implements CardDetail, DeckDisplay, N
}
});
creatureCheckBox.setBounds(385, 400, 65, 20);
creatureCheckBox.setFont(f);
if (!Gui_NewGame.useLAFFonts.isSelected()) creatureCheckBox.setFont(f);
creatureCheckBox.setOpaque(false);
creatureCheckBox.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
@@ -498,7 +498,7 @@ public class Gui_DeckEditor extends JFrame implements CardDetail, DeckDisplay, N
}
});
sorceryCheckBox.setBounds(447, 400, 62, 20);
sorceryCheckBox.setFont(f);
if (!Gui_NewGame.useLAFFonts.isSelected()) sorceryCheckBox.setFont(f);
sorceryCheckBox.setOpaque(false);
sorceryCheckBox.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
@@ -506,7 +506,7 @@ public class Gui_DeckEditor extends JFrame implements CardDetail, DeckDisplay, N
}
});
instantCheckBox.setBounds(505, 400, 60, 20);
instantCheckBox.setFont(f);
if (!Gui_NewGame.useLAFFonts.isSelected()) instantCheckBox.setFont(f);
instantCheckBox.setOpaque(false);
instantCheckBox.addItemListener(new ItemListener() {
@@ -515,7 +515,7 @@ public class Gui_DeckEditor extends JFrame implements CardDetail, DeckDisplay, N
}
});
planeswalkerCheckBox.setBounds(558, 400, 85, 20);
planeswalkerCheckBox.setFont(f);
if (!Gui_NewGame.useLAFFonts.isSelected()) planeswalkerCheckBox.setFont(f);
planeswalkerCheckBox.setOpaque(false);
planeswalkerCheckBox.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
@@ -523,7 +523,7 @@ public class Gui_DeckEditor extends JFrame implements CardDetail, DeckDisplay, N
}
});
artifactCheckBox.setBounds(638, 400, 58, 20);
artifactCheckBox.setFont(f);
if (!Gui_NewGame.useLAFFonts.isSelected()) artifactCheckBox.setFont(f);
artifactCheckBox.setOpaque(false);
artifactCheckBox.addItemListener(new ItemListener() {
@@ -532,7 +532,7 @@ public class Gui_DeckEditor extends JFrame implements CardDetail, DeckDisplay, N
}
});
enchantmentCheckBox.setBounds(692, 400, 80, 20);
enchantmentCheckBox.setFont(f);
if (!Gui_NewGame.useLAFFonts.isSelected()) enchantmentCheckBox.setFont(f);
enchantmentCheckBox.setOpaque(false);
enchantmentCheckBox.addItemListener(new ItemListener() {
@@ -603,7 +603,7 @@ public class Gui_DeckEditor extends JFrame implements CardDetail, DeckDisplay, N
picturePanel.setBounds(new Rectangle(765, 372, 239, 338));
picturePanel.setLayout(borderLayout1);
picturePanel.addMouseListener(new CustomListener());
statsLabel.setFont(new java.awt.Font("Dialog", 0, 14));
if (!Gui_NewGame.useLAFFonts.isSelected()) statsLabel.setFont(new java.awt.Font("Dialog", 0, 14));
statsLabel.setText("Total - 0, Creatures - 0 Land - 0");
statsLabel.setBounds(new Rectangle(19, 672, 720, 31));
//Do not lower statsLabel any lower, we want this to be visible at 1024 x 768 screen size
@@ -612,24 +612,24 @@ public class Gui_DeckEditor extends JFrame implements CardDetail, DeckDisplay, N
jScrollPane3.setBounds(new Rectangle(6, 168, 225, 143));
jPanel3.setBounds(new Rectangle(7, 21, 224, 141));
jPanel3.setLayout(gridLayout1);
cdLabel4.setFont(new java.awt.Font("Dialog", 0, 14));
if (!Gui_NewGame.useLAFFonts.isSelected()) cdLabel4.setFont(new java.awt.Font("Dialog", 0, 14));
cdLabel4.setHorizontalAlignment(SwingConstants.LEFT);
cdLabel1.setFont(new java.awt.Font("Dialog", 0, 14));
if (!Gui_NewGame.useLAFFonts.isSelected()) cdLabel1.setFont(new java.awt.Font("Dialog", 0, 14));
cdLabel1.setHorizontalAlignment(SwingConstants.CENTER);
cdLabel2.setFont(new java.awt.Font("Dialog", 0, 14));
if (!Gui_NewGame.useLAFFonts.isSelected()) cdLabel2.setFont(new java.awt.Font("Dialog", 0, 14));
cdLabel2.setHorizontalAlignment(SwingConstants.CENTER);
cdLabel3.setFont(new java.awt.Font("Dialog", 0, 14));
if (!Gui_NewGame.useLAFFonts.isSelected()) cdLabel3.setFont(new java.awt.Font("Dialog", 0, 14));
cdLabel3.setHorizontalAlignment(SwingConstants.CENTER);
gridLayout1.setColumns(1);
gridLayout1.setRows(0);
cdLabel5.setFont(new java.awt.Font("Dialog", 0, 14));
if (!Gui_NewGame.useLAFFonts.isSelected())cdLabel5.setFont(new java.awt.Font("Dialog", 0, 14));
cdLabel5.setHorizontalAlignment(SwingConstants.LEFT);
cdTextArea.setFont(new java.awt.Font("Dialog", 0, 12));
if (!Gui_NewGame.useLAFFonts.isSelected()) cdTextArea.setFont(new java.awt.Font("Dialog", 0, 12));
cdTextArea.setLineWrap(true);
cdTextArea.setWrapStyleWord(true);
statsLabel2.setBounds(new Rectangle(19, 365, 720, 31));
statsLabel2.setText("Total - 0, Creatures - 0 Land - 0");
statsLabel2.setFont(new java.awt.Font("Dialog", 0, 14));
if (!Gui_NewGame.useLAFFonts.isSelected()) statsLabel2.setFont(new java.awt.Font("Dialog", 0, 14));
jLabel1.setText("Click on the column name (like name or color) to sort the cards");
jLabel1.setBounds(new Rectangle(20, 1, 400, 19));
this.getContentPane().add(cardDetailPanel, null);

View File

@@ -14,6 +14,8 @@ import java.awt.event.WindowEvent;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import javax.swing.AbstractAction;
import javax.swing.Action;
@@ -38,6 +40,13 @@ import javax.swing.UIManager.LookAndFeelInfo;
import javax.swing.border.Border;
import javax.swing.border.TitledBorder;
//import com.nilo.plaf.nimrod.NimRODLookAndFeel;
//import net.sourceforge.napkinlaf.NapkinLookAndFeel;
//import net.sourceforge.napkinlaf.NapkinTheme;
//import org.jvnet.substance.SubstanceLookAndFeel;
import forge.error.ErrorViewer;
import forge.error.ExceptionHandler;
import forge.gui.ListChooser;
@@ -87,6 +96,7 @@ public class Gui_NewGame extends JFrame implements NewConstants, NewConstants.LA
ForgeProps.getLocalized(MENU_BAR.OPTIONS.GENERATE.REMOVE_SMALL));
public static JCheckBoxMenuItem removeArtifacts = new JCheckBoxMenuItem(
ForgeProps.getLocalized(MENU_BAR.OPTIONS.GENERATE.REMOVE_ARTIFACTS));
public static JCheckBoxMenuItem useLAFFonts = new JCheckBoxMenuItem(ForgeProps.getLocalized(MENU_BAR.OPTIONS.FONT));
private JButton questButton = new JButton();
@@ -99,6 +109,8 @@ public class Gui_NewGame extends JFrame implements NewConstants, NewConstants.LA
public static void main(String[] args) {
ExceptionHandler.registerErrorHandling();
try {
Object[] o = UIManager.getInstalledLookAndFeels();
if(o.length > 3) {
@@ -117,7 +129,6 @@ public class Gui_NewGame extends JFrame implements NewConstants, NewConstants.LA
ErrorViewer.showError(ex);
}
try {
//deck migration - this is a little hard to read, because i can't just plainly reference a class in the
//default package
@@ -131,7 +142,26 @@ public class Gui_NewGame extends JFrame implements NewConstants, NewConstants.LA
Constant.Runtime.GameType[0] = Constant.GameType.Constructed;
AllZone.Computer = new ComputerAI_Input(new ComputerAI_General());
new Gui_NewGame();
/*
JFrame.setDefaultLookAndFeelDecorated(true);
SwingUtilities.invokeLater(new Runnable() {
public void run() {
try {
UIManager.setLookAndFeel("org.jvnet.substance.skin.ChallengerDeepSkin");
} catch (Exception e) {
e.printStackTrace();
}
}
});
SwingUtilities.invokeLater(new Runnable() {
public void run() {
new Gui_NewGame();
}
});
*/
new Gui_NewGame();
} catch(Exception ex) {
ErrorViewer.showError(ex);
@@ -191,6 +221,8 @@ public class Gui_NewGame extends JFrame implements NewConstants, NewConstants.LA
for(Action a:actions)
menu.add(a);
//useLAFFonts.setSelected(false);
// new stuff
JMenu generatedDeck = new JMenu(ForgeProps.getLocalized(MENU_BAR.OPTIONS.GENERATE.TITLE));
generatedDeck.add(removeSmallCreatures);
@@ -198,6 +230,8 @@ public class Gui_NewGame extends JFrame implements NewConstants, NewConstants.LA
JMenu optionsMenu = new JMenu(ForgeProps.getLocalized(OPTIONS.TITLE));
optionsMenu.add(generatedDeck);
optionsMenu.add(useLAFFonts);
JMenuBar bar = new JMenuBar();
bar.add(menu);
bar.add(optionsMenu);
@@ -613,14 +647,61 @@ public class Gui_NewGame extends JFrame implements NewConstants, NewConstants.LA
public void actionPerformed(ActionEvent e) {
LookAndFeelInfo[] info = UIManager.getInstalledLookAndFeels();
String[] keys = new String[info.length];
for(int i = 0; i < info.length; i++)
keys[i] = info[i].getName();
HashMap<String, String> LAFMap = new HashMap<String, String>();
for (int i=0; i < info.length; i++)
LAFMap.put(info[i].getName(), info[i].getClassName());
//NapkinLookAndFeel napkin = new NapkinLookAndFeel();
//NimRODLookAndFeel nrLAF = new NimRODLookAndFeel();
//add Substance LAFs:
LAFMap.put("Autumn", "org.jvnet.substance.skin.SubstanceAutumnLookAndFeel");
LAFMap.put("Business", "org.jvnet.substance.skin.SubstanceBusinessLookAndFeel");
LAFMap.put("Business Black Steel", "org.jvnet.substance.skin.SubstanceBusinessBlackSteelLookAndFeel");
LAFMap.put("Business Blue Steel", "org.jvnet.substance.skin.SubstanceBusinessBlueSteelLookAndFeel");
LAFMap.put("Challenger Deep", "org.jvnet.substance.skin.SubstanceChallengerDeepLookAndFeel");
LAFMap.put("Creme", "org.jvnet.substance.skin.SubstanceCremeLookAndFeel");
LAFMap.put("Creme Coffee", "org.jvnet.substance.skin.SubstanceCremeCoffeeLookAndFeel");
LAFMap.put("Dust", "org.jvnet.substance.skin.SubstanceDustLookAndFeel");
LAFMap.put("Dust Coffee", "org.jvnet.substance.skin.SubstanceDustCoffeeLookAndFeel");
LAFMap.put("Emerald Dusk", "org.jvnet.substance.skin.SubstanceEmeraldDuskLookAndFeel");
LAFMap.put("Gemini", "org.jvnet.substance.api.skin.SubstanceGeminiLookAndFeel");
LAFMap.put("Graphite Aqua", "org.jvnet.substance.api.skin.SubstanceGraphiteAquaLookAndFeel");
LAFMap.put("Moderate", "org.jvnet.substance.skin.SubstanceModerateLookAndFeel");
LAFMap.put("Magellan", "org.jvnet.substance.skin.SubstanceMagellanLookAndFeel");
LAFMap.put("Magma", "org.jvnet.substance.skin.SubstanceMagmaLookAndFeel");
LAFMap.put("Mist Aqua", "org.jvnet.substance.skin.SubstanceMistAquaLookAndFeel");
LAFMap.put("Mist Silver", "org.jvnet.substance.skin.SubstanceMistSilverLookAndFeel");
LAFMap.put("Napkin", "net.sourceforge.napkinlaf.NapkinLookAndFeel");
LAFMap.put("Nebula", "org.jvnet.substance.skin.SubstanceNebulaLookAndFeel");
LAFMap.put("Nebula Brick Wall", "org.jvnet.substance.skin.SubstanceNebulaBrickWallLookAndFeel");
LAFMap.put("NimROD", "com.nilo.plaf.nimrod.NimRODLookAndFeel");
LAFMap.put("Office Blue 2007", "org.jvnet.substance.skin.SubstanceOfficeBlue2007LookAndFeel");
LAFMap.put("Office Silver 2007", "org.jvnet.substance.skin.SubstanceOfficeSilver2007LookAndFeel");
//LAFMap.put("Oyoaha", "com.oyoaha.swing.plaf.oyoaha.OyoahaLookAndFeel");
LAFMap.put("Raven", "org.jvnet.substance.skin.SubstanceRavenLookAndFeel");
LAFMap.put("Raven Graphite", "org.jvnet.substance.skin.SubstanceRavenGraphiteLookAndFeel");
LAFMap.put("Raven Graphite Glass", "org.jvnet.substance.skin.SubstanceRavenGraphiteGlassLookAndFeel");
LAFMap.put("Sahara", "org.jvnet.substance.skin.SubstanceSaharaLookAndFeel");
LAFMap.put("Twilight", "org.jvnet.substance.skin.SubstanceTwilightLookAndFeel");
String[] keys = new String[LAFMap.size()];
int count = 0;
Iterator<String> iter = LAFMap.keySet().iterator();
while(iter.hasNext()) {
String s = iter.next();
keys[count++] = s;
}
Arrays.sort(keys);
ListChooser<String> ch = new ListChooser<String>("Choose one", 0, 1, keys);
if(ch.show()) try {
String name = ch.getSelectedValue();
int index = ch.getSelectedIndex();
if(index == -1) return;
UIManager.setLookAndFeel(info[index].getClassName());
//UIManager.setLookAndFeel(info[index].getClassName());
UIManager.setLookAndFeel(LAFMap.get(name));
SwingUtilities.updateComponentTreeUI(c);
} catch(Exception ex) {
ErrorViewer.showError(ex);
@@ -695,6 +776,7 @@ public class Gui_NewGame extends JFrame implements NewConstants, NewConstants.LA
}
}
public static class AboutAction extends AbstractAction {
private static final long serialVersionUID = 5492173304463396871L;
@@ -705,8 +787,11 @@ public class Gui_NewGame extends JFrame implements NewConstants, NewConstants.LA
public void actionPerformed(ActionEvent e) {
JTextArea area = new JTextArea(8, 25);
Font f = new Font(area.getFont().getName(), Font.PLAIN, 13);
area.setFont(f);
if (useLAFFonts.isSelected()) {
Font f = new Font(area.getFont().getName(), Font.PLAIN, 13);
area.setFont(f);
}
area.setText("I enjoyed programming this project. I'm glad other people also enjoy my program. MTG Forge has turned out to be very successful.\n\nmtgrares@yahoo.com\nhttp://mtgrares.blogspot.com\n\nWritten by: Forge");

View File

@@ -234,6 +234,15 @@ private void playerDamage(PlayerLife p)
while(iter.hasNext()) {
Card crd = iter.next();
//AllZone.GameAction.addDamage(c, crd , assignedDamageMap.get(crd));
/*
for (String effect : AllZone.StateBasedEffects.getStateBasedMap().keySet() ) {
Command com = GameActionUtil.commands.get(effect);
com.execute();
}
GameActionUtil.executeCardStateEffects();
*/
damageMap.put(crd, assignedDamageMap.get(crd));
}
AllZone.GameAction.addDamage(c, damageMap);

View File

@@ -0,0 +1,35 @@
package forge;
import java.util.Enumeration;
import javax.swing.UIDefaults;
import javax.swing.UIManager;
public class ListProperties {
public static void main(String args[]) throws Exception {
//UIManager.LookAndFeelInfo looks[] = UIManager.getInstalledLookAndFeels();
/*
for (UIManager.LookAndFeelInfo info : looks) {
UIManager.setLookAndFeel(info.getClassName());
UIDefaults defaults = UIManager.getDefaults();
Enumeration<?> newKeys = defaults.keys();
while (newKeys.hasMoreElements()) {
Object obj = newKeys.nextElement();
System.out.printf("%50s : %s\n", obj, UIManager.get(obj));
}
}
*/
UIManager.setLookAndFeel("net.sourceforge.napkinlaf.NapkinLookAndFeel");
UIDefaults defaults = UIManager.getDefaults();
Enumeration<?> newKeys = defaults.keys();
while (newKeys.hasMoreElements()) {
Object obj = newKeys.nextElement();
System.out.printf("%50s : %s\n", obj, UIManager.get(obj));
}
}
}

View File

@@ -30,7 +30,7 @@ public class MagicStack extends MyObservable
//attempt to counter human spell
if (sp.getSourceCard().getController().equals(Constant.Player.Human) &&
CardFactoryUtil.isCounterable(sp.getSourceCard()) )
ComputerAI_counterSpells.counter_Spell(sp);
ComputerAI_counterSpells2.counter_Spell(sp);
//put code for Standstill here
GameActionUtil.executePlayCardEffects(sp);

View File

@@ -259,6 +259,7 @@ public interface NewConstants {
public static interface OPTIONS {
public static final String TITLE = "%s/NewGame/options/title";
public static final String FONT = "%s/NewGame/options/font";
public static interface GENERATE {
public static final String TITLE = "%s/NewGame/options/generate/title";