we should access the data required within a given context. Using DeckStats in this way works
but only by chance that the previous step set the current deck file. Used victory percentage from the MetaData object rather than forcing what has already been computed. TODO: getVictoryPercentage() needs to represent Overall VictoryPercentage for all decks, not just player decks. AI Decks use getVictoryPercentage() to represent the VictoryPercentage against a specific deck. There should be an additional method that says getVictoryPercentageVsDeck( deckObject )
This commit is contained in:
@@ -1147,7 +1147,7 @@ AIPlayer * AIPlayerFactory::createAIPlayer(MTGAllCards * collection, Player * op
|
|||||||
if (deckid == GameStateDuel::MENUITEM_EVIL_TWIN)
|
if (deckid == GameStateDuel::MENUITEM_EVIL_TWIN)
|
||||||
{ //Evil twin
|
{ //Evil twin
|
||||||
sprintf(deckFile, "%s", opponent->deckFile.c_str());
|
sprintf(deckFile, "%s", opponent->deckFile.c_str());
|
||||||
DebugTrace(opponent->deckFile);
|
DebugTrace("Evil Twin => " << opponent->deckFile);
|
||||||
sprintf(avatarFile, "%s", "baka.jpg");
|
sprintf(avatarFile, "%s", "baka.jpg");
|
||||||
sprintf(deckFileSmall, "%s", "ai_baka_eviltwin");
|
sprintf(deckFileSmall, "%s", "ai_baka_eviltwin");
|
||||||
}
|
}
|
||||||
@@ -1179,18 +1179,16 @@ AIPlayer * AIPlayerFactory::createAIPlayer(MTGAllCards * collection, Player * op
|
|||||||
sprintf(avatarFile, "avatar%i.jpg", deckid);
|
sprintf(avatarFile, "avatar%i.jpg", deckid);
|
||||||
sprintf(deckFileSmall, "ai_baka_deck%i", deckid);
|
sprintf(deckFileSmall, "ai_baka_deck%i", deckid);
|
||||||
}
|
}
|
||||||
DeckStats * stats = DeckStats::GetInstance();
|
|
||||||
int deckSetting = NULL;
|
int deckSetting = EASY;
|
||||||
int diff = stats->percentVictories();
|
if ( opponent )
|
||||||
if (diff >= 65)
|
{
|
||||||
{
|
bool isOpponentAI = opponent->isAI() == 1;
|
||||||
deckSetting = HARD;
|
DeckMetaData *meta = DeckManager::GetInstance()->getDeckMetaDataByFilename( opponent->deckFile, isOpponentAI );
|
||||||
}
|
if ( meta->getVictoryPercentage() >= 65)
|
||||||
else if (diff < 65)
|
deckSetting = HARD;
|
||||||
{
|
}
|
||||||
deckSetting = EASY;
|
MTGDeck * tempDeck = NEW MTGDeck(deckFile, collection,0, deckSetting);
|
||||||
}
|
|
||||||
MTGDeck * tempDeck = NEW MTGDeck(deckFile, collection,0,deckSetting);
|
|
||||||
AIPlayerBaka * baka = NEW AIPlayerBaka(tempDeck, deckFile, deckFileSmall, avatarFile);
|
AIPlayerBaka * baka = NEW AIPlayerBaka(tempDeck, deckFile, deckFileSmall, avatarFile);
|
||||||
baka->deckId = deckid;
|
baka->deckId = deckid;
|
||||||
SAFE_DELETE(tempDeck);
|
SAFE_DELETE(tempDeck);
|
||||||
|
|||||||
Reference in New Issue
Block a user