Merge pull request #643 from kevlahnota/master

Bug Fix: legend rule, profile stat on main menu and aura curse update on player target
This commit is contained in:
Anthony Calosa
2015-10-14 23:24:41 +08:00
9 changed files with 18 additions and 16 deletions

View File

@@ -90850,7 +90850,7 @@ toughness=1
[/card] [/card]
[card] [card]
name=Skywise Teachings name=Skywise Teachings
auto=@movedto(*[-creature]|mystack):pay[{1}{U}] name(Pay 1U mana) token(Djinn Monk,Creature Djinn Monk,2/2,flying,blue) controller auto=@movedto(*[-creature]|mystack):pay({1}{U}) name(Pay 1U mana) token(Djinn Monk,Creature Djinn Monk,2/2,flying,blue) controller
text=Whenever you cast a noncreature spell, you may pay {1}{U}. If you do, put a 2/2 blue Djinn Monk creature token with flying onto the battlefield. text=Whenever you cast a noncreature spell, you may pay {1}{U}. If you do, put a 2/2 blue Djinn Monk creature token with flying onto the battlefield.
mana={3}{U} mana={3}{U}
type=Enchantment type=Enchantment

View File

@@ -73,6 +73,7 @@ public:
static hgeParticleSystem * Particles[6]; static hgeParticleSystem * Particles[6];
static bool HasMusic; static bool HasMusic;
static string systemError; static string systemError;
static char mynbcardsStr[512];
static JMusic* music; static JMusic* music;
static string currentMusicFile; static string currentMusicFile;
static void playMusic(string filename = "", bool loop = true); static void playMusic(string filename = "", bool loop = true);

View File

@@ -24,7 +24,6 @@ private:
float mCreditsYPos; float mCreditsYPos;
int currentState; int currentState;
int mVolume; int mVolume;
char nbcardsStr[400];
vector<string> langs; vector<string> langs;
vector<string> primitives; vector<string> primitives;
@@ -46,7 +45,6 @@ private:
bool langChoices; bool langChoices;
void runTest(); //!! void runTest(); //!!
void listPrimitives(); void listPrimitives();
void genNbCardsStr(); //computes the contents of nbCardsStr
void ensureMGuiController(); //creates the MGuiController if it doesn't exist void ensureMGuiController(); //creates the MGuiController if it doesn't exist
string loadRandomWallpaper(); //loads a list of string of textures that can be randolmy shown on the loading screen string loadRandomWallpaper(); //loads a list of string of textures that can be randolmy shown on the loading screen
@@ -66,6 +64,7 @@ public:
int nextSetFolder(const string & root, const string & file); // Retrieves the next directory to have matching file int nextSetFolder(const string & root, const string & file); // Retrieves the next directory to have matching file
void createUsersFirstDeck(int setId); void createUsersFirstDeck(int setId);
static void genNbCardsStr(); //computes the contents of nbCardsStr
virtual ostream& toString(ostream& out) const; virtual ostream& toString(ostream& out) const;
enum enum

View File

@@ -39,6 +39,7 @@ bool GameApp::HasMusic = true;
JMusic * GameApp::music = NULL; JMusic * GameApp::music = NULL;
string GameApp::currentMusicFile = ""; string GameApp::currentMusicFile = "";
string GameApp::systemError = ""; string GameApp::systemError = "";
char GameApp::mynbcardsStr[512] = {0};
vector<JQuadPtr > manaIcons; vector<JQuadPtr > manaIcons;

View File

