diff --git a/projects/mtg/src/MTGAbility.cpp b/projects/mtg/src/MTGAbility.cpp index 28846d848..ae04011aa 100644 --- a/projects/mtg/src/MTGAbility.cpp +++ b/projects/mtg/src/MTGAbility.cpp @@ -2972,6 +2972,56 @@ int AbilityFactory::abilityEfficiency(MTGAbility * a, Player * p, int mode, Targ return abilityEfficiency(abi->ability, p, mode, tc); if (ATeach * abi = dynamic_cast(a)) return abilityEfficiency(abi->ability, p, mode, tc); + if (ATargetedAbilityCreator * atac = dynamic_cast(a)) + { + Player * targetedPlyr; + switch(atac->who) + { + case TargetChooser::CONTROLLER: + targetedPlyr = atac->source->controller(); + break; + case TargetChooser::OPPONENT: + targetedPlyr = atac->source->controller()->opponent(); + break; + case TargetChooser::TARGET_CONTROLLER: + if(dynamic_cast(target)) + { + targetedPlyr = ((MTGCardInstance*)atac->target)->controller(); + break; + } + case TargetChooser::TARGETED_PLAYER: + { + targetedPlyr = atac->source->playerTarget?atac->source->playerTarget:p; + break; + } + default: + targetedPlyr = atac->source->controller()->opponent(); + break; + } + int result = 0; + if(targetedPlyr) + { + MTGCardInstance * testDummy = NEW MTGCardInstance(); + testDummy->setObserver(targetedPlyr->getObserver()); + testDummy->owner = targetedPlyr; + testDummy->storedCard = atac->source; + vectormagictextlines = split(atac->sabilities,'_'); + if(magictextlines.size()) + { + for(unsigned int i = 0; i < magictextlines.size(); i++) + { + MTGAbility * ata = parseMagicLine(magictextlines[i],-1,NULL,testDummy); + if(ata) + { + result += abilityEfficiency(getCoreAbility(ata), targetedPlyr,mode); + SAFE_DELETE(ata); + } + } + } + SAFE_DELETE(testDummy); + } + return result; + } if (dynamic_cast (a)) return BAKA_EFFECT_BAD; if (dynamic_cast (a))