Merge pull request #794 from kevlahnota/master
Event for token sacrifice
This commit is contained in:
@@ -1370,6 +1370,8 @@ public:
|
||||
{
|
||||
WEventCardSacrifice * e = dynamic_cast<WEventCardSacrifice *> (event);
|
||||
if (!e) return 0;
|
||||
if (e->istoken)
|
||||
return 1;
|
||||
MTGCardInstance * check = e->cardAfter;
|
||||
MTGGameZone * oldZone = e->cardAfter->currentZone;
|
||||
check->currentZone = check->previousZone;
|
||||
|
||||
@@ -184,7 +184,8 @@ struct WEventCardBlocked : public WEventCardUpdate {
|
||||
//event when card is sacrificed.
|
||||
struct WEventCardSacrifice : public WEventCardUpdate {
|
||||
MTGCardInstance * cardAfter;
|
||||
WEventCardSacrifice(MTGCardInstance * card,MTGCardInstance * afterCard);
|
||||
bool istoken;
|
||||
WEventCardSacrifice(MTGCardInstance * card,MTGCardInstance * afterCard, bool token = false);
|
||||
virtual Targetable * getTarget(int target);
|
||||
};
|
||||
|
||||
|
||||
@@ -2704,10 +2704,14 @@ int AASacrificeCard::resolve()
|
||||
{
|
||||
Player * p = _target->controller();
|
||||
MTGCardInstance * beforeCard = _target;
|
||||
WEvent * e;
|
||||
if(!_target->isToken)
|
||||
e = NEW WEventCardSacrifice(beforeCard,_target);
|
||||
else
|
||||
e = NEW WEventCardSacrifice(beforeCard,_target,true);
|
||||
p->game->putInGraveyard(_target);
|
||||
while(_target->next)
|
||||
_target = _target->next;
|
||||
WEvent * e = NEW WEventCardSacrifice(beforeCard,_target);
|
||||
game->receiveEvent(e);
|
||||
if(andAbility)
|
||||
{
|
||||
|
||||
@@ -1288,8 +1288,12 @@ int SacrificeCost::doPay()
|
||||
{
|
||||
MTGCardInstance * beforeCard = target;
|
||||
source->storedCard = target->createSnapShot();
|
||||
WEvent * e;
|
||||
if(!target->isToken)
|
||||
e = NEW WEventCardSacrifice(beforeCard,target);
|
||||
else
|
||||
e = NEW WEventCardSacrifice(beforeCard,target,true);
|
||||
target->controller()->game->putInGraveyard(target);
|
||||
WEvent * e = NEW WEventCardSacrifice(beforeCard,target);
|
||||
GameObserver * game = target->owner->getObserver();
|
||||
game->receiveEvent(e);
|
||||
target = NULL;
|
||||
|
||||
@@ -99,8 +99,8 @@ player(player), nb_cards(nb_cards),drawAbility(cardDraw)
|
||||
{
|
||||
}
|
||||
|
||||
WEventCardSacrifice::WEventCardSacrifice(MTGCardInstance * card, MTGCardInstance * after) :
|
||||
WEventCardUpdate(card),cardAfter(after)
|
||||
WEventCardSacrifice::WEventCardSacrifice(MTGCardInstance * card, MTGCardInstance * after, bool token) :
|
||||
WEventCardUpdate(card),cardAfter(after),istoken(token)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user