- bug fix in JGE++ audio (improve HBL compatibility)
- Added new rewards in story mode: random card, card (either by "name" or id), specific set
- Story mode: added possibility to choose music, and bg for duel.
-- See "01. Where it all begins" for examples of new features
This commit is contained in:
wagic.the.homebrew@gmail.com
2010-07-19 13:44:26 +00:00
parent acf06d0181
commit 1332842025
22 changed files with 205 additions and 63 deletions
+32
View File
@@ -8,6 +8,7 @@
#include "../include/MTGDeck.h"
#include "../include/GameObserver.h"
#include "../include/GameStateShop.h"
#include "../include/PlayerData.h"
CreditBonus::CreditBonus(int _value, string _text){
value = _value;
@@ -289,6 +290,37 @@ int Credits::addCreditBonus(int value){
SAFE_DELETE(playerdata);
return value;
}
/*
* adds a Card to a deck
* @param cardId id of the card
* @param collection deck representing player's collection
*/
int Credits::addCardToCollection(int cardId, MTGDeck * collection) {
return collection->add(cardId);
}
/*
* adds a Card to player's collection
* prefer to call the above function if you want to add several cards, since saving is expensive
*/
int Credits::addCardToCollection(int cardId) {
MTGAllCards * ac = GameApp::collection;
PlayerData * playerdata = NEW PlayerData(ac);
int result = addCardToCollection(cardId, playerdata->collection);
playerdata->collection->save();
return result;
}
int Credits::unlockSetByName(string name){
int setId = setlist.findSet(name);
if (setId < 0) return 0;
GameOptionAward* goa = (GameOptionAward*) &options[Options::optionSet(setId)];
goa->giveAward();
options.save();
return setId + 1; //We add 1 here to show success/failure. Be sure to subtract later.
}
int Credits::unlockRandomSet(bool force){
int setId = WRand() % setlist.size();