It is currently 23 Apr 2024, 21:36
   
Text Size

fixing quest e cards and changing card sets

Post MTG Forge Related Programming Questions Here

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

fixing quest e cards and changing card sets

Postby mtgrares » 03 Jun 2009, 19:18

The problem is that Gui_Quest_DeckEditor was using the class ReadBoosterPack which reads from common.txt instead of QuestData_BoosterPack which reads from quest-common.txt I personally use Chris's original rarity files for both common.txt and quest-common.txt. I thought it would be good to divide them but who knows?

I wrote this code using wordpad and the code may have small syntax errors.

Code: Select all
QuestData_BoosterPack.java - add this method

public String getRarity(String cardName)
{
  if(commonCreature.contains(cardName) || commonSpell.contains(cardName))
    return "common";
  else if(uncommonCreature.contains(cardName) || uncommonSpell.contains(cardName))
    return "uncommon";
  else if(rareCreature.contains(cardName) || rareSpell.contains(cardName))
    return "rare";
  else
    return "error";
}

Gui_Quest_DeckEditor - I changed one line, ReadBoosterPack to Quest_ReadBoosterPack

  public void updateDisplay(CardList top, CardList bottom)
  {
    topModel.clear();
    bottomModel.clear();

    Card c;
    String cardName;
    Quest_ReadBoosterPack pack = new Quest_ReadBoosterPack();

    ArrayList<String> addedList = AllZone.QuestData.getAddedCards();


    //update top
    for(int i = 0; i < top.size(); i++)
    {
      c = top.get(i);

      cardName = c.getName();
      c.setRarity(pack.getRarity(cardName));

      if(addedList.contains(cardName))
        c.setRarity("new");


      topModel.addCard(c);
    }//for

    //update bottom
    for(int i = 0; i < bottom.size(); i++)
    {
      c = bottom.get(i);


      c.setRarity(pack.getRarity(c.getName()));;

      bottomModel.addCard(c);
    }//for

    topModel.resort();
    bottomModel.resort();
  }//updateDisplay
mtgrares
DEVELOPER
 
Posts: 1352
Joined: 08 Sep 2008, 22:10
Has thanked: 3 times
Been thanked: 12 times

Re: source code - fixing quest e cards

Postby Chris H. » 03 Jun 2009, 19:31

mtgrares wrote:I thought it would be good to divide them but who knows?
I think that with the recent changes that you made to the way cards are distributed to our starting pool will help to alleviate the imbalance that we were seeing in quest mode. :)

It may be difficult for the development team to keep track of and maintain multiple sets of rarity files. If members of our user base chose to create an alternate set of rarity files, great. =D> We can include other people's contribution in a sub-directory ... we could call it "alternate rarity sets". :mrgreen:
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: source code - fixing quest e cards

Postby Rob Cashwalker » 04 Jun 2009, 03:32

One suggestion spawned from the custom card threads, is if there could be an easy way to switch card sets while Forge is running. From my understanding of the code, the cardset gets loaded on startup, I don't know how well the system could handle the switch.
The Force will be with you, Always.
User avatar
Rob Cashwalker
Programmer
 
Posts: 2167
Joined: 09 Sep 2008, 15:09
Location: New York
Has thanked: 5 times
Been thanked: 40 times

Re: source code - fixing quest e cards

Postby DennisBergkamp » 04 Jun 2009, 16:50

Cool thanks, yes this fix works (with some minor tweaks). No annoying e's in quest mode anymore, =D>
User avatar
DennisBergkamp
AI Programmer
 
Posts: 2602
Joined: 09 Sep 2008, 15:46
Has thanked: 0 time
Been thanked: 0 time

Re: source code - fixing quest e cards

Postby mtgrares » 04 Jun 2009, 18:22

Rob Cashwalker wrote:One suggestion spawned from the custom card threads, is if there could be an easy way to switch card sets while Forge is running. From my understanding of the code, the cardset gets loaded on startup, I don't know how well the system could handle the switch.
The card files could be changed by the user, with some minor tweaking. Maybe let the user select which files are read for the different rarities: common, uncommon, rare. The only reason why I haven't added this feature is because I wouldn't use it but I understand how other people would.
mtgrares
DEVELOPER
 
Posts: 1352
Joined: 08 Sep 2008, 22:10
Has thanked: 3 times
Been thanked: 12 times

Re: source code - fixing quest e cards

Postby mtgrares » 09 Jun 2009, 18:11

Mostly I just have to update the gui, the coding isn't that hard.
mtgrares
DEVELOPER
 
Posts: 1352
Joined: 08 Sep 2008, 22:10
Has thanked: 3 times
Been thanked: 12 times


Return to Developer's Corner

Who is online

Users browsing this forum: Google [Bot] and 44 guests


Who is online

In total there are 45 users online :: 1 registered, 0 hidden and 44 guests (based on users active over the past 10 minutes)
Most users ever online was 4143 on 23 Jan 2024, 08:21

Users browsing this forum: Google [Bot] and 44 guests

Login Form