support "other" in type:* parsing

if a card with a cleric subtype has an autoline like this:
othertype:cleric:battlefield, means that the targetchooser excludes that
card, only the other "cleric" are counted.
This commit is contained in:
Anthony Calosa
2015-09-17 11:16:29 +08:00
parent 76c48a8c4e
commit 6cba14181d
2 changed files with 25 additions and 2 deletions

View File

@@ -68,6 +68,7 @@ private:
bool plusone = false;
bool plustwo = false;
bool plusthree = false;
bool other = false;//othertype:[subtype]
if (!target) target = card;
int multiplier = 1;
if (s[0] == '-')
@@ -134,6 +135,12 @@ private:
size_t pThree = s.find("plusthree");
s.erase(pThree,pThree + 9);
}
if(s.find("othertype") != string::npos)
{
other = true;
size_t oth = s.find("othertype");
s.erase(oth,oth + 5);
}
if(s == "prex")
{
ManaCost * cX = card->controller()->getManaPool()->Diff(card->getManaCost());
@@ -395,6 +402,7 @@ private:
}
TargetChooserFactory tf(card->getObserver());
TargetChooser * tc = tf.createTargetChooser(theType.c_str(),NULL);
tc->other = other;
for (int i = 0; i < 2; i++)
{
Player * p = card->getObserver()->players[i];
@@ -642,6 +650,21 @@ private:
{
intValue = target->controller()->opponent()->game->hand->nb_cards;
}
else if (s == "myname")//Plague Rats and others
{
intValue = 0;
for (int i = 0; i < 2; i++)
{
Player * p = card->getObserver()->players[i];
for (int j = p->game->battlefield->nb_cards - 1; j >= 0; --j)
{
if (p->game->battlefield->cards[j]->name == card->name)
{
intValue += 1;
}
}
}
}
else if (s == "pgbzombie")//Soulless One
{
intValue = 0;

View File

@@ -12,8 +12,8 @@ Author: Michael Nguyen
/* Wagic versions */
#define WAGIC_VERSION_MAJOR 0
#define WAGIC_VERSION_MEDIUM 19
#define WAGIC_VERSION_MINOR 2
#define WAGIC_VERSION_MEDIUM 20
#define WAGIC_VERSION_MINOR 1
#define VERSION_DOT(a, b, c) a ##.## b ##.## c
#define VERSION_WITHOUT_DOT(a, b, c) a ## b ## c