Jeck - Hooked economic difficulty into booster prices.
This commit is contained in:
@@ -114,9 +114,6 @@ class Constants
|
||||
RARITY_L = 'L', //Lands
|
||||
RARITY_T = 'T', //Tokens
|
||||
|
||||
//Economic values (Placeholders for stuff later set by economic difficulty)
|
||||
PRICE_FILTER_SCALAR = 4,
|
||||
|
||||
ECON_NORMAL = 0, //Options default to 0.
|
||||
ECON_HARD = 1,
|
||||
ECON_LUCK = 2,
|
||||
|
||||
@@ -22,6 +22,7 @@ class PriceList{
|
||||
int getPurchasePrice(int cardid);
|
||||
int getPrice(int cardId);
|
||||
int setPrice(int cardId, int price);
|
||||
static float difficultyScalar(float price, int cardid=0);
|
||||
static void updateKey() {randomKey = rand();};
|
||||
};
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "../include/Subtypes.h"
|
||||
#include "../include/Translate.h"
|
||||
#include "../include/DeckMetaData.h"
|
||||
#include "../include/PriceList.h"
|
||||
#include <algorithm>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
@@ -336,8 +337,8 @@ bool MTGAllCards::addCardToCollection(MTGCard * card, int setId){
|
||||
|
||||
CardPrimitive * MTGAllCards::addPrimitive(CardPrimitive * primitive, MTGCard * card){
|
||||
int maxGrade = options[Options::MAX_GRADE].number;
|
||||
if (!maxGrade) maxGrade = Constants::GRADE_BORDERLINE;
|
||||
if (currentGrade >maxGrade) {
|
||||
if (!maxGrade) maxGrade = Constants::GRADE_BORDERLINE; //Default setting for grade is borderline?
|
||||
if (currentGrade > maxGrade) {
|
||||
SAFE_DELETE(primitive);
|
||||
return NULL;
|
||||
}
|
||||
@@ -900,7 +901,8 @@ int MTGSetInfo::boosterCost(){
|
||||
price += booster[i] * Constants::PRICE_XR;
|
||||
}
|
||||
|
||||
return price;
|
||||
price += price + PriceList::difficultyScalar(price,setlist.findSet(id));
|
||||
return (price/3); //Boosters only 33% influenced by economic difficulty.
|
||||
}
|
||||
|
||||
string MTGSetInfo::getName(){
|
||||
|
||||
@@ -73,15 +73,14 @@ int PriceList::setPrice(int cardId, int price){
|
||||
int PriceList::getSellPrice(int cardid){
|
||||
return getPurchasePrice(cardid) / 2;
|
||||
}
|
||||
int PriceList::getPurchasePrice(int cardid){
|
||||
float price = (float) getPrice(cardid);
|
||||
float PriceList::difficultyScalar(float price, int cardid){
|
||||
float badluck = (float)(abs(cardid + randomKey) % 201) / 100; //Float between 0 and 2.
|
||||
|
||||
switch(options[Options::ECON_DIFFICULTY].number){
|
||||
case Constants::ECON_EASY:
|
||||
badluck -= 1.5; price /= 2; break; //Price from .25x to .75x, .25x more likely.
|
||||
case Constants::ECON_NORMAL: default:
|
||||
badluck -= 1; break; //price from 1x to 2x, even probability.
|
||||
badluck /= 2; break; //price from 1x to 2x, even probability.
|
||||
case Constants::ECON_HARD:
|
||||
price *= 1.5; break; //price from 1.5x to 3x, 3x being twice as likely.
|
||||
case Constants::ECON_LUCK:
|
||||
@@ -91,3 +90,8 @@ int PriceList::getPurchasePrice(int cardid){
|
||||
else if(badluck < -1) badluck = -1;
|
||||
return (price + price * badluck);
|
||||
}
|
||||
int PriceList::getPurchasePrice(int cardid){
|
||||
float p = difficultyScalar(getPrice(cardid),cardid);
|
||||
if(p < 2) p = 2; //Prevents "Sell for 0 credits"
|
||||
return (int)p;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user