Fixed issues #1049 and #1050 opened by @ranger7271, improved imprint keywords, improved boast ability, added a new "hasability" keyword to check if a card has an ability or not.
This commit is contained in:
@@ -2048,6 +2048,7 @@ AAImprint::AAImprint(GameObserver* observer, int _id, MTGCardInstance * _source,
|
||||
ActivatedAbility(observer, _id, _source, _cost, 0)
|
||||
{
|
||||
target = _target;
|
||||
andAbility = NULL;
|
||||
}
|
||||
|
||||
int AAImprint::resolve()
|
||||
@@ -2083,6 +2084,20 @@ int AAImprint::resolve()
|
||||
source->imprintedNames.push_back(source->imprintedCards.back()->getName());
|
||||
}
|
||||
}
|
||||
if(andAbility)
|
||||
{
|
||||
MTGAbility * andAbilityClone = andAbility->clone();
|
||||
andAbilityClone->target = _target;
|
||||
if(andAbility->oneShot)
|
||||
{
|
||||
andAbilityClone->resolve();
|
||||
SAFE_DELETE(andAbilityClone);
|
||||
}
|
||||
else
|
||||
{
|
||||
andAbilityClone->addToGame();
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
||||
@@ -3165,6 +3165,13 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
||||
{
|
||||
MTGAbility * a = NEW AAImprint(observer, id, card, target);
|
||||
a->oneShot = 1;
|
||||
//andability
|
||||
if(storedAndAbility.size())
|
||||
{
|
||||
string stored = storedAndAbility;
|
||||
storedAndAbility.clear();
|
||||
((AAImprint*)a)->andAbility = parseMagicLine(stored, id, spell, card);
|
||||
}
|
||||
return a;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -207,7 +207,8 @@ const char* Constants::MTGBasicAbilities[] = {
|
||||
"cycling", //It has cycling ability
|
||||
"foretell", //It has foretell cost
|
||||
"anytypeofmanaability", //It allows to spend mana as it were of any color to activate abilities.
|
||||
"boast" //It has boast ability
|
||||
"boast", //It has boast ability
|
||||
"twoboast" //It has boast twice ability (e.g. Birgi, God of Storytelling)
|
||||
};
|
||||
|
||||
map<string,int> Constants::MTGBasicAbilitiesMap;
|
||||
|
||||
@@ -953,6 +953,16 @@ TargetChooser * TargetChooserFactory::createTargetChooser(string s, MTGCardInsta
|
||||
}
|
||||
}
|
||||
|
||||
if (attribute.find("evictname") != string::npos && card->imprintedCards.size())
|
||||
{
|
||||
attributefound = 1;
|
||||
cd->compareName = card->currentimprintName;
|
||||
if (minus)
|
||||
cd->nameComparisonMode = COMPARISON_UNEQUAL;
|
||||
else
|
||||
cd->nameComparisonMode = COMPARISON_EQUAL;
|
||||
}
|
||||
|
||||
if (!attributefound)
|
||||
{
|
||||
//Abilities
|
||||
|
||||
@@ -438,6 +438,14 @@ void WParsedInt::init(string s, Spell * spell, MTGCardInstance * card)
|
||||
{
|
||||
intValue = (s == "pnumofcommandcast")?card->controller()->numOfCommandCast:card->controller()->opponent()->numOfCommandCast;
|
||||
}
|
||||
else if (s == "isflipped" || s == "iscopied") // Return 1 if card has been flipped -- Return 1 if card has copied another card
|
||||
{
|
||||
intValue = (s == "isflipped")?card->isFlipped:card->isACopier;
|
||||
}
|
||||
else if (s == "evictmc" || s == "hasevict")
|
||||
{
|
||||
if(card->imprintedCards.size() > 0) intValue = (s == "evictmc")?card->imprintedCards.back()->getManaCost()->getConvertedCost():card->imprintedCards.size();
|
||||
}
|
||||
else if (s == "evictpw" || s == "evictth")
|
||||
{
|
||||
if(card->imprintedCards.size() > 0) intValue = (s == "evictpw")?card->imprintedCards.back()->getPower():card->imprintedCards.back()->getToughness();
|
||||
@@ -563,9 +571,12 @@ void WParsedInt::init(string s, Spell * spell, MTGCardInstance * card)
|
||||
{
|
||||
intValue = (target->foretellTurn < 0)?0:(target->getObserver()->turn-target->foretellTurn); // Check if you can use the foretell cost from exile (CurrentTurn > ForetellTurn).
|
||||
}
|
||||
else if (s == "isflipped") // Return 1 if card has been flipped
|
||||
else if (s.find("hasability") != string::npos) //Return 1 if card has the specified ability
|
||||
{
|
||||
intValue = card->isFlipped;
|
||||
intValue = 0;
|
||||
for(size_t i = 0; i < Constants::NB_BASIC_ABILITIES; i++)
|
||||
if(Constants::MTGBasicAbilities[i] == s.substr(10))
|
||||
intValue = card->basicAbilities[i];
|
||||
}
|
||||
else if (s == "manacost") //Return the converted manacost
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user