replaced tabs with 4 spaces.
This commit is contained in:
@@ -168,10 +168,10 @@ void Rules::addExtraRules(GameObserver* g)
|
||||
difficultyRating = 0;
|
||||
else if(g->mRules->gamemode == GAME_TYPE_RANDOM1 || g->mRules->gamemode == GAME_TYPE_RANDOM2)
|
||||
difficultyRating = 0;
|
||||
else if(g->mRules->gamemode == GAME_TYPE_RANDOM3 || g->mRules->gamemode == GAME_TYPE_RANDOM5)
|
||||
difficultyRating = 0;
|
||||
else if(g->mRules->gamemode == GAME_TYPE_HORDE || g->mRules->gamemode == GAME_TYPE_SET_LIMITED)
|
||||
difficultyRating = 0;
|
||||
else if(g->mRules->gamemode == GAME_TYPE_RANDOM3 || g->mRules->gamemode == GAME_TYPE_RANDOM5)
|
||||
difficultyRating = 0;
|
||||
else if(g->mRules->gamemode == GAME_TYPE_HORDE || g->mRules->gamemode == GAME_TYPE_SET_LIMITED)
|
||||
difficultyRating = 0;
|
||||
else if (g->mRules->gamemode == GAME_TYPE_STORY)
|
||||
difficultyRating = 0;
|
||||
else if (a->aType == MTGAbility::STANDARD_DRAW)
|
||||
@@ -200,8 +200,8 @@ void Rules::addExtraRules(GameObserver* g)
|
||||
a->resolve();
|
||||
else if(g->mRules->gamemode == GAME_TYPE_RANDOM1 || g->mRules->gamemode == GAME_TYPE_RANDOM2)
|
||||
a->resolve();
|
||||
else if(g->mRules->gamemode == GAME_TYPE_RANDOM3 || g->mRules->gamemode == GAME_TYPE_RANDOM5)
|
||||
a->resolve();
|
||||
else if(g->mRules->gamemode == GAME_TYPE_RANDOM3 || g->mRules->gamemode == GAME_TYPE_RANDOM5)
|
||||
a->resolve();
|
||||
else if (g->mRules->gamemode == GAME_TYPE_STORY)
|
||||
a->resolve();
|
||||
else//stupid protections to keep this out of momir and other game modes.
|
||||
@@ -313,35 +313,35 @@ Player * Rules::loadPlayerRandom(GameObserver* observer, int isAI, int mode)
|
||||
|
||||
Player * Rules::loadRandomSetLimited(GameObserver* observer, int isAI)
|
||||
{
|
||||
//Random sets
|
||||
int setId[] = { observer->getRandomGenerator()->random() % setlist.size(), observer->getRandomGenerator()->random() % setlist.size() };
|
||||
int nbSet = sizeof(setId)/sizeof(setId[0]);
|
||||
//Random sets
|
||||
int setId[] = { observer->getRandomGenerator()->random() % setlist.size(), observer->getRandomGenerator()->random() % setlist.size() };
|
||||
int nbSet = sizeof(setId)/sizeof(setId[0]);
|
||||
|
||||
int color1 = 1 + observer->getRandomGenerator()->random() % 5;
|
||||
int color1 = 1 + observer->getRandomGenerator()->random() % 5;
|
||||
int color2 = 1 + observer->getRandomGenerator()->random() % 5;
|
||||
int colors[] = { color1, color2 };
|
||||
int nbcolors = 2;
|
||||
string lands[] = { "", "forest", "island", "mountain", "swamp", "plains" };
|
||||
|
||||
MTGDeck * tempDeck = NEW MTGDeck(MTGCollection());
|
||||
// Try to add basic lands from that set
|
||||
tempDeck->addRandomCards(8, setId, nbSet, -1, lands[color1].c_str());
|
||||
MTGDeck * tempDeck = NEW MTGDeck(MTGCollection());
|
||||
// Try to add basic lands from that set
|
||||
tempDeck->addRandomCards(8, setId, nbSet, -1, lands[color1].c_str());
|
||||
tempDeck->addRandomCards(8, setId, nbSet, -1, lands[color2].c_str());
|
||||
tempDeck->addRandomCards(2, setId, nbSet, -1, "land");
|
||||
// If lands < 18 add from any set
|
||||
int missingLands = 18 - tempDeck->totalCards();
|
||||
if (missingLands > 0)
|
||||
{
|
||||
tempDeck->addRandomCards(missingLands/2, 0, 0, -1, lands[color1].c_str());
|
||||
tempDeck->addRandomCards(missingLands/2, 0, 0, -1, lands[color2].c_str());
|
||||
}
|
||||
// Lone artifact and creatures.
|
||||
tempDeck->addRandomCards(1, setId, nbSet, -1, "artifact");
|
||||
tempDeck->addRandomCards(12, setId, nbSet, -1, "creature", colors, nbcolors);
|
||||
// Want the deck to be 40 cards, take any card from the set in the colors
|
||||
int missingCards = 40 - tempDeck->totalCards();
|
||||
if (missingCards > 0)
|
||||
tempDeck->addRandomCards(missingCards, setId, nbSet, -1, "", colors, nbcolors);
|
||||
// If lands < 18 add from any set
|
||||
int missingLands = 18 - tempDeck->totalCards();
|
||||
if (missingLands > 0)
|
||||
{
|
||||
tempDeck->addRandomCards(missingLands/2, 0, 0, -1, lands[color1].c_str());
|
||||
tempDeck->addRandomCards(missingLands/2, 0, 0, -1, lands[color2].c_str());
|
||||
}
|
||||
// Lone artifact and creatures.
|
||||
tempDeck->addRandomCards(1, setId, nbSet, -1, "artifact");
|
||||
tempDeck->addRandomCards(12, setId, nbSet, -1, "creature", colors, nbcolors);
|
||||
// Want the deck to be 40 cards, take any card from the set in the colors
|
||||
int missingCards = 40 - tempDeck->totalCards();
|
||||
if (missingCards > 0)
|
||||
tempDeck->addRandomCards(missingCards, setId, nbSet, -1, "", colors, nbcolors);
|
||||
|
||||
string deckFile = "random";
|
||||
string deckFileSmall = "random";
|
||||
@@ -359,7 +359,7 @@ Player * Rules::loadPlayerRandomThree(GameObserver* observer, int isAI)
|
||||
{
|
||||
int color1 = 1 + observer->getRandomGenerator()->random() % 5;
|
||||
int color2 = 1 + observer->getRandomGenerator()->random() % 5;
|
||||
int color3 = 1 + observer->getRandomGenerator()->random() % 5;
|
||||
int color3 = 1 + observer->getRandomGenerator()->random() % 5;
|
||||
int color0 = Constants::MTG_COLOR_ARTIFACT;
|
||||
|
||||
int colors[] = { color1, color2, color3, color0 };
|
||||
@@ -370,21 +370,21 @@ Player * Rules::loadPlayerRandomThree(GameObserver* observer, int isAI)
|
||||
MTGDeck * tempDeck = NEW MTGDeck(MTGCollection());
|
||||
tempDeck->addRandomCards(1, 0, 0, -1, lands[color1].c_str());
|
||||
tempDeck->addRandomCards(1, 0, 0, -1, lands[color2].c_str());
|
||||
tempDeck->addRandomCards(1, 0, 0, -1, lands[color3].c_str());
|
||||
tempDeck->addRandomCards(6, 0, 0, 'R', lands[color1].c_str());
|
||||
tempDeck->addRandomCards(1, 0, 0, -1, lands[color3].c_str());
|
||||
tempDeck->addRandomCards(6, 0, 0, 'R', lands[color1].c_str());
|
||||
tempDeck->addRandomCards(6, 0, 0, 'R', lands[color2].c_str());
|
||||
tempDeck->addRandomCards(6, 0, 0, 'R', lands[color3].c_str());
|
||||
tempDeck->addRandomCards(3, 0, 0, -1, "land");
|
||||
tempDeck->addRandomCards(6, 0, 0, 'R', lands[color3].c_str());
|
||||
tempDeck->addRandomCards(3, 0, 0, -1, "land");
|
||||
tempDeck->addRandomCards(1, 0, 0, 'U', "land");
|
||||
tempDeck->addRandomCards(1, 0, 0, 'R', "land");
|
||||
tempDeck->addRandomCards(18, 0, 0, -1, "creature", colors, nbcolors);
|
||||
tempDeck->addRandomCards(1, 0, 0, 'R', "creature", colors, nbcolors);
|
||||
tempDeck->addRandomCards(1, 0, 0, 'M', "creature", colors, nbcolors);
|
||||
tempDeck->addRandomCards(1, 0, 0, 'R', "creature", colors, nbcolors);
|
||||
tempDeck->addRandomCards(1, 0, 0, 'M', "creature", colors, nbcolors);
|
||||
tempDeck->addRandomCards(3, 0, 0, -1, "sorcery", colors, nbcolors);
|
||||
tempDeck->addRandomCards(3, 0, 0, -1, "enchantment", colors, nbcolors);
|
||||
tempDeck->addRandomCards(3, 0, 0, -1, "instant", colors, nbcolors);
|
||||
tempDeck->addRandomCards(4, 0, 0, -1, "artifact", colors, nbcolors);
|
||||
tempDeck->addRandomCards(1, 0, 0, -1, "planeswalker", colors, nbcolors);
|
||||
tempDeck->addRandomCards(1, 0, 0, -1, "planeswalker", colors, nbcolors);
|
||||
|
||||
string deckFile = "random";
|
||||
string deckFileSmall = "random";
|
||||
@@ -403,9 +403,9 @@ Player * Rules::loadPlayerRandomFive(GameObserver* observer, int isAI)
|
||||
MTGDeck * tempDeck = NEW MTGDeck(MTGCollection());
|
||||
|
||||
tempDeck->addRandomCards(20, 0, 0, -1, "land");
|
||||
tempDeck->addRandomCards(20, 0, 0, -1, "creature");
|
||||
tempDeck->addRandomCards(20, 0, 0, -1, "");
|
||||
|
||||
tempDeck->addRandomCards(20, 0, 0, -1, "creature");
|
||||
tempDeck->addRandomCards(20, 0, 0, -1, "");
|
||||
|
||||
string deckFile = "random";
|
||||
string deckFileSmall = "random";
|
||||
|
||||
@@ -419,59 +419,59 @@ Player * Rules::loadPlayerRandomFive(GameObserver* observer, int isAI)
|
||||
}
|
||||
|
||||
Player * Rules::loadPlayerHorde(GameObserver* observer, int isAI)
|
||||
{
|
||||
int nbColors = 1;
|
||||
string randomTribe = "";
|
||||
int tribeColor[] = { observer->getRandomGenerator()->random() % 6 };
|
||||
{
|
||||
int nbColors = 1;
|
||||
string randomTribe = "";
|
||||
int tribeColor[] = { observer->getRandomGenerator()->random() % 6 };
|
||||
|
||||
string lands[] = { "land", "forest", "island", "mountain", "swamp", "plains" };
|
||||
string lands[] = { "land", "forest", "island", "mountain", "swamp", "plains" };
|
||||
|
||||
const char* const multicolorTribes[] = { "Ally", "Eldrazi", "Elemental", "Golem", "Hound", "Human", "Knight",
|
||||
"Myr", "Samurai", "Shaman", "Shapeshifter", "Sliver", "Soldier", "Spellshaper", "Spirit", "Warrior", "Wizard" };
|
||||
const char* const whiteTribes[] = { "Angel", "Bird", "Cat", "cleric", "Griffin", "Kithkin", "Knight", "Soldier", "Spirit", "Wizard" };
|
||||
const char* const blueTribes[] = { "Artificer", "Bird", "Drake", "Faerie", "Illusion", "Merfolk", "Spirit", "Vedalken", "Wizard", "Zombie" };
|
||||
const char* const blackTribes[] = { "Cleric", "Demon", "Faerie", "Horror", "Pirate", "Rat", "Rogue", "Shade", "Skeleton", "Vampire", "Wizard", "Zombie" };
|
||||
const char* const redTribes[] = { "Barbarian", "Berserker"," Cat", "Devil", "Dragon", "Goblin", "Minotaur", "Ogre", "Werewolf", "Wizard" };
|
||||
const char* const greenTribes[] = { "Beast", "Cat", "Centaur", "Dinosaur", "Druid", "Elf", "Fungus", "Snake", "Spider", "Treefolk", "Werewolf", "Wizard" };
|
||||
const char* const multicolorTribes[] = { "Ally", "Eldrazi", "Elemental", "Golem", "Hound", "Human", "Knight",
|
||||
"Myr", "Samurai", "Shaman", "Shapeshifter", "Sliver", "Soldier", "Spellshaper", "Spirit", "Warrior", "Wizard" };
|
||||
const char* const whiteTribes[] = { "Angel", "Bird", "Cat", "cleric", "Griffin", "Kithkin", "Knight", "Soldier", "Spirit", "Wizard" };
|
||||
const char* const blueTribes[] = { "Artificer", "Bird", "Drake", "Faerie", "Illusion", "Merfolk", "Spirit", "Vedalken", "Wizard", "Zombie" };
|
||||
const char* const blackTribes[] = { "Cleric", "Demon", "Faerie", "Horror", "Pirate", "Rat", "Rogue", "Shade", "Skeleton", "Vampire", "Wizard", "Zombie" };
|
||||
const char* const redTribes[] = { "Barbarian", "Berserker"," Cat", "Devil", "Dragon", "Goblin", "Minotaur", "Ogre", "Werewolf", "Wizard" };
|
||||
const char* const greenTribes[] = { "Beast", "Cat", "Centaur", "Dinosaur", "Druid", "Elf", "Fungus", "Snake", "Spider", "Treefolk", "Werewolf", "Wizard" };
|
||||
|
||||
int multicolorTribesSize = sizeof(multicolorTribes)/sizeof(multicolorTribes[0]);
|
||||
int whiteTribesSize = sizeof(whiteTribes)/sizeof(whiteTribes[0]);
|
||||
int blueTribesSize = sizeof(blueTribes)/sizeof(blueTribes[0]);
|
||||
int blackTribesSize = sizeof(blackTribes)/sizeof(blackTribes[0]);
|
||||
int redTribesSize = sizeof(redTribes)/sizeof(redTribes[0]);
|
||||
int greenTribesSize = sizeof(greenTribes)/sizeof(greenTribes[0]);
|
||||
int multicolorTribesSize = sizeof(multicolorTribes)/sizeof(multicolorTribes[0]);
|
||||
int whiteTribesSize = sizeof(whiteTribes)/sizeof(whiteTribes[0]);
|
||||
int blueTribesSize = sizeof(blueTribes)/sizeof(blueTribes[0]);
|
||||
int blackTribesSize = sizeof(blackTribes)/sizeof(blackTribes[0]);
|
||||
int redTribesSize = sizeof(redTribes)/sizeof(redTribes[0]);
|
||||
int greenTribesSize = sizeof(greenTribes)/sizeof(greenTribes[0]);
|
||||
|
||||
switch (tribeColor[0])
|
||||
{
|
||||
case Constants::MTG_COLOR_ARTIFACT :
|
||||
randomTribe = multicolorTribes[observer->getRandomGenerator()->random() % multicolorTribesSize];
|
||||
nbColors = 0;
|
||||
break;
|
||||
case Constants::MTG_COLOR_WHITE :
|
||||
randomTribe = whiteTribes[observer->getRandomGenerator()->random() % whiteTribesSize];
|
||||
break;
|
||||
case Constants::MTG_COLOR_BLUE :
|
||||
randomTribe = blueTribes[observer->getRandomGenerator()->random() % blueTribesSize];
|
||||
break;
|
||||
case Constants::MTG_COLOR_BLACK :
|
||||
randomTribe = blackTribes[observer->getRandomGenerator()->random() % blackTribesSize];
|
||||
break;
|
||||
case Constants::MTG_COLOR_RED :
|
||||
randomTribe = redTribes[observer->getRandomGenerator()->random() % redTribesSize];
|
||||
break;
|
||||
case Constants::MTG_COLOR_GREEN :
|
||||
randomTribe = greenTribes[observer->getRandomGenerator()->random() % greenTribesSize];
|
||||
break;
|
||||
}
|
||||
switch (tribeColor[0])
|
||||
{
|
||||
case Constants::MTG_COLOR_ARTIFACT :
|
||||
randomTribe = multicolorTribes[observer->getRandomGenerator()->random() % multicolorTribesSize];
|
||||
nbColors = 0;
|
||||
break;
|
||||
case Constants::MTG_COLOR_WHITE :
|
||||
randomTribe = whiteTribes[observer->getRandomGenerator()->random() % whiteTribesSize];
|
||||
break;
|
||||
case Constants::MTG_COLOR_BLUE :
|
||||
randomTribe = blueTribes[observer->getRandomGenerator()->random() % blueTribesSize];
|
||||
break;
|
||||
case Constants::MTG_COLOR_BLACK :
|
||||
randomTribe = blackTribes[observer->getRandomGenerator()->random() % blackTribesSize];
|
||||
break;
|
||||
case Constants::MTG_COLOR_RED :
|
||||
randomTribe = redTribes[observer->getRandomGenerator()->random() % redTribesSize];
|
||||
break;
|
||||
case Constants::MTG_COLOR_GREEN :
|
||||
randomTribe = greenTribes[observer->getRandomGenerator()->random() % greenTribesSize];
|
||||
break;
|
||||
}
|
||||
|
||||
MTGDeck * tempDeck = NEW MTGDeck(MTGCollection());
|
||||
tempDeck->addRandomCards(16, 0, 0, -1, lands[tribeColor[0]].c_str());
|
||||
MTGDeck * tempDeck = NEW MTGDeck(MTGCollection());
|
||||
tempDeck->addRandomCards(16, 0, 0, -1, lands[tribeColor[0]].c_str());
|
||||
tempDeck->addRandomCards(4, 0, 0, 'R', lands[tribeColor[0]].c_str());
|
||||
tempDeck->addRandomCards(4, 0, 0, -1, "land");
|
||||
tempDeck->addRandomCards(21, 0, 0, -1, randomTribe);
|
||||
tempDeck->addRandomCards(21, 0, 0, -1, randomTribe);
|
||||
tempDeck->addRandomCards(5, 0, 0, -1, "enchantment", tribeColor, nbColors);
|
||||
tempDeck->addRandomCards(5, 0, 0, -1, "instant", tribeColor, nbColors);
|
||||
tempDeck->addRandomCards(5, 0, 0, -1, "sorcery", tribeColor, nbColors);
|
||||
tempDeck->addRandomCards(5, 0, 0, -1, "sorcery", tribeColor, nbColors);
|
||||
|
||||
string deckFile = "random";
|
||||
string deckFileSmall = "random";
|
||||
@@ -502,14 +502,14 @@ Player * Rules::initPlayer(GameObserver *g, int playerId)
|
||||
return loadPlayerRandom(g, isAI, GAME_TYPE_RANDOM1);
|
||||
case GAME_TYPE_RANDOM2:
|
||||
return loadPlayerRandom(g, isAI, GAME_TYPE_RANDOM2);
|
||||
case GAME_TYPE_RANDOM3:
|
||||
case GAME_TYPE_RANDOM3:
|
||||
return loadPlayerRandomThree(g, isAI);
|
||||
case GAME_TYPE_RANDOM5:
|
||||
case GAME_TYPE_RANDOM5:
|
||||
return loadPlayerRandomFive(g, isAI);
|
||||
case GAME_TYPE_HORDE:
|
||||
case GAME_TYPE_HORDE:
|
||||
return loadPlayerHorde(g, isAI);
|
||||
case GAME_TYPE_SET_LIMITED:
|
||||
return loadRandomSetLimited(g, isAI);
|
||||
case GAME_TYPE_SET_LIMITED:
|
||||
return loadRandomSetLimited(g, isAI);
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
@@ -815,10 +815,10 @@ GameType Rules::strToGameMode(string s)
|
||||
if (s.compare("momir") == 0) return GAME_TYPE_MOMIR;
|
||||
if (s.compare("random1") == 0) return GAME_TYPE_RANDOM1;
|
||||
if (s.compare("random2") == 0) return GAME_TYPE_RANDOM2;
|
||||
if (s.compare("random3") == 0) return GAME_TYPE_RANDOM3;
|
||||
if (s.compare("random5") == 0) return GAME_TYPE_RANDOM5;
|
||||
if (s.compare("horde") == 0) return GAME_TYPE_HORDE;
|
||||
if (s.compare("set_limited") == 0) return GAME_TYPE_SET_LIMITED;
|
||||
if (s.compare("random3") == 0) return GAME_TYPE_RANDOM3;
|
||||
if (s.compare("random5") == 0) return GAME_TYPE_RANDOM5;
|
||||
if (s.compare("horde") == 0) return GAME_TYPE_HORDE;
|
||||
if (s.compare("set_limited") == 0) return GAME_TYPE_SET_LIMITED;
|
||||
if (s.compare("story") == 0) return GAME_TYPE_STORY;
|
||||
if (s.compare("stonehewer") == 0) return GAME_TYPE_STONEHEWER;
|
||||
if (s.compare("hermit") == 0) return GAME_TYPE_HERMIT;
|
||||
|
||||
Reference in New Issue
Block a user