Added/fixed primitives, Added keywords "showopponenthand" and "showcontrollerhand" to allow controller and opponent to play with their hand revealed, added "mytarg" prefix to check values for a card target as like we do for "storedcard" prefix (e.g. "Redirect"), fixed "undocpy" keyoword for all cards (e.g. "Renegade Doppelganger") that have to be back from a previous copy.

This commit is contained in:
Vittorio Alfieri
2021-08-27 00:29:47 +02:00
parent bbc25e2727
commit 1ce0facf21
11 changed files with 305 additions and 216 deletions
+2
View File
@@ -4827,6 +4827,8 @@ int AAFlip::resolve()
}
SAFE_DELETE(myFlip);
_target->mPropertiesChangedSinceLastUpdate = true;
if(backfromcopy)
_target->isACopier = false; //the card is no longer a copy (e.g. "Renegade Doppelganger" and "Scion of the Ur-Dragon")
if(!isflipcard && !backfromcopy)
{
if(_target->isFacedown)
+3 -1
View File
@@ -1384,8 +1384,10 @@ void GameObserver::ButtonPressed(PlayGuiObject * target)
}
else
{
bool showopponenthand = (opponentHand->zone && opponentHand->zone->owner->opponent()->game->battlefield->nb_cards && opponentHand->zone->owner->opponent()->game->battlefield->hasAbility(Constants::SHOWOPPONENTHAND))?true:false;
bool showcontrollerhand = (opponentHand->zone && opponentHand->zone->owner->game->battlefield->nb_cards && opponentHand->zone->owner->game->battlefield->hasAbility(Constants::SHOWCONTROLLERHAND))?true:false;
TargetChooser * _tc = this->getCurrentTargetChooser();
if (_tc && _tc->targetsZone(opponentHand->zone))
if ((_tc && _tc->targetsZone(opponentHand->zone)) || showopponenthand || showcontrollerhand)
{
opponentHand->toggleDisplay();
}
+16 -23
View File
@@ -252,7 +252,7 @@ void GuiGameZone::Render()
modx = -0.f;
mody = -2.f;
iconhand->SetColor(ARGB((int)(actA),255,255,255));
quad = iconhand;
quad = iconhand;
}
if(iconcard && type == GUI_GRAVEYARD)
{
@@ -286,7 +286,6 @@ void GuiGameZone::Render()
iconsideboard->SetColor(ARGB((int)(actA),255,255,255));
quad = iconsideboard;
}
//
if(type == GUI_LIBRARY && zone->nb_cards && !showCards)
{
@@ -297,32 +296,26 @@ void GuiGameZone::Render()
if(card && card->getObserver())
{
replaced = true;
/*TargetChooser * tc = card->getObserver()->getCurrentTargetChooser();
if(tc && tc->canTarget(card) && !tc->done)
replaced = false;
JQuadPtr kquad = WResourceManager::Instance()->RetrieveCard(card, CACHE_THUMB);
if(kquad)
{
kquad->SetColor(ARGB((int)(actA),255,255,255));
scale2 = defaultHeight / kquad->mHeight;
modx = (35/4)+1;
mody = (50/4)+1;
quad = kquad;
}
else
{*/
JQuadPtr kquad = WResourceManager::Instance()->RetrieveCard(card, CACHE_THUMB);
if(kquad)
{
quad = CardGui::AlternateThumbQuad(card);
if(quad)
{
kquad->SetColor(ARGB((int)(actA),255,255,255));
scale2 = defaultHeight / kquad->mHeight;
quad->SetColor(ARGB((int)(actA),255,255,255));
scale2 = defaultHeight / quad->mHeight;
modx = (35/4)+1;
mody = (50/4)+1;
quad = kquad;
}
else
{
quad = CardGui::AlternateThumbQuad(card);
if(quad)
{
quad->SetColor(ARGB((int)(actA),255,255,255));
scale2 = defaultHeight / quad->mHeight;
modx = (35/4)+1;
mody = (50/4)+1;
}
}
//}
}
}
}
}
+2
View File
@@ -226,6 +226,8 @@ const char* Constants::MTGBasicAbilities[] = {
"noncombatvigor", //instead of taking non-combat damage the source gains +1/+1 counters (e.g. Stormwild Capridor)
"nomovetrigger", //no trigger when playing these cards (e.g. fake ability cards such as Davriel Conditions, Davriel Offers, Annihilation Rooms)
"wascommander", //It was the current commander (e.g. after it flipped or morphed)
"showopponenthand", //opponent plays with his hand revealed.
"showcontrollerhand" //controller plays with his hand revealed.
};
map<string,int> Constants::MTGBasicAbilitiesMap;
+12 -2
View File
@@ -16,7 +16,7 @@ void WParsedInt::init(string s, Spell * spell, MTGCardInstance * card)
return;
if (!card)
{
intValue = atoi(s.c_str());//if there is no card, try parsing a number.
intValue = atoi(s.c_str()); //if there is no card, try parsing a number.
return;
}
MTGCardInstance * target = card->target;
@@ -45,6 +45,12 @@ void WParsedInt::init(string s, Spell * spell, MTGCardInstance * card)
altered.append(s.substr(+6));
return init(altered,spell,card->storedCard);
}
if(s.find("mytarg") != string::npos)
{
string altered ="-";
altered.append(s.substr(+6));
return init(altered,spell,card->target); //we refer the target (e.g. Redirect)
}
}
if(s[0] == '+')
{
@@ -55,6 +61,10 @@ void WParsedInt::init(string s, Spell * spell, MTGCardInstance * card)
{
return init(s.substr(+6),spell,card->storedCard);
}
if(s.find("mytarg") != string::npos)
{
return init(s.substr(+6),spell,card->target); //we refer the target (e.g. Redirect)
}
//rounding values, the words can be written anywhere in the line,
//they are erased after parsing.
if(s.find("halfup") != string::npos)
@@ -742,7 +752,7 @@ void WParsedInt::init(string s, Spell * spell, MTGCardInstance * card)
}
else if (s == "kicked" || s == "handsize")
{
intValue = (s == "kicked")?target->kicked:target->controller()->handsize;
intValue = (s == "kicked")?card->kicked:target->controller()->handsize;
}
else if (s == "olandg" || s == "olandu")
{