Erwan
- Fix issue 291 (cantbeblockedby segfault) - Fix some issues with pricing
This commit is contained in:
@@ -1212,6 +1212,7 @@ class AProtectionFrom: public MTGAbility{
|
||||
|
||||
AProtectionFrom * clone() const{
|
||||
AProtectionFrom * a = NEW AProtectionFrom(*this);
|
||||
a->fromTc = fromTc->clone();
|
||||
a->isClone = 1;
|
||||
return a;
|
||||
}
|
||||
@@ -1244,6 +1245,7 @@ class ACantBeBlockedBy: public MTGAbility{
|
||||
|
||||
ACantBeBlockedBy * clone() const{
|
||||
ACantBeBlockedBy * a = NEW ACantBeBlockedBy(*this);
|
||||
a->fromTc = fromTc->clone();
|
||||
a->isClone = 1;
|
||||
return a;
|
||||
}
|
||||
|
||||
@@ -126,6 +126,7 @@ private:
|
||||
string newDeckname;
|
||||
StatsWrapper stw;
|
||||
bool mSwitching;
|
||||
void saveDeck(); //Saves the deck and additional necessary information
|
||||
|
||||
public:
|
||||
GameStateDeckViewer(GameApp* parent);
|
||||
|
||||
@@ -227,6 +227,12 @@ void GameStateDeckViewer::addRemove(MTGCard * card){
|
||||
loadIndexes();
|
||||
}
|
||||
|
||||
void GameStateDeckViewer::saveDeck(){
|
||||
myDeck->save();
|
||||
playerdata->save();
|
||||
pricelist->save();
|
||||
}
|
||||
|
||||
void GameStateDeckViewer::Update(float dt)
|
||||
{
|
||||
|
||||
@@ -241,7 +247,7 @@ void GameStateDeckViewer::Update(float dt)
|
||||
if(newDeckname != ""){
|
||||
if(myDeck && myDeck->parent){
|
||||
myDeck->parent->meta_name = newDeckname;
|
||||
myDeck->save();
|
||||
saveDeck();
|
||||
}
|
||||
mStage = STAGE_WAITING;
|
||||
}
|
||||
@@ -1469,9 +1475,7 @@ void GameStateDeckViewer::ButtonPressed(int controllerId, int controlId)
|
||||
{
|
||||
|
||||
case 0:
|
||||
myDeck->save();
|
||||
playerdata->save();
|
||||
pricelist->save();
|
||||
saveDeck();
|
||||
mParent->DoTransition(TRANSITION_FADE,GAME_STATE_MENU);
|
||||
break;
|
||||
case 1:
|
||||
@@ -1507,7 +1511,7 @@ void GameStateDeckViewer::ButtonPressed(int controllerId, int controlId)
|
||||
int rnd = (rand() % 25);
|
||||
playerdata->credits += price;
|
||||
price = price - (rnd * price)/100;
|
||||
pricelist->setPrice(card->getMTGId(),price*2);
|
||||
pricelist->setPrice(card->getMTGId(),price);
|
||||
playerdata->collection->remove(card->getMTGId());
|
||||
displayed_deck->Remove(card,1);
|
||||
displayed_deck->validate();
|
||||
|
||||
@@ -74,7 +74,7 @@ int PriceList::setPrice(int cardId, int price){
|
||||
return price;
|
||||
}
|
||||
int PriceList::getSellPrice(int cardid){
|
||||
return getPurchasePrice(cardid) / 2;
|
||||
return getPrice(cardid);
|
||||
}
|
||||
float PriceList::difficultyScalar(float price, int cardid){
|
||||
float badluck = (float)(abs(cardid + randomKey) % 201) / 100; //Float between 0 and 2.
|
||||
|
||||
Reference in New Issue
Block a user