-fixed a memory leak
- Added P02 and PTK 
- New way to create tokens in the parser, much more flexible, see the Hive in RV. Tokens can now be written as other cards, with a rarity of "T". I suggest their id to be the negative value of the card that generates them when possible. Naming convention for images is the same as before: a negative id such as -1138 will need a [id]t.jpg image (1138t.jpg). Positive ids work as "normal" pictures
This commit is contained in:
wagic.the.homebrew@gmail.com
2009-11-18 13:14:08 +00:00
parent ca4c1ca2a8
commit 7f9d22e0aa
16 changed files with 3283 additions and 30 deletions

View File

@@ -385,9 +385,21 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
//Token creator. Name, type, p/t, abilities
found = s.find("token(");
if (found != string::npos){
int end = s.find(",", found);
WParsedInt * multiplier = NULL;
size_t star = s.find("*");
if (star != string::npos) multiplier = NEW WParsedInt(s.substr(star+1),spell,card);
size_t end = s.find(")", found);
int tokenId = atoi(s.substr(found + 6,end - found - 6).c_str());
if (tokenId){
ATokenCreator * tok = NEW ATokenCreator(id,card,NULL,tokenId,0, multiplier);
tok->oneShot = 1;
return tok;
}
end = s.find(",", found);
string sname = s.substr(found + 6,end - found - 6);
int previous = end+1;
size_t previous = end+1;
end = s.find(",",previous);
string stypes = s.substr(previous,end - previous);
previous = end+1;
@@ -396,9 +408,7 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
int power, toughness;
parsePowerToughness(spt,&power, &toughness);
string sabilities = s.substr(end+1);
WParsedInt * multiplier = NULL;
found = s.find("*");
if (found != string::npos)multiplier = NEW WParsedInt(s.substr(found+1),spell,card);
ATokenCreator * tok = NEW ATokenCreator(id,card,NULL,sname,stypes,power,toughness,sabilities,0, multiplier);
tok->oneShot = 1;
return tok;