Psyringe - added quantifiable target restrictions. Whenever you use square brackets [] to specify attributes of a target, you can use the operators <=, >= and = to specify quantities for power, toughness, and/or converted manacost. See added cards for examples.

Limitations:
- Operators for "greater than", "less than", "unequal" have not been implemented, but if a card actually needs them, you can use a preceding minus sign to negate a comparison. Example: -power=3 means "power not equal to 3", -toughness<=3 means "toughness>3".
- You can't use spaces when specifying such restrictions. Write "power<=3" instead of "power <= 3"
- You now need to use a space before the "<" and ">" commands that count the matches for lord(), foreach(), all() and aslongas(). So far we always did use spaces in front of them without actually needing to, now we need to.
- manacost restrictions don't take "X" costs into account. Example: Mistmeadow Skulkin (FUT) has protection from manacost>=3. Blaze has a converted manacost of 1, but when you cast it with an X of 2, then it actually has a converted manacost of 3 while on the stack, and Mistmeadow Skulkin would be protected from it, but currently it isn't.

Please review the code, I'll add a few remarks/questions of my own.
This commit is contained in:
Psyyringe
2009-12-26 01:50:33 +00:00
parent ddb9ce251b
commit 5c3b3f1d03
22 changed files with 276 additions and 81 deletions
+5 -38
View File
@@ -364,10 +364,10 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
int mini = 0;
int maxi = 0;
found = s.find(">");
if (found !=string::npos) mini = atoi(s.substr(found+1,1).c_str());
found = s.find("<");
if (found !=string::npos) maxi = atoi(s.substr(found+1,1).c_str());
found = s.find(" >");
if (found !=string::npos) mini = atoi(s.substr(found+2,1).c_str());
found = s.find(" <");
if (found !=string::npos) maxi = atoi(s.substr(found+2,1).c_str());
switch(i){
case 0: result = NEW ALord(id, card, lordTargets, lordIncludeSelf, a); break;
case 1: result = NEW AForeach(id, card, _target,lordTargets, lordIncludeSelf, a,mini,maxi); break;
@@ -1351,13 +1351,6 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){
}
break;
}
case 1285: //Dwarven Warriors
{
CreatureTargetChooser * tc = NEW CreatureTargetChooser(card);
tc->maxpower = 2;
game->addObserver(NEW ABasicAbilityModifierUntilEOT(_id, card, Constants::UNBLOCKABLE, NULL,tc));
break;
}
case 1288: //EarthBind
{
game->addObserver(NEW AEarthbind(_id, card, card->target));
@@ -1435,15 +1428,6 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){
game->addObserver(NEW AInstantPowerToughnessModifierUntilEOT(id, card, card->target, NEW WParsedPT(power,toughness)));
}
case 1703: //Pendelhaven
{
CreatureTargetChooser * tc = NEW CreatureTargetChooser(card);
tc->maxpower = 1;
tc->maxtoughness =1;
game->addObserver(NEW ATargetterPowerToughnessModifierUntilEOT(id, card, NEW WParsedPT(1,2), NEW ManaCost(),tc));
break;
}
//Addons ICE-AGE Cards
case 2474: //Minion of Leshrac
@@ -1456,25 +1440,8 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){
game->addObserver(NEW AShieldOfTheAge( _id, card));
break;
}
case 2435: //Whalebone Glider
{
int cost[] = {Constants::MTG_COLOR_ARTIFACT,2};
CreatureTargetChooser * tc = NEW CreatureTargetChooser(card);
tc->maxpower = 3;
game->addObserver(NEW ABasicAbilityModifierUntilEOT(_id, card, Constants::FLYING, NEW ManaCost(cost,1),tc));
break;
}
case 2393: //Aegis of the Meek work but work also for 0/1 creatures... :D
{
int cost[] = {Constants::MTG_COLOR_ARTIFACT,1};
CreatureTargetChooser * tc = NEW CreatureTargetChooser(card);
tc->maxpower = 1;
tc->maxtoughness =1;
game->addObserver(NEW ATargetterPowerToughnessModifierUntilEOT(id, card, NEW WParsedPT(1,2), NEW ManaCost(cost,1),tc));
break;
}
// --- addon Mirage ---
// --- addon Mirage ---
case 3410: //Seed of Innocence
{