From 2690a3f9a0d9aecda14d9f49fdfa05041e3084ed Mon Sep 17 00:00:00 2001 From: "omegablast2002@yahoo.com" Date: Sat, 12 Feb 2011 16:21:54 +0000 Subject: [PATCH] updated variable "type:" to act more like a targetchooser... draw:type:creature|opponentbattlefield will draw a card for each creature on the opponents battlefield this defualts to "|mybattlefield" however any target zone can be used, hand, library ect.... this will add support to some cards which werent possible with previous version of it, without having to create new word variables to do the same exact thing as can now be done with this. --- projects/mtg/include/AllAbilities.h | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/projects/mtg/include/AllAbilities.h b/projects/mtg/include/AllAbilities.h index 9ded92b98..ec43ca453 100644 --- a/projects/mtg/include/AllAbilities.h +++ b/projects/mtg/include/AllAbilities.h @@ -84,9 +84,27 @@ public: } else if (s.find("type:") != string::npos) { - size_t begins = s.find(":"); - string theType = s.substr(begins + 1); - intValue = target->controller()->game->inPlay->countByType(theType.c_str()); + size_t begins = s.find(":"); + string theType = s.substr(begins + 1); + size_t zoned = theType.find("|"); + if(zoned == string::npos) + { + theType.append("|mybattlefield"); + } + TargetChooserFactory tf; + TargetChooser * tc = tf.createTargetChooser(theType.c_str(),NULL); + GameObserver * game = game->GetInstance(); + for (int i = 0; i < 2; i++) + { + Player * p = game->players[i]; + MTGGameZone * zones[] = { p->game->inPlay, p->game->graveyard, p->game->hand, p->game->library }; + for (int k = 0; k < 4; k++) + { + MTGGameZone * zone = zones[k]; + intValue += zone->countByCanTarget(tc); + } + } + SAFE_DELETE(tc); } else if (s == "sunburst") {