Added new primitives from LTR set, improved "steal" ability with "and" option, printed the nember of ring temptations on "The Ring" card, improved "hasdead" restriction to calculate if a card of a specific type has died during the current turn.

This commit is contained in:
Vittorio Alfieri
2023-06-27 18:17:22 +02:00
parent edc0aebf04
commit 9760ab39b7
6 changed files with 587 additions and 25 deletions
+22 -16
View File
@@ -521,25 +521,25 @@ int AbilityFactory::parseCastRestrictions(MTGCardInstance * card, Player * playe
if(check != string::npos)
{
bool hasdeadtype = false;
string checktype = restriction[i].substr(7);
for(int cp = 0;cp < 2;cp++)
string checktype = "";
Player * checkCurrent = NULL;
if(restriction[i].find("oppo") != string::npos){
checktype = restriction[i].substr(11);
checkCurrent = card->controller()->opponent();
} else {
checktype = restriction[i].substr(9);
checkCurrent = card->controller();
}
MTGGameZone * grave = checkCurrent->game->graveyard;
for(unsigned int gy = 0; gy < grave->cardsSeenThisTurn.size(); gy++)
{
Player * checkCurrent = observer->players[cp];
MTGGameZone * grave = checkCurrent->game->graveyard;
for(unsigned int gy = 0;gy < grave->cardsSeenThisTurn.size();gy++)
MTGCardInstance * checkCard = grave->cardsSeenThisTurn[gy];
if(checkCard->hasType(checktype) &&
((checkCard->previousZone == checkCurrent->game->battlefield))) //died from battlefield
{
MTGCardInstance * checkCard = grave->cardsSeenThisTurn[gy];
if(checkCard->hasType(checktype) &&
((checkCard->previousZone == checkCurrent->game->battlefield)||
(checkCard->previousZone == checkCurrent->opponent()->game->battlefield))//died from battlefield
)
{
hasdeadtype = true;
break;
}
}
if(hasdeadtype)
hasdeadtype = true;
break;
}
}
if(!hasdeadtype)
return 0;
@@ -5665,6 +5665,12 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
{
MTGAbility * a = NEW ASeizeWrapper(observer, id, card, target);
a->oneShot = 1;
if(storedAndAbility.size())
{
string stored = storedAndAbility;
storedAndAbility.clear();
((ASeizeWrapper*)a)->andAbility = parseMagicLine(stored, id, spell, card);
}
return a;
}