It is currently 27 Jun 2025, 17:53
   
Text Size

MTGForge 05/28 (unofficial BETA) version

Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins

Re: MTGForge 05/28 (unofficial BETA) version

Postby mtgrares » 29 May 2009, 17:35

You can read about my (failed) phone interview on my blog, here.

There are two new features: you can add cards to your quest pool and you can sort using the Deck Editor (non-quest). You can also sort according to the card's placement in cards.txt, so the new cards are at the top. (I'm working on sorting all of the cards by set, with the newest sets first.)

I wanted to be able to add a card to my quest cardpool, so I made an option in the "AI Deck" menu which you will see if you have a file named "edit" in the MTG Forge directory. I enjoy using new cards but I also play mostly quest, so I wanted to be able to use new cards while I'm questing.

And secondly I wanted to be able to see which cards are new, so the regular non-quest Deck Editor will have a sort menu that lets you sort by name, color, type, mana cost, rarity or "New Card First" which sorts the cards according to their order in cards.txt
mtgrares
DEVELOPER
 
Posts: 1352
Joined: 08 Sep 2008, 22:10
Has thanked: 3 times
Been thanked: 12 times

Re: MTGForge 05/28 (unofficial BETA) version

Postby Chris H. » 30 May 2009, 17:12

I like how the buttons in the Deck Editor now state "Add Card" and "Remove Card". Nice! :)
User avatar
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: MTGForge 05/28 (unofficial BETA) version

Postby mtgrares » 01 Jun 2009, 17:23

I forgot post the code to add "Add Card" to the quest deck editor AI menu. The new version has flashback which is cool. I presume you are using (abusing) SpellAbility.canPlay(). Part of the AI will now have to search the computer's hand and graveyard since we now have flashback.

Code: Select all
updated Gui_Quest_DeckEditor_Menu.setupComputerMenu()

  //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: MTGForge 05/28 (unofficial BETA) version

Postby DennisBergkamp » 01 Jun 2009, 17:48

I'll add this in!

Yes, the AI will use spells with flashback too by the way, I had to hack this in.
User avatar
DennisBergkamp
AI Programmer
 
Posts: 2602
Joined: 09 Sep 2008, 15:46
Has thanked: 0 time
Been thanked: 0 time

Re: MTGForge 05/28 (unofficial BETA) version

Postby mtgrares » 01 Jun 2009, 17:55

DennisBergkamp wrote:Yes, the AI will use spells with flashback too by the way, I had to hack this in.
Very cool indeed, thanks.
mtgrares
DEVELOPER
 
Posts: 1352
Joined: 08 Sep 2008, 22:10
Has thanked: 3 times
Been thanked: 12 times

Re: MTGForge 05/28 (unofficial BETA) version

Postby Arcanis222 » 01 Jun 2009, 17:57

Persist And Flashback!?
The Next Beta should be awesome!
Arcanis222
 
Posts: 61
Joined: 26 May 2009, 20:48
Has thanked: 0 time
Been thanked: 0 time

Re: MTGForge 05/28 (unofficial BETA) version

Postby tchiseen » 02 Jun 2009, 07:39

Lookin' good.

I just found a bit of a bug - I had a Slith Bloodletter with counters on it, my opponent Threaten 'd it, it hit me, got another token, and then next turn it came back to me with 0 counters on it. Sad face.
tchiseen
 
Posts: 69
Joined: 30 May 2009, 15:37
Has thanked: 1 time
Been thanked: 7 times

Previous

Return to Forge

Who is online

Users browsing this forum: No registered users and 50 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 50 users online :: 0 registered, 0 hidden and 50 guests (based on users active over the past 10 minutes)
Most users ever online was 5050 on 26 Jun 2025, 06:02

Users browsing this forum: No registered users and 50 guests

Login Form