From 3635137906794eab05a0645157c0cd9846fe64d2 Mon Sep 17 00:00:00 2001 From: Anthony Calosa Date: Wed, 14 Oct 2015 20:04:29 +0800 Subject: [PATCH 1/4] fix legend rule MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 704.5k If a player controls two or more legendary permanents with the same name, that player chooses one of them, and the rest are put into their owners’ graveyards. This is called the “legend rule.” bury is destroy without regenerate, so when two legends of the same name has indestructible, bury will have no effect... I changed it to put into owners graveyard instead using mover... --- projects/mtg/bin/Res/sets/primitives/mtg.txt | 2 +- projects/mtg/src/MTGRules.cpp | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/projects/mtg/bin/Res/sets/primitives/mtg.txt b/projects/mtg/bin/Res/sets/primitives/mtg.txt index 9531c0e06..9581a0030 100644 --- a/projects/mtg/bin/Res/sets/primitives/mtg.txt +++ b/projects/mtg/bin/Res/sets/primitives/mtg.txt @@ -90850,7 +90850,7 @@ toughness=1 [/card] [card] 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. mana={3}{U} type=Enchantment diff --git a/projects/mtg/src/MTGRules.cpp b/projects/mtg/src/MTGRules.cpp index 6b982ce95..0fccefa61 100644 --- a/projects/mtg/src/MTGRules.cpp +++ b/projects/mtg/src/MTGRules.cpp @@ -2518,16 +2518,14 @@ int MTGLegendRule::added(MTGCardInstance * card) MultiAbility * multi = NEW MultiAbility(game, game->mLayers->actionLayer()->getMaxId(), card, card, NULL); for(unsigned int i = 0;i < oldCards.size();i++) { - AABuryCard *a = NEW AABuryCard(game, game->mLayers->actionLayer()->getMaxId(), card, oldCards[i]); - a->menu = "Keep New"; + AAMover *a = NEW AAMover(game, game->mLayers->actionLayer()->getMaxId(), card, oldCards[i],"ownergraveyard","Keep New"); a->oneShot = true; multi->Add(a); } multi->oneShot = 1; MTGAbility * a1 = multi; selection.push_back(a1); - AABuryCard *b = NEW AABuryCard(game, game->mLayers->actionLayer()->getMaxId(), card, card); - b->menu = "Keep Old"; + AAMover *b = NEW AAMover(game, game->mLayers->actionLayer()->getMaxId(), card, card,"ownergraveyard","Keep Old"); b->oneShot = true; MTGAbility * b1 = b; selection.push_back(b1); From 626f0677f798edfe60763d2df2d1bd9ade450c9e Mon Sep 17 00:00:00 2001 From: Anthony Calosa Date: Wed, 14 Oct 2015 21:26:22 +0800 Subject: [PATCH 2/4] Fix profile status on upper left of main menu The profile status on the upper left of main menu should update now when changing user profiles...:) --- projects/mtg/include/GameApp.h | 1 + projects/mtg/include/GameStateMenu.h | 3 +-- projects/mtg/src/GameApp.cpp | 1 + projects/mtg/src/GameStateMenu.cpp | 13 ++++++------- projects/mtg/src/GameStateOptions.cpp | 2 ++ 5 files changed, 11 insertions(+), 9 deletions(-) diff --git a/projects/mtg/include/GameApp.h b/projects/mtg/include/GameApp.h index eeb1c8141..d672e45bf 100644 --- a/projects/mtg/include/GameApp.h +++ b/projects/mtg/include/GameApp.h @@ -73,6 +73,7 @@ public: static hgeParticleSystem * Particles[6]; static bool HasMusic; static string systemError; + static char mynbcardsStr[512]; static JMusic* music; static string currentMusicFile; static void playMusic(string filename = "", bool loop = true); diff --git a/projects/mtg/include/GameStateMenu.h b/projects/mtg/include/GameStateMenu.h index d8fb9106a..6b4b3f205 100644 --- a/projects/mtg/include/GameStateMenu.h +++ b/projects/mtg/include/GameStateMenu.h @@ -24,7 +24,6 @@ private: float mCreditsYPos; int currentState; int mVolume; - char nbcardsStr[400]; vector langs; vector primitives; @@ -46,7 +45,6 @@ private: bool langChoices; void runTest(); //!! void listPrimitives(); - void genNbCardsStr(); //computes the contents of nbCardsStr 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 @@ -66,6 +64,7 @@ public: int nextSetFolder(const string & root, const string & file); // Retrieves the next directory to have matching file void createUsersFirstDeck(int setId); + static void genNbCardsStr(); //computes the contents of nbCardsStr virtual ostream& toString(ostream& out) const; enum diff --git a/projects/mtg/src/GameApp.cpp b/projects/mtg/src/GameApp.cpp index 7dc82def3..c207594c2 100644 --- a/projects/mtg/src/GameApp.cpp +++ b/projects/mtg/src/GameApp.cpp @@ -39,6 +39,7 @@ bool GameApp::HasMusic = true; JMusic * GameApp::music = NULL; string GameApp::currentMusicFile = ""; string GameApp::systemError = ""; +char GameApp::mynbcardsStr[512] = {0}; vector manaIcons; diff --git a/projects/mtg/src/GameStateMenu.cpp b/projects/mtg/src/GameStateMenu.cpp index d10fcaa2d..9845c291e 100644 --- a/projects/mtg/src/GameStateMenu.cpp +++ b/projects/mtg/src/GameStateMenu.cpp @@ -164,22 +164,22 @@ void GameStateMenu::genNbCardsStr() PlayerData * playerdata = NEW PlayerData(MTGCollection()); size_t totalUnique = MTGCollection()->primitives.size(); size_t totalPrints = MTGCollection()->totalCards(); - + if (totalUnique != totalPrints) { 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); else - sprintf(nbcardsStr, _("%i cards (%i unique)").c_str(),totalPrints,totalUnique); + sprintf(GameApp::mynbcardsStr, _("%i cards (%i unique)").c_str(),totalPrints,totalUnique); } else { 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); else - sprintf(nbcardsStr, _("%i cards").c_str(),totalPrints); + sprintf(GameApp::mynbcardsStr, _("%i cards").c_str(),totalPrints); } SAFE_DELETE(playerdata); @@ -730,7 +730,7 @@ void GameStateMenu::RenderTopMenu() mFont->SetScale(DEFAULT_MAIN_FONT_SCALE); mFont->SetColor(ARGB(128,255,255,255)); 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 + 2, 28, (float)(gamePercentComplete()), 4, ARGB(255,220,200, 125)); char buf[512]; @@ -964,7 +964,6 @@ ostream& GameStateMenu::toString(ostream& out) const << " ; mCreditsYPos : " << mCreditsYPos << " ; currentState : " << currentState << " ; mVolume : " << mVolume - << " ; nbcardsStr : " << nbcardsStr << " ; mCurrentSetName : " << mCurrentSetName << " ; mCurrentSetFileName : " << mCurrentSetFileName << " ; mReadConf : " << mReadConf diff --git a/projects/mtg/src/GameStateOptions.cpp b/projects/mtg/src/GameStateOptions.cpp index 5817744fe..95d4856c9 100644 --- a/projects/mtg/src/GameStateOptions.cpp +++ b/projects/mtg/src/GameStateOptions.cpp @@ -1,6 +1,7 @@ #include "PrecompiledHeader.h" #include "GameStateOptions.h" +#include "GameStateMenu.h" #include "GameApp.h" #include "OptionItem.h" #include "SimpleMenu.h" @@ -167,6 +168,7 @@ void GameStateOptions::Update(float dt) JSoundSystem::GetInstance()->SetMusicVolume(options[Options::MUSICVOLUME].number); mParent->DoTransition(TRANSITION_FADE, GAME_STATE_MENU); mState = SHOW_OPTIONS; + GameStateMenu::genNbCardsStr(); break; case WGuiBase::CONFIRM_NEED: optionsTabs->yieldFocus(); From 297206b054d7cbff9f8874aa3f384373148bf8bc Mon Sep 17 00:00:00 2001 From: Anthony Calosa Date: Wed, 14 Oct 2015 21:33:12 +0800 Subject: [PATCH 3/4] Fix update profile stat after buying cards profile stats on the upper left of main menu should update after buying some cards :) --- projects/mtg/src/GameStateShop.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/projects/mtg/src/GameStateShop.cpp b/projects/mtg/src/GameStateShop.cpp index 84ca3f6e4..d7f6f76b5 100644 --- a/projects/mtg/src/GameStateShop.cpp +++ b/projects/mtg/src/GameStateShop.cpp @@ -5,6 +5,7 @@ #include #include "GameStateShop.h" +#include "GameStateMenu.h" #include "GameApp.h" #include "MTGDeck.h" #include "MTGPack.h" @@ -840,6 +841,7 @@ void GameStateShop::ButtonPressed(int controllerId, int controlId) mStage = STAGE_SHOP_SHOP; mParent->DoTransition(TRANSITION_FADE, GAME_STATE_MENU); save(); + GameStateMenu::genNbCardsStr(); break; case 14: mStage = STAGE_SHOP_TASKS; From 0f0bdd7d13b247602fe85ec4eb18f6d60c620cb4 Mon Sep 17 00:00:00 2001 From: Anthony Calosa Date: Wed, 14 Oct 2015 22:14:13 +0800 Subject: [PATCH 4/4] Fix Aura Curse Aura Curse that targets a player should update its position after casting. --- projects/mtg/src/GuiPlay.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/mtg/src/GuiPlay.cpp b/projects/mtg/src/GuiPlay.cpp index 59a5a138c..437ff4945 100644 --- a/projects/mtg/src/GuiPlay.cpp +++ b/projects/mtg/src/GuiPlay.cpp @@ -195,7 +195,7 @@ void GuiPlay::Replace() for (iterator it = cards.begin(); it != end_spells; ++it) 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()) ++selfSpellsN; @@ -231,7 +231,7 @@ void GuiPlay::Replace() for (iterator it = cards.begin(); it != end_spells; ++it) 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()) selfSpells.Enstack(*it);