diff --git a/projects/mtg/bin/Res/sets/ODY/_cards.dat b/projects/mtg/bin/Res/sets/ODY/_cards.dat index a9719112b..c9737a74c 100644 --- a/projects/mtg/bin/Res/sets/ODY/_cards.dat +++ b/projects/mtg/bin/Res/sets/ODY/_cards.dat @@ -293,6 +293,15 @@ type=Land rarity=R [/card] [card] +text={2}, {T}, Sacrifice Darkwater Egg: Add {U}{B} to your mana pool. Draw a card. +auto={2}{T}{S}:Add{U}{B} && Draw:1 +id=30749 +name=Darkwater Egg +rarity=U +type=Artifact +mana={1} +[/card] +[card] text={W}, Sacrifice Dedicated Martyr: You gain 3 life. id=31771 name=Dedicated Martyr @@ -306,6 +315,15 @@ toughness=1 rarity=C [/card] [card] +text=Tap all creatures without flying. +auto=tap all(creature[-flying]) +id=31816 +name=Deluge +rarity=U +type=Instant +mana={2}{U} +[/card] +[card] text=Destroy target artifact or land. id=29867 name=Demolish @@ -431,6 +449,17 @@ toughness=4 rarity=U [/card] [card] +text=Flame Burst deals X damage to target creature or player, where X is 2 plus the number of cards named Flame Burst in all graveyards. +target=creature,player +auto=Damage:2 +auto=foreach(Flame Burst|graveyard) Damage:1 +id=29767 +name=Flame Burst +rarity=C +type=Instant +mana={1}{R} +[/card] +[card] text={B}, Discard a card from your hand: Fledgling Imp gains flying until end of turn. id=31777 name=Fledgling Imp @@ -698,6 +727,15 @@ toughness=* rarity=R [/card] [card] +text={2}, {T}, Sacrifice Mossfire Egg: Add {R}{G} to your mana pool. Draw a card. +auto={2}{T}{S}:Add{r}{R} && Draw:1 +id=30010 +name=Mossfire Egg +rarity=U +type=Artifact +mana={1} +[/card] +[card] text={1}{T}: Add {R}{G} to your mana pool. id=29795 name=Mossfire Valley @@ -742,6 +780,17 @@ subtype=Mountain rarity=L [/card] [card] +text=Target creature gets +X/+X until end of turn, where X is 3 plus the number of cards named Muscle Burst in all graveyards. +target=creature +auto=3/3 +auto=foreach(Muscle Burst|graveyard) 1/1 +id=29788 +name=Muscle Burst +rarity=C +type=Instant +mana={1}{G} +[/card] +[card] text={G}{T}: Target creature gets +2/+2 until end of turn. id=29771 name=Nantuko Disciple diff --git a/projects/mtg/bin/Res/sets/ODY/todo.dat b/projects/mtg/bin/Res/sets/ODY/todo.dat index dc5377c13..e0ceb9632 100644 --- a/projects/mtg/bin/Res/sets/ODY/todo.dat +++ b/projects/mtg/bin/Res/sets/ODY/todo.dat @@ -490,14 +490,7 @@ power=4 subtype=Horror toughness=3 [/card] -[card] -text={2}, {T}, Sacrifice Darkwater Egg: Add {U}{B} to your mana pool. Draw a card. -id=30749 -name=Darkwater Egg -rarity=U -type=Artifact -mana={1} -[/card] + [card] text=At the beginning of your upkeep, remove a card in your graveyard from the game. Threshold - As long as seven or more cards are in your graveyard, Decaying Soil has "Whenever a nontoken creature is put into your graveyard from play, you may pay {1}. If you do, return that card to your hand." id=29955 @@ -538,14 +531,7 @@ rarity=R type=Enchantment mana={3}{W} [/card] -[card] -text=Tap all creatures without flying. -id=31816 -name=Deluge -rarity=U -type=Instant -mana={2}{U} -[/card] + [card] text=Return target permanent to its owner's hand. Flashback {5}{U}{U} (You may play this card from your graveyard for its flashback cost. Then remove it from the game.) id=29826 @@ -629,7 +615,8 @@ rarity=R text=Dreamwinder can't attack unless defending player controls an Island. {U}, Sacrifice an Island: Target land becomes an Island until end of turn. id=31802 name=Dreamwinder -auto=aslongas(land[-island]|opponentinplay) cantattack +auto=aslongas(land[island]|opponentinplay) -cantattack +abilities=cantattack rarity=C type=Creature mana={3}{U} @@ -775,14 +762,7 @@ rarity=C type=Sorcery mana={R} [/card] -[card] -text=Flame Burst deals X damage to target creature or player, where X is 2 plus the number of cards named Flame Burst in all graveyards. -id=29767 -name=Flame Burst -rarity=C -type=Instant -mana={1}{R} -[/card] + [card] text={R}, Discard a card at random: Frenetic Ogre gets +3/+0 until end of turn. id=29855 @@ -1176,14 +1156,7 @@ rarity=C type=Sorcery mana={1}{B} [/card] -[card] -text={2}, {T}, Sacrifice Mossfire Egg: Add {R}{G} to your mana pool. Draw a card. -id=30010 -name=Mossfire Egg -rarity=U -type=Artifact -mana={1} -[/card] + [card] text=Target player removes all land cards in his or her graveyard from the game. id=31740 @@ -1192,14 +1165,7 @@ rarity=R type=Instant mana={2}{R} [/card] -[card] -text=Target creature gets +X/+X until end of turn, where X is 3 plus the number of cards named Muscle Burst in all graveyards. -id=29788 -name=Muscle Burst -rarity=C -type=Instant -mana={1}{G} -[/card] + [card] text=Protection from black and from red Threshold - Mystic Crusader gets +1/+1 and has flying as long as seven or more cards are in your graveyard. id=29802 diff --git a/projects/mtg/bin/Res/sets/USG/_cards.dat b/projects/mtg/bin/Res/sets/USG/_cards.dat index 05f85b2d9..c3f3abfb8 100644 --- a/projects/mtg/bin/Res/sets/USG/_cards.dat +++ b/projects/mtg/bin/Res/sets/USG/_cards.dat @@ -57,6 +57,19 @@ mana={U} type=Instant [/card] [card] +text=Shroud (This permanent can't be the target of spells or abilities.) Whenever you play an enchantment spell, draw a card. +abilities=shroud +auto=@movedTo(enchantment|mystack):draw:1 +id=5686 +name=Argothian Enchantress +rarity=R +type=Creature +mana={1}{G} +power=0 +subtype=Human Druid +toughness=1 +[/card] +[card] text=Trample id=5862 name=Argothian swine @@ -70,6 +83,15 @@ toughness=3 abilities=trample [/card] [card] +text=Nonbasic lands don't untap during their controllers' untap steps. +auto=lord(land[-basic]) doesnotuntap +id=5711 +name=Back to Basics +rarity=R +type=Enchantment +mana={2}{U} +[/card] +[card] text=Legendary {2}, Sacrifice a permanent: Return target creature to its owner's hand. id=9856 name=Barrin, Master Wizard diff --git a/projects/mtg/bin/Res/sets/USG/todo.dat b/projects/mtg/bin/Res/sets/USG/todo.dat index 9afe6ac89..d15e0b3aa 100644 --- a/projects/mtg/bin/Res/sets/USG/todo.dat +++ b/projects/mtg/bin/Res/sets/USG/todo.dat @@ -101,17 +101,7 @@ power=2 subtype=Elf Druid toughness=2 [/card] -[card] -text=Shroud (This permanent can't be the target of spells or abilities.) Whenever you play an enchantment spell, draw a card. -id=5686 -name=Argothian Enchantress -rarity=R -type=Creature -mana={1}{G} -power=0 -subtype=Human Druid -toughness=1 -[/card] + [card] text=Trample When Argothian Wurm comes into play, any player may sacrifice a land. If a player does, put Argothian Wurm on top of its owner's library. id=5769 @@ -131,14 +121,7 @@ rarity=R type=Enchantment mana={2}{U} [/card] -[card] -text=Nonbasic lands don't untap during their controllers' untap steps. -id=5711 -name=Back to Basics -rarity=R -type=Enchantment -mana={2}{U} -[/card] + [card] text=At the beginning of your upkeep, you may put a page counter on Barrin's Codex. {4}, {T}, Sacrifice Barrin's Codex: Draw X cards, where X is the number of page counters on Barrin's Codex. id=5735 diff --git a/projects/mtg/bin/Res/test/_tests.txt b/projects/mtg/bin/Res/test/_tests.txt index ada43c276..a5426a55b 100644 --- a/projects/mtg/bin/Res/test/_tests.txt +++ b/projects/mtg/bin/Res/test/_tests.txt @@ -32,6 +32,7 @@ ankh_of_mishra.txt arcanis_the_omnipotent.txt arcanis_the_omnipotent2.txt ardakar_wastes.txt +argothian_enchantress.txt ascendant_evincar.txt ascendant_evincar2.txt ascendant_evincar3.txt diff --git a/projects/mtg/bin/Res/test/argothian_enchantress.txt b/projects/mtg/bin/Res/test/argothian_enchantress.txt new file mode 100644 index 000000000..c17830c7b --- /dev/null +++ b/projects/mtg/bin/Res/test/argothian_enchantress.txt @@ -0,0 +1,20 @@ +#Testing Argothian Enchantress +#Whenever you play an enchantment spell, draw a card. +[INIT] +FIRSTMAIN +[PLAYER1] +inplay:Argothian Enchantress +hand:lifeforce +library:plains +manapool:{G}{G} +[PLAYER2] +[DO] +lifeforce +[ASSERT] +FIRSTMAIN +[PLAYER1] +inplay:Argothian Enchantress,lifeforce +hand:plains +manapool{0} +[PLAYER2] +[END] \ No newline at end of file diff --git a/projects/mtg/include/ActionStack.h b/projects/mtg/include/ActionStack.h index 725d72637..15d728ecc 100644 --- a/projects/mtg/include/ActionStack.h +++ b/projects/mtg/include/ActionStack.h @@ -146,7 +146,7 @@ class ActionStack :public GuiLayer{ Player * askIfWishesToInterrupt; int garbageCollect(); int addAction(Interruptible * interruptible); - int addSpell(MTGCardInstance* card, Targetable * targets[], int nbtargets, ManaCost * mana); + Spell * addSpell(MTGCardInstance* card, Targetable * targets[], int nbtargets, ManaCost * mana); int AddNextGamePhase(); int addPutInGraveyard(MTGCardInstance * card); int addDraw(Player * player, int nbcards = 1); diff --git a/projects/mtg/include/AllAbilities.h b/projects/mtg/include/AllAbilities.h index 3951347a3..9585c008f 100644 --- a/projects/mtg/include/AllAbilities.h +++ b/projects/mtg/include/AllAbilities.h @@ -21,6 +21,40 @@ using std::map; +// +//Triggers +// + +class TrCardAddedToZone:public TriggeredAbility{ +public: + TargetChooser * toTc; + TargetZoneChooser * fromTc; + TrCardAddedToZone::TrCardAddedToZone(int id,MTGCardInstance * source, TargetChooser * toTc, TargetZoneChooser * fromTc = NULL):TriggeredAbility(id,source), fromTc(fromTc),toTc(toTc){ + } + + int resolve(){ + return 0; //This is a trigger, this function should not be called + } + + int triggerOnEvent(WEvent * event){ + WEventZoneChange * e = dynamic_cast(event); + if (!e) return 0; + if (!toTc->canTarget(e->card)) return 0; + if (fromTc && !fromTc->targetsZone(e->from)) return 0; + return 1; + } + + ~TrCardAddedToZone(){ + SAFE_DELETE(toTc); + SAFE_DELETE(fromTc); + } + + TrCardAddedToZone * clone() const{ + TrCardAddedToZone * a = NEW TrCardAddedToZone(*this); + a->isClone = 1; + return a; + } +}; class AAFizzler:public ActivatedAbility{ diff --git a/projects/mtg/include/MTGAbility.h b/projects/mtg/include/MTGAbility.h index 92252fe39..88006b95f 100644 --- a/projects/mtg/include/MTGAbility.h +++ b/projects/mtg/include/MTGAbility.h @@ -88,7 +88,9 @@ class TriggeredAbility:public MTGAbility{ TriggeredAbility(int id, MTGCardInstance * _source, Targetable * _target); virtual void Update(float dt); virtual void Render(){}; - virtual int trigger()=0; + virtual int trigger(){return 0;}; + virtual int triggerOnEvent(WEvent * e){return 0;}; + int receiveEvent(WEvent * e); virtual int resolve() = 0; virtual TriggeredAbility* clone() const = 0; virtual ostream& toString(ostream& out) const; @@ -183,11 +185,12 @@ class GenericTriggeredAbility:public TriggeredAbility{ MTGAbility * destroyCondition; GenericTriggeredAbility(int id, MTGCardInstance * _source, TriggeredAbility * _t, MTGAbility * a,MTGAbility * dc = NULL, Targetable * _target = NULL); virtual int trigger(); - virtual int receiveEvent(WEvent * e); + virtual int triggerOnEvent(WEvent * e); virtual int resolve(); virtual int testDestroy(); void Update(float dt); virtual GenericTriggeredAbility* clone() const; + const char * getMenuText(); ~GenericTriggeredAbility(); }; diff --git a/projects/mtg/src/ActionStack.cpp b/projects/mtg/src/ActionStack.cpp index d79f794d8..d79b216db 100644 --- a/projects/mtg/src/ActionStack.cpp +++ b/projects/mtg/src/ActionStack.cpp @@ -320,7 +320,7 @@ int ActionStack::addAction(Interruptible * action){ return 1; } -int ActionStack::addSpell(MTGCardInstance * _source, Targetable * _targets[], int _nbtargets, ManaCost * mana){ +Spell * ActionStack::addSpell(MTGCardInstance * _source, Targetable * _targets[], int _nbtargets, ManaCost * mana){ #if defined (WIN32) || defined (LINUX) char buf[4096], *p = buf; sprintf(buf, "Add spell\n"); @@ -333,7 +333,7 @@ int ActionStack::addSpell(MTGCardInstance * _source, Targetable * _targets[], in GameOptions::GetInstance()->values[OPTIONS_INTERRUPTMYSPELLS].getIntValue() == 0){ interruptDecision[0] = DONT_INTERRUPT; } - return result; + return spell; } diff --git a/projects/mtg/src/MTGAbility.cpp b/projects/mtg/src/MTGAbility.cpp index 249432ea2..630cf3275 100644 --- a/projects/mtg/src/MTGAbility.cpp +++ b/projects/mtg/src/MTGAbility.cpp @@ -71,6 +71,17 @@ TriggeredAbility * AbilityFactory::parseTrigger(string magicText, int id, Spell size_t found = magicText.find("@"); if (found == string::npos) return NULL; + //Card Changed Zone + found = magicText.find("movedto("); + if (found != string::npos){ + size_t end = magicText.find (")"); + string starget = magicText.substr(found+8,end - found - 8); + TargetChooserFactory tcf; + TargetChooser *toTc = tcf.createTargetChooser(starget,card); + toTc->targetter = NULL; + return NEW TrCardAddedToZone(id,card,toTc); + } + //Next Time... found = magicText.find("next"); if (found != string::npos){ @@ -339,13 +350,6 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG found = s.find(destroys[i]); if (found != string::npos){ int bury = destroyTypes[i]; - /*if (trigger){ - if (bury){ - BuryEvent * action = NEW BuryEvent(); - return NEW GenericTriggeredAbility(id, card,trigger,action); - } - return NULL; - }*/ MTGAbility * a = NEW AADestroyer(id,card,target,bury); a->oneShot = 1; return a; @@ -403,11 +407,6 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG nbcards = atoi(s.substr(start+1).c_str()); } - /*if (trigger){ - DrawEvent * action = NEW DrawEvent(card->controller(),nbcards); - return NEW GenericTriggeredAbility(id, card,trigger,action); - }*/ - MTGAbility * a = NEW AADrawer(id,card,NULL,nbcards); a->oneShot = 1; return a; @@ -2205,6 +2204,14 @@ TriggeredAbility::TriggeredAbility(int id, MTGCardInstance * card, Targetable * TriggeredAbility::TriggeredAbility(int id, MTGCardInstance * card):MTGAbility(id,card){ } +int TriggeredAbility::receiveEvent(WEvent * e){ + if (triggerOnEvent(e)){ + fireAbility(); + return 1; + } + return 0; +} + void TriggeredAbility::Update(float dt){ if (trigger()) fireAbility(); } @@ -2397,9 +2404,8 @@ int GenericTriggeredAbility::trigger(){ } -int GenericTriggeredAbility::receiveEvent(WEvent * e){ - if (t->receiveEvent(e)) return resolve(); - return 0; +int GenericTriggeredAbility::triggerOnEvent(WEvent * e){ + return t->triggerOnEvent(e); } void GenericTriggeredAbility::Update(float dt){ @@ -2427,6 +2433,10 @@ GenericTriggeredAbility::~GenericTriggeredAbility(){ } } + const char * GenericTriggeredAbility::getMenuText(){ + return ability->getMenuText(); + } + GenericTriggeredAbility* GenericTriggeredAbility::clone() const{ GenericTriggeredAbility * a = NEW GenericTriggeredAbility(*this); a->isClone = 1; diff --git a/projects/mtg/src/MTGGameZones.cpp b/projects/mtg/src/MTGGameZones.cpp index 902add29e..2b377db7f 100644 --- a/projects/mtg/src/MTGGameZones.cpp +++ b/projects/mtg/src/MTGGameZones.cpp @@ -502,6 +502,14 @@ int MTGGameZone::zoneStringToId(string zoneName){ "targetcontrollerexile", "ownerexile", "exile", + + "mystack", + "opponentstack", + "targetownerstack", + "targetcontrollerstack", + "ownerstack", + "stack", + }; int values[] = { @@ -553,6 +561,13 @@ int MTGGameZone::zoneStringToId(string zoneName){ TARGET_CONTROLLER_EXILE, OWNER_EXILE , EXILE, + + MY_STACK, + OPPONENT_STACK, + TARGET_OWNER_STACK , + TARGET_CONTROLLER_STACK, + OWNER_STACK , + STACK, }; int max = sizeof(values) / sizeof*(values); diff --git a/projects/mtg/src/MTGRules.cpp b/projects/mtg/src/MTGRules.cpp index 2f530268b..f66a35fb4 100644 --- a/projects/mtg/src/MTGRules.cpp +++ b/projects/mtg/src/MTGRules.cpp @@ -60,15 +60,15 @@ int MTGPutInPlayRule::reactToClick(MTGCardInstance * card){ delete spell; player->canPutLandsIntoPlay--; }else{ - MTGCardInstance * copy = player->game->putInZone(card, player->game->hand, player->game->stack); + Spell * spell = NULL; if (game->targetChooser){ - game->mLayers->stackLayer()->addSpell(copy,game->targetChooser->targets,game->targetChooser->cursor, spellCost); + spell = game->mLayers->stackLayer()->addSpell(card,game->targetChooser->targets,game->targetChooser->cursor, spellCost); SAFE_DELETE(game->targetChooser); }else{ - game->mLayers->stackLayer()->addSpell(copy,NULL,0, spellCost); + spell = game->mLayers->stackLayer()->addSpell(card,NULL,0, spellCost); } - - + MTGCardInstance * copy = player->game->putInZone(card, player->game->hand, player->game->stack); + spell->source = copy; } return 1; } diff --git a/projects/mtg/template.vcproj b/projects/mtg/template.vcproj index 0ade39d38..ee07950da 100644 --- a/projects/mtg/template.vcproj +++ b/projects/mtg/template.vcproj @@ -741,10 +741,6 @@ RelativePath=".\include\MTGRules.h" > - -