ReadPriceList
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins
1 post
• Page 1 of 1
ReadPriceList
by 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:
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) {
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
1 post
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 26 guests