Fixed a bug on deck choosing menu when an AI deck has no avatar image (it will be used "baka.jpg"), added new default avatar images for AI decks (up to 200), fixed "_PROLIFERATE_" macro and fixed all primitives with "proliferate" ability, improved the "proliferation" keyword for target chooser in order to avoid targeting permanents or players without counters and/or with some protections (e.g. hexproof, shroud and similar).
This commit is contained in:
@@ -4292,7 +4292,7 @@ AIPlayerBaka::AIPlayerBaka(GameObserver *observer, string file, string fileSmall
|
||||
{
|
||||
avatarFile = "avatar";
|
||||
char buffer[3];
|
||||
sprintf(buffer, "%i", int(observer->getRandomGenerator()->random()%100));
|
||||
sprintf(buffer, "%i", int(observer->getRandomGenerator()->random()%200));
|
||||
avatarFile.append(buffer);
|
||||
avatarFile.append(".jpg");
|
||||
if(!loadAvatar(avatarFile, "bakaAvatar"))
|
||||
|
||||
@@ -49,7 +49,11 @@ DeckMenuItem::DeckMenuItem(DeckMenu* _parent, int id, int fontId, string text, f
|
||||
}
|
||||
|
||||
if (mMetaData && mMetaData->getAvatarFilename().size() > 0)
|
||||
{
|
||||
mImageFilename = mMetaData->getAvatarFilename();
|
||||
if(!(WResourceManager::Instance()->RetrieveTexture(mImageFilename)))
|
||||
mImageFilename = "baka.jpg"; // if the AI deck has no specific avatar we will display the default "baka.jpg" image.
|
||||
}
|
||||
else
|
||||
{
|
||||
// this is a non-deck menu item (ie "Random", "Cancel", etc
|
||||
|
||||
@@ -2180,13 +2180,41 @@ bool ProliferateChooser::canTarget(Targetable * target,bool withoutProtections)
|
||||
{
|
||||
if (MTGCardInstance * card = dynamic_cast<MTGCardInstance*>(target))
|
||||
{
|
||||
if (source && card->isInPlay(observer) && !withoutProtections)
|
||||
{
|
||||
if (card->has(Constants::SHROUD)) return source->bypassTC;
|
||||
if (card->protectedAgainst(source)) return source->bypassTC;
|
||||
if (card->CantBeTargetby(source)) return source->bypassTC;
|
||||
if ((source->controller() != card->controller()) && card->has(Constants::OPPONENTSHROUD)) return source->bypassTC;
|
||||
if (card->has(Constants::PROTECTIONFROMCOLOREDSPELLS)){
|
||||
if((source->spellTargetType.size()) && (source->hasColor(1)||source->hasColor(2)||source->hasColor(3)||source->hasColor(4)||source->hasColor(5)))
|
||||
return source->bypassTC;
|
||||
}
|
||||
}
|
||||
if(card->counters && card->counters->counters.empty())
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
else if (Player * p = dynamic_cast<Player*>(target))
|
||||
{
|
||||
if(!p->poisonCount)
|
||||
if (source)
|
||||
{
|
||||
if ((source->controller() != source->controller()->opponent())
|
||||
&& (source->controller()->opponent()->game->inPlay->hasAbility(Constants::CONTROLLERSHROUD))
|
||||
&& source->controller() != target)
|
||||
return source->bypassTC;
|
||||
if ((source->controller()->opponent()->game->inPlay->hasAbility(Constants::PLAYERSHROUD))
|
||||
&& source->controller()->opponent() == target)
|
||||
return source->bypassTC;
|
||||
if ((source->controller()->game->inPlay->hasAbility(Constants::PLAYERSHROUD))
|
||||
&& source->controller() == target)
|
||||
return source->bypassTC;
|
||||
if(source->controller()->isAI() && p == source->controller() && p->poisonCount)
|
||||
return false; // prevent AI to target itself when it has some poison counters.
|
||||
if(source->controller()->isAI() && p != source->controller() && !p->poisonCount)
|
||||
return false; // prevent AI to target opponent when there are no poison counters.
|
||||
}
|
||||
if(!p->poisonCount && !p->energyCount && !p->experienceCount)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user