Added Y22 set, improved Android downloader for Y22 set, added new restriction "librarycast" to check if a card has been casted from library, added new keyword "startingplayer" to retrieve who was the starting player, added a new ability "nodamageremoved" to avoid damage is removed from a card (e.g. "Patient Zero"), fixed a possbile crash when using "andability" option in "moverandom" ability (e.g. cards with seek abilites), added "myname" option to conjure "ability" to refer the orginal source card name (e.g. "Clone Crafter"), added new zone definitions "myhandlibrary" and "opponenthandlibrary" to refer same time hand and library zone of a player, added new ability "nonight" to avoid it can become night (e.g. "Angel of Eternal Dawn"), improved all cards with "it becomes night" ability.

This commit is contained in:
Vittorio Alfieri
2021-12-20 18:55:54 +01:00
parent 7fa03e620d
commit fa7a0daae1
12 changed files with 522 additions and 56 deletions
+4 -1
View File
@@ -3901,7 +3901,8 @@ ADrawReplacer::~ADrawReplacer()
int AAResetDamage::resolve()
{
MTGCardInstance * _target = (MTGCardInstance *)target;
_target->life = _target->toughness;
if(!_target->has(Constants::NODAMAGEREMOVED)) // Added to avoid damage is removed from a card (e.g. "Patient Zero").
_target->life = _target->toughness;
return 1;
}
@@ -6330,6 +6331,8 @@ const string AARandomMover::getMenuText()
AARandomMover * AARandomMover::clone() const
{
AARandomMover * a = NEW AARandomMover(*this);
if(andAbility)
a->andAbility = andAbility->clone();
return a;
}
+1 -1
View File
@@ -1035,7 +1035,7 @@ void GameObserver::gameStateBasedEffects()
c->flanked -= 1;
}
c->fresh = 0;
if(c->wasDealtDamage > 0 && c->isInPlay(this))
if(c->wasDealtDamage > 0 && c->isInPlay(this) && !c->has(Constants::NODAMAGEREMOVED)) // Added to avoid damage is removed from a card (e.g. "Patient Zero").
c->wasDealtDamage = 0;
c->damageToController = 0;
c->damageToOpponent = 0;
+17
View File
@@ -329,6 +329,21 @@ int AbilityFactory::parseCastRestrictions(MTGCardInstance * card, Player * playe
if(!count)
return 0;
}
check = restriction[i].find("librarycast");
if(check != string::npos)
{
int count = 0;
for(unsigned int k = 0; k < player->game->stack->cardsSeenThisTurn.size(); k++)
{
MTGCardInstance * stackCard = player->game->stack->cardsSeenThisTurn[k];
if(stackCard->next && stackCard->next == card && (card->previousZone == card->controller()->game->library||card->previousZone == card->controller()->opponent()->game->library))
count++;
if(stackCard == card && (card->previousZone == card->controller()->game->library||card->previousZone == card->controller()->opponent()->game->library))
count++;
}
if(!count)
return 0;
}
check = restriction[i].find("rebound");
if(check != string::npos)
{
@@ -3479,6 +3494,8 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
{
cardName = splitCard[1];
}
if(cardName == "myname")
cardName = card->name; // Added to refer the orginal source card name (e.g. "Clone Crafter").
string cardZone = "";
vector<string> splitZone = parseBetween(s, "zone(", ")");
if (splitZone.size())
+3 -1
View File
@@ -242,7 +242,9 @@ const char* Constants::MTGBasicAbilities[] = {
"training", //Has training ability (e.g. "Gryff Rider")
"energyshroud", //Player can't get energy counters (e.g. "Solemnity").
"expshroud", //Player can't get experience counters (e.g. "Solemnity").
"countershroud" //Card can't get any kind of counter (e.g. "Solemnity").
"countershroud", //Card can't get any kind of counter (e.g. "Solemnity").
"nonight", //It can't become night (e.g. "Angel of Eternal Dawn").
"nodamageremoved" //Damage is not removed from card (e.g. "Patient Zero").
};
map<string,int> Constants::MTGBasicAbilitiesMap;
+10
View File
@@ -276,6 +276,11 @@ TargetChooser * TargetChooserFactory::createTargetChooser(string s, MTGCardInsta
zones[nbzones++] = MTGGameZone::MY_BATTLEFIELD;
zones[nbzones++] = MTGGameZone::MY_COMMANDZONE;
}
else if (zoneName.compare("myhandlibrary") == 0)
{
zones[nbzones++] = MTGGameZone::MY_HAND;
zones[nbzones++] = MTGGameZone::MY_LIBRARY;
}
else if (zoneName.compare("opponentcastingzone") == 0)
{
zones[nbzones++] = MTGGameZone::OPPONENT_GRAVEYARD;
@@ -294,6 +299,11 @@ TargetChooser * TargetChooserFactory::createTargetChooser(string s, MTGCardInsta
zones[nbzones++] = MTGGameZone::OPPONENT_BATTLEFIELD;
zones[nbzones++] = MTGGameZone::OPPONENT_COMMANDZONE;
}
else if (zoneName.compare("opponenthandlibrary") == 0)
{
zones[nbzones++] = MTGGameZone::OPPONENT_HAND;
zones[nbzones++] = MTGGameZone::OPPONENT_LIBRARY;
}
else if (zoneName.compare("mynonplaynonexile") == 0)
{
zones[nbzones++] = MTGGameZone::MY_GRAVEYARD;
+5
View File
@@ -1496,6 +1496,11 @@ void WParsedInt::extendedParse(string s, Spell * spell, MTGCardInstance * card)
}
}
}
else if(s.find("startingplayer") != string::npos){ //Return who was the starting player (0 is controller, 1 is opponent).
intValue = card->controller()->getObserver()->turn%2;
if(card->controller()->getObserver()->currentlyActing() != card->controller())
intValue = 1 - intValue;
}
else if(!intValue)//found nothing, try parsing a atoi
{
intValue = atoi(s.c_str());