Erwan
- Updated fix for Dragon Broodmother
This commit is contained in:
@@ -209,10 +209,10 @@ divergent_growth.txt
|
|||||||
doomed_necromancer.txt
|
doomed_necromancer.txt
|
||||||
double_strike_i145.txt
|
double_strike_i145.txt
|
||||||
double_strike2_i145.txt
|
double_strike2_i145.txt
|
||||||
|
dragon_broodmother_i491.txt
|
||||||
dragon_fodder.txt
|
dragon_fodder.txt
|
||||||
dragon_fodder2.txt
|
dragon_fodder2.txt
|
||||||
dragon_whelp_i154.txt
|
dragon_whelp_i154.txt
|
||||||
dragon_broodmother_multicolored tokens test.txt
|
|
||||||
drain_life.txt
|
drain_life.txt
|
||||||
dream_fracture_i142.txt
|
dream_fracture_i142.txt
|
||||||
drift_of_the_dead.txt
|
drift_of_the_dead.txt
|
||||||
|
|||||||
@@ -1,28 +0,0 @@
|
|||||||
#Bug: "new school" Tokens can't have two colors
|
|
||||||
|
|
||||||
[INIT]
|
|
||||||
UNTAP
|
|
||||||
[PLAYER1]
|
|
||||||
inplay:mountain
|
|
||||||
hand:shock
|
|
||||||
[PLAYER2]
|
|
||||||
inplay:dragon broodmother,Boartusk Liege
|
|
||||||
[DO]
|
|
||||||
next
|
|
||||||
#upkeep
|
|
||||||
choice 1
|
|
||||||
next
|
|
||||||
#draw
|
|
||||||
next
|
|
||||||
#main
|
|
||||||
mountain
|
|
||||||
shock
|
|
||||||
Dragon
|
|
||||||
[ASSERT]
|
|
||||||
FIRSTMAIN
|
|
||||||
[PLAYER1]
|
|
||||||
graveyard:shock
|
|
||||||
inplay:mountain
|
|
||||||
[PLAYER2]
|
|
||||||
inplay:dragon broodmother,Boartusk Liege,*
|
|
||||||
[END]
|
|
||||||
@@ -33,11 +33,16 @@
|
|||||||
|
|
||||||
using std::string;
|
using std::string;
|
||||||
|
|
||||||
|
|
||||||
//string manipulation methods
|
//string manipulation methods
|
||||||
string& trim(string &str);
|
string& trim(string &str);
|
||||||
string& ltrim(string &str);
|
string& ltrim(string &str);
|
||||||
string& rtrim(string &str);
|
string& rtrim(string &str);
|
||||||
|
|
||||||
|
std::vector<std::string> &split(const std::string &s, char delim, std::vector<std::string> &elems);
|
||||||
|
std::vector<std::string> split(const std::string &s, char delim); //splits a string with "delim" and returns a vector of strings.
|
||||||
|
|
||||||
|
|
||||||
int loadRandValues(string s);
|
int loadRandValues(string s);
|
||||||
int filesize(const char * filename);
|
int filesize(const char * filename);
|
||||||
int fileExists(const char * filename);
|
int fileExists(const char * filename);
|
||||||
|
|||||||
@@ -89,22 +89,12 @@ int MTGAllCards::processConfLine(string &s, MTGCard *card, CardPrimitive * primi
|
|||||||
{
|
{
|
||||||
string value = val;
|
string value = val;
|
||||||
std::transform(value.begin(), value.end(), value.begin(), ::tolower);
|
std::transform(value.begin(), value.end(), value.begin(), ::tolower);
|
||||||
list<int>colors;
|
vector<string> values = split(value, ',');
|
||||||
for (int j = 0; j < Constants::MTG_NB_COLORS; j++){
|
int removeAllOthers = 1;
|
||||||
size_t found = value.find(Constants::MTGColorStrings[j]);
|
for (size_t values_i = 0; values_i < values.size(); ++values_i) {
|
||||||
if (found != string::npos){
|
primitive->setColor(values[values_i], removeAllOthers);
|
||||||
colors.push_back(j);
|
removeAllOthers = 0;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if(colors.size())
|
|
||||||
{
|
|
||||||
primitive->setColor(0,1);
|
|
||||||
primitive->removeColor(0);
|
|
||||||
}
|
|
||||||
list<int>::iterator it;
|
|
||||||
for ( it=colors.begin() ; it != colors.end(); it++ ){
|
|
||||||
primitive->setColor(*it);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
#include "../include/config.h"
|
#include "../include/config.h"
|
||||||
#include "../include/utils.h"
|
#include "../include/utils.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <sstream>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
using std::vector;
|
using std::vector;
|
||||||
|
|
||||||
int randValuesCursor = -1;
|
int randValuesCursor = -1;
|
||||||
@@ -201,3 +204,18 @@ string& rtrim(string &str)
|
|||||||
str.resize(str.find_last_not_of(" \t") + 1);
|
str.resize(str.find_last_not_of(" \t") + 1);
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<std::string> &split(const std::string &s, char delim, std::vector<std::string> &elems) {
|
||||||
|
std::stringstream ss(s);
|
||||||
|
std::string item;
|
||||||
|
while(std::getline(ss, item, delim)) {
|
||||||
|
elems.push_back(item);
|
||||||
|
}
|
||||||
|
return elems;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
std::vector<std::string> split(const std::string &s, char delim) {
|
||||||
|
std::vector<std::string> elems;
|
||||||
|
return split(s, delim, elems);
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user