@@ -164,22 +164,22 @@ void GameStateMenu::genNbCardsStr()
PlayerData * playerdata = NEW PlayerData(MTGCollection()); PlayerData * playerdata = NEW PlayerData(MTGCollection());
size_t totalUnique = MTGCollection()->primitives.size(); size_t totalUnique = MTGCollection()->primitives.size();
size_t totalPrints = MTGCollection()->totalCards(); size_t totalPrints = MTGCollection()->totalCards();
if (totalUnique != totalPrints) if (totalUnique != totalPrints)
{ {
if (playerdata && !options[Options::ACTIVE_PROFILE].isDefault()) if (playerdata && !options[Options::ACTIVE_PROFILE].isDefault())
sprintf(nbcardsStr, _("%s: %i cards (%i) (%i unique)").c_str(), options[Options::ACTIVE_PROFILE].str.c_str(), sprintf(GameApp::mynbcardsStr, _("%s: %i cards (%i) (%i unique)").c_str(), options[Options::ACTIVE_PROFILE].str.c_str(),
playerdata->collection->totalCards(), totalPrints,totalUnique); playerdata->collection->totalCards(), totalPrints,totalUnique);
else else
sprintf(nbcardsStr, _("%i cards (%i unique)").c_str(),totalPrints,totalUnique); sprintf(GameApp::mynbcardsStr, _("%i cards (%i unique)").c_str(),totalPrints,totalUnique);
} }
else else
{ {
if (playerdata && !options[Options::ACTIVE_PROFILE].isDefault()) if (playerdata && !options[Options::ACTIVE_PROFILE].isDefault())
sprintf(nbcardsStr, _("%s: %i cards (%i)").c_str(), options[Options::ACTIVE_PROFILE].str.c_str(), sprintf(GameApp::mynbcardsStr, _("%s: %i cards (%i)").c_str(), options[Options::ACTIVE_PROFILE].str.c_str(),
playerdata->collection->totalCards(), totalPrints); playerdata->collection->totalCards(), totalPrints);
else else
sprintf(nbcardsStr, _("%i cards").c_str(),totalPrints); sprintf(GameApp::mynbcardsStr, _("%i cards").c_str(),totalPrints);
} }
SAFE_DELETE(playerdata); SAFE_DELETE(playerdata);
@@ -730,7 +730,7 @@ void GameStateMenu::RenderTopMenu()
mFont->SetScale(DEFAULT_MAIN_FONT_SCALE); mFont->SetScale(DEFAULT_MAIN_FONT_SCALE);
mFont->SetColor(ARGB(128,255,255,255)); mFont->SetColor(ARGB(128,255,255,255));
mFont->DrawString(GAME_VERSION, rightTextPos, 5, JGETEXT_RIGHT); mFont->DrawString(GAME_VERSION, rightTextPos, 5, JGETEXT_RIGHT);
mFont->DrawString(nbcardsStr, leftTextPos, 5); mFont->DrawString(GameApp::mynbcardsStr, leftTextPos, 5);
renderer->FillRect(leftTextPos, 26, 104, 8, ARGB(255, 100, 90, 60)); renderer->FillRect(leftTextPos, 26, 104, 8, ARGB(255, 100, 90, 60));
renderer->FillRect(leftTextPos + 2, 28, (float)(gamePercentComplete()), 4, ARGB(255,220,200, 125)); renderer->FillRect(leftTextPos + 2, 28, (float)(gamePercentComplete()), 4, ARGB(255,220,200, 125));
char buf[512]; char buf[512];
@@ -964,7 +964,6 @@ ostream& GameStateMenu::toString(ostream& out) const
<< " ; mCreditsYPos : " << mCreditsYPos << " ; mCreditsYPos : " << mCreditsYPos
<< " ; currentState : " << currentState << " ; currentState : " << currentState
<< " ; mVolume : " << mVolume << " ; mVolume : " << mVolume
<< " ; nbcardsStr : " << nbcardsStr
<< " ; mCurrentSetName : " << mCurrentSetName << " ; mCurrentSetName : " << mCurrentSetName
<< " ; mCurrentSetFileName : " << mCurrentSetFileName << " ; mCurrentSetFileName : " << mCurrentSetFileName
<< " ; mReadConf : " << mReadConf << " ; mReadConf : " << mReadConf

View File

@@ -1,6 +1,7 @@
#include "PrecompiledHeader.h" #include "PrecompiledHeader.h"
#include "GameStateOptions.h" #include "GameStateOptions.h"
#include "GameStateMenu.h"
#include "GameApp.h" #include "GameApp.h"
#include "OptionItem.h" #include "OptionItem.h"
#include "SimpleMenu.h" #include "SimpleMenu.h"
@@ -167,6 +168,7 @@ void GameStateOptions::Update(float dt)
JSoundSystem::GetInstance()->SetMusicVolume(options[Options::MUSICVOLUME].number); JSoundSystem::GetInstance()->SetMusicVolume(options[Options::MUSICVOLUME].number);
mParent->DoTransition(TRANSITION_FADE, GAME_STATE_MENU); mParent->DoTransition(TRANSITION_FADE, GAME_STATE_MENU);
mState = SHOW_OPTIONS; mState = SHOW_OPTIONS;
GameStateMenu::genNbCardsStr();
break; break;
case WGuiBase::CONFIRM_NEED: case WGuiBase::CONFIRM_NEED:
optionsTabs->yieldFocus(); optionsTabs->yieldFocus();

View File

