revised pw rule
also fixed where planeswalker can use its ability after it was transformed/flipped by activation ex. Garruk Relentless... You can’t activate a loyalty ability of Garruk Relentless and later that turn after he transforms activate a loyalty ability of Garruk, the Veil-Cursed.
This commit is contained in:
@@ -445,6 +445,10 @@ public:
|
|||||||
class MTGPlaneWalkerRule: public ListMaintainerAbility
|
class MTGPlaneWalkerRule: public ListMaintainerAbility
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
TargetChooser * tcP;
|
||||||
|
MTGAbility * PWrule;
|
||||||
|
MTGAbility * PWruleAbility;
|
||||||
|
MTGAbility * PWruleGeneric;
|
||||||
MTGPlaneWalkerRule(GameObserver* observer, int _id);
|
MTGPlaneWalkerRule(GameObserver* observer, int _id);
|
||||||
int canBeInList(MTGCardInstance * card);
|
int canBeInList(MTGCardInstance * card);
|
||||||
int added(MTGCardInstance * card);
|
int added(MTGCardInstance * card);
|
||||||
|
|||||||
@@ -3347,6 +3347,7 @@ InstantAbility(observer, id, card, _target),flipStats(flipStats),isflipcard(isfl
|
|||||||
int AAFlip::resolve()
|
int AAFlip::resolve()
|
||||||
{
|
{
|
||||||
int cdaDamage = 0;
|
int cdaDamage = 0;
|
||||||
|
int activatedanyability = 0;
|
||||||
MTGCardInstance * Flipper = (MTGCardInstance*)source;
|
MTGCardInstance * Flipper = (MTGCardInstance*)source;
|
||||||
this->oneShot = true;
|
this->oneShot = true;
|
||||||
if(Flipper->isFlipped)
|
if(Flipper->isFlipped)
|
||||||
@@ -3397,6 +3398,17 @@ int AAFlip::resolve()
|
|||||||
_target->setMTGId(myFlip->getMTGId());
|
_target->setMTGId(myFlip->getMTGId());
|
||||||
_target->setId = myFlip->setId;
|
_target->setId = myFlip->setId;
|
||||||
}
|
}
|
||||||
|
//check pw
|
||||||
|
if(_target->hasType(Subtypes::TYPE_PLANESWALKER))
|
||||||
|
{
|
||||||
|
for(unsigned int k = 0;k < _target->cardsAbilities.size();++k)
|
||||||
|
{
|
||||||
|
ActivatedAbility * check = dynamic_cast<ActivatedAbility*>(_target->cardsAbilities[k]);
|
||||||
|
if(check && check->counters)
|
||||||
|
activatedanyability++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//
|
||||||
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]);
|
||||||
@@ -3428,6 +3440,19 @@ int AAFlip::resolve()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//limit pw abi
|
||||||
|
if(activatedanyability)
|
||||||
|
{
|
||||||
|
if(_target->hasType(Subtypes::TYPE_PLANESWALKER))
|
||||||
|
{
|
||||||
|
for(unsigned int k = 0;k < _target->cardsAbilities.size();++k)
|
||||||
|
{
|
||||||
|
ActivatedAbility * check = dynamic_cast<ActivatedAbility*>(_target->cardsAbilities[k]);
|
||||||
|
if(check)//is there a better way?
|
||||||
|
check->counters++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
//power
|
//power
|
||||||
int powerMod = 0;
|
int powerMod = 0;
|
||||||
int toughMod = 0;
|
int toughMod = 0;
|
||||||
|
|||||||
@@ -3288,6 +3288,10 @@ MTGLegendRule * MTGLegendRule::clone() const
|
|||||||
MTGPlaneWalkerRule::MTGPlaneWalkerRule(GameObserver* observer, int _id) :
|
MTGPlaneWalkerRule::MTGPlaneWalkerRule(GameObserver* observer, int _id) :
|
||||||
ListMaintainerAbility(observer, _id)
|
ListMaintainerAbility(observer, _id)
|
||||||
{
|
{
|
||||||
|
tcP = NULL;
|
||||||
|
PWrule = NULL;
|
||||||
|
PWruleAbility = NULL;
|
||||||
|
PWruleGeneric = NULL;
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
@@ -3311,30 +3315,29 @@ int MTGPlaneWalkerRule::added(MTGCardInstance * card)
|
|||||||
{
|
{
|
||||||
MTGCardInstance * comparison = (*it).first;
|
MTGCardInstance * comparison = (*it).first;
|
||||||
if (comparison != card && comparison->types == card->types && comparison->controller() == card->controller())
|
if (comparison != card && comparison->types == card->types && comparison->controller() == card->controller())
|
||||||
{
|
|
||||||
oldCards.push_back(comparison);
|
|
||||||
destroy = 1;
|
destroy = 1;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (destroy)
|
if (destroy)
|
||||||
{
|
{
|
||||||
vector<MTGAbility*>selection;
|
vector<MTGAbility*>selection;
|
||||||
|
MTGCardInstance * myClone = NEW MTGCardInstance(card, card->controller()->game);
|
||||||
MultiAbility * multi = NEW MultiAbility(game,game->mLayers->actionLayer()->getMaxId(), card, card, NULL);
|
TargetChooserFactory tfL(game);
|
||||||
for(unsigned int i = 0;i < oldCards.size();i++)
|
tcP = tfL.createTargetChooser("planeswalker[share!types!]|mybattlefield",myClone);
|
||||||
{
|
tcP->targetter = NULL;
|
||||||
AAMover *a = NEW AAMover(game, game->mLayers->actionLayer()->getMaxId(), card, oldCards[i],"ownergraveyard","Keep New");
|
tcP->maxtargets = 1;
|
||||||
a->oneShot = true;
|
PWrule = NEW AAMover(game, game->mLayers->actionLayer()->getMaxId(), myClone, NULL,"ownergraveyard","Put in Graveyard");
|
||||||
multi->Add(a);
|
PWrule->oneShot = true;
|
||||||
}
|
PWrule->canBeInterrupted = false;
|
||||||
multi->oneShot = 1;
|
PWruleAbility = NEW GenericTargetAbility(game, "","",game->mLayers->actionLayer()->getMaxId(), myClone,tcP, PWrule->clone());
|
||||||
MTGAbility * a1 = multi;
|
SAFE_DELETE(PWrule);
|
||||||
selection.push_back(a1);
|
PWruleAbility->oneShot = true;
|
||||||
AAMover *b = NEW AAMover(game, game->mLayers->actionLayer()->getMaxId(), card, card,"ownergraveyard","Keep Old");
|
PWruleAbility->canBeInterrupted = false;
|
||||||
b->oneShot = true;
|
PWruleGeneric = NEW GenericAddToGame(game, game->mLayers->actionLayer()->getMaxId(), myClone,NULL,PWruleAbility->clone());
|
||||||
MTGAbility * b1 = b;
|
SAFE_DELETE(PWruleAbility);
|
||||||
selection.push_back(b1);
|
PWruleGeneric->oneShot = true;
|
||||||
MTGAbility * menuChoice = NEW MenuAbility(game, game->mLayers->actionLayer()->getMaxId(), card, card,true,selection,card->controller(),"Planeswalker Rule");
|
selection.push_back(PWruleGeneric->clone());
|
||||||
|
SAFE_DELETE(PWruleGeneric);
|
||||||
|
MTGAbility * menuChoice = NEW MenuAbility(game, game->mLayers->actionLayer()->getMaxId(), NULL, myClone,true,selection,card->controller(),"Planeswalker Uniqueness Rule");
|
||||||
menuChoice->addToGame();
|
menuChoice->addToGame();
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user