- 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
+6 -6
View File
@@ -17,7 +17,7 @@ abilities=exalted
[/card] [/card]
[card] [card]
text=Shroud Whenever another creature is put into a graveyard from the battlefield, you may put a +1/+1 counter on Algae Gharial. text=Shroud Whenever another creature is put into a graveyard from the battlefield, you may put a +1/+1 counter on Algae Gharial.
auto=@movedTo(other creature|graveyard) from(battlefield):may counter(1/1) auto=@movedTo(graveyard) from(other creature|battlefield):may counter(1/1)
id=174986 id=174986
name=Algae Gharial name=Algae Gharial
rarity=U rarity=U
@@ -218,7 +218,7 @@ abilities=flying
[card] [card]
text=Enchant artifact or creature. Enchanted permanent doesn't untap during its controller's untap step. text=Enchant artifact or creature. Enchanted permanent doesn't untap during its controller's untap step.
id=175042 id=175042
target=creature,artifact target=creature,artifact
auto=doesnotuntap auto=doesnotuntap
name=Coma Veil name=Coma Veil
@@ -308,7 +308,7 @@ toughness=2
[/card] [/card]
[card] [card]
text=Whenever another creature is put into a graveyard from the battlefield, you may gain 1 life. text=Whenever another creature is put into a graveyard from the battlefield, you may gain 1 life.
auto=@movedTo(other creature|graveyard) from(battlefield):may life:1 auto=@movedTo(graveyard) from(other creature|battlefield):may life:1
id=175073 id=175073
name=Deathgreeter name=Deathgreeter
rarity=C rarity=C
@@ -589,7 +589,7 @@ abilities=flying,trample,haste
[/card] [/card]
[card] [card]
text=Whenever another creature is put into a graveyard from the battlefield, you may have Hissing Iguanar deal 1 damage to target player. text=Whenever another creature is put into a graveyard from the battlefield, you may have Hissing Iguanar deal 1 damage to target player.
auto=@movedTo(other creature|graveyard) from(battlefield):may damage:1 target(player) auto=@movedTo(graveyard) from(other creature|battlefield):may damage:1 target(player)
id=174873 id=174873
name=Hissing Iguanar name=Hissing Iguanar
rarity=C rarity=C
@@ -1178,7 +1178,7 @@ toughness=7
[/card] [/card]
[card] [card]
text=First strike Whenever another creature is put into a graveyard from the battlefield, you may put a +1/+1 counter on Rockslide Elemental. text=First strike Whenever another creature is put into a graveyard from the battlefield, you may put a +1/+1 counter on Rockslide Elemental.
auto=@movedTo(other creature|graveyard) from(battlefield):may counter(1/1) auto=@movedTo(graveyard) from(other creature|battlefield):may counter(1/1)
id=174988 id=174988
name=Rockslide Elemental name=Rockslide Elemental
rarity=U rarity=U
@@ -1239,7 +1239,7 @@ type=Land
[/card] [/card]
[card] [card]
text=Flying Whenever another creature is put into a graveyard from the battlefield, you may put a +1/+1 counter on Scavenger Drake. text=Flying Whenever another creature is put into a graveyard from the battlefield, you may put a +1/+1 counter on Scavenger Drake.
auto=@movedTo(other creature|graveyard) from(battlefield):may counter(1/1) auto=@movedTo(graveyard) from(other creature|battlefield):may counter(1/1)
id=174987 id=174987
name=Scavenger Drake name=Scavenger Drake
rarity=U rarity=U
+1 -1
View File
@@ -411,7 +411,7 @@ type=Sorcery
[card] [card]
text=Whenever Mycoid Shepherd or another creature you control with power 5 or greater is put into a graveyard from the battlefield, you may gain 5 life. text=Whenever Mycoid Shepherd or another creature you control with power 5 or greater is put into a graveyard from the battlefield, you may gain 5 life.
auto=@movedTo(this|graveyard) from(myBattlefield):may life:5 controller auto=@movedTo(this|graveyard) from(myBattlefield):may life:5 controller
auto=@movedTo(other creature[power>=5]|graveyard) from(myBattlefield):may life:5 controller auto=@movedTo(graveyard) from(other creature[power>=5]|myBattlefield):may life:5 controller
id=179548 id=179548
name=Mycoid Shepherd name=Mycoid Shepherd
rarity=R rarity=R
+1 -1
View File
@@ -996,7 +996,7 @@ abilities=flying
[card] [card]
text=Enchant creature When a creature is put into a graveyard from the battlefield, destroy enchanted creature. text=Enchant creature When a creature is put into a graveyard from the battlefield, destroy enchanted creature.
target=creature target=creature
auto=@movedTo(creature|graveyard) from(battlefield):destroy auto=@movedTo(graveyard) from(creature|battlefield):destroy
id=179891 id=179891
name=Yoke of the Damned name=Yoke of the Damned
rarity=C rarity=C
+1 -1
View File
@@ -369,7 +369,7 @@ toughness=2
[/card] [/card]
[card] [card]
text=Whenever another nontoken creature you control is put into a graveyard from the battlefield, put a 3/1 black and red Graveborn creature token with haste onto the battlefield. text=Whenever another nontoken creature you control is put into a graveyard from the battlefield, put a 3/1 black and red Graveborn creature token with haste onto the battlefield.
auto=@movedto(other creature|myGraveyard) from(myBattlefield):token(Graveborn, Creature Graveborn,3/1,haste red black) auto=@movedto(myGraveyard) from(other creature|myBattlefield):token(Graveborn, Creature Graveborn,3/1,haste red black)
id=121261 id=121261
name=Sek'Kuar, Deathkeeper name=Sek'Kuar, Deathkeeper
rarity=R rarity=R
+1 -1
View File
@@ -1016,7 +1016,7 @@ subtype=Aura
[/card] [/card]
[card] [card]
text=Whenever another nontoken Elf is put into your graveyard from the battlefield, you may put a 1/1 green Elf Warrior creature token onto the battlefield. text=Whenever another nontoken Elf is put into your graveyard from the battlefield, you may put a 1/1 green Elf Warrior creature token onto the battlefield.
auto=@movedTo(other elf|graveyard) from(battlefield):may token(Elf Warrior,creature elf warrior,1/1,green) auto=@movedTo(graveyard) from(other elf|battlefield):may token(Elf Warrior,creature elf warrior,1/1,green)
id=146167 id=146167
name=Prowess of the Fair name=Prowess of the Fair
rarity=U rarity=U
+4 -4
View File
@@ -224,7 +224,7 @@ subtype=Aura
[card] [card]
text=Whenever an artifact is put into a graveyard from the battlefield, you may have target opponent lose 1 life. text=Whenever an artifact is put into a graveyard from the battlefield, you may have target opponent lose 1 life.
id=49090 id=49090
auto=@movedTo(artifact|graveyard) from(battlefield):may life:-1 opponent auto=@movedTo(graveyard) from(artifact|battlefield):may life:-1 opponent
name=Disciple of the Vault name=Disciple of the Vault
rarity=C rarity=C
mana={B} mana={B}
@@ -244,7 +244,7 @@ type=Artifact
[/card] [/card]
[card] [card]
text=Protection from white. At the end of your turn, you lose 4 life. Whenever a creature is put into a graveyard from the battlefield, you gain 2 life. text=Protection from white. At the end of your turn, you lose 4 life. Whenever a creature is put into a graveyard from the battlefield, you gain 2 life.
auto=@movedTo(creature|graveyard) from(battlefield):life:2 auto=@movedTo(graveyard) from(creature|battlefield):life:2
auto=@each my end:life:-4 controller auto=@each my end:life:-4 controller
id=50537 id=50537
name=Dross Harvester name=Dross Harvester
@@ -270,7 +270,7 @@ abilities=fear
[/card] [/card]
[card] [card]
text=Whenever Dross Scorpion or another artifact creature is put into a graveyard from the battlefield, you may untap target artifact. text=Whenever Dross Scorpion or another artifact creature is put into a graveyard from the battlefield, you may untap target artifact.
auto=@movedTo(creature[artifact]|graveyard) from(battlefield):may untap target(artifact) auto=@movedTo(graveyard) from(creature[artifact]|battlefield):may untap target(artifact)
id=46434 id=46434
name=Dross Scorpion name=Dross Scorpion
rarity=C rarity=C
@@ -869,7 +869,7 @@ subtype=Mountain
[/card] [/card]
[card] [card]
text=When Myr Retriever is put into a graveyard from the battlefield, return another target artifact card from your graveyard to your hand. text=When Myr Retriever is put into a graveyard from the battlefield, return another target artifact card from your graveyard to your hand.
auto=@movedTo(this|graveyard) from(battlefield):moveTo(myhand) target(other artifact|mygraveyard) auto=@movedTo(this|graveyard) from(battlefield):moveTo(myhand) target(other artifact|mygraveyard)
id=46126 id=46126
name=Myr Retriever name=Myr Retriever
+1 -1
View File
@@ -992,7 +992,7 @@ abilities=flying
[card] [card]
text=Whenever a creature is put into a graveyard from the battlefield, you gain 1 life. text=Whenever a creature is put into a graveyard from the battlefield, you gain 1 life.
id=136514 id=136514
auto=@movedTo(creature|graveyard) from(battlefield):life:1 controller auto=@movedTo(graveyard) from(creature|battlefield):life:1 controller
name=Moonlit Wake name=Moonlit Wake
rarity=U rarity=U
mana={2}{W} mana={2}{W}
+1 -1
View File
@@ -1606,7 +1606,7 @@ abilities=reach
[/card] [/card]
[card] [card]
text=Flying Whenever a creature with flying is put into a graveyard from the battlefield, put a +1/+1 counter on Soulcatcher. text=Flying Whenever a creature with flying is put into a graveyard from the battlefield, put a +1/+1 counter on Soulcatcher.
auto=@movedTo(creature[flying]|graveyard) from(battlefield):counter(1/1) auto=@movedTo(graveyard) from(creature[flying]|battlefield):counter(1/1)
id=31865 id=31865
name=Soulcatcher name=Soulcatcher
rarity=U rarity=U
+2 -2
View File
@@ -632,7 +632,7 @@ mana={2}{R}
type=Creature type=Creature
subtype=Goblin subtype=Goblin
auto={T}:Damage:1 target(creature,player) auto={T}:Damage:1 target(creature,player)
auto=@movedTo(creature|graveyard) from(battlefield):untap auto=@movedTo(graveyard) from(creature|battlefield):untap
power=1 power=1
toughness=1 toughness=1
abilities=doesnotuntap abilities=doesnotuntap
@@ -1130,7 +1130,7 @@ mana={2}{B}
type=Creature type=Creature
subtype=Zombie Cleric subtype=Zombie Cleric
auto=@movedTo(this|graveyard) from(battlefield):token(Zombie,creature token Zombie, 2/2,black) auto=@movedTo(this|graveyard) from(battlefield):token(Zombie,creature token Zombie, 2/2,black)
auto=@movedTo(other cleric|graveyard) from(battlefield):token(Zombie,creature token Zombie, 2/2,black) auto=@movedTo(graveyard) from(other cleric|battlefield):token(Zombie,creature token Zombie, 2/2,black)
power=2 power=2
toughness=2 toughness=2
[/card] [/card]
+1 -1
View File
@@ -549,7 +549,7 @@ abilities=mountainwalk
[card] [card]
text=Whenever a nontoken creature you control is put into a graveyard from the battlefield, put a 1/1 green Saproling creature token onto the battlefield. text=Whenever a nontoken creature you control is put into a graveyard from the battlefield, put a 1/1 green Saproling creature token onto the battlefield.
id=89069 id=89069
auto=@movedto(creature[-token]|graveyard) from(myBattlefield):token(Saproling,creature saproling, 1/1,green) auto=@movedto(graveyard) from(creature[-token]|myBattlefield):token(Saproling,creature saproling, 1/1,green)
name=Golgari Germination name=Golgari Germination
rarity=U rarity=U
type=Enchantment type=Enchantment
+3 -3
View File
@@ -397,7 +397,7 @@ rarity=U
mana={3}{B} mana={3}{B}
auto=@next my endofturn:bury auto=@next my endofturn:bury
auto=@next my endofturn:life:-8 controller auto=@next my endofturn:life:-8 controller
auto=@movedto(* other|graveyard):moveto(opponentBattlefield) auto=@movedto(graveyard) from(* other|*):moveto(opponentBattlefield)
type=Enchantment type=Enchantment
[/card] [/card]
[card] [card]
@@ -540,8 +540,8 @@ toughness=1
[/card] [/card]
[card] [card]
text=When a creature you control is put into a graveyard from the battlefield, sacrifice Promise of Bunrei. If you do, put four 1/1 colorless Spirit creature tokens onto the battlefield. text=When a creature you control is put into a graveyard from the battlefield, sacrifice Promise of Bunrei. If you do, put four 1/1 colorless Spirit creature tokens onto the battlefield.
auto=@movedto(creature|graveyard) from(myBattlefield):token(Spirit,Creature Spirit,1/1,)*4 auto=@movedto(graveyard) from(creature|myBattlefield):token(Spirit,Creature Spirit,1/1,)*4
auto=@movedto(creature|graveyard) from(myBattlefield):bury auto=@movedto(graveyard) from(creature|myBattlefield):bury
id=84376 id=84376
name=Promise of Bunrei name=Promise of Bunrei
rarity=R rarity=R
+2 -2
View File
@@ -377,7 +377,7 @@ type=Enchantment
[/card] [/card]
[card] [card]
text=Shadow (This creature can block or be blocked by only creatures with shadow.) Whenever a creature with shadow is put into a graveyard from the battlefield, put a +1/+1 counter on Dauthi Ghoul. text=Shadow (This creature can block or be blocked by only creatures with shadow.) Whenever a creature with shadow is put into a graveyard from the battlefield, put a +1/+1 counter on Dauthi Ghoul.
auto=@movedTo(creature[shadow]|graveyard) from(battlefield):counter(1/1) auto=@movedTo(graveyard) from(creature[shadow]|battlefield):counter(1/1)
id=4649 id=4649
name=Dauthi Ghoul name=Dauthi Ghoul
rarity=U rarity=U
@@ -1490,7 +1490,7 @@ toughness=1
[card] [card]
text=Enchant creature Whenever a creature is put into a graveyard from the battlefield, put a +1/+1 counter on enchanted creature. text=Enchant creature Whenever a creature is put into a graveyard from the battlefield, put a +1/+1 counter on enchanted creature.
target=creature target=creature
auto=@movedTo(creature|graveyard) from(battlefield):counter(1/1) auto=@movedTo(graveyard) from(creature|battlefield):counter(1/1)
id=4682 id=4682
name=Sadistic Glee name=Sadistic Glee
rarity=C rarity=C
+2 -2
View File
@@ -130,8 +130,8 @@ abilities=flying,cloud
[card] [card]
text=Whenever a creature is put into a graveyard from the battlefield, Dingus Staff deals 2 damage to that creature's controller. text=Whenever a creature is put into a graveyard from the battlefield, Dingus Staff deals 2 damage to that creature's controller.
id=4432 id=4432
auto=@movedTo(creature|mygraveyard) from(myBattlefield):life:-2 controller auto=@movedTo(mygraveyard) from(creature|myBattlefield):life:-2 controller
auto=@movedTo(creature|opponentgraveyard) from(opponentBattlefield):life:-2 opponent auto=@movedTo(opponentgraveyard) from(creature|opponentBattlefield):life:-2 opponent
name=Dingus Staff name=Dingus Staff
rarity=U rarity=U
mana={4} mana={4}
+1
View File
@@ -269,6 +269,7 @@ kird_ape.txt
kjeldoran_frostbeast1.txt kjeldoran_frostbeast1.txt
knight_captain_of_eos_i294.txt knight_captain_of_eos_i294.txt
knight_captain_of_eos_i294_2.txt knight_captain_of_eos_i294_2.txt
kormus_bell_i301.txt
krosan_beast.txt krosan_beast.txt
krosan_beast2.txt krosan_beast2.txt
kraken_eye.txt kraken_eye.txt
+8 -4
View File
@@ -101,8 +101,9 @@ public:
class TrCardAddedToZone:public TriggeredAbility{ class TrCardAddedToZone:public TriggeredAbility{
public: public:
TargetChooser * toTc; TargetChooser * toTc;
TargetZoneChooser * fromTc; TargetZoneChooser * fromTcZone;
TrCardAddedToZone(int id, MTGCardInstance * source, TargetChooser * toTc, TargetZoneChooser * fromTc = NULL):TriggeredAbility(id,source), toTc(toTc), fromTc(fromTc){} 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(){ int resolve(){
return 0; //This is a trigger, this function should not be called return 0; //This is a trigger, this function should not be called
@@ -111,8 +112,10 @@ public:
int triggerOnEvent(WEvent * event){ int triggerOnEvent(WEvent * event){
WEventZoneChange * e = dynamic_cast<WEventZoneChange*>(event); WEventZoneChange * e = dynamic_cast<WEventZoneChange*>(event);
if (!e) return 0; if (!e) return 0;
if (!toTc->canTarget(e->card)) 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 //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 // http://code.google.com/p/wagic/issues/detail?id=179
@@ -125,7 +128,8 @@ public:
~TrCardAddedToZone(){ ~TrCardAddedToZone(){
SAFE_DELETE(toTc); SAFE_DELETE(toTc);
SAFE_DELETE(fromTc); SAFE_DELETE(fromTcZone);
SAFE_DELETE(fromTcCard);
} }
TrCardAddedToZone * clone() const{ TrCardAddedToZone * clone() const{
+2
View File
@@ -20,6 +20,8 @@ class MTGGameZone {
public: public:
enum{ enum{
ALL_ZONES = -1,
MY_GRAVEYARD = 11, MY_GRAVEYARD = 11,
OPPONENT_GRAVEYARD = 12, OPPONENT_GRAVEYARD = 12,
TARGET_OWNER_GRAVEYARD = 13, TARGET_OWNER_GRAVEYARD = 13,
+13 -3
View File
@@ -64,20 +64,30 @@ TriggeredAbility * AbilityFactory::parseTrigger(string magicText, int id, Spell
if (found != string::npos){ if (found != string::npos){
size_t end = s.find (")"); size_t end = s.find (")");
string starget = s.substr(found+8,end - found - 8); string starget = s.substr(found+8,end - found - 8);
if (starget.find("|") == string::npos) starget.insert(0,"*|");
TargetChooserFactory tcf; TargetChooserFactory tcf;
TargetChooser *toTc = tcf.createTargetChooser(starget,card); TargetChooser *toTc = tcf.createTargetChooser(starget,card);
toTc->targetter = NULL; toTc->targetter = NULL;
TargetChooser *fromTc = NULL; TargetChooser *fromTc = NULL;
TargetChooser * fromTcCard = NULL;
found = s.find("from("); found = s.find("from(");
if (found != string::npos){ if (found != string::npos){
end = s.find ("|", found);
if (end == string::npos) {
fromTcCard = tcf.createTargetChooser("*",card);
found = found + 5;
}else{
fromTcCard = tcf.createTargetChooser(s.substr(found + 5, end - found - 5).append("|*"),card);
found = end + 1;
}
fromTcCard->setAllZones();
end = s.find (")", found); end = s.find (")", found);
starget = s.substr(found+5,end - found - 5); starget = s.substr(found,end - found).insert(0,"*|");
if (starget.find("|") == string::npos) starget.insert(0,"*|");
fromTc = tcf.createTargetChooser(starget,card); fromTc = tcf.createTargetChooser(starget,card);
fromTc->targetter = NULL; fromTc->targetter = NULL;
} }
return NEW TrCardAddedToZone(id,card,toTc,(TargetZoneChooser *)fromTc); return NEW TrCardAddedToZone(id,card,toTc,(TargetZoneChooser *)fromTc,fromTcCard);
} }
//Card Tapped //Card Tapped
+8 -16
View File
@@ -56,8 +56,9 @@ TargetChooser * TargetChooserFactory::createTargetChooser(string s, MTGCardInsta
} }
zones[nbzones] = MTGGameZone::MY_BATTLEFIELD; zones[nbzones] = MTGGameZone::MY_BATTLEFIELD;
//Graveyards if(zoneName.compare("*") == 0){
if(zoneName.compare("graveyard") == 0){ zones[nbzones] = MTGGameZone::ALL_ZONES;
}else if(zoneName.compare("graveyard") == 0){
zones[nbzones] = MTGGameZone::MY_GRAVEYARD; zones[nbzones] = MTGGameZone::MY_GRAVEYARD;
nbzones++; nbzones++;
zones[nbzones] = MTGGameZone::OPPONENT_GRAVEYARD; zones[nbzones] = MTGGameZone::OPPONENT_GRAVEYARD;
@@ -590,21 +591,10 @@ int TargetZoneChooser::init(int * _zones, int _nbzones){
int TargetZoneChooser::setAllZones(){ int TargetZoneChooser::setAllZones(){
int zones[] = { int zones[] = {
MTGGameZone::MY_BATTLEFIELD, MTGGameZone::ALL_ZONES,
MTGGameZone::MY_EXILE,
MTGGameZone::MY_GRAVEYARD,
MTGGameZone::MY_HAND,
MTGGameZone::MY_LIBRARY,
MTGGameZone::MY_STACK,
MTGGameZone::OPPONENT_BATTLEFIELD,
MTGGameZone::OPPONENT_EXILE,
MTGGameZone::OPPONENT_GRAVEYARD,
MTGGameZone::OPPONENT_HAND,
MTGGameZone::OPPONENT_LIBRARY,
MTGGameZone::OPPONENT_STACK
}; };
init(zones,12); init(zones,1);
return 1; return 1;
} }
@@ -613,8 +603,10 @@ bool TargetZoneChooser::canTarget(Targetable * target){
if (!TargetChooser::canTarget(target)) return false; if (!TargetChooser::canTarget(target)) return false;
if (target->typeAsTarget() == TARGET_CARD){ if (target->typeAsTarget() == TARGET_CARD){
MTGCardInstance * card = (MTGCardInstance *) target; MTGCardInstance * card = (MTGCardInstance *) target;
for (int i = 0; i<nbzones; i++) for (int i = 0; i<nbzones; i++){
if (zones[i] == MTGGameZone::ALL_ZONES) return true;
if (MTGGameZone::intToZone(zones[i],source,card)->hasCard(card)) return true; if (MTGGameZone::intToZone(zones[i],source,card)->hasCard(card)) return true;
}
}else if (target->typeAsTarget() == TARGET_STACKACTION){ }else if (target->typeAsTarget() == TARGET_STACKACTION){
OutputDebugString ("CHECKING INTERRUPTIBLE\n"); OutputDebugString ("CHECKING INTERRUPTIBLE\n");
Interruptible * action = (Interruptible *) target; Interruptible * action = (Interruptible *) target;