diff --git a/projects/mtg/include/GameOptions.h b/projects/mtg/include/GameOptions.h index 1e1061ac8..7f0420a9a 100644 --- a/projects/mtg/include/GameOptions.h +++ b/projects/mtg/include/GameOptions.h @@ -39,6 +39,8 @@ public: SFXVOLUME, DIFFICULTY, CHEATMODE, + OPTIMIZE_HAND, + CHEATMODEAIDECK, OSD, CLOSEDHAND, HANDDIRECTION, @@ -79,6 +81,7 @@ public: AWARD_COLLECTOR, LAST_NAMED, //Any option after this does not look up in optionNames. SET_UNLOCKS = LAST_NAMED + 1, //For sets. + }; static int optionSet(int setID); @@ -171,7 +174,7 @@ private: }; class OptionManaDisplay: public EnumDefinition { public: - enum { DYNAMIC = 0, STATIC = 1, BOTH = 2}; + enum { DYNAMIC = 0, STATIC = 1, NOSTARSDYNAMIC = 2, BOTH = 3}; static EnumDefinition * getInstance() {return &mDef;}; private: OptionManaDisplay(); diff --git a/projects/mtg/include/MTGGameZones.h b/projects/mtg/include/MTGGameZones.h index 3d5e8604d..f50a02030 100644 --- a/projects/mtg/include/MTGGameZones.h +++ b/projects/mtg/include/MTGGameZones.h @@ -156,7 +156,7 @@ class MTGPlayerCards { MTGPlayerCards(MTGDeck * deck); ~MTGPlayerCards(); void initGame(int shuffle = 1, int draw = 1); - void OptimizedHand(int amount = 7,int lands = 3,int creatures = 0,int othercards = 4); + void OptimizedHand(Player * who,int amount = 7,int lands = 3,int creatures = 0,int othercards = 4); void setOwner(Player * player); void discardRandom(MTGGameZone * from,MTGCardInstance * source); void drawFromLibrary(); diff --git a/projects/mtg/src/AIPlayer.cpp b/projects/mtg/src/AIPlayer.cpp index 041ab3193..3f9918c37 100644 --- a/projects/mtg/src/AIPlayer.cpp +++ b/projects/mtg/src/AIPlayer.cpp @@ -428,6 +428,8 @@ int AIAction::getEfficiency() //ensuring that Ai grants abilities to creatures during first main, so it can actually use them in combat. if (target) { + //quick note: the eff is multiplied by creatures ranking then divided by the number of cards in hand. + //the reason i do this is to encourage more casting and less waste of mana on abilities. AbilityFactory af; int suggestion = af.abilityEfficiency(a, p, MODE_ABILITY); @@ -437,16 +439,16 @@ int AIAction::getEfficiency() efficiency = 0; //stop giving trample to the players creatures. } - if (suggestion == BAKA_EFFECT_BAD && p != _target->controller() && _target->has(a->abilitygranted)) + if (suggestion == BAKA_EFFECT_BAD && p != _target->controller() && target->has(a->abilitygranted)) { - efficiency += (15 * _target->DangerRanking()); + efficiency += (15 * target->DangerRanking())/p->game->hand->nb_cards; } - if (_target && !_target->has(a->abilitygranted) && g->getCurrentGamePhase() == Constants::MTG_PHASE_FIRSTMAIN) + if (_target && !target->has(a->abilitygranted) && g->getCurrentGamePhase() == Constants::MTG_PHASE_FIRSTMAIN) { - efficiency += (15 * _target->DangerRanking()); + efficiency += (15 * target->DangerRanking())/p->game->hand->nb_cards; } - if (_target && _target->has(a->abilitygranted)) + if (_target && target->has(a->abilitygranted)) { //trying to avoid Ai giving ie:flying creatures ie:flying twice. efficiency = 0; diff --git a/projects/mtg/src/GameOptions.cpp b/projects/mtg/src/GameOptions.cpp index 920f3d61a..1a52206ae 100644 --- a/projects/mtg/src/GameOptions.cpp +++ b/projects/mtg/src/GameOptions.cpp @@ -18,6 +18,8 @@ const string Options::optionNames[] = { "sfxVolume", "difficulty", "cheatmode", + "optimizedhand", + "cheatmodedecks", "displayOSD", "closed_hand", "hand_direction", @@ -337,7 +339,11 @@ int GameOptions::load() } // (PSY) Make sure that cheatmode is switched off for ineligible profiles: if (options[Options::ACTIVE_PROFILE].str != SECRET_PROFILE) + { (*this)[Options::CHEATMODE].number = 0; + (*this)[Options::OPTIMIZE_HAND].number = 0; + (*this)[Options::CHEATMODEAIDECK].number = 0; + } //Default values. Anywhere else to put those ? if (!(*this)[Options::MAX_GRADE].number) @@ -352,7 +358,11 @@ int GameOptions::save() { // (PSY) Make sure that cheatmode is switched off for ineligible profiles: if (options[Options::ACTIVE_PROFILE].str != SECRET_PROFILE) + { (*this)[Options::CHEATMODE].number = 0; + (*this)[Options::OPTIMIZE_HAND].number = 0; + (*this)[Options::CHEATMODEAIDECK].number = 0; + } std::ofstream file(mFilename.c_str()); if (file) @@ -878,7 +888,9 @@ OptionManaDisplay::OptionManaDisplay() { mDef.values.push_back(EnumDefinition::assoc(DYNAMIC, "Eye candy")); mDef.values.push_back(EnumDefinition::assoc(STATIC, "Simple")); - mDef.values.push_back(EnumDefinition::assoc(BOTH, "Both")); + mDef.values.push_back(EnumDefinition::assoc(NOSTARSDYNAMIC, "No Glitter")); + mDef.values.push_back(EnumDefinition::assoc(BOTH, "Both"));//no luck in getting this to show up as an option. + //Both should still work as always however the enum and this dont want to pair up, no "both" in options now. } ; OptionVolume OptionVolume::mDef; diff --git a/projects/mtg/src/GameStateDuel.cpp b/projects/mtg/src/GameStateDuel.cpp index 42c1c3dad..fc88691c7 100644 --- a/projects/mtg/src/GameStateDuel.cpp +++ b/projects/mtg/src/GameStateDuel.cpp @@ -283,7 +283,15 @@ void GameStateDuel::ensureOpponentMenu() if (options[Options::EVILTWIN_MODE_UNLOCKED].number) opponentMenu->Add(MENUITEM_EVIL_TWIN, "Evil Twin", _( "Can you play against yourself?").c_str()); DeckManager * deckManager = DeckManager::GetInstance(); + vector opponentDeckList; + if(!options[Options::CHEATMODEAIDECK].number) + { vector opponentDeckList = fillDeckMenu(opponentMenu, JGE_GET_RES("ai/baka"), "ai_baka", mPlayers[0], options[Options::AIDECKS_UNLOCKED].number); + } + else + { + vector opponentDeckList = fillDeckMenu(opponentMenu, JGE_GET_RES("ai/baka"), "ai_baka", mPlayers[0],1000); + } deckManager->updateMetaDataList(&opponentDeckList, true); opponentMenu->Add(MENUITEM_CANCEL, "Cancel", _("Choose a different player deck").c_str()); opponentDeckList.clear(); diff --git a/projects/mtg/src/GameStateOptions.cpp b/projects/mtg/src/GameStateOptions.cpp index 1b3ea1dea..b097e90e4 100644 --- a/projects/mtg/src/GameStateOptions.cpp +++ b/projects/mtg/src/GameStateOptions.cpp @@ -81,7 +81,10 @@ void GameStateOptions::Start() optionsList->Add(cStyle); optionsList->Add(NEW WGuiButton(NEW WGuiHeader("New Profile"), -102, kNewProfileID, this)); - optionsList->Add(NEW WDecoCheat(NEW OptionInteger(Options::CHEATMODE, "Enable cheat mode"))); + optionsList->Add(NEW WDecoCheat(NEW OptionInteger(Options::CHEATMODE, "Enable Cheat Mode"))); + optionsList->Add(NEW WDecoCheat(NEW OptionInteger(Options::OPTIMIZE_HAND, "Optimize Starting Hand"))); + optionsList->Add(NEW WDecoCheat(NEW OptionInteger(Options::CHEATMODEAIDECK, "Unlock All Ai Decks"))); + optionsTabs->Add(optionsList); optionsList = NEW WGuiList("Advanced"); diff --git a/projects/mtg/src/GuiMana.cpp b/projects/mtg/src/GuiMana.cpp index 1025e8b72..c31a84edd 100644 --- a/projects/mtg/src/GuiMana.cpp +++ b/projects/mtg/src/GuiMana.cpp @@ -105,7 +105,14 @@ ManaIcon::ManaIcon(int color, float x, float y, float destx, float desty) : // if we want to throttle the amount of particles for mana, // here's where to do it - this is hardcoded to something like 114 in the psi file + if(OptionManaDisplay::NOSTARSDYNAMIC == options[Options::MANADISPLAY].number) + { + particleSys->info.nEmission = 0; + } + else + { particleSys->info.nEmission = 60; + } icon = manaIcons[color]; particleSys->FireAt(x, y); @@ -185,7 +192,7 @@ void ManaIcon::Update(float dt, float shift) if (particleSys && (fabs(destx - x) < 5) && (fabs(desty + shift - y) < 5)) { - if (OptionManaDisplay::STATIC == options[Options::MANADISPLAY].number) + if (OptionManaDisplay::STATIC == options[Options::MANADISPLAY].number) { SAFE_DELETE(particleSys); //Static Mana Only: avoid expensive particle processing } @@ -285,7 +292,7 @@ void GuiMana::Render() for (vector::iterator it = manas.begin(); it != manas.end(); ++it) (*it)->Render(); - if (OptionManaDisplay::DYNAMIC != options[Options::MANADISPLAY].number) + if (OptionManaDisplay::DYNAMIC != options[Options::MANADISPLAY].number && OptionManaDisplay::NOSTARSDYNAMIC != options[Options::MANADISPLAY].number ) RenderStatic(); } diff --git a/projects/mtg/src/MTGGameZones.cpp b/projects/mtg/src/MTGGameZones.cpp index b1fa27a07..7045e2c3c 100644 --- a/projects/mtg/src/MTGGameZones.cpp +++ b/projects/mtg/src/MTGGameZones.cpp @@ -90,7 +90,7 @@ void MTGPlayerCards::initGame(int shuffle, int draw) } } -void MTGPlayerCards::OptimizedHand(int amount, int lands, int creatures, int othercards) +void MTGPlayerCards::OptimizedHand(Player * who,int amount, int lands, int creatures, int othercards) { //give the Ai hand adventage to insure a challanging match. GameObserver * game = game->GetInstance(); @@ -99,7 +99,7 @@ void MTGPlayerCards::OptimizedHand(int amount, int lands, int creatures, int oth if (!game->players[0]->isAI() && game->players[1]->isAI()) { - Player * p = game->players[1]; + Player * p = who; MTGCardInstance * card = NULL; MTGGameZone * z = p->game->library; MTGGameZone * e = p->game->temp; diff --git a/projects/mtg/src/Rules.cpp b/projects/mtg/src/Rules.cpp index db726d1e7..7d2f3668f 100644 --- a/projects/mtg/src/Rules.cpp +++ b/projects/mtg/src/Rules.cpp @@ -180,6 +180,8 @@ void Rules::addExtraRules() MTGPlayerCards * hand = NULL; int handsize = 7; int difficultyRating = 0; + int Optimizedhandcheat = options[Options::OPTIMIZE_HAND].number; + MTGAbility * a = af.parseMagicLine(initState.playerData[i].extraRules[j], id++, NULL, &MTGCardInstance::ExtraRules[i]); if (p->playMode != Player::MODE_TEST_SUITE && g->mRules->gamemode != GAME_TYPE_MOMIR && g->mRules->gamemode != GAME_TYPE_RANDOM1 && g->mRules->gamemode != GAME_TYPE_RANDOM2 && g->mRules->gamemode @@ -192,7 +194,7 @@ void Rules::addExtraRules() { if (a->oneShot) { - if (p->isAI() && a->aType == MTGAbility::STANDARD_DRAW && difficultyRating == EASY && p->playMode + if (( p->isAI() ||( !p->isAI() && Optimizedhandcheat)) && a->aType == MTGAbility::STANDARD_DRAW && difficultyRating == EASY && p->playMode != Player::MODE_TEST_SUITE && g->mRules->gamemode != GAME_TYPE_MOMIR && g->mRules->gamemode != GAME_TYPE_RANDOM1 && g->mRules->gamemode != GAME_TYPE_RANDOM2 && g->mRules->gamemode != GAME_TYPE_STORY)//stupid protections to keep this out of mimor and other game modes. @@ -200,17 +202,23 @@ void Rules::addExtraRules() handsize = a->nbcardAmount; ((AIPlayer *) p)->forceBestAbilityUse = true; ((AIPlayer *) p)->agressivity += 100; - hand->OptimizedHand(handsize, 3, 1, 3);//easy decks get a major boost, open hand is 2lands,1 creature under 3 mana,3spells under 3 mana. + hand->OptimizedHand(p,handsize, 3, 1, 3);//easy decks get a major boost, open hand is 2lands,1 creature under 3 mana,3spells under 3 mana. } - else if (p->isAI() && a->aType == MTGAbility::STANDARD_DRAW && difficultyRating == NORMAL && p->playMode + else if (( p->isAI() ||( !p->isAI() && Optimizedhandcheat)) && a->aType == MTGAbility::STANDARD_DRAW && difficultyRating == NORMAL && p->playMode != Player::MODE_TEST_SUITE && g->mRules->gamemode != GAME_TYPE_MOMIR && g->mRules->gamemode != GAME_TYPE_RANDOM1 && g->mRules->gamemode != GAME_TYPE_RANDOM2 && g->mRules->gamemode != GAME_TYPE_STORY)//stupid protections to keep this out of mimor and other game modes. { - handsize = a->nbcardAmount; - hand->OptimizedHand(handsize, 1, 0, 2);//give the Ai deck a tiny boost by giving it 1 land and 2 spells under 3 manacost. - } - else + handsize = a->nbcardAmount; + hand->OptimizedHand(p,handsize, 1, 0, 2);//give the Ai deck a tiny boost by giving it 1 land and 2 spells under 3 manacost. + }else if (( !p->isAI() && Optimizedhandcheat) && a->aType == MTGAbility::STANDARD_DRAW && p->playMode + != Player::MODE_TEST_SUITE && g->mRules->gamemode != GAME_TYPE_MOMIR && g->mRules->gamemode + != GAME_TYPE_RANDOM1 && g->mRules->gamemode != GAME_TYPE_RANDOM2 && g->mRules->gamemode + != GAME_TYPE_STORY) + { + hand->OptimizedHand(p,handsize, 3, 1, 3); + } + else {//resolve normally if the deck is listed as hard. a->resolve(); }