added new legend & pw rule, trigger & event
added new pw & legend rule (i just leave the old rules behind and disabled it), added phasesin, faceup, copiedacard event, added facedup & phasedin trigger.
This commit is contained in:
@@ -790,7 +790,7 @@ type=Instant
|
||||
name=Villainous Wealth
|
||||
#can't order stack
|
||||
target=opponent
|
||||
auto=reveal:castx revealzone(targetedpersonslibrary) optionone all(*|reveal) moveto(exile) and!( if cantargetcard(*[-land;manacost<=castx]|*) then transforms((,newability[may activate castcard(normal)]])) oneshot )! optiononeend revealend
|
||||
auto=moveto(exile) and!( if cantargetcard(*[-land;manacost<=castx]|*) then transforms((,newability[may activate castcard(normal)]])) ueot )! all(*[zpos<=castx]|mylibrary)
|
||||
text=Target opponent exiles the top X cards of his or her library. You may cast any number of nonland cards with converted mana cost X or less from among them without paying their mana costs.
|
||||
mana={X}{B}{G}{U}
|
||||
type=Sorcery
|
||||
|
||||
@@ -1332,6 +1332,50 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
class TrCardPhasesIn: public Trigger
|
||||
{
|
||||
public:
|
||||
TrCardPhasesIn(GameObserver* observer, int id, MTGCardInstance * source, TargetChooser * tc, bool once = false) :
|
||||
Trigger(observer, id, source, once, tc)
|
||||
{
|
||||
}
|
||||
|
||||
int triggerOnEventImpl(WEvent * event)
|
||||
{
|
||||
WEventCardPhasesIn * e = dynamic_cast<WEventCardPhasesIn *> (event);
|
||||
if (!e) return 0;
|
||||
if (!tc->canTarget(e->card)) return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
TrCardPhasesIn * clone() const
|
||||
{
|
||||
return NEW TrCardPhasesIn(*this);
|
||||
}
|
||||
};
|
||||
|
||||
class TrCardFaceUp: public Trigger
|
||||
{
|
||||
public:
|
||||
TrCardFaceUp(GameObserver* observer, int id, MTGCardInstance * source, TargetChooser * tc, bool once = false) :
|
||||
Trigger(observer, id, source, once, tc)
|
||||
{
|
||||
}
|
||||
|
||||
int triggerOnEventImpl(WEvent * event)
|
||||
{
|
||||
WEventCardFaceUp * e = dynamic_cast<WEventCardFaceUp *> (event);
|
||||
if (!e) return 0;
|
||||
if (!tc->canTarget(e->card)) return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
TrCardFaceUp * clone() const
|
||||
{
|
||||
return NEW TrCardFaceUp(*this);
|
||||
}
|
||||
};
|
||||
|
||||
class TrCardTransformed: public Trigger
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -253,6 +253,7 @@ public:
|
||||
int LKIpower;
|
||||
int LKItoughness;
|
||||
int countDuplicateCardNames();
|
||||
int countDuplicateCardTypes();
|
||||
void cdaPT(int p = 0, int t = 0);
|
||||
bool isCDA;
|
||||
void switchPT(bool apply = false);
|
||||
|
||||
@@ -421,7 +421,36 @@ public:
|
||||
int receiveEvent(WEvent * event);
|
||||
virtual MTGTokensCleanup * clone() const;
|
||||
};
|
||||
|
||||
//New Legend Rule
|
||||
class MTGNewLegend: public PermanentAbility
|
||||
{
|
||||
public:
|
||||
TargetChooser * tcL;
|
||||
MTGAbility * Legendrule;
|
||||
MTGAbility * LegendruleAbility;
|
||||
MTGAbility * LegendruleGeneric;
|
||||
//vector<MTGCardInstance *> list;
|
||||
MTGNewLegend(GameObserver* observer, int _id);
|
||||
int CheckLegend(MTGCardInstance * card);
|
||||
void MoveLegend(MTGCardInstance * card);
|
||||
int receiveEvent(WEvent * event);
|
||||
virtual MTGNewLegend * clone() const;
|
||||
};
|
||||
//New Planeswalker Rule
|
||||
class MTGNewPlaneswalker: public PermanentAbility
|
||||
{
|
||||
public:
|
||||
TargetChooser * tcP;
|
||||
MTGAbility * PWrule;
|
||||
MTGAbility * PWruleAbility;
|
||||
MTGAbility * PWruleGeneric;
|
||||
//vector<MTGCardInstance *> list;
|
||||
MTGNewPlaneswalker(GameObserver* observer, int _id);
|
||||
int CheckPW(MTGCardInstance * card);
|
||||
void MovePW(MTGCardInstance * card);
|
||||
int receiveEvent(WEvent * event);
|
||||
virtual MTGNewPlaneswalker * clone() const;
|
||||
};
|
||||
/*
|
||||
* 704.5k If a player controls two or more legendary permanents with the same name,
|
||||
* that player chooses one of them, and the rest are put into their owners’ graveyards.
|
||||
@@ -430,10 +459,6 @@ public:
|
||||
class MTGLegendRule: public ListMaintainerAbility
|
||||
{
|
||||
public:
|
||||
TargetChooser * tcL;
|
||||
MTGAbility * Legendrule;
|
||||
MTGAbility * LegendruleAbility;
|
||||
MTGAbility * LegendruleGeneric;
|
||||
MTGLegendRule(GameObserver* observer, int _id);
|
||||
int canBeInList(MTGCardInstance * card);
|
||||
int added(MTGCardInstance * card);
|
||||
@@ -445,10 +470,6 @@ 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);
|
||||
|
||||
@@ -305,12 +305,30 @@ struct WEventCardControllerChange : public WEventCardUpdate {
|
||||
virtual Targetable * getTarget(int target);
|
||||
};
|
||||
|
||||
//event when card with phases in
|
||||
struct WEventCardPhasesIn : public WEventCardUpdate {
|
||||
WEventCardPhasesIn(MTGCardInstance * card);
|
||||
virtual Targetable * getTarget(int target);
|
||||
};
|
||||
|
||||
//event when card with morph faces up
|
||||
struct WEventCardFaceUp : public WEventCardUpdate {
|
||||
WEventCardFaceUp(MTGCardInstance * card);
|
||||
virtual Targetable * getTarget(int target);
|
||||
};
|
||||
|
||||
//event when card transforms
|
||||
struct WEventCardTransforms : public WEventCardUpdate {
|
||||
WEventCardTransforms(MTGCardInstance * card);
|
||||
virtual Targetable * getTarget(int target);
|
||||
};
|
||||
|
||||
//event when card copies a card
|
||||
struct WEventCardCopiedACard : public WEventCardUpdate {
|
||||
WEventCardCopiedACard(MTGCardInstance * card);
|
||||
virtual Targetable * getTarget(int target);
|
||||
};
|
||||
|
||||
//alterenergy event
|
||||
struct WEventplayerEnergized : public WEvent {
|
||||
WEventplayerEnergized(Player * player,int nb_count);
|
||||
|
||||
@@ -1674,6 +1674,7 @@ int AACopier::resolve()
|
||||
}
|
||||
}
|
||||
}
|
||||
currentAbilities.clear();
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
@@ -3284,6 +3285,8 @@ int AAMorph::resolve()
|
||||
}
|
||||
}
|
||||
}
|
||||
WEvent * e = NEW WEventCardFaceUp(_target);
|
||||
game->receiveEvent(e);
|
||||
currentAbilities.clear();
|
||||
testDestroy();
|
||||
}
|
||||
|
||||
@@ -859,6 +859,9 @@ void GameObserver::gameStateBasedEffects()
|
||||
card->phasedTurn = turn;
|
||||
if(card->view)
|
||||
card->view->alpha = 255;
|
||||
//add event phases in here
|
||||
WEvent * evphasein = NEW WEventCardPhasesIn(card);
|
||||
receiveEvent(evphasein);
|
||||
}
|
||||
if (card->target && isInPlay(card->target) && (card->hasSubtype(Subtypes::TYPE_EQUIPMENT) || card->hasSubtype(Subtypes::TYPE_AURA)))
|
||||
{
|
||||
|
||||
@@ -426,6 +426,10 @@ int GuiPlay::receiveEventPlus(WEvent * e)
|
||||
Replace();
|
||||
else if (dynamic_cast<WEventCardTransforms*> (e))
|
||||
Replace();
|
||||
else if (dynamic_cast<WEventCardCopiedACard*> (e))
|
||||
Replace();
|
||||
else if (dynamic_cast<WEventCardFaceUp*> (e))
|
||||
Replace();
|
||||
Replace();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1036,6 +1036,14 @@ TriggeredAbility * AbilityFactory::parseTrigger(string s, string, int id, Spell
|
||||
if (TargetChooser *tc = parseSimpleTC(s,"transformed", card))
|
||||
return NEW TrCardTransformed(observer, id, card, tc,once);
|
||||
|
||||
//Card Faces Up
|
||||
if (TargetChooser *tc = parseSimpleTC(s,"facedup", card))
|
||||
return NEW TrCardFaceUp(observer, id, card, tc,once);
|
||||
|
||||
//Card Phases In
|
||||
if (TargetChooser *tc = parseSimpleTC(s,"phasedin", card))
|
||||
return NEW TrCardPhasesIn(observer, id, card, tc,once);
|
||||
|
||||
//CombatTrigger
|
||||
//Card card attacked and is blocked
|
||||
found = s.find("combat(");
|
||||
@@ -1478,14 +1486,16 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
||||
found = s.find("legendrule");
|
||||
if(found != string::npos)
|
||||
{
|
||||
observer->addObserver(NEW MTGLegendRule(observer, -1));
|
||||
//observer->addObserver(NEW MTGLegendRule(observer, -1));
|
||||
observer->addObserver(NEW MTGNewLegend(observer, -1));
|
||||
return NULL;
|
||||
}
|
||||
//this handles the planeswalker named legend rule which is dramatically different from above.
|
||||
found = s.find("planeswalkerrule");
|
||||
if(found != string::npos)
|
||||
{
|
||||
observer->addObserver(NEW MTGPlaneWalkerRule(observer, -1));
|
||||
//observer->addObserver(NEW MTGPlaneWalkerRule(observer, -1));
|
||||
observer->addObserver(NEW MTGNewPlaneswalker(observer, -1));
|
||||
return NULL;
|
||||
}
|
||||
found = s.find("planeswalkerdamage");
|
||||
|
||||
@@ -169,6 +169,11 @@ void MTGCardInstance::copy(MTGCardInstance * card)
|
||||
backupTargets = this->backupTargets;
|
||||
storedCard = oldStored;
|
||||
miracle = false;
|
||||
|
||||
|
||||
//add event here copied a card...
|
||||
WEvent * e = NEW WEventCardCopiedACard(this);
|
||||
getObserver()->receiveEvent(e);
|
||||
}
|
||||
|
||||
MTGCardInstance::~MTGCardInstance()
|
||||
@@ -849,6 +854,22 @@ int MTGCardInstance::countDuplicateCardNames()
|
||||
return count;
|
||||
}
|
||||
|
||||
int MTGCardInstance::countDuplicateCardTypes()
|
||||
{
|
||||
int count = 0;
|
||||
|
||||
if(observer)
|
||||
{
|
||||
int nb_cards = controller()->game->battlefield->nb_cards;
|
||||
for(int x = 0; x < nb_cards; x++)
|
||||
{
|
||||
if(controller()->game->battlefield->cards[x] != this && controller()->game->battlefield->cards[x]->types == this->types)
|
||||
count+=1;
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
//check can produce mana
|
||||
int MTGCardInstance::canproduceMana(int color)
|
||||
{
|
||||
|
||||
@@ -3228,15 +3228,244 @@ MTGTokensCleanup * MTGTokensCleanup::clone() const
|
||||
return NEW MTGTokensCleanup(*this);
|
||||
}
|
||||
|
||||
/* Legend Rule */
|
||||
MTGLegendRule::MTGLegendRule(GameObserver* observer, int _id) :
|
||||
ListMaintainerAbility(observer, _id)
|
||||
//new legend rule
|
||||
MTGNewLegend::MTGNewLegend(GameObserver* observer, int _id) :
|
||||
PermanentAbility(observer, _id)
|
||||
{
|
||||
tcL = NULL;
|
||||
Legendrule = NULL;
|
||||
LegendruleAbility = NULL;
|
||||
LegendruleGeneric = NULL;
|
||||
}
|
||||
|
||||
int MTGNewLegend::receiveEvent(WEvent * e)
|
||||
{
|
||||
if(game->getCurrentTargetChooser() || game->mLayers->actionLayer()->isWaitingForAnswer())
|
||||
return 0;
|
||||
if (WEventZoneChange* ev1 = dynamic_cast<WEventZoneChange*>(e))
|
||||
{
|
||||
if (ev1->to == game->players[0]->game->inPlay || ev1->to == game->players[1]->game->inPlay)
|
||||
{
|
||||
MTGCardInstance * card = ev1->card;
|
||||
if(card && card->countDuplicateCardNames() > 1 && card->hasType(Subtypes::TYPE_LEGENDARY))
|
||||
{
|
||||
CheckLegend(card);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(WEventCardControllerChange* ev2 = dynamic_cast<WEventCardControllerChange*>(e))
|
||||
{
|
||||
MTGCardInstance * card = ev2->card;
|
||||
if(card && card->countDuplicateCardNames() > 1 && card->hasType(Subtypes::TYPE_LEGENDARY))
|
||||
{
|
||||
CheckLegend(card);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else if(WEventCardTransforms* ev3 = dynamic_cast<WEventCardTransforms*>(e))
|
||||
{
|
||||
MTGCardInstance * card = ev3->card;
|
||||
if(card && card->countDuplicateCardNames() > 1 && card->hasType(Subtypes::TYPE_LEGENDARY))
|
||||
{
|
||||
CheckLegend(card);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else if(WEventCardCopiedACard* ev4 = dynamic_cast<WEventCardCopiedACard*>(e))
|
||||
{
|
||||
MTGCardInstance * card = ev4->card;
|
||||
if(card && card->countDuplicateCardNames() > 1 && card->hasType(Subtypes::TYPE_LEGENDARY))
|
||||
{
|
||||
CheckLegend(card);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else if(WEventCardFaceUp* ev5 = dynamic_cast<WEventCardFaceUp*>(e))
|
||||
{
|
||||
MTGCardInstance * card = ev5->card;
|
||||
if(card && card->countDuplicateCardNames() > 1 && card->hasType(Subtypes::TYPE_LEGENDARY))
|
||||
{
|
||||
CheckLegend(card);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else if(WEventCardPhasesIn* ev6 = dynamic_cast<WEventCardPhasesIn*>(e))
|
||||
{
|
||||
MTGCardInstance * card = ev6->card;
|
||||
if(card && card->countDuplicateCardNames() > 1 && card->hasType(Subtypes::TYPE_LEGENDARY))
|
||||
{
|
||||
CheckLegend(card);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
int MTGNewLegend::CheckLegend(MTGCardInstance * card)
|
||||
{
|
||||
if(!card)
|
||||
return 0;
|
||||
if(card->isPhased)
|
||||
return 0;
|
||||
if (card->hasType(Subtypes::TYPE_LEGENDARY) && card->controller()->game->inPlay->hasCard(card))
|
||||
if(card->has(Constants::NOLEGEND)||card->controller()->opponent()->inPlay()->hasAbility(Constants::NOLEGENDRULE)||card->controller()->inPlay()->hasAbility(Constants::NOLEGENDRULE))
|
||||
return 0;
|
||||
if(card->countDuplicateCardNames() <= 1)
|
||||
return 0;
|
||||
|
||||
MoveLegend(card);
|
||||
return 1;
|
||||
}
|
||||
void MTGNewLegend::MoveLegend(MTGCardInstance * card)
|
||||
{
|
||||
game->LPWeffect = true;
|
||||
vector<MTGAbility*>selection;
|
||||
MTGCardInstance * myClone = NEW MTGCardInstance(card, card->controller()->game);
|
||||
TargetChooserFactory tfL(game);
|
||||
tcL = tfL.createTargetChooser("*[share!name!]|mybattlefield",myClone);
|
||||
tcL->targetter = NULL;
|
||||
tcL->maxtargets = 1;
|
||||
Legendrule = NEW AAMover(game, game->mLayers->actionLayer()->getMaxId(), myClone, NULL,"ownergraveyard","Put in Graveyard");
|
||||
Legendrule->oneShot = true;
|
||||
Legendrule->canBeInterrupted = false;
|
||||
LegendruleAbility = NEW GenericTargetAbility(game, "","",game->mLayers->actionLayer()->getMaxId(), myClone,tcL, Legendrule->clone());
|
||||
SAFE_DELETE(Legendrule);
|
||||
LegendruleAbility->oneShot = true;
|
||||
LegendruleAbility->canBeInterrupted = false;
|
||||
LegendruleGeneric = NEW GenericAddToGame(game, game->mLayers->actionLayer()->getMaxId(), myClone,NULL,LegendruleAbility->clone());
|
||||
SAFE_DELETE(LegendruleAbility);
|
||||
LegendruleGeneric->oneShot = true;
|
||||
selection.push_back(LegendruleGeneric->clone());
|
||||
SAFE_DELETE(LegendruleGeneric);
|
||||
MTGAbility * menuChoice = NEW MenuAbility(game, game->mLayers->actionLayer()->getMaxId(), NULL, myClone,true,selection,card->controller(),"Legendary Rule");
|
||||
menuChoice->addToGame();
|
||||
return;
|
||||
}
|
||||
MTGNewLegend * MTGNewLegend::clone() const
|
||||
{
|
||||
return NEW MTGNewLegend(*this);
|
||||
}
|
||||
//new pw rule
|
||||
MTGNewPlaneswalker::MTGNewPlaneswalker(GameObserver* observer, int _id) :
|
||||
PermanentAbility(observer, _id)
|
||||
{
|
||||
tcP = NULL;
|
||||
PWrule = NULL;
|
||||
PWruleAbility = NULL;
|
||||
PWruleGeneric = NULL;
|
||||
}
|
||||
|
||||
int MTGNewPlaneswalker::receiveEvent(WEvent * e)
|
||||
{
|
||||
if(game->getCurrentTargetChooser() || game->mLayers->actionLayer()->isWaitingForAnswer())
|
||||
return 0;
|
||||
if (WEventZoneChange* ev1 = dynamic_cast<WEventZoneChange*>(e))
|
||||
{
|
||||
if (ev1->to == game->players[0]->game->inPlay || ev1->to == game->players[1]->game->inPlay)
|
||||
{
|
||||
MTGCardInstance * card = ev1->card;
|
||||
if(card && card->hasType(Subtypes::TYPE_PLANESWALKER))
|
||||
{
|
||||
CheckPW(card);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(WEventCardControllerChange* ev2 = dynamic_cast<WEventCardControllerChange*>(e))
|
||||
{
|
||||
MTGCardInstance * card = ev2->card;
|
||||
if(card && card->hasType(Subtypes::TYPE_PLANESWALKER))
|
||||
{
|
||||
CheckPW(card);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else if(WEventCardTransforms* ev3 = dynamic_cast<WEventCardTransforms*>(e))
|
||||
{
|
||||
MTGCardInstance * card = ev3->card;
|
||||
if(card && card->hasType(Subtypes::TYPE_PLANESWALKER))
|
||||
{
|
||||
CheckPW(card);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else if(WEventCardCopiedACard* ev4 = dynamic_cast<WEventCardCopiedACard*>(e))
|
||||
{
|
||||
MTGCardInstance * card = ev4->card;
|
||||
if(card && card->hasType(Subtypes::TYPE_PLANESWALKER))
|
||||
{
|
||||
CheckPW(card);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else if(WEventCardFaceUp* ev5 = dynamic_cast<WEventCardFaceUp*>(e))
|
||||
{
|
||||
MTGCardInstance * card = ev5->card;
|
||||
if(card && card->hasType(Subtypes::TYPE_PLANESWALKER))
|
||||
{
|
||||
CheckPW(card);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else if(WEventCardPhasesIn* ev6 = dynamic_cast<WEventCardPhasesIn*>(e))
|
||||
{
|
||||
MTGCardInstance * card = ev6->card;
|
||||
if(card && card->hasType(Subtypes::TYPE_PLANESWALKER))
|
||||
{
|
||||
CheckPW(card);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
int MTGNewPlaneswalker::CheckPW(MTGCardInstance * card)
|
||||
{
|
||||
if(!card)
|
||||
return 0;
|
||||
if(card->isPhased)
|
||||
return 0;
|
||||
if(card->countDuplicateCardTypes() < 1)
|
||||
return 0;
|
||||
|
||||
MovePW(card);
|
||||
return 1;
|
||||
}
|
||||
void MTGNewPlaneswalker::MovePW(MTGCardInstance * card)
|
||||
{
|
||||
game->LPWeffect = true;
|
||||
vector<MTGAbility*>selection;
|
||||
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;
|
||||
}
|
||||
MTGNewPlaneswalker * MTGNewPlaneswalker::clone() const
|
||||
{
|
||||
return NEW MTGNewPlaneswalker(*this);
|
||||
}
|
||||
////end new////
|
||||
///old below///
|
||||
/* Legend Rule */
|
||||
MTGLegendRule::MTGLegendRule(GameObserver* observer, int _id) :
|
||||
ListMaintainerAbility(observer, _id)
|
||||
{
|
||||
}
|
||||
;
|
||||
|
||||
int MTGLegendRule::canBeInList(MTGCardInstance * card)
|
||||
@@ -3257,43 +3486,19 @@ int MTGLegendRule::added(MTGCardInstance * card)
|
||||
{
|
||||
map<MTGCardInstance *, bool>::iterator it;
|
||||
int destroy = 0;
|
||||
//vector<MTGCardInstance*>oldCards;
|
||||
vector<MTGCardInstance*>oldCards;
|
||||
for (it = cards.begin(); it != cards.end(); it++)
|
||||
{
|
||||
MTGCardInstance * comparison = (*it).first;
|
||||
if (comparison != card && comparison->controller() == card->controller() && !(comparison->getName().compare(card->getName())))
|
||||
if (!(game->getCurrentTargetChooser() || game->mLayers->actionLayer()->isWaitingForAnswer()))
|
||||
{
|
||||
//oldCards.push_back(comparison);
|
||||
oldCards.push_back(comparison);
|
||||
destroy = 1;
|
||||
game->LPWeffect = true;
|
||||
}
|
||||
}
|
||||
if(destroy)
|
||||
{
|
||||
vector<MTGAbility*>selection;
|
||||
MTGCardInstance * myClone = NEW MTGCardInstance(card, card->controller()->game);
|
||||
TargetChooserFactory tfL(game);
|
||||
tcL = tfL.createTargetChooser("*[share!name!]|mybattlefield",myClone);
|
||||
tcL->targetter = NULL;
|
||||
tcL->maxtargets = 1;
|
||||
Legendrule = NEW AAMover(game, game->mLayers->actionLayer()->getMaxId(), myClone, NULL,"ownergraveyard","Put in Graveyard");
|
||||
Legendrule->oneShot = true;
|
||||
Legendrule->canBeInterrupted = false;
|
||||
LegendruleAbility = NEW GenericTargetAbility(game, "","",game->mLayers->actionLayer()->getMaxId(), myClone,tcL, Legendrule->clone());
|
||||
SAFE_DELETE(Legendrule);
|
||||
LegendruleAbility->oneShot = true;
|
||||
LegendruleAbility->canBeInterrupted = false;
|
||||
LegendruleGeneric = NEW GenericAddToGame(game, game->mLayers->actionLayer()->getMaxId(), myClone,NULL,LegendruleAbility->clone());
|
||||
SAFE_DELETE(LegendruleAbility);
|
||||
LegendruleGeneric->oneShot = true;
|
||||
selection.push_back(LegendruleGeneric->clone());
|
||||
SAFE_DELETE(LegendruleGeneric);
|
||||
MTGAbility * menuChoice = NEW MenuAbility(game, game->mLayers->actionLayer()->getMaxId(), NULL, myClone,true,selection,card->controller(),"Legendary Rule");
|
||||
menuChoice->addToGame();
|
||||
}
|
||||
//reverted to old since this new code conflicts with reveal targetchooser
|
||||
/*if(destroy)
|
||||
{
|
||||
vector<MTGAbility*>selection;
|
||||
MultiAbility * multi = NEW MultiAbility(game, game->mLayers->actionLayer()->getMaxId(), card, card, NULL);
|
||||
@@ -3312,7 +3517,7 @@ int MTGLegendRule::added(MTGCardInstance * card)
|
||||
selection.push_back(b1);
|
||||
MTGAbility * menuChoice = NEW MenuAbility(game, game->mLayers->actionLayer()->getMaxId(), card, card,true,selection,card->controller(),"Legendary Rule");
|
||||
menuChoice->addToGame();
|
||||
}*/
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -3339,10 +3544,6 @@ MTGLegendRule * MTGLegendRule::clone() const
|
||||
MTGPlaneWalkerRule::MTGPlaneWalkerRule(GameObserver* observer, int _id) :
|
||||
ListMaintainerAbility(observer, _id)
|
||||
{
|
||||
tcP = NULL;
|
||||
PWrule = NULL;
|
||||
PWruleAbility = NULL;
|
||||
PWruleGeneric = NULL;
|
||||
}
|
||||
;
|
||||
|
||||
@@ -3361,43 +3562,19 @@ int MTGPlaneWalkerRule::added(MTGCardInstance * card)
|
||||
{
|
||||
map<MTGCardInstance *, bool>::iterator it;
|
||||
int destroy = 0;
|
||||
//vector<MTGCardInstance*>oldCards;
|
||||
vector<MTGCardInstance*>oldCards;
|
||||
for (it = cards.begin(); it != cards.end(); it++)
|
||||
{
|
||||
MTGCardInstance * comparison = (*it).first;
|
||||
if (comparison != card && comparison->types == card->types && comparison->controller() == card->controller())
|
||||
if (!(game->getCurrentTargetChooser() || game->mLayers->actionLayer()->isWaitingForAnswer()))
|
||||
{
|
||||
//oldCards.push_back(comparison);
|
||||
oldCards.push_back(comparison);
|
||||
destroy = 1;
|
||||
game->LPWeffect = true;
|
||||
}
|
||||
}
|
||||
if (destroy)
|
||||
{
|
||||
vector<MTGAbility*>selection;
|
||||
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();
|
||||
}
|
||||
//reverted to old since this new code conflicts with reveal targetchooser
|
||||
/*if (destroy)
|
||||
{
|
||||
vector<MTGAbility*>selection;
|
||||
|
||||
@@ -3417,7 +3594,7 @@ int MTGPlaneWalkerRule::added(MTGCardInstance * card)
|
||||
selection.push_back(b1);
|
||||
MTGAbility * menuChoice = NEW MenuAbility(game, game->mLayers->actionLayer()->getMaxId(), card, card,true,selection,card->controller(),"Planeswalker Rule");
|
||||
menuChoice->addToGame();
|
||||
}*/
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -236,11 +236,26 @@ WEventCardControllerChange::WEventCardControllerChange(MTGCardInstance * card) :
|
||||
{
|
||||
}
|
||||
|
||||
WEventCardPhasesIn::WEventCardPhasesIn(MTGCardInstance * card) :
|
||||
WEventCardUpdate(card)
|
||||
{
|
||||
}
|
||||
|
||||
WEventCardFaceUp::WEventCardFaceUp(MTGCardInstance * card) :
|
||||
WEventCardUpdate(card)
|
||||
{
|
||||
}
|
||||
|
||||
WEventCardTransforms::WEventCardTransforms(MTGCardInstance * card) :
|
||||
WEventCardUpdate(card)
|
||||
{
|
||||
}
|
||||
|
||||
WEventCardCopiedACard::WEventCardCopiedACard(MTGCardInstance * card) :
|
||||
WEventCardUpdate(card)
|
||||
{
|
||||
}
|
||||
|
||||
WEventCombatStepChange::WEventCombatStepChange(CombatStep step) :
|
||||
WEvent(), step(step)
|
||||
{
|
||||
@@ -412,12 +427,30 @@ Targetable * WEventCardControllerChange::getTarget(int target)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Targetable * WEventCardPhasesIn::getTarget(int target)
|
||||
{
|
||||
if (target) return card;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Targetable * WEventCardFaceUp::getTarget(int target)
|
||||
{
|
||||
if (target) return card;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Targetable * WEventCardTransforms::getTarget(int target)
|
||||
{
|
||||
if (target) return card;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Targetable * WEventCardCopiedACard::getTarget(int target)
|
||||
{
|
||||
if (target) return card;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Targetable * WEventplayerEnergized::getTarget(Player * player)
|
||||
{
|
||||
if (player) return player;
|
||||
|
||||
Reference in New Issue
Block a user