From 6fa016ca541f1f1f76d0c38b5034b44d42cacf8c Mon Sep 17 00:00:00 2001 From: "omegablast2002@yahoo.com" Date: Tue, 11 Oct 2011 11:14:55 +0000 Subject: [PATCH] corrected my logic, for some reason i remember clearly already having moved this line, but i guess it didn't make it into the last change i did to choosecard function. THIS is what it was meant to do... also corrected an issue with the changed logic of ALife eff return. you have to take into account that "{cost}:life:200" <---is not targeted so there is no player targeting involved with such code, making the eff return always 0 in cases where you don't have {cost}:target(player) life:200...i might need to review the eff returns to check that there are not other cases similar to this, :P my original code there was messy but took that into account. so careful with refactors in this area. to see how this function was intended to work, try the following lines on any card auto={t(creature|opponentbattlefield)}:life:233 auto={s(creature|mybattlefield)}:damage:4 target(player) --- projects/mtg/src/AIPlayerBaka.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/projects/mtg/src/AIPlayerBaka.cpp b/projects/mtg/src/AIPlayerBaka.cpp index baf7deb3c..9750d9147 100644 --- a/projects/mtg/src/AIPlayerBaka.cpp +++ b/projects/mtg/src/AIPlayerBaka.cpp @@ -408,7 +408,12 @@ int OrderedAIAction::getEfficiency() AbilityFactory af(g); int suggestion = af.abilityEfficiency(a, p, MODE_ABILITY); - if ((suggestion == BAKA_EFFECT_BAD && _t == p) || (suggestion == BAKA_EFFECT_GOOD && _t != p)) + if(_t->typeAsTarget() == TARGET_CARD) + { + if((suggestion == BAKA_EFFECT_BAD && ((MTGCardInstance*)_t)->controller() == p) || (suggestion == BAKA_EFFECT_GOOD && ((MTGCardInstance*)_t)->controller() != p)) + efficiency = 0; + } + else if ((suggestion == BAKA_EFFECT_BAD && _t == p) || (suggestion == BAKA_EFFECT_GOOD && _t != p)) { efficiency = 0; } @@ -617,9 +622,9 @@ int AIPlayerBaka::getEfficiency(OrderedAIAction * action) MTGCardInstance * AIPlayerBaka::chooseCard(TargetChooser * tc, MTGCardInstance * source, int random) { MTGPlayerCards * playerZones = source->controller()->game; - MTGGameZone * zones[] = { playerZones->hand, playerZones->library, playerZones->inPlay, playerZones->graveyard,playerZones->stack }; for(int players = 0; players < 2;++players) { + MTGGameZone * zones[] = { playerZones->hand, playerZones->library, playerZones->inPlay, playerZones->graveyard,playerZones->stack }; for (int j = 0; j < 5; j++) { MTGGameZone * zone = zones[j];