multi tokens images on same source

you can specifiy tnum:number on token parameters and it will concatenate
the default token id and the specified number. example: token(Saproling,
Creature Saproling, 1/1, green, tnum:15) if the source id is 12345, the
default token id will be -12345, concat tnum, id will be -1234515 and
the game will try to find the image 1234515t.jpg
This commit is contained in:
Anthony Calosa
2016-08-08 10:37:27 +08:00
parent 65ef1f384c
commit 8c9d2d6f1d
2 changed files with 25 additions and 5 deletions

View File

@@ -2420,15 +2420,21 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
string sname = tokenParameters[0];
string stypes = tokenParameters[1];
string spt = tokenParameters[2];
string cID = "";
//reconstructing string abilities from the split version,
// then we re-split it again in the token constructor,
// this needs to be improved
string sabilities = (tokenParameters.size() > 3)? tokenParameters[3] : "";
for (size_t i = 4; i < tokenParameters.size(); ++i)
{
sabilities.append(",");
sabilities.append(tokenParameters[i]);
string tnum = tokenParameters[i];
if(tnum.find("tnum:"))
cID = cReplaceString(tnum,"tnum:","");
else
{
sabilities.append(",");
sabilities.append(tokenParameters[i]);
}
}
int value = 0;
if (spt.find("xx/xx") != string::npos)
@@ -2441,7 +2447,7 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
ATokenCreator * tok = NEW ATokenCreator(
observer, id, card,target, NULL, sname, stypes, power + value, toughness + value,
sabilities, starfound, multiplier, who, aLivingWeapon, spt);
sabilities, starfound, multiplier, who, aLivingWeapon, spt, cID);
tok->oneShot = 1;
if(aLivingWeapon)
tok->forceDestroy = 1;