Fix Flip/Transform Cards
If the card is a copier or a token, it cannot be transformed since it's not a double face card. Also the copied card must be the "active" part of a double faced card. Flip cards (kamigawa block) is not restricted by this since its a single sided card. If the transformed card is cda, take any damage into account (PT bonus is already in effect for cda)..
This commit is contained in:
@@ -4499,7 +4499,8 @@ class AAFlip: public InstantAbility
|
|||||||
public:
|
public:
|
||||||
vector<MTGAbility *> currentAbilities;
|
vector<MTGAbility *> currentAbilities;
|
||||||
string flipStats;
|
string flipStats;
|
||||||
AAFlip(GameObserver* observer, int id, MTGCardInstance * card, MTGCardInstance * _target,string flipStats);
|
bool isflipcard;
|
||||||
|
AAFlip(GameObserver* observer, int id, MTGCardInstance * card, MTGCardInstance * _target,string flipStats, bool isflipcard = false);
|
||||||
int resolve();
|
int resolve();
|
||||||
int testDestroy();
|
int testDestroy();
|
||||||
const string getMenuText();
|
const string getMenuText();
|
||||||
|
|||||||
@@ -3148,14 +3148,15 @@ AAMeld * AAMeld::clone() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
// flip a card
|
// flip a card
|
||||||
AAFlip::AAFlip(GameObserver* observer, int id, MTGCardInstance * card, MTGCardInstance * _target,string flipStats) :
|
AAFlip::AAFlip(GameObserver* observer, int id, MTGCardInstance * card, MTGCardInstance * _target,string flipStats, bool isflipcard) :
|
||||||
InstantAbility(observer, id, card, _target),flipStats(flipStats)
|
InstantAbility(observer, id, card, _target),flipStats(flipStats),isflipcard(isflipcard)
|
||||||
{
|
{
|
||||||
target = _target;
|
target = _target;
|
||||||
}
|
}
|
||||||
|
|
||||||
int AAFlip::resolve()
|
int AAFlip::resolve()
|
||||||
{
|
{
|
||||||
|
int cdaDamage = 0;
|
||||||
MTGCardInstance * Flipper = (MTGCardInstance*)source;
|
MTGCardInstance * Flipper = (MTGCardInstance*)source;
|
||||||
this->oneShot = true;
|
this->oneShot = true;
|
||||||
if(Flipper->isFlipped)
|
if(Flipper->isFlipped)
|
||||||
@@ -3163,9 +3164,20 @@ int AAFlip::resolve()
|
|||||||
game->removeObserver(this);
|
game->removeObserver(this);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//701.25a Only permanents represented by double-faced cards can transform.
|
||||||
|
//(See rule 711, “Double-Faced Cards.”) If a spell or ability instructs a player
|
||||||
|
//to transform any permanent that isn’t represented by a double-faced card, nothing happens.
|
||||||
|
//***Copier and Tokens cannot transform but can be flip since flip cards are single sided***
|
||||||
MTGCardInstance * _target = (MTGCardInstance *) target;
|
MTGCardInstance * _target = (MTGCardInstance *) target;
|
||||||
if (_target)
|
if (_target)
|
||||||
{
|
{
|
||||||
|
if((_target->isACopier||_target->isToken) && !isflipcard)
|
||||||
|
{
|
||||||
|
game->removeObserver(this);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
while (_target->next)
|
while (_target->next)
|
||||||
_target = _target->next;
|
_target = _target->next;
|
||||||
|
|
||||||
@@ -3179,12 +3191,19 @@ int AAFlip::resolve()
|
|||||||
MTGCardInstance * myFlip = NEW MTGCardInstance(fcard, _target->controller()->game);
|
MTGCardInstance * myFlip = NEW MTGCardInstance(fcard, _target->controller()->game);
|
||||||
_target->name = myFlip->name;
|
_target->name = myFlip->name;
|
||||||
_target->setName(myFlip->name);
|
_target->setName(myFlip->name);
|
||||||
|
if(!isflipcard)//transform card
|
||||||
|
{
|
||||||
|
_target->getManaCost()->resetCosts();
|
||||||
|
if(myFlip->getManaCost())
|
||||||
|
_target->getManaCost()->copy(myFlip->getManaCost());
|
||||||
|
}
|
||||||
_target->colors = myFlip->colors;
|
_target->colors = myFlip->colors;
|
||||||
_target->types = myFlip->types;
|
_target->types = myFlip->types;
|
||||||
_target->text = myFlip->text;
|
_target->text = myFlip->text;
|
||||||
_target->formattedText = myFlip->formattedText;
|
_target->formattedText = myFlip->formattedText;
|
||||||
_target->basicAbilities = myFlip->basicAbilities;
|
_target->basicAbilities = myFlip->basicAbilities;
|
||||||
|
cdaDamage = _target->damageCount;
|
||||||
|
_target->copiedID = myFlip->getMTGId();//for copier
|
||||||
for(unsigned int i = 0;i < _target->cardsAbilities.size();i++)
|
for(unsigned int i = 0;i < _target->cardsAbilities.size();i++)
|
||||||
{
|
{
|
||||||
MTGAbility * a = dynamic_cast<MTGAbility *>(_target->cardsAbilities[i]);
|
MTGAbility * a = dynamic_cast<MTGAbility *>(_target->cardsAbilities[i]);
|
||||||
@@ -3242,11 +3261,15 @@ int AAFlip::resolve()
|
|||||||
}
|
}
|
||||||
if(!_target->isCDA)
|
if(!_target->isCDA)
|
||||||
{
|
{
|
||||||
_target->power = powerlessThanOriginal?myFlip->power - powerMod:myFlip->power + powerMod;
|
_target->power = powerlessThanOriginal?myFlip->power - powerMod:myFlip->power + powerMod;
|
||||||
_target->life = toughLessThanOriginal?myFlip->toughness - toughMod:myFlip->toughness + toughMod;
|
_target->life = toughLessThanOriginal?myFlip->toughness - toughMod:myFlip->toughness + toughMod;
|
||||||
_target->toughness = toughLessThanOriginal?myFlip->toughness - toughMod:myFlip->toughness + toughMod;
|
_target->toughness = toughLessThanOriginal?myFlip->toughness - toughMod:myFlip->toughness + toughMod;
|
||||||
_target->origpower = myFlip->origpower;
|
_target->origpower = myFlip->origpower;
|
||||||
_target->origtoughness = myFlip->origtoughness;
|
_target->origtoughness = myFlip->origtoughness;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{//pbonus & tbonus are already computed except damage taken...
|
||||||
|
_target->life -= cdaDamage;
|
||||||
}
|
}
|
||||||
SAFE_DELETE(myFlip);
|
SAFE_DELETE(myFlip);
|
||||||
_target->mPropertiesChangedSinceLastUpdate = true;
|
_target->mPropertiesChangedSinceLastUpdate = true;
|
||||||
|
|||||||
@@ -3334,8 +3334,35 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
|||||||
/*vector<string>FlipStats = split(splitFlipStat[1],'%');*/
|
/*vector<string>FlipStats = split(splitFlipStat[1],'%');*/
|
||||||
flipStats = splitFlipStat[1];
|
flipStats = splitFlipStat[1];
|
||||||
}
|
}
|
||||||
MTGAbility * a = NEW AAFlip(observer, id, card, target,flipStats);
|
if(flipStats == "Tomoya the Revealer" ||
|
||||||
return a;
|
flipStats == "Tok-Tok, Volcano Born" ||
|
||||||
|
flipStats == "Tobita, Master of Winds" ||
|
||||||
|
flipStats == "Stabwhisker the Odious" ||
|
||||||
|
flipStats == "Shidako, Broodmistress" ||
|
||||||
|
flipStats == "Sasaya's Essence" ||
|
||||||
|
flipStats == "Rune-Tail's Essence" ||
|
||||||
|
flipStats == "Nighteyes the Desecrator" ||
|
||||||
|
flipStats == "Kuon's Essence" ||
|
||||||
|
flipStats == "Kenzo the Hardhearted" ||
|
||||||
|
flipStats == "Kaiso, Memory of Loyalty" ||
|
||||||
|
flipStats == "Ichiga, Who Topples Oaks" ||
|
||||||
|
flipStats == "Homura's Essence" ||
|
||||||
|
flipStats == "Scarmaker" ||
|
||||||
|
flipStats == "Goka the Unjust" ||
|
||||||
|
flipStats == "Erayo's Essence" ||
|
||||||
|
flipStats == "Jaraku the Interloper" ||
|
||||||
|
flipStats == "Azamuki, Treachery Incarnate" ||
|
||||||
|
flipStats == "Autumn-Tail, Kitsune Sage" ||
|
||||||
|
flipStats == "Dokai, Weaver of Life" )
|
||||||
|
{//old flip cards kamigawa
|
||||||
|
MTGAbility * a = NEW AAFlip(observer, id, card, target,flipStats,true);
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
else//regular transform
|
||||||
|
{
|
||||||
|
MTGAbility * a = NEW AAFlip(observer, id, card, target,flipStats);
|
||||||
|
return a;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Change Power/Toughness
|
//Change Power/Toughness
|
||||||
|
|||||||
Reference in New Issue
Block a user