copy/flip limit

if the copy/flip is activated, it means it's already in the battlefield,
so "enters the battlefield" must not trigger...
This commit is contained in:
Anthony Calosa
2016-08-10 19:49:31 +08:00
parent 2422e72713
commit 0c124327de
7 changed files with 25 additions and 14 deletions

View File

@@ -119077,8 +119077,7 @@ toughness=4
[/card]
[card]
name=Vesuva
auto=tap(noevent)
auto=may copy notatarget(land)
auto=may copy notatarget(land) and!( tap(noevent) )!
text=You may have Vesuva enter the battlefield tapped as a copy of any land on the battlefield.
type=Land
[/card]

View File

@@ -1949,7 +1949,8 @@ class AACopier: public ActivatedAbility
{
public:
MTGAbility * andAbility;
AACopier(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target = NULL, ManaCost * _cost = NULL);
bool activated;
AACopier(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target = NULL, ManaCost * _cost = NULL, bool activated = false);
int resolve();
const string getMenuText();
AACopier * clone() const;
@@ -4595,7 +4596,8 @@ public:
string flipStats;
bool isflipcard;
bool forcedcopy;
AAFlip(GameObserver* observer, int id, MTGCardInstance * card, MTGCardInstance * _target,string flipStats, bool isflipcard = false, bool forcedcopy = false);
bool activated;
AAFlip(GameObserver* observer, int id, MTGCardInstance * card, MTGCardInstance * _target,string flipStats, bool isflipcard = false, bool forcedcopy = false, bool activated = false);
int resolve();
int testDestroy();
const string getMenuText();

View File

@@ -89,6 +89,7 @@ public:
bool turningOver;
bool isMorphed;
bool isFlipped;
bool activateCF;
string MeldedFrom;
bool isPhased;
bool isCascaded;

View File

@@ -1449,11 +1449,12 @@ AALibraryBottom * AALibraryBottom::clone() const
}
//AACopier
AACopier::AACopier(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target, ManaCost * _cost) :
AACopier::AACopier(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target, ManaCost * _cost, bool _activated) :
ActivatedAbility(observer, _id, _source, _cost, 0)
{
target = _target;
andAbility = NULL;
activated = _activated;
}
int AACopier::resolve()
@@ -1462,6 +1463,7 @@ int AACopier::resolve()
MTGCardInstance * _target = (MTGCardInstance *) target;
if (_target)
{
_target->activateCF = activated;
MTGCard* clone ;
if(_target->isToken || (_target->isACopier && _target->hasCopiedToken))
{//fix crash when copying token
@@ -1482,7 +1484,7 @@ int AACopier::resolve()
* instead of using source->copy(myClone) use *
* AAFlip with forcedcopy to true *
*********************************************/
AAFlip * af = NEW AAFlip(game, game->mLayers->actionLayer()->getMaxId(), source, source, clone->data->name, false, true);
AAFlip * af = NEW AAFlip(game, game->mLayers->actionLayer()->getMaxId(), source, source, clone->data->name, false, true, activated);
af->oneShot = 1;
af->canBeInterrupted = false;
af->resolve();
@@ -1532,6 +1534,7 @@ int AACopier::resolve()
andAbilityClone->addToGame();
}
}
_target->activateCF = false;
return 1;
}
return 0;
@@ -1653,7 +1656,7 @@ AACounter::AACounter(GameObserver* observer, int id, MTGCardInstance * source, M
if (target)
{
MTGCardInstance * _target = (MTGCardInstance *) target;
if(_target->isFlipped && _target->hasType(Subtypes::TYPE_PLANESWALKER))//is flipping pw
if(_target->isFlipped && (_target->activateCF || _target->hasType(Subtypes::TYPE_PLANESWALKER)))//is flipping && activated flip or activated copy or Planeswalker
{
this->forceDestroy = 1;
return 0;
@@ -3204,10 +3207,11 @@ AAMeld * AAMeld::clone() const
}
// flip a card
AAFlip::AAFlip(GameObserver* observer, int id, MTGCardInstance * card, MTGCardInstance * _target,string flipStats, bool isflipcard, bool forcedcopy) :
AAFlip::AAFlip(GameObserver* observer, int id, MTGCardInstance * card, MTGCardInstance * _target,string flipStats, bool isflipcard, bool forcedcopy, bool _activated) :
InstantAbility(observer, id, card, _target),flipStats(flipStats),isflipcard(isflipcard),forcedcopy(forcedcopy)
{
target = _target;
activated = _activated;
}
int AAFlip::resolve()
@@ -3239,6 +3243,7 @@ int AAFlip::resolve()
AbilityFactory af(game);
_target->isFlipped = true;
_target->activateCF = activated;
GameObserver * game = _target->getObserver();
if(flipStats.size())
{
@@ -3286,7 +3291,8 @@ int AAFlip::resolve()
{
if (a->oneShot)
{
a->resolve();
if(!activated)
a->resolve();
SAFE_DELETE(a);
}
else
@@ -3368,6 +3374,7 @@ int AAFlip::testDestroy()
//originally added as a safegaurd to insure the ability was removed
//it's been so long and so much has changed that it appears to do nothing but cause a crash now
_target->isFlipped = false;
_target->activateCF = false;
return 1;
}
}

View File

@@ -12,10 +12,10 @@ GuiAvatars::GuiAvatars(DuelLayers* duelLayers) :
{
Add(self = NEW GuiAvatar(SCREEN_WIDTH, SCREEN_HEIGHT, false, mpDuelLayers->getRenderedPlayer(), GuiAvatar::BOTTOM_RIGHT, this));
self->zoom = 0.9f;
Add(selfGraveyard = NEW GuiGraveyard(SCREEN_WIDTH - GuiAvatar::Width - GuiGameZone::Width / 2 - 11, SCREEN_HEIGHT - GuiAvatar::Height - 1, false, mpDuelLayers->getRenderedPlayer(), this));
Add(selfLibrary = NEW GuiLibrary(SCREEN_WIDTH - GuiAvatar::Width - GuiGameZone::Width / 2 - 11, SCREEN_HEIGHT - GuiAvatar::Height - 5 + GuiGameZone::Height + 5, false, mpDuelLayers->getRenderedPlayer(), this));
Add(selfGraveyard = NEW GuiGraveyard(SCREEN_WIDTH - GuiAvatar::Width - GuiGameZone::Width / 2 - 11, SCREEN_HEIGHT - GuiAvatar::Height - 7, false, mpDuelLayers->getRenderedPlayer(), this));
Add(selfLibrary = NEW GuiLibrary(SCREEN_WIDTH - GuiAvatar::Width - GuiGameZone::Width / 2 - 11, SCREEN_HEIGHT - GuiAvatar::Height - 10 + GuiGameZone::Height + 5, false, mpDuelLayers->getRenderedPlayer(), this));
//myexile
Add(selfExile = NEW GuiExile(SCREEN_WIDTH - GuiAvatar::Width - GuiGameZone::Width / 2 - 11, SCREEN_HEIGHT - GuiAvatar::Height - 30, false, mpDuelLayers->getRenderedPlayer(), this));
Add(selfExile = NEW GuiExile(SCREEN_WIDTH - GuiAvatar::Width - GuiGameZone::Width / 2 - 11, SCREEN_HEIGHT - GuiAvatar::Height - 34, false, mpDuelLayers->getRenderedPlayer(), this));
Add(opponent = NEW GuiAvatar(0, 0, false, mpDuelLayers->getRenderedPlayerOpponent(), GuiAvatar::TOP_LEFT, this));
opponent->zoom = 0.9f;

View File

@@ -2547,6 +2547,7 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
MTGAbility * a = NEW AACopier(observer, id, card, target);
a->oneShot = 1;
a->canBeInterrupted = false;
((AACopier*)a)->activated = activated;
//andability
if(storedAndAbility.size())
{
@@ -3393,12 +3394,12 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
}
if(card->getdoubleFaced() == "kamiflip")
{//old flip cards kamigawa
MTGAbility * a = NEW AAFlip(observer, id, card, target,flipStats,true);
MTGAbility * a = NEW AAFlip(observer, id, card, target,flipStats,true,false,activated);
return a;
}
else//regular transform
{
MTGAbility * a = NEW AAFlip(observer, id, card, target,flipStats);
MTGAbility * a = NEW AAFlip(observer, id, card, target,flipStats,false,false,activated);
return a;
}
}

View File

@@ -195,6 +195,7 @@ void MTGCardInstance::initMTGCI()
isMorphed = false;
MeldedFrom = "";
isFlipped = false;
activateCF = false;
isPhased = false;
isCascaded = false;
phasedTurn = -1;