Page 1 of 1

fixing quest e cards and changing card sets

PostPosted: 03 Jun 2009, 19:18
by mtgrares
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

Re: source code - fixing quest e cards

PostPosted: 03 Jun 2009, 19:31
by Chris H.
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:

Re: source code - fixing quest e cards

PostPosted: 04 Jun 2009, 03:32
by Rob Cashwalker
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.

Re: source code - fixing quest e cards

PostPosted: 04 Jun 2009, 16:50
by DennisBergkamp
Cool thanks, yes this fix works (with some minor tweaks). No annoying e's in quest mode anymore, =D>

Re: source code - fixing quest e cards

PostPosted: 04 Jun 2009, 18:22
by mtgrares
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.

Re: source code - fixing quest e cards

PostPosted: 09 Jun 2009, 18:11
by mtgrares
Mostly I just have to update the gui, the coding isn't that hard.