- fix for issue 301 (creatures go to graveyard)
- This adds an important change to "movedTo", which now accepts a "full" target description in both "from" and "movedTo". The point is that a card does not move to "creature|graveyard" from "battlefield" but moves from "creature|battlefield" to "graveyard".
This commit is contained in:
wagic.the.homebrew@gmail.com
2010-01-21 14:12:11 +00:00
parent 0948dc611a
commit 3edc364d8e
19 changed files with 58 additions and 49 deletions

View File

@@ -101,8 +101,9 @@ public:
class TrCardAddedToZone:public TriggeredAbility{
public:
TargetChooser * toTc;
TargetZoneChooser * fromTc;
TrCardAddedToZone(int id, MTGCardInstance * source, TargetChooser * toTc, TargetZoneChooser * fromTc = NULL):TriggeredAbility(id,source), toTc(toTc), fromTc(fromTc){}
TargetZoneChooser * fromTcZone;
TargetChooser * fromTcCard;
TrCardAddedToZone(int id, MTGCardInstance * source, TargetChooser * toTc, TargetZoneChooser * fromTcZone = NULL,TargetChooser * fromTcCard = NULL):TriggeredAbility(id,source), toTc(toTc), fromTcZone(fromTcZone), fromTcCard(fromTcCard){}
int resolve(){
return 0; //This is a trigger, this function should not be called
@@ -111,8 +112,10 @@ public:
int triggerOnEvent(WEvent * event){
WEventZoneChange * e = dynamic_cast<WEventZoneChange*>(event);
if (!e) return 0;
if (!toTc->canTarget(e->card)) return 0;
if (fromTc && !fromTc->targetsZone(e->from)) return 0;
if (fromTcZone && !fromTcZone->targetsZone(e->from)) return 0;
if (fromTcCard && !fromTcCard->canTarget(e->card->previous)) return 0;
//Battlefield is a special case. We usually don't want to trigger when a card comes from battlefield to battlefield
// http://code.google.com/p/wagic/issues/detail?id=179
@@ -125,7 +128,8 @@ public:
~TrCardAddedToZone(){
SAFE_DELETE(toTc);
SAFE_DELETE(fromTc);
SAFE_DELETE(fromTcZone);
SAFE_DELETE(fromTcCard);
}
TrCardAddedToZone * clone() const{

View File

@@ -20,6 +20,8 @@ class MTGGameZone {
public:
enum{
ALL_ZONES = -1,
MY_GRAVEYARD = 11,
OPPONENT_GRAVEYARD = 12,
TARGET_OWNER_GRAVEYARD = 13,