converted cycling into a cost type to bring it more inline with MTGrules {cycle}, also added the cycled trigger @cycled(tc):
this cost type sends both the event for discard and the event for cycled trigger, it no longer automatically draws a card, that is part of this cost ability instead.
standard cycling is autohand={cycle}:draw:1 controller
its trigger is
auto=@cycled(*|myhand):damage:2 target(creature)
"whenever you cycle a card deal 2 damage to a target creature."
This commit is contained in:
@@ -549,16 +549,28 @@ public:
|
||||
class TrCardDiscarded: public Trigger
|
||||
{
|
||||
public:
|
||||
TrCardDiscarded(GameObserver* observer, int id, MTGCardInstance * source, TargetChooser * tc,bool once = false) :
|
||||
Trigger(observer, id, source, once, tc)
|
||||
bool cycledTrigger;
|
||||
TrCardDiscarded(GameObserver* observer, int id, MTGCardInstance * source, TargetChooser * tc,bool once = false, bool cycledTrigger = false) :
|
||||
Trigger(observer, id, source, once, tc)
|
||||
{
|
||||
}
|
||||
|
||||
int triggerOnEventImpl(WEvent * event)
|
||||
{
|
||||
WEventCardDiscard * e = dynamic_cast<WEventCardDiscard *> (event);
|
||||
if (!e) return 0;
|
||||
if (!tc->canTarget(e->card)) return 0;
|
||||
MTGCardInstance * targetCard = NULL;
|
||||
if(cycledTrigger)
|
||||
{
|
||||
WEventCardCycle * c = dynamic_cast<WEventCardCycle *> (event);
|
||||
if (!c) return 0;
|
||||
targetCard = c->card;
|
||||
}
|
||||
else
|
||||
{
|
||||
WEventCardDiscard * e = dynamic_cast<WEventCardDiscard *> (event);
|
||||
if (!e) return 0;
|
||||
targetCard = e->card;
|
||||
}
|
||||
if (!targetCard || !tc->canTarget(targetCard)) return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -1067,38 +1079,6 @@ public:
|
||||
|
||||
};
|
||||
|
||||
//Cycling
|
||||
|
||||
class ACycle: public ActivatedAbility
|
||||
{
|
||||
public:
|
||||
ACycle(GameObserver* observer, int _id, MTGCardInstance * card, Targetable * _target) :
|
||||
ActivatedAbility(observer, _id, card)
|
||||
{
|
||||
target = _target;
|
||||
}
|
||||
|
||||
int resolve()
|
||||
{
|
||||
WEvent * e = NEW WEventCardDiscard(source);
|
||||
game->receiveEvent(e);
|
||||
source->controller()->game->putInGraveyard(source);
|
||||
source->controller()->game->drawFromLibrary();
|
||||
return 1;
|
||||
}
|
||||
|
||||
const char * getMenuText()
|
||||
{
|
||||
return "Cycling";
|
||||
}
|
||||
|
||||
ACycle * clone() const
|
||||
{
|
||||
return NEW ACycle(*this);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
//ninjutsu
|
||||
|
||||
class ANinja: public ActivatedAbility
|
||||
|
||||
@@ -106,6 +106,15 @@ public:
|
||||
virtual DiscardCost * clone() const;
|
||||
};
|
||||
|
||||
//cycle
|
||||
class CycleCost : public ExtraCost
|
||||
{
|
||||
public:
|
||||
CycleCost(TargetChooser *_tc = NULL);
|
||||
virtual int doPay();
|
||||
virtual CycleCost * clone() const;
|
||||
};
|
||||
|
||||
//tolibrary cost
|
||||
class ToLibraryCost : public ExtraCost
|
||||
{
|
||||
|
||||
@@ -183,6 +183,12 @@ struct WEventCardDiscard : public WEventCardUpdate {
|
||||
virtual Targetable * getTarget(int target);
|
||||
};
|
||||
|
||||
//event when card is cycled.
|
||||
struct WEventCardCycle : public WEventCardUpdate {
|
||||
WEventCardCycle(MTGCardInstance * card);
|
||||
virtual Targetable * getTarget(int target);
|
||||
};
|
||||
|
||||
//Event when a card's "defenser" status changes
|
||||
//before : attacker that card was blocking previously
|
||||
//after: attacker that card is blocking now
|
||||
|
||||
Reference in New Issue
Block a user