Added/Fixed primitives, updated the "missing_cards_by_sets" folder, added a new option "keepname" to keep the original name after the copy (e.g. Olag, Ludevic's Hubris), implemented a fix to avoid triggering of oneshot abilities when "flip" ability is used to return from a copy, fixed an issue with colors and "transforms" keyword, implemented a fix to avoid crashes when the card paying extracost has also a cost alteration (e.g. combo with "Pirate's Pillage" and "Ruby Medallion"), added a new keyword "totmanaspent" to return the real amount of mana spent to cast a card (e.g. Memory Deluge), added new keywords "pnumofidentitycols" and "onumofidentitycols" to return the total amount of commander identity colors for controller or opponent (e.g. War Room), improved "totcnt" keyword, added new keywords "totalcololorsinplay" and "oppototalcololorsinplay" to return the total amount of colors on controller or opponent battlefield (e.g. Moonveil Regent), added new keywords "pcoven" and "ocoven" to return if a player controls three or more creatures with different powers (e.g. Augur of Autumn).

This commit is contained in:
Vittorio Alfieri
2021-09-12 21:18:43 +02:00
parent 9aa15766d4
commit 04a6a4bfe2
12 changed files with 254 additions and 118 deletions

View File

@@ -2031,6 +2031,10 @@ int AACopier::resolve()
/*since we look for the real card it will not copy granted haste ability however for token we copy all*/
/*but how to do backup for token so we just copy the backup???*/
bool nolegend = options.find("nolegend") != string::npos; // Check if the copy has to be legendary or not. (e.g. Echoing Equation)
string keepname = "";
if(options.find("keepname") != string::npos){ // Keep the original name after the copy. (e.g. "Olag, Ludevic's Hubris")
keepname = source->getName();
}
if(tokencopied && !_target->isACopier && !_target->getMTGId())
{
source->copy(_target->tokCard, nolegend);
@@ -2138,6 +2142,8 @@ int AACopier::resolve()
andAbilityClone->addToGame();
}
}
if(keepname != "")
source->name = keepname; // Keep the original name after the copy. (e.g. "Olag, Ludevic's Hubris")
}
currentAbilities.clear();
return 1;
@@ -4822,21 +4828,25 @@ int AAFlip::resolve()
{
if (a->oneShot)
{
if(_target->hasType(Subtypes::TYPE_PLANESWALKER)){ // Fix to don't let planeswalker die on flip (since the counter ability is not resolving correctly during flip).
AACounter * tmp = dynamic_cast<AACounter *>(a);
if(tmp && tmp->counterstring.find("loyalty") != string::npos){
for (int j = 0; j < tmp->nb; j++)
_target->counters->addCounter("loyalty", 0, 0, true);
if(!backfromcopy){ // Fix to avoid triggering of oneshot abilities when flip is used to return from a copy.
if(_target->hasType(Subtypes::TYPE_PLANESWALKER)){ // Fix to don't let planeswalker die on flip (since the counter ability is not resolving correctly during flip).
AACounter * tmp = dynamic_cast<AACounter *>(a);
if(tmp && tmp->counterstring.find("loyalty") != string::npos){
for (int j = 0; j < tmp->nb; j++)
_target->counters->addCounter("loyalty", 0, 0, true);
} else a->resolve();
} else a->resolve();
} else a->resolve();
}
SAFE_DELETE(a);
}
else
{
a->addToGame();
MayAbility * dontAdd = dynamic_cast<MayAbility*>(a);
if(!dontAdd)
if(!dontAdd){
a->addToGame();
_target->cardsAbilities.push_back(a);
} else if(!backfromcopy) // Fix to avoid triggering of may abilities when flip is used to return from a copy (e.g. Mirror of the Forebears).
a->addToGame();
}
}
}
@@ -10270,11 +10280,17 @@ void PopulateColorIndexVector(list<int>& colors, const string& colorStringList,
vector<string> abilitiesList = split(colorStringList, delimiter);
for (vector<string>::iterator iter = abilitiesList.begin(); iter != abilitiesList.end(); ++iter)
{
// if the text is not a basic ability but contains a valid color add it to the color vector
if((*iter).find("newcolors[") != string::npos){
size_t start_pos = (*iter).find("newcolors[");
(*iter).replace(start_pos, 10, "");
start_pos = (*iter).find("]");
(*iter).replace(start_pos, 1, "");
}
for (int colorIndex = Constants::MTG_COLOR_ARTIFACT; colorIndex < Constants::NB_Colors; ++colorIndex)
{
// if the text is not a basic ability but contains a valid color add it to the color vector
if ((Constants::GetBasicAbilityIndex(*iter) == -1)
&& ((*iter).find(Constants::MTGColorStrings[colorIndex]) != string::npos))
// We match now exactly the color to avoid wrong color assignment from gained abilities (e.g. protection from blue)
if ((Constants::GetBasicAbilityIndex(*iter) == -1) && ((*iter) == Constants::MTGColorStrings[colorIndex]))
colors.push_back(colorIndex);
}
}