Added feature to allow some cards to copy and flip back at the end of turn, added feature to use type: keyword with chosentype and chosencolor combo, fixed crashes on "can play land" restriction, fixed land primitives with pay life or tap condition to avoid crashes.

This commit is contained in:
Vittorio Alfieri
2020-12-23 12:39:18 +01:00
parent d40d6f319e
commit 0ca310da54
7 changed files with 197 additions and 209 deletions
+4 -4
View File
@@ -3995,8 +3995,8 @@ AAMeld * AAMeld::clone() const
}
// flip a card
AAFlip::AAFlip(GameObserver* observer, int id, MTGCardInstance * card, MTGCardInstance * _target,string flipStats, bool isflipcard, bool forcedcopy, string forcetype) :
InstantAbility(observer, id, card, _target),flipStats(flipStats),isflipcard(isflipcard),forcedcopy(forcedcopy),forcetype(forcetype)
AAFlip::AAFlip(GameObserver* observer, int id, MTGCardInstance * card, MTGCardInstance * _target,string flipStats, bool isflipcard, bool forcedcopy, string forcetype, bool backfromcopy) :
InstantAbility(observer, id, card, _target),flipStats(flipStats),isflipcard(isflipcard),forcedcopy(forcedcopy),forcetype(forcetype),backfromcopy(backfromcopy)
{
target = _target;
}
@@ -4016,7 +4016,7 @@ int AAFlip::resolve()
if (_target)
{
if(_target->mutation && _target->parentCards.size() > 0) return 0; // Mutated down cards cannot be flipped, they will follow the fate of top-card
if(((_target->isACopier||_target->isToken) && !isflipcard) || _target->has(Constants::CANTTRANSFORM))
if(((_target->isACopier||_target->isToken) && !isflipcard && !backfromcopy) || _target->has(Constants::CANTTRANSFORM))
{
game->removeObserver(this);
return 0;
@@ -4166,7 +4166,7 @@ int AAFlip::resolve()
}
SAFE_DELETE(myFlip);
_target->mPropertiesChangedSinceLastUpdate = true;
if(!isflipcard)
if(!isflipcard && !backfromcopy)
{
if(_target->isFacedown)
_target->isFacedown = false;
+3 -3
View File
@@ -834,8 +834,6 @@ int AbilityFactory::parseCastRestrictions(MTGCardInstance * card, Player * playe
card->addType("Land");
if (observer->currentActionPlayer->game->playRestrictions->canPutIntoZone(card, observer->currentActionPlayer->game->inPlay) == PlayRestriction::CANT_PLAY)
canplay = false;
if (!card->StackIsEmptyandSorcerySpeed())
canplay = false;
if(!isLand)
card->removeType("Land");
if(!canplay)
@@ -4167,6 +4165,7 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
a->oneShot = true;
return a;
}
//flip
vector<string> splitFlipStat = parseBetween(s, "flip(", ")", true);
if(splitFlipStat.size())
@@ -4183,8 +4182,9 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
{
forcetype = splitType[1];
}
bool backfromcopy = (s.find("undocpy") != string::npos)?true:false; // Added to undo the copy effect at end of turn (es. Scion of the Ur-Dragon).
bool transmode = card->getdoubleFaced() == "kamiflip"?true:false;
MTGAbility * a = NEW AAFlip(observer, id, card, target, flipStats, transmode, false, forcetype);
MTGAbility * a = NEW AAFlip(observer, id, card, target, flipStats, transmode, false, forcetype, backfromcopy);
return a;
}
+10
View File
@@ -253,6 +253,11 @@ TargetChooser * TargetChooserFactory::createTargetChooser(string s, MTGCardInsta
zones[nbzones++] = MTGGameZone::MY_SIDEBOARD;
zones[nbzones++] = MTGGameZone::MY_COMMANDZONE;
}
else if (zoneName.compare("myrestrictedcastingzone") == 0)
{
zones[nbzones++] = MTGGameZone::MY_HAND;
zones[nbzones++] = MTGGameZone::MY_COMMANDZONE;
}
else if (zoneName.compare("opponentcastingzone") == 0)
{
zones[nbzones++] = MTGGameZone::OPPONENT_GRAVEYARD;
@@ -262,6 +267,11 @@ TargetChooser * TargetChooserFactory::createTargetChooser(string s, MTGCardInsta
zones[nbzones++] = MTGGameZone::OPPONENT_SIDEBOARD;
zones[nbzones++] = MTGGameZone::OPPONENT_COMMANDZONE;
}
else if (zoneName.compare("opponentrestrictedcastingzone") == 0)
{
zones[nbzones++] = MTGGameZone::OPPONENT_HAND;
zones[nbzones++] = MTGGameZone::OPPONENT_COMMANDZONE;
}
else if (zoneName.compare("mynonplaynonexile") == 0)
{
zones[nbzones++] = MTGGameZone::MY_GRAVEYARD;