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
|
||||
{
|
||||
public:
|
||||
TargetChooser * tcP;
|
||||
MTGAbility * PWrule;
|
||||
MTGAbility * PWruleAbility;
|
||||
MTGAbility * PWruleGeneric;
|
||||
MTGPlaneWalkerRule(GameObserver* observer, int _id);
|
||||
int canBeInList(MTGCardInstance * card);
|
||||
int added(MTGCardInstance * card);
|
||||
|
||||
@@ -3347,6 +3347,7 @@ InstantAbility(observer, id, card, _target),flipStats(flipStats),isflipcard(isfl
|
||||
int AAFlip::resolve()
|
||||
{
|
||||
int cdaDamage = 0;
|
||||
int activatedanyability = 0;
|
||||
MTGCardInstance * Flipper = (MTGCardInstance*)source;
|
||||
this->oneShot = true;
|
||||
if(Flipper->isFlipped)
|
||||
@@ -3397,6 +3398,17 @@ int AAFlip::resolve()
|
||||
_target->setMTGId(myFlip->getMTGId());
|
||||
_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++)
|
||||
{
|
||||
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
|
||||
int powerMod = 0;
|
||||
int toughMod = 0;
|
||||
|
||||
@@ -3288,6 +3288,10 @@ MTGLegendRule * MTGLegendRule::clone() const
|
||||
MTGPlaneWalkerRule::MTGPlaneWalkerRule(GameObserver* observer, int _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;
|
||||
if (comparison != card && comparison->types == card->types && comparison->controller() == card->controller())
|
||||
{
|
||||
oldCards.push_back(comparison);
|
||||
destroy = 1;
|
||||
}
|
||||
}
|
||||
if (destroy)
|
||||
{
|
||||
vector<MTGAbility*>selection;
|
||||
|
||||
MultiAbility * multi = NEW MultiAbility(game,game->mLayers->actionLayer()->getMaxId(), card, card, NULL);
|
||||
for(unsigned int i = 0;i < oldCards.size();i++)
|
||||
{
|
||||
AAMover *a = NEW AAMover(game, game->mLayers->actionLayer()->getMaxId(), card, oldCards[i],"ownergraveyard","Keep New");
|
||||
a->oneShot = true;
|
||||
multi->Add(a);
|
||||
}
|
||||
multi->oneShot = 1;
|
||||
MTGAbility * a1 = multi;
|
||||
selection.push_back(a1);
|
||||
AAMover *b = NEW AAMover(game, game->mLayers->actionLayer()->getMaxId(), card, card,"ownergraveyard","Keep Old");
|
||||
b->oneShot = true;
|
||||
MTGAbility * b1 = b;
|
||||
selection.push_back(b1);
|
||||
MTGAbility * menuChoice = NEW MenuAbility(game, game->mLayers->actionLayer()->getMaxId(), card, card,true,selection,card->controller(),"Planeswalker Rule");
|
||||
MTGCardInstance * myClone = NEW MTGCardInstance(card, card->controller()->game);
|
||||
TargetChooserFactory tfL(game);
|
||||
tcP = tfL.createTargetChooser("planeswalker[share!types!]|mybattlefield",myClone);
|
||||
tcP->targetter = NULL;
|
||||
tcP->maxtargets = 1;
|
||||
PWrule = NEW AAMover(game, game->mLayers->actionLayer()->getMaxId(), myClone, NULL,"ownergraveyard","Put in Graveyard");
|
||||
PWrule->oneShot = true;
|
||||
PWrule->canBeInterrupted = false;
|
||||
PWruleAbility = NEW GenericTargetAbility(game, "","",game->mLayers->actionLayer()->getMaxId(), myClone,tcP, PWrule->clone());
|
||||
SAFE_DELETE(PWrule);
|
||||
PWruleAbility->oneShot = true;
|
||||
PWruleAbility->canBeInterrupted = false;
|
||||
PWruleGeneric = NEW GenericAddToGame(game, game->mLayers->actionLayer()->getMaxId(), myClone,NULL,PWruleAbility->clone());
|
||||
SAFE_DELETE(PWruleAbility);
|
||||
PWruleGeneric->oneShot = true;
|
||||
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();
|
||||
}
|
||||
return 1;
|
||||
|
||||
Reference in New Issue
Block a user