Added Background partner ability for CLB commanders, fixed some tab with spaces
This commit is contained in:
@@ -17,7 +17,7 @@ typedef enum
|
|||||||
GAME_TYPE_RANDOM2,
|
GAME_TYPE_RANDOM2,
|
||||||
GAME_TYPE_RANDOM3,
|
GAME_TYPE_RANDOM3,
|
||||||
GAME_TYPE_RANDOM5,
|
GAME_TYPE_RANDOM5,
|
||||||
GAME_TYPE_RANDOMCOMMANDER,
|
GAME_TYPE_RANDOMCOMMANDER,
|
||||||
GAME_TYPE_HORDE,
|
GAME_TYPE_HORDE,
|
||||||
GAME_TYPE_SET_LIMITED,
|
GAME_TYPE_SET_LIMITED,
|
||||||
GAME_TYPE_STORY,
|
GAME_TYPE_STORY,
|
||||||
@@ -339,7 +339,8 @@ class Constants
|
|||||||
COUNTERSHROUD = 211,
|
COUNTERSHROUD = 211,
|
||||||
NONIGHT = 212,
|
NONIGHT = 212,
|
||||||
NODAMAGEREMOVED = 213,
|
NODAMAGEREMOVED = 213,
|
||||||
NB_BASIC_ABILITIES = 214,
|
BACKGROUNDPARTNER = 214,
|
||||||
|
NB_BASIC_ABILITIES = 215,
|
||||||
|
|
||||||
RARITY_S = 'S', //Special Rarity
|
RARITY_S = 'S', //Special Rarity
|
||||||
RARITY_M = 'M', //Mythics
|
RARITY_M = 'M', //Mythics
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ protected:
|
|||||||
Player * loadPlayerRandom(GameObserver* observer, int isAI, int mode);
|
Player * loadPlayerRandom(GameObserver* observer, int isAI, int mode);
|
||||||
Player * loadPlayerRandomThree(GameObserver* observer, int isAI);
|
Player * loadPlayerRandomThree(GameObserver* observer, int isAI);
|
||||||
Player * loadPlayerRandomFive(GameObserver* observer, int isAI);
|
Player * loadPlayerRandomFive(GameObserver* observer, int isAI);
|
||||||
Player * loadPlayerRandomCommander(GameObserver* observer, int isAI);
|
Player * loadPlayerRandomCommander(GameObserver* observer, int isAI);
|
||||||
Player * loadPlayerHorde(GameObserver* observer, int isAI);
|
Player * loadPlayerHorde(GameObserver* observer, int isAI);
|
||||||
Player * loadRandomSetLimited(GameObserver* observer, int isAI);
|
Player * loadRandomSetLimited(GameObserver* observer, int isAI);
|
||||||
Player * initPlayer(GameObserver *observer, int playerId);
|
Player * initPlayer(GameObserver *observer, int playerId);
|
||||||
|
|||||||
@@ -33,7 +33,8 @@ public:
|
|||||||
TYPE_DUNGEON = 18,
|
TYPE_DUNGEON = 18,
|
||||||
TYPE_EMBLEM = 19,
|
TYPE_EMBLEM = 19,
|
||||||
TYPE_CONSPIRACY = 20,
|
TYPE_CONSPIRACY = 20,
|
||||||
LAST_TYPE = TYPE_CONSPIRACY,
|
TYPE_BACKGROUND = 21,
|
||||||
|
LAST_TYPE = TYPE_BACKGROUND,
|
||||||
};
|
};
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|||||||
@@ -995,10 +995,10 @@ MTGDeck::MTGDeck(const string& config_file, MTGAllCards * _allcards, int meta_on
|
|||||||
MTGCard * newcard = database->getCardById(atoi(s.c_str()));
|
MTGCard * newcard = database->getCardById(atoi(s.c_str()));
|
||||||
if(!CommandZone.size() && newcard->data->hasType("Legendary") && (newcard->data->hasType("Creature") || newcard->data->basicAbilities[Constants::CANBECOMMANDER])) // If no commander has been added you can add one.
|
if(!CommandZone.size() && newcard->data->hasType("Legendary") && (newcard->data->hasType("Creature") || newcard->data->basicAbilities[Constants::CANBECOMMANDER])) // If no commander has been added you can add one.
|
||||||
CommandZone.push_back(s);
|
CommandZone.push_back(s);
|
||||||
else if(CommandZone.size() == 1 && newcard->data->hasType("Legendary") && (newcard->data->hasType("Creature") || newcard->data->basicAbilities[Constants::CANBECOMMANDER])){ // If a commander has been added you can add a new one just if both have partner ability.
|
else if(CommandZone.size() == 1 && newcard->data->hasType("Legendary") && (newcard->data->hasType("Creature") || newcard->data->basicAbilities[Constants::CANBECOMMANDER])){ // If a commander has been added you can add a new one just if both have partner ability of if one can choose a Background.
|
||||||
if(newcard && newcard->data->basicAbilities[Constants::PARTNER]){
|
if(newcard && (newcard->data->basicAbilities[Constants::PARTNER] || newcard->data->basicAbilities[Constants::BACKGROUNDPARTNER])){
|
||||||
MTGCard * oldcard = database->getCardById(atoi((CommandZone.at(0)).c_str()));
|
MTGCard * oldcard = database->getCardById(atoi((CommandZone.at(0)).c_str()));
|
||||||
if(oldcard && oldcard->data->basicAbilities[Constants::PARTNER] && (oldcard->data->name != newcard->data->name) && ((oldcard->data->partner == "" && newcard->data->partner == "") || (oldcard->data->partner == newcard->data->name && newcard->data->partner == oldcard->data->name)))
|
if((oldcard && oldcard->data->hasType(Subtypes::TYPE_BACKGROUND) && (oldcard->data->name != newcard->data->name)) || (oldcard && oldcard->data->basicAbilities[Constants::PARTNER] && (oldcard->data->name != newcard->data->name) && ((oldcard->data->partner == "" && newcard->data->partner == "") || (oldcard->data->partner == newcard->data->name && newcard->data->partner == oldcard->data->name))))
|
||||||
CommandZone.push_back(s);
|
CommandZone.push_back(s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1012,10 +1012,10 @@ MTGDeck::MTGDeck(const string& config_file, MTGAllCards * _allcards, int meta_on
|
|||||||
str_id << newcard->getId();
|
str_id << newcard->getId();
|
||||||
if(!CommandZone.size() && newcard->data->hasType("Legendary") && (newcard->data->hasType("Creature") || newcard->data->basicAbilities[Constants::CANBECOMMANDER])) // If no commander has been added you can add one.
|
if(!CommandZone.size() && newcard->data->hasType("Legendary") && (newcard->data->hasType("Creature") || newcard->data->basicAbilities[Constants::CANBECOMMANDER])) // If no commander has been added you can add one.
|
||||||
CommandZone.push_back(str_id.str());
|
CommandZone.push_back(str_id.str());
|
||||||
else if(CommandZone.size() == 1 && newcard->data->hasType("Legendary") && (newcard->data->hasType("Creature") || newcard->data->basicAbilities[Constants::CANBECOMMANDER])){ // If a commander has been added you can add a new one just if both have partner ability.
|
else if(CommandZone.size() == 1 && newcard->data->hasType("Legendary") && (newcard->data->hasType("Creature") || newcard->data->basicAbilities[Constants::CANBECOMMANDER])){ // If a commander has been added you can add a new one just if both have partner ability of if one can choose a Background.
|
||||||
if(newcard->data->basicAbilities[Constants::PARTNER]){
|
if(newcard && (newcard->data->basicAbilities[Constants::PARTNER] || newcard->data->basicAbilities[Constants::BACKGROUNDPARTNER])){
|
||||||
MTGCard * oldcard = database->getCardById(atoi((CommandZone.at(0)).c_str()));
|
MTGCard * oldcard = database->getCardById(atoi((CommandZone.at(0)).c_str()));
|
||||||
if(oldcard && oldcard->data->basicAbilities[Constants::PARTNER] && (oldcard->data->name != newcard->data->name) && ((oldcard->data->partner == "" && newcard->data->partner == "") || (oldcard->data->partner == newcard->data->name && newcard->data->partner == oldcard->data->name)))
|
if((oldcard && oldcard->data->hasType(Subtypes::TYPE_BACKGROUND) && (oldcard->data->name != newcard->data->name)) || (oldcard && oldcard->data->basicAbilities[Constants::PARTNER] && (oldcard->data->name != newcard->data->name) && ((oldcard->data->partner == "" && newcard->data->partner == "") || (oldcard->data->partner == newcard->data->name && newcard->data->partner == oldcard->data->name))))
|
||||||
CommandZone.push_back(str_id.str());
|
CommandZone.push_back(str_id.str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -244,7 +244,8 @@ const char* Constants::MTGBasicAbilities[] = {
|
|||||||
"expshroud", //Player can't get experience counters (e.g. "Solemnity").
|
"expshroud", //Player can't get experience counters (e.g. "Solemnity").
|
||||||
"countershroud", //Card can't get any kind of counter (e.g. "Solemnity").
|
"countershroud", //Card can't get any kind of counter (e.g. "Solemnity").
|
||||||
"nonight", //It can't become night (e.g. "Angel of Eternal Dawn").
|
"nonight", //It can't become night (e.g. "Angel of Eternal Dawn").
|
||||||
"nodamageremoved" //Damage is not removed from card (e.g. "Patient Zero").
|
"nodamageremoved", //Damage is not removed from card (e.g. "Patient Zero").
|
||||||
|
"backgoundpartner" //Can choose a backgorund partner as commander (e.g. "Faceless One").
|
||||||
};
|
};
|
||||||
|
|
||||||
map<string,int> Constants::MTGBasicAbilitiesMap;
|
map<string,int> Constants::MTGBasicAbilitiesMap;
|
||||||
|
|||||||
@@ -168,7 +168,7 @@ void Rules::addExtraRules(GameObserver* g)
|
|||||||
difficultyRating = 0;
|
difficultyRating = 0;
|
||||||
else if(g->mRules->gamemode == GAME_TYPE_RANDOM1 || g->mRules->gamemode == GAME_TYPE_RANDOM2)
|
else if(g->mRules->gamemode == GAME_TYPE_RANDOM1 || g->mRules->gamemode == GAME_TYPE_RANDOM2)
|
||||||
difficultyRating = 0;
|
difficultyRating = 0;
|
||||||
else if(g->mRules->gamemode == GAME_TYPE_RANDOM3 || g->mRules->gamemode == GAME_TYPE_RANDOM5 || g->mRules->gamemode == GAME_TYPE_RANDOMCOMMANDER)
|
else if(g->mRules->gamemode == GAME_TYPE_RANDOM3 || g->mRules->gamemode == GAME_TYPE_RANDOM5 || g->mRules->gamemode == GAME_TYPE_RANDOMCOMMANDER)
|
||||||
difficultyRating = 0;
|
difficultyRating = 0;
|
||||||
else if(g->mRules->gamemode == GAME_TYPE_HORDE || g->mRules->gamemode == GAME_TYPE_SET_LIMITED)
|
else if(g->mRules->gamemode == GAME_TYPE_HORDE || g->mRules->gamemode == GAME_TYPE_SET_LIMITED)
|
||||||
difficultyRating = 0;
|
difficultyRating = 0;
|
||||||
@@ -420,47 +420,47 @@ Player * Rules::loadPlayerRandomCommander(GameObserver* observer, int isAI)
|
|||||||
{
|
{
|
||||||
MTGDeck * cmdTempDeck = NEW MTGDeck(MTGCollection());
|
MTGDeck * cmdTempDeck = NEW MTGDeck(MTGCollection());
|
||||||
MTGDeck * tempDeck = NEW MTGDeck(MTGCollection());
|
MTGDeck * tempDeck = NEW MTGDeck(MTGCollection());
|
||||||
tempDeck->meta_commander = true;
|
tempDeck->meta_commander = true;
|
||||||
|
|
||||||
string lands[] = { "", "forest", "island", "mountain", "swamp", "plains", "basic", "basic" };
|
string lands[] = { "", "forest", "island", "mountain", "swamp", "plains", "basic", "basic" };
|
||||||
|
|
||||||
cmdTempDeck->addRandomCards(1, 0, 0, -1, "legendary");
|
cmdTempDeck->addRandomCards(1, 0, 0, -1, "legendary");
|
||||||
DeckDataWrapper * myCommandZone = NEW DeckDataWrapper(cmdTempDeck);
|
DeckDataWrapper * myCommandZone = NEW DeckDataWrapper(cmdTempDeck);
|
||||||
MTGCard * commander = myCommandZone->getCard(0, true);
|
MTGCard * commander = myCommandZone->getCard(0, true);
|
||||||
|
|
||||||
while(!commander->data->isCreature())
|
while(!commander->data->isCreature())
|
||||||
{
|
{
|
||||||
cmdTempDeck->addRandomCards(1, 0, 0, -1, "legendary");
|
cmdTempDeck->addRandomCards(1, 0, 0, -1, "legendary");
|
||||||
myCommandZone = NEW DeckDataWrapper(cmdTempDeck);
|
myCommandZone = NEW DeckDataWrapper(cmdTempDeck);
|
||||||
commander = myCommandZone->getCard(0, true);
|
commander = myCommandZone->getCard(0, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
stringstream cid;
|
stringstream cid;
|
||||||
cid << commander->getMTGId();
|
cid << commander->getMTGId();
|
||||||
vector<string> newCMD;
|
vector<string> newCMD;
|
||||||
newCMD.push_back(cid.str());
|
newCMD.push_back(cid.str());
|
||||||
tempDeck->replaceCMD(newCMD);
|
tempDeck->replaceCMD(newCMD);
|
||||||
|
|
||||||
std::vector< int > colors;
|
std::vector< int > colors;
|
||||||
|
|
||||||
for (int i = 0; i < Constants::NB_Colors; i++)
|
for (int i = 0; i < Constants::NB_Colors; i++)
|
||||||
{
|
{
|
||||||
if (commander->data->getManaCost()->hasColor(i))
|
if (commander->data->getManaCost()->hasColor(i))
|
||||||
colors.push_back(i);
|
colors.push_back(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(colors.data()[0] != 0) { colors.insert(colors.begin(),0); }
|
if(colors.data()[0] != 0) { colors.insert(colors.begin(),0); }
|
||||||
|
|
||||||
if(colors.size() > 1)
|
if(colors.size() > 1)
|
||||||
{
|
{
|
||||||
for (unsigned int i = 1; i < colors.size(); i++)
|
for (unsigned int i = 1; i < colors.size(); i++)
|
||||||
{
|
{
|
||||||
tempDeck->addRandomCards(40/(colors.size()-1), 0, 0, 'L', lands[colors.data()[i]].c_str());
|
tempDeck->addRandomCards(40/(colors.size()-1), 0, 0, 'L', lands[colors.data()[i]].c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else { tempDeck->addRandomCards(40, 0, 0, -1, "basic"); }
|
else { tempDeck->addRandomCards(40, 0, 0, -1, "basic"); }
|
||||||
|
|
||||||
tempDeck->addRandomCards(59, 0, 0, -1, "", colors.data(), colors.size());
|
tempDeck->addRandomCards(59, 0, 0, -1, "", colors.data(), colors.size());
|
||||||
|
|
||||||
string deckFile = "random";
|
string deckFile = "random";
|
||||||
string deckFileSmall = "random";
|
string deckFileSmall = "random";
|
||||||
@@ -565,7 +565,7 @@ Player * Rules::initPlayer(GameObserver *g, int playerId)
|
|||||||
return loadPlayerRandomThree(g, isAI);
|
return loadPlayerRandomThree(g, isAI);
|
||||||
case GAME_TYPE_RANDOM5:
|
case GAME_TYPE_RANDOM5:
|
||||||
return loadPlayerRandomFive(g, isAI);
|
return loadPlayerRandomFive(g, isAI);
|
||||||
case GAME_TYPE_RANDOMCOMMANDER:
|
case GAME_TYPE_RANDOMCOMMANDER:
|
||||||
return loadPlayerRandomCommander(g, isAI);
|
return loadPlayerRandomCommander(g, isAI);
|
||||||
case GAME_TYPE_HORDE:
|
case GAME_TYPE_HORDE:
|
||||||
return loadPlayerHorde(g, isAI);
|
return loadPlayerHorde(g, isAI);
|
||||||
@@ -888,7 +888,7 @@ GameType Rules::strToGameMode(string s)
|
|||||||
if (s.compare("random2") == 0) return GAME_TYPE_RANDOM2;
|
if (s.compare("random2") == 0) return GAME_TYPE_RANDOM2;
|
||||||
if (s.compare("random3") == 0) return GAME_TYPE_RANDOM3;
|
if (s.compare("random3") == 0) return GAME_TYPE_RANDOM3;
|
||||||
if (s.compare("random5") == 0) return GAME_TYPE_RANDOM5;
|
if (s.compare("random5") == 0) return GAME_TYPE_RANDOM5;
|
||||||
if (s.compare("random_commander") == 0) return GAME_TYPE_RANDOMCOMMANDER;
|
if (s.compare("random_commander") == 0) return GAME_TYPE_RANDOMCOMMANDER;
|
||||||
if (s.compare("horde") == 0) return GAME_TYPE_HORDE;
|
if (s.compare("horde") == 0) return GAME_TYPE_HORDE;
|
||||||
if (s.compare("set_limited") == 0) return GAME_TYPE_SET_LIMITED;
|
if (s.compare("set_limited") == 0) return GAME_TYPE_SET_LIMITED;
|
||||||
if (s.compare("story") == 0) return GAME_TYPE_STORY;
|
if (s.compare("story") == 0) return GAME_TYPE_STORY;
|
||||||
|
|||||||
Reference in New Issue
Block a user