Added/fixed some primitives, improved Deck Editor to allow user to choose commanders from collection and add them to their decks. Implemented command color identity rule and single card instance limitation for Commander Format game mode.

This commit is contained in:
valfieri
2020-12-07 19:25:06 +01:00
parent ced2c85076
commit d6a1a8eda8
8 changed files with 322 additions and 93 deletions

View File

@@ -1190,6 +1190,16 @@ void MTGDeck::replaceSB(vector<string> newSB)
return;
}
void MTGDeck::replaceCMD(vector<string> newCMD)
{
if(newCMD.size())
{
CommandZone.clear();
CommandZone = newCMD;
}
return;
}
int MTGDeck::remove(int cardid)
{
if (cards.find(cardid) == cards.end() || cards[cardid] == 0) return 0;
@@ -1270,6 +1280,17 @@ int MTGDeck::save(const string& destFileName, bool useExpandedDescriptions, cons
file << "#SB:" << checkID << "\n";
}
}
//save commanders
if(CommandZone.size())
{
sort(CommandZone.begin(), CommandZone.end());
for(unsigned int k = 0; k < CommandZone.size(); k++)
{
int checkID = atoi(CommandZone[k].c_str());
if(checkID)
file << "#CMD:" << checkID << "\n";
}
}
file.close();
JFileSystem::GetInstance()->Rename(tmp, destFileName);