Bushido & Modular

add Bushido and Modular points
This commit is contained in:
Anthony Calosa
2017-03-16 16:58:56 +08:00
parent 44cb0d995e
commit d4e1d809f3
11 changed files with 192 additions and 75 deletions

View File

@@ -60,6 +60,7 @@ CardPrimitive::CardPrimitive(CardPrimitive * source)
setAICustomCode(source->AICustomCode);
setCrewAbility(source->CrewAbility);
setPhasedOutAbility(source->PhasedOutAbility);
setModularValue(source->ModularValue);
power = source->power;
toughness = source->toughness;
restrictions = source->restrictions ? source->restrictions->clone() : NULL;
@@ -381,6 +382,17 @@ const string& CardPrimitive::getPhasedOutAbility() const
return PhasedOutAbility;
}
void CardPrimitive::setModularValue(const string& value)
{
ModularValue = value;
std::transform(ModularValue.begin(), ModularValue.end(), ModularValue.begin(), ::tolower);
}
const string& CardPrimitive::getModularValue() const
{
return ModularValue;
}
void CardPrimitive::setName(const string& value)
{
name = value;

View File

@@ -3501,7 +3501,7 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
vector<string>splitPT = split(splitBushido[1],'/');
if(!splitPT.size())
return NULL;
return NEW ABushidoAbility(observer, id, card,splitBushido[1]);
return NEW ABushidoAbility(observer, id, card,splitBushido[1],splitPT[0]);
}
vector<string> splitPhaseAlter = parseBetween(s, "phasealter(", ")");
if (splitPhaseAlter.size())
@@ -5327,6 +5327,12 @@ void AbilityFactory::addAbilities(int _id, Spell * spell)
observer->addObserver(NEW AFlankerAbility(observer, _id, card));
}
if(card->basicAbilities[(int)Constants::MODULAR])
{
AModularAbility * ability = NEW AModularAbility(observer, _id, card, card, card->getModularValue());
observer->addObserver(ability);
}
const int HomeAbilities[] = {(int)Constants::FORESTHOME, (int)Constants::ISLANDHOME, (int)Constants::MOUNTAINHOME, (int)Constants::SWAMPHOME, (int)Constants::PLAINSHOME};
const char * HomeLands[] = {"forest", "island", "mountain", "swamp", "plains"};

View File

@@ -154,6 +154,7 @@ void MTGCardInstance::copy(MTGCardInstance * card)
doubleFaced = data->doubleFaced;
AICustomCode = data->AICustomCode;
CrewAbility = data->CrewAbility;
ModularValue = data->ModularValue;
PhasedOutAbility = data->PhasedOutAbility;
origpower = card->origpower;//for flip
origtoughness = card->origtoughness;//for flip
@@ -279,6 +280,8 @@ void MTGCardInstance::initMTGCI()
imprintR = 0;
imprintB = 0;
imprintW = 0;
bushidoPoints = 0;
modularPoints = 0;
entersBattlefield = 0;
currentimprintName = "";
imprintedNames.clear();

View File

@@ -224,9 +224,16 @@ int MTGAllCards::processConfLine(string &s, MTGCard *card, CardPrimitive * primi
case 'm': //mana
if (!primitive) primitive = NEW CardPrimitive();
{
string value = val;
std::transform(value.begin(), value.end(), value.begin(), ::tolower);
primitive->setManaCost(value);
if( key == "modular")//modular
{
primitive->setModularValue(val);
}
else
{
string value = val;
std::transform(value.begin(), value.end(), value.begin(), ::tolower);
primitive->setManaCost(value);
}
}
break;

View File

@@ -187,7 +187,8 @@ const char* Constants::MTGBasicAbilities[] = {
"showfromtoplibrary",
"showopponenttoplibrary",
"totemarmor",
"discardtoplaybyopponent"
"discardtoplaybyopponent",
"modular"
};
map<string,int> Constants::MTGBasicAbilitiesMap;