It is currently 09 Sep 2025, 11:04
   
Text Size

ReadPriceList

Post MTG Forge Related Programming Questions Here

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

ReadPriceList

Postby Rob Cashwalker » 04 Jul 2010, 15:46

I committed a change to ReadPriceList.

It randomly modifies the prices as it reads the file.

90% of the time the modification is +/- 0-10%.
10% of the time the modification is +/- 0-50%.

This is the section I changed:
Code: Select all
                    try {
                        long val = Long.parseLong(price.trim());

                        if(!(name.equals("Plains") || name.equals("Island") || name.equals("Swamp") || name.equals("Mountain") || name.equals("Forest") ||
                            name.equals("Snow-Covered Plains") || name.equals("Snow-Covered Island") || name.equals("Snow-Covered Swamp") || name.equals("Snow-Covered Mountain") || name.equals("Snow-Covered Forest") ))
                        {                       
                           float ff = 0;
                           if (r.nextInt(100) < 90)   // +/- 10%
                              ff = (float) r.nextInt(10) * (float) .01;
                           else                  // +/- 50%
                              ff = (float) r.nextInt(50) * (float) .01;
                          
                           if (r.nextInt(100) < 50) // -ff%
                              val = (long) ((float) val * ((float) 1 - ff));
                           else       // +ff%
                              val = (long) ((float) val * ((float) 1 + ff));
                        }
                       
                        map.put(name, val);
                     } catch (NumberFormatException nfe) {
It's kinda cool, you can hope for a better price to come along.... My most valuable card is Demonic Tutor, and it hovers in the 1000-1100 range, but one time it hit somewhere around 1600.
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

Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 26 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 26 users online :: 0 registered, 0 hidden and 26 guests (based on users active over the past 10 minutes)
Most users ever online was 7303 on 15 Jul 2025, 20:46

Users browsing this forum: No registered users and 26 guests

Login Form