@@ -5,6 +5,7 @@
#include <JRenderer.h> #include <JRenderer.h>
#include "GameStateShop.h" #include "GameStateShop.h"
#include "GameStateMenu.h"
#include "GameApp.h" #include "GameApp.h"
#include "MTGDeck.h" #include "MTGDeck.h"
#include "MTGPack.h" #include "MTGPack.h"
@@ -840,6 +841,7 @@ void GameStateShop::ButtonPressed(int controllerId, int controlId)
mStage = STAGE_SHOP_SHOP; mStage = STAGE_SHOP_SHOP;
mParent->DoTransition(TRANSITION_FADE, GAME_STATE_MENU); mParent->DoTransition(TRANSITION_FADE, GAME_STATE_MENU);
save(); save();
GameStateMenu::genNbCardsStr();
break; break;
case 14: case 14:
mStage = STAGE_SHOP_TASKS; mStage = STAGE_SHOP_TASKS;

View File

@@ -195,7 +195,7 @@ void GuiPlay::Replace()
for (iterator it = cards.begin(); it != end_spells; ++it) for (iterator it = cards.begin(); it != end_spells; ++it)
if (!(*it)->card->target) if (!(*it)->card->target)
{ {
if((!(*it)->card->hasSubtype(Subtypes::TYPE_AURA)|| ((*it)->card->hasSubtype(Subtypes::TYPE_AURA) && (*it)->card->playerTarget)) && !(*it)->card->hasType(Subtypes::TYPE_PLANESWALKER)) if((!(*it)->card->hasSubtype(Subtypes::TYPE_AURA)|| ((*it)->card->hasSubtype(Subtypes::TYPE_AURA) && !(*it)->card->playerTarget)) && !(*it)->card->hasType(Subtypes::TYPE_PLANESWALKER))
{ {
if (mpDuelLayers->getRenderedPlayer() == (*it)->card->controller()) if (mpDuelLayers->getRenderedPlayer() == (*it)->card->controller())
++selfSpellsN; ++selfSpellsN;
@@ -231,7 +231,7 @@ void GuiPlay::Replace()
for (iterator it = cards.begin(); it != end_spells; ++it) for (iterator it = cards.begin(); it != end_spells; ++it)
if (!(*it)->card->target) if (!(*it)->card->target)
{ {
if((!(*it)->card->hasSubtype(Subtypes::TYPE_AURA)|| ((*it)->card->hasSubtype(Subtypes::TYPE_AURA) && (*it)->card->playerTarget)) && !(*it)->card->hasType(Subtypes::TYPE_PLANESWALKER)) if((!(*it)->card->hasSubtype(Subtypes::TYPE_AURA)|| ((*it)->card->hasSubtype(Subtypes::TYPE_AURA) && !(*it)->card->playerTarget)) && !(*it)->card->hasType(Subtypes::TYPE_PLANESWALKER))
{ {
if (mpDuelLayers->getRenderedPlayer() == (*it)->card->controller()) if (mpDuelLayers->getRenderedPlayer() == (*it)->card->controller())
selfSpells.Enstack(*it); selfSpells.Enstack(*it);

View File

@@ -2518,16 +2518,14 @@ int MTGLegendRule::added(MTGCardInstance * card)
MultiAbility * multi = NEW MultiAbility(game, game->mLayers->actionLayer()->getMaxId(), card, card, NULL); MultiAbility * multi = NEW MultiAbility(game, game->mLayers->actionLayer()->getMaxId(), card, card, NULL);
for(unsigned int i = 0;i < oldCards.size();i++) for(unsigned int i = 0;i < oldCards.size();i++)
{ {
AABuryCard *a = NEW AABuryCard(game, game->mLayers->actionLayer()->getMaxId(), card, oldCards[i]); AAMover *a = NEW AAMover(game, game->mLayers->actionLayer()->getMaxId(), card, oldCards[i],"ownergraveyard","Keep New");
a->menu = "Keep New";
a->oneShot = true; a->oneShot = true;
multi->Add(a); multi->Add(a);
} }
multi->oneShot = 1; multi->oneShot = 1;
MTGAbility * a1 = multi; MTGAbility * a1 = multi;
selection.push_back(a1); selection.push_back(a1);
AABuryCard *b = NEW AABuryCard(game, game->mLayers->actionLayer()->getMaxId(), card, card); AAMover *b = NEW AAMover(game, game->mLayers->actionLayer()->getMaxId(), card, card,"ownergraveyard","Keep Old");
b->menu = "Keep Old";
b->oneShot = true; b->oneShot = true;
MTGAbility * b1 = b; MTGAbility * b1 = b;
selection.push_back(b1); selection.push_back(b1);