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