MTG Forge 06-12
by mtgrares
Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins
MTG Forge 06-12
by mtgrares » 12 Jun 2009, 17:40
Download 06-12
Hi this version is just a minor update of the 06-06 version. I made two minor changes.
1. The "Generate Deck" option for Constructed or Sealed ensures that all of your creatures will have at least an attacking power of 2. (I got tired of puny 1/1s and this code does eleminate */* creatures like Nightmare and Serra Avatar.)
2. In the quest deck editor "AI Menu" there is a new option called "Add Card" which lets you add a card to your current cardpool, aka. this lets you cheat. You can see the "AI Menu" by creating a file named "edit" in the MTG Forge directory.
Maybe I should add a cheat menu and add this option, what do you think?
I used Chris's all rarities for common.txt, uncommon.txt, rare.txt and quest-common.txt, quest-uncommon.txt, quest-rare.txt
////////////////////////////////
Dennis,
Here are my small changes. When I tried to compile QuestData_BoosterPack the compiler said that it add some error message with the method addAll(), because it didn't know which addAll() method to use, so I changed the code so that it would compile. I just changed ArrayList<?> to ArrayList<String>.
QuestData_BoosterPack.java
Hi this version is just a minor update of the 06-06 version. I made two minor changes.
1. The "Generate Deck" option for Constructed or Sealed ensures that all of your creatures will have at least an attacking power of 2. (I got tired of puny 1/1s and this code does eleminate */* creatures like Nightmare and Serra Avatar.)
2. In the quest deck editor "AI Menu" there is a new option called "Add Card" which lets you add a card to your current cardpool, aka. this lets you cheat. You can see the "AI Menu" by creating a file named "edit" in the MTG Forge directory.
Maybe I should add a cheat menu and add this option, what do you think?
I used Chris's all rarities for common.txt, uncommon.txt, rare.txt and quest-common.txt, quest-uncommon.txt, quest-rare.txt
////////////////////////////////
Dennis,
Here are my small changes. When I tried to compile QuestData_BoosterPack the compiler said that it add some error message with the method addAll(), because it didn't know which addAll() method to use, so I changed the code so that it would compile. I just changed ArrayList<?> to ArrayList<String>.
QuestData_BoosterPack.java
- Code: Select all
//nCommon is the number of common cards
@SuppressWarnings("unchecked")
private ArrayList<String> getNewCards(int nCommon, int nUncommon, int nRare)
{
ArrayList<String> out = new ArrayList<String>();
out.addAll(getCommon(nCommon));
out.addAll(getCommon(nUncommon));
out.addAll(getCommon(nRare));
return out;
}//getNewCards()
1. changed GenerateSealedDeck.filterBadCards() - removes creatures with power less than 2
private CardList filterBadCards(CardList list)
{
//remove "bad" and multi-colored cards
final ArrayList<String> remove = new ArrayList<String>();
remove.add("Force of Savagery");
remove.add("Darksteel Colossus");
remove.add("Jokulhaups");
remove.add("Steel Wall");
remove.add("Ornithopter");
remove.add("Sarcomite Myr");
CardList out = list.filter(new CardListFilter()
{
public boolean addCard(Card c)
{
if(c.isCreature() && c.getBaseAttack() < 2)
return false;
return CardUtil.getColors(c).size() == 1 && !remove.contains(c.getName());
}
});
return out;
}//filterBadCards()
////////////////////////////////////////////////////////////////////////////////
2. changed GenerateConstructedDeck.filterBadCards() - removes creatures with power less than 2
private CardList filterBadCards(CardList list)
{
//remove "bad" and multi-colored cards
final ArrayList<String> remove = new ArrayList<String>();
remove.add("Sarcomite Myr");
remove.add("Force of Savagery");
remove.add("Darksteel Colossus");
remove.add("Jokulhaups");
remove.add("Steel Wall");
remove.add("Ornithopter");
remove.add("Amnesia");
remove.add("Battle of Wits");
remove.add("Ashes to Ashes");
remove.add("Haunted Angel");
remove.add("Sky Swallower");
remove.add("Magus of the Library");
remove.add("The Unspeakable");
remove.add("Wall of Kelp");
remove.add("Incendiary Command");
remove.add("Memnarch");
remove.add("Plague Wind");
remove.add("Klaas, Elf Friend");
remove.add("Delirium Skeins");
remove.add("Undying Beast");
remove.add("Wit's End");
remove.add("Blinding Light");
remove.add("Hymn to Tourach");
//useless, or combo cards:
remove.add("Aluren");
remove.add("Conspiracy");
remove.add("Crucible of Fire");
remove.add("Verduran Enchantress");
remove.add("Enchantress's Presence");
remove.add("Mesa Enchantress");
remove.add("Moat");
remove.add("Magus of the Moat");
remove.add("Relentless Rats");
remove.add("Vedalken Archmage");
remove.add("Hatching Plans");
remove.add("Sensation Gorger");
//cards the AI cannot play:
remove.add("Sensei's Divining Top");
remove.add("Standstill");
remove.add("Counterspell");
remove.add("Exclude");
remove.add("Remove Soul");
remove.add("Punish Ignorance");
remove.add("Remand");
remove.add("Mystic Snake");
remove.add("Absorb");
remove.add("Undermine");
remove.add("Overwhelming Intellect");
final ArrayList<Card> goodLand = new ArrayList<Card>();
//goodLand.add("Faerie Conclave");
//goodLand.add("Forbidding Watchtower");
//goodLand.add("Treetop Village");
CardList out = list.filter(new CardListFilter()
{
public boolean addCard(Card c)
{
if(c.isCreature() && c.getBaseAttack() < 2)
return false;
return CardUtil.getColors(c).size() == 1 && //no gold colored cards
!c.isLand() && //no land
!remove.contains(c.getName()) || //OR very important
goodLand.contains(c.getName());
}
});
return out;
}//filterBadCards()
////////////////////////////////////////////////////////////////////////////////
2. changed Gui_Quest_DeckEditor_Menu.setupComputerMenu() - adds "Add Card" to quest deck editor "AI Deck" menu
import javax.swing.event.*; //add this import statement
//edit the AI decks
private void setupComputerMenu()
{
JMenuItem open = new JMenuItem("Open");
JMenuItem new2 = new JMenuItem("New");
JMenuItem rename = new JMenuItem("Rename");
JMenuItem save = new JMenuItem("Save");
JMenuItem copy = new JMenuItem("Copy");
JMenuItem delete = new JMenuItem("Delete");
JMenuItem exit = new JMenuItem("Exit");
//adds a card to human player's cardpool
JMenuItem addCard = new JMenuItem("Add Card");
JMenuItem viewAllDecks = new JMenuItem("View All Decks");
//add card
addCard.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent a)
{
CardList cardList = AllZone.CardFactory.getAllCards();
TableSorter sorter = new TableSorter(cardList, 1, true);
cardList.sort(sorter);
final Card[] card = cardList.toArray();
final JList list = new JList(card);
list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
list.addListSelectionListener(new ListSelectionListener()
{
public void valueChanged(ListSelectionEvent e)
{
CardDetail cd = (CardDetail)deckDisplay;
cd.updateCardDetail((Card)list.getSelectedValue());
}
});
Object[] o = {"Add Card to Your Cardpool", "The number next to the card name doesn't mean anything", new JScrollPane(list)};
JOptionPane pane = new JOptionPane(o, JOptionPane.INFORMATION_MESSAGE, JOptionPane.OK_CANCEL_OPTION);
JDialog dialog = pane.createDialog(null, "Add Card");
dialog.setModal(true);
dialog.setVisible(true);
Object choice = pane.getValue();
boolean cancel = false;
//there are a ton of ways to cancel
if(
choice == null ||
choice.equals(JOptionPane.UNINITIALIZED_VALUE)
)
cancel = true;
else
{
int n = ((Integer)choice).intValue();
if(n == JOptionPane.CANCEL_OPTION)
cancel = true;
}
if(cancel || list.getSelectedValue() == null)
System.out.println("cancelled");
else
{
System.out.println(list.getSelectedValue());
Card c = (Card) list.getSelectedValue();
Gui_Quest_DeckEditor g = (Gui_Quest_DeckEditor)deckDisplay;
TableModel table = g.getTopTableModel();
table.addCard(c);
table.resort();
}
}//actionPerformed()
});//add card
//AI
viewAllDecks.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent a)
{
ArrayList nameList = questData.ai_getDeckNames();
Collections.sort(nameList);
Deck deck;
String allText = "";
for(int i = 0; i < nameList.size(); i++)
{
deck = questData.ai_getDeck(nameList.get(i).toString());
allText += deck.getName() +"\r\n";
allText += getExportDeckText(deck);
allText += "++++++++++++++++++++++++++++++++++++++++++++++++++++++ \r\n \r\n";
}
JTextArea area = new JTextArea(allText, 30, 30);
JOptionPane.showMessageDialog(null, new JScrollPane(area));
}//actionPerformed()
});//viewAllDecks
//AI
open.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent a)
{
String deckName = getUserInput_OpenDeck(questData.ai_getDeckNames());
//check if user selected "cancel"
if(deckName.equals(""))
return;
setComputerPlayer(deckName);
Deck d = questData.ai_getDeck(deckName);
CardList deck = new CardList();
for(int i = 0; i < d.countMain(); i++)
deck.add(AllZone.CardFactory.getCard(d.getMain(i), ""));
CardList cardpool = AllZone.CardFactory.getAllCards();
deckDisplay.updateDisplay(cardpool, deck);
}
});//open
//AI
new2.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent a)
{
deckDisplay.updateDisplay(AllZone.CardFactory.getAllCards(), new CardList());
setComputerPlayer("");
}
});//new
//AI
rename.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent a)
{
String name = getUserInput_GetDeckName(questData.ai_getDeckNames());
//check if user cancels
if(name.equals(""))
return;
//is the current deck already saved and in QuestData?
if(questData.ai_getDeckNames().contains(currentDeck.getName()))
questData.ai_removeDeck(currentDeck.getName());//remove old deck
currentDeck.setName(name);
Deck deck = convertCardListToDeck(deckDisplay.getBottom());
deck.setName(name);
questData.ai_addDeck(deck);
setComputerPlayer(name);
}
});//rename
//AI
save.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent a)
{
String name = currentDeck.getName();
//check to see if name is set
if(name.equals(""))
{
name = getUserInput_GetDeckName(questData.ai_getDeckNames());
//check if user cancels
if(name.equals(""))
return;
}
setComputerPlayer(name);
Deck deck = convertCardListToDeck(deckDisplay.getBottom());
deck.setName(name);
questData.ai_addDeck(deck);
}
});//save
//AI
copy.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent a)
{
String name = getUserInput_GetDeckName(questData.ai_getDeckNames());
//check if user cancels
if(name.equals(""))
return;
setComputerPlayer(name);
Deck deck = convertCardListToDeck(deckDisplay.getBottom());
deck.setName(name);
questData.ai_addDeck(deck);
}
});//copy
//AI
delete.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent a)
{
if(currentDeck == null || currentDeck.getName().equals(""))
return;
int check = JOptionPane.showConfirmDialog(null, "Do you really want to delete this deck?", "Delete", JOptionPane.YES_NO_OPTION);
if(check == JOptionPane.NO_OPTION)
return;//stop here
questData.ai_removeDeck(currentDeck.getName());
//show card pool
CardList cardpool = AllZone.CardFactory.getAllCards();
deckDisplay.updateDisplay(cardpool, new CardList());
setComputerPlayer("");
}
});//delete
//AI
exit.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent a)
{
Gui_Quest_DeckEditor_Menu.this.close();
}
});
JMenu deckMenu = new JMenu("AI Deck");
deckMenu.add(addCard);//not sure where to put this
deckMenu.addSeparator();
deckMenu.add(open);
deckMenu.add(rename);
deckMenu.add(new2);
deckMenu.add(save);
deckMenu.add(copy);
deckMenu.addSeparator();
addImportExport(deckMenu, false);
deckMenu.add(viewAllDecks);
deckMenu.addSeparator();
deckMenu.add(delete);
deckMenu.addSeparator();
deckMenu.add(exit);
this.add(deckMenu);
}//setupComputerMenu()
- mtgrares
- DEVELOPER
- Posts: 1352
- Joined: 08 Sep 2008, 22:10
- Has thanked: 3 times
- Been thanked: 12 times
Re: MTG Forge 06-12
by Rob Cashwalker » 12 Jun 2009, 18:11
I understand your logic, but I don't like the results. There are a lot of french vanilla creatures that are powerful even though they're 1/*. This also might eliminate some walls, which have value. I tend to play the generated decks a lot, so this affects me more than those who play mainly in quest mode. In quest mode, this sort of change to the card selection process may be more valuable.mtgrares wrote:1. The "Generate Deck" option for Constructed or Sealed ensures that all of your creatures will have at least an attacking power of 2. (I got tired of puny 1/1s and this code does eleminate */* creatures like Nightmare and Serra Avatar.)
The Force will be with you, Always.
-
Rob Cashwalker - Programmer
- Posts: 2167
- Joined: 09 Sep 2008, 15:09
- Location: New York
- Has thanked: 5 times
- Been thanked: 40 times
Re: MTG Forge 06-12
by mtgrares » 12 Jun 2009, 18:14
The filtering probably should be made into an option instead of mandatory, but it was just easier to program that way.
- mtgrares
- DEVELOPER
- Posts: 1352
- Joined: 08 Sep 2008, 22:10
- Has thanked: 3 times
- Been thanked: 12 times
Re: MTG Forge 06-12
by GandoTheBard » 12 Jun 2009, 18:27
I think it would be brilliant if the players had control over what gets filtered. Particularly if there are wild cards so that you could filter say no fliers etc. Might make for some strange decks but hey strange is good sometimes.mtgrares wrote:The filtering probably should be made into an option instead of mandatory, but it was just easier to program that way.
visit my personal homepage here: http://outofthebrokensky.com
Listen to my podcast with famed AJ_Impy "Freed from the Real" on http://puremtgo.com
Listen to my podcast with famed AJ_Impy "Freed from the Real" on http://puremtgo.com
-
GandoTheBard - Tester
- Posts: 1043
- Joined: 06 Sep 2008, 18:43
- Has thanked: 0 time
- Been thanked: 0 time
Re: MTG Forge 06-12
by Mr.Chaos » 13 Jun 2009, 05:28
I will skip this "update" because of the filtering of 1/1 - 1/* and */* creatures in Generated decks.
Frankly, I don't understand why you would make this change.
Sorry, but that is just the way I feel about it.
Frankly, I don't understand why you would make this change.
Sorry, but that is just the way I feel about it.
= coder at work, according to a coder.It does explain some of the bugs.
- Mr.Chaos
- Tester
- Posts: 625
- Joined: 06 Sep 2008, 08:15
- Has thanked: 0 time
- Been thanked: 0 time
Re: MTG Forge 06-12
by DennisBergkamp » 13 Jun 2009, 20:07
I will try to add this as an option ... not sure what I should call it yet. "Filter boring creatures"?
-
DennisBergkamp - AI Programmer
- Posts: 2602
- Joined: 09 Sep 2008, 15:46
- Has thanked: 0 time
- Been thanked: 0 time
Re: MTG Forge 06-12
by Chris H. » 13 Jun 2009, 21:19
I am partial to "Weenie Filter"DennisBergkamp wrote:I will try to add this as an option ... not sure what I should call it yet. "Filter boring creatures"?
-
Chris H. - Forge Moderator
- Posts: 6320
- Joined: 04 Nov 2008, 12:11
- Location: Mac OS X Yosemite
- Has thanked: 644 times
- Been thanked: 643 times
Re: MTG Forge 06-12
by Rob Cashwalker » 14 Jun 2009, 00:05
I like that.Chris H. wrote:I am partial to "Weenie Filter"DennisBergkamp wrote:I will try to add this as an option ... not sure what I should call it yet. "Filter boring creatures"?
The Force will be with you, Always.
-
Rob Cashwalker - Programmer
- Posts: 2167
- Joined: 09 Sep 2008, 15:09
- Location: New York
- Has thanked: 5 times
- Been thanked: 40 times
Re: MTG Forge 06-12
by slyphidine » 15 Jun 2009, 14:06
I just updated and the stacking and equipment are a welcome improvement.
Oddly, I found that Spawnwrithe tokens stack as well. Does all mass token production stack like the lands?
This continues to be amazing. Thanks for your hard work!
Oddly, I found that Spawnwrithe tokens stack as well. Does all mass token production stack like the lands?
This continues to be amazing. Thanks for your hard work!
- slyphidine
- Posts: 11
- Joined: 07 Oct 2008, 20:53
- Has thanked: 0 time
- Been thanked: 1 time
Re: MTG Forge 06-12
by DennisBergkamp » 15 Jun 2009, 16:09
All (non-equipped) tokens with the same name stack now
-
DennisBergkamp - AI Programmer
- Posts: 2602
- Joined: 09 Sep 2008, 15:46
- Has thanked: 0 time
- Been thanked: 0 time
Re: MTG Forge 06-12
by mtgrares » 15 Jun 2009, 18:48
- mtgrares
- DEVELOPER
- Posts: 1352
- Joined: 08 Sep 2008, 22:10
- Has thanked: 3 times
- Been thanked: 12 times
11 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 77 guests