diff --git a/projects/mtg/bin/Res/sets/10E/_cards.dat b/projects/mtg/bin/Res/sets/10E/_cards.dat index 0f0ef04af..a9f91fa93 100644 --- a/projects/mtg/bin/Res/sets/10E/_cards.dat +++ b/projects/mtg/bin/Res/sets/10E/_cards.dat @@ -286,7 +286,8 @@ type=Land [/card] [card] text=Counter target spell. -alias=1196 +target=*|stack +auto=fizzle id=129882 name=Cancel rarity=C @@ -648,6 +649,17 @@ subtype=Goblin Mutant toughness=2 [/card] [card] +text=Counter target red or green spell. +target=*[red;green]|stack +auto=fizzle +id=129908 +name=Flashfreeze +rarity=U +color=Blue +type=Instant +mana={1}{U} +[/card] +[card] text={T}: Add {G} to your mana pool. auto={T}: Add {G} id=129561 @@ -1701,6 +1713,17 @@ subtype=Rat toughness=2 [/card] [card] +text=Counter target creature spell. +target=creature|stack +auto=fizzle +id=129699 +name=Remove Soul +rarity=C +color=Blue +type=Instant +mana={1}{U} +[/card] +[card] text=You gain 3 life. Draw a card. auto=life:3 auto=draw:1 diff --git a/projects/mtg/bin/Res/sets/10E/todo.dat b/projects/mtg/bin/Res/sets/10E/todo.dat index 2513cf742..3c394a985 100644 --- a/projects/mtg/bin/Res/sets/10E/todo.dat +++ b/projects/mtg/bin/Res/sets/10E/todo.dat @@ -530,15 +530,7 @@ power=1 subtype=Zombie Goblin toughness=1 [/card] -[card] -text=Counter target red or green spell. -id=129908 -name=Flashfreeze -rarity=U -color=Blue -type=Instant -mana={1}{U} -[/card] + [card] text=All creatures get +X/-X until end of turn. id=130542 @@ -1163,15 +1155,7 @@ color=Blue type=Sorcery mana={2}{U} [/card] -[card] -text=Counter target creature spell. -id=129699 -name=Remove Soul -rarity=C -color=Blue -type=Instant -mana={1}{U} -[/card] + [card] text=Flying (This creature can't be blocked except by creatures with flying or reach.) At the beginning of your upkeep, you may return target creature card from your graveyard to play. id=106384 diff --git a/projects/mtg/bin/Res/sets/ALA/_cards.dat b/projects/mtg/bin/Res/sets/ALA/_cards.dat index 4dd3ace94..75b147a0b 100644 --- a/projects/mtg/bin/Res/sets/ALA/_cards.dat +++ b/projects/mtg/bin/Res/sets/ALA/_cards.dat @@ -62,7 +62,8 @@ toughness=5 [card] text=Counter target spell. id=178092 -alias=1196 +target=*|stack +auto=fizzle name=Cancel rarity=C type=Instant diff --git a/projects/mtg/bin/Res/sets/ICE/_cards.dat b/projects/mtg/bin/Res/sets/ICE/_cards.dat index 96b431739..840c93d51 100644 --- a/projects/mtg/bin/Res/sets/ICE/_cards.dat +++ b/projects/mtg/bin/Res/sets/ICE/_cards.dat @@ -109,7 +109,8 @@ mana={1}{W} [card] text=Counter target spell. id=2500 -alias=1196 +target=*|stack +auto=fizzle name=Counterspell rarity=C type=Instant diff --git a/projects/mtg/bin/Res/sets/ICE/todo.dat b/projects/mtg/bin/Res/sets/ICE/todo.dat index e80d6ec12..66dc80007 100644 --- a/projects/mtg/bin/Res/sets/ICE/todo.dat +++ b/projects/mtg/bin/Res/sets/ICE/todo.dat @@ -553,14 +553,6 @@ mana={2}{W} subtype=Aura [/card] [card] -text=Counter target spell. -id=2500 -name=Counterspell -rarity=C -type=Instant -mana={U}{U} -[/card] -[card] text={4}, {T}: Attach target Aura attached to a creature to another creature. id=2401 name=Crown of the Ages @@ -1348,22 +1340,6 @@ subtype=Spirit toughness=3 [/card] [card] -text=Choose one - Counter target spell if it's red; or destroy target permanent if it's red. -id=2508 -name=Hydroblast -rarity=C -type=Instant -mana={U} -[/card] -[card] -text=Put target creature card in a graveyard into play under your control. -id=2731 -name=Hymn of Rebirth -rarity=U -type=Sorcery -mana={3}{G}{W} -[/card] -[card] text={X}, {T}: Put a charge counter on Ice Cauldron and remove a nonland card in your hand from the game. As long as that card remains removed from the game, you may play it. Note the type and amount of mana spent to pay this activation cost. Play this ability only if there are no charge counters on Ice Cauldron. {T}, Remove a charge counter from Ice Cauldron: Add Ice Cauldron's last noted type and amount of mana to your mana pool. Spend this mana only to play the last card removed from the game with Ice Cauldron. id=2407 name=Ice Cauldron @@ -2475,22 +2451,6 @@ subtype=Ouphe toughness=1 [/card] [card] -text=Choose one - Counter target spell if it's blue; or destroy target permanent if it's blue. -id=2649 -name=Pyroblast -rarity=C -type=Instant -mana={R} -[/card] -[card] -text=Pyroclasm deals 2 damage to each creature. -id=2650 -name=Pyroclasm -rarity=U -type=Sorcery -mana={1}{R} -[/card] -[card] text=Blocking creatures get +1/+1 until end of turn. id=2708 name=Rally diff --git a/projects/mtg/bin/Res/sets/INV/_cards.dat b/projects/mtg/bin/Res/sets/INV/_cards.dat index 51009ef35..a19fb61ef 100644 --- a/projects/mtg/bin/Res/sets/INV/_cards.dat +++ b/projects/mtg/bin/Res/sets/INV/_cards.dat @@ -1,10 +1,10 @@ [card] text=Counter target spell. You gain 3 life. -alias=1196 id=23155 +target=*|stack +auto=fizzle auto=life:3 name=Absorb -color=White,Blue rarity=R mana={W}{U}{U} type=Instant @@ -339,6 +339,17 @@ subtype=Elf toughness=2 [/card] [card] +text=Counter target creature spell. Draw a card. +target=creature|stack +auto=fizzle +auto=draw:1 +id=22986 +name=Exclude +rarity=C +type=Instant +mana={2}{U} +[/card] +[card] text=Creatures you control have haste. Sacrifice Fires of Yavimaya: Target creature gets +2/+2 until end of turn. auto=lord(creature|myinplay) haste auto={s}:2/2 target(creature) diff --git a/projects/mtg/bin/Res/sets/INV/todo.dat b/projects/mtg/bin/Res/sets/INV/todo.dat index 4e146f142..bc3a0910f 100644 --- a/projects/mtg/bin/Res/sets/INV/todo.dat +++ b/projects/mtg/bin/Res/sets/INV/todo.dat @@ -1,12 +1,4 @@ [card] -text=Counter target spell. You gain 3 life. -id=23155 -name=Absorb -rarity=R -type=Instant -mana={W}{U}{U} -[/card] -[card] text=Choose a color. Target player reveals his or her hand, then you choose a card of that color from it. That player discards that card. id=23030 name=Addle @@ -723,14 +715,7 @@ type=Enchantment mana={U} subtype=Aura [/card] -[card] -text=Counter target creature spell. Draw a card. -id=22986 -name=Exclude -rarity=C -type=Instant -mana={2}{U} -[/card] + [card] text=Enchant creature Domain - Enchanted creature gets -1/-1 for each basic land type among lands you control. id=23032 diff --git a/projects/mtg/bin/Res/sets/MIR/_cards.dat b/projects/mtg/bin/Res/sets/MIR/_cards.dat index 1c107883b..2a26e8c66 100644 --- a/projects/mtg/bin/Res/sets/MIR/_cards.dat +++ b/projects/mtg/bin/Res/sets/MIR/_cards.dat @@ -1051,6 +1051,17 @@ toughness=2 rarity=U [/card] [card] +text=As an additional cost to play Withering Boon, pay 3 life. Counter target creature spell. +target=creature|stack +auto=fizzle +auto=life:-3 +id=3321 +name=Withering Boon +rarity=U +type=Instant +mana={1}{B} +[/card] +[card] text=Flying. Other Griffin creatures get +1/+1. id=3526 name=Zuberi, Golden Feather diff --git a/projects/mtg/bin/Res/sets/MIR/todo.dat b/projects/mtg/bin/Res/sets/MIR/todo.dat index 63201f1a0..60d4126c1 100644 --- a/projects/mtg/bin/Res/sets/MIR/todo.dat +++ b/projects/mtg/bin/Res/sets/MIR/todo.dat @@ -3153,14 +3153,7 @@ power=1 subtype=Bird toughness=1 [/card] -[card] -text=As an additional cost to play Withering Boon, pay 3 life. Counter target creature spell. -id=3321 -name=Withering Boon -rarity=U -type=Instant -mana={1}{B} -[/card] + [card] text=Search your library for a creature card and reveal that card. Shuffle your library, then put the revealed card back on top of it. id=3424 diff --git a/projects/mtg/bin/Res/sets/MRD/_cards.dat b/projects/mtg/bin/Res/sets/MRD/_cards.dat index f21b9014c..283625562 100644 --- a/projects/mtg/bin/Res/sets/MRD/_cards.dat +++ b/projects/mtg/bin/Res/sets/MRD/_cards.dat @@ -21,6 +21,16 @@ mana={2}{W}{W} type=Instant [/card] [card] +text=Counter target artifact or enchantment spell. +target=artifact,enchantment|stack +auto=fizzle +id=45976 +name=Annul +rarity=C +type=Instant +mana={U} +[/card] +[card] text=Sacrifice an artifact: Atog gets +2/+2 until end of turn. id=46106 alias=1280 diff --git a/projects/mtg/bin/Res/sets/MRD/todo.dat b/projects/mtg/bin/Res/sets/MRD/todo.dat index 0fab0f871..9fb5bceaa 100644 --- a/projects/mtg/bin/Res/sets/MRD/todo.dat +++ b/projects/mtg/bin/Res/sets/MRD/todo.dat @@ -40,14 +40,7 @@ name=Ancient Den rarity=C type=Artifact Land [/card] -[card] -text=Counter target artifact or enchantment spell. -id=45976 -name=Annul -rarity=C -type=Instant -mana={U} -[/card] + [card] text={R}, Remove the top ten cards of your library from the game: Arc-Slogger deals 2 damage to target creature or player. id=48436 diff --git a/projects/mtg/bin/Res/sets/MRQ/_cards.dat b/projects/mtg/bin/Res/sets/MRQ/_cards.dat index 01fe7a7d7..49c398368 100644 --- a/projects/mtg/bin/Res/sets/MRQ/_cards.dat +++ b/projects/mtg/bin/Res/sets/MRQ/_cards.dat @@ -194,7 +194,8 @@ abilities=flying,cloud [/card] [card] text=Counter target spell. -alias=1196 +target=*|stack +auto=fizzle id=19570 name=Counterspell color=Blue @@ -546,8 +547,7 @@ color=Black rarity=U mana={2}{B}{B}{B} type=Enchantment -[/card] -[card] +[/card] [card] text={3}, {T}: Target creature gains first strike until end of turn. id=19882 name=Iron Lance diff --git a/projects/mtg/bin/Res/sets/MRQ/todo.dat b/projects/mtg/bin/Res/sets/MRQ/todo.dat index de3f2e05a..24c145a50 100644 --- a/projects/mtg/bin/Res/sets/MRQ/todo.dat +++ b/projects/mtg/bin/Res/sets/MRQ/todo.dat @@ -617,14 +617,6 @@ subtype=Human Minion toughness=1 [/card] [card] -text=Counter target spell. -id=19570 -name=Counterspell -rarity=C -type=Instant -mana={U}{U} -[/card] -[card] text=Whenever a creature becomes the target of a spell or ability, return that creature to its owner's hand. (It won't be affected by the spell or ability.) id=19683 name=Cowardice diff --git a/projects/mtg/bin/Res/sets/POR/_cards.dat b/projects/mtg/bin/Res/sets/POR/_cards.dat index 75bca03cb..b2ca0fcd8 100644 --- a/projects/mtg/bin/Res/sets/POR/_cards.dat +++ b/projects/mtg/bin/Res/sets/POR/_cards.dat @@ -786,6 +786,16 @@ toughness=1 abilities=mountainwalk [/card] [card] +text=Counter target creature or sorcery spell. +target=creature,sorcery|stack +auto=fizzle +id=4268 +name=Mystic Denial +rarity=U +type=Instant +mana={1}{U}{U} +[/card] +[card] text=Target player gains 8 life. target=player auto=life:8 diff --git a/projects/mtg/bin/Res/sets/POR/todo.dat b/projects/mtg/bin/Res/sets/POR/todo.dat index 147419966..19966a023 100644 --- a/projects/mtg/bin/Res/sets/POR/todo.dat +++ b/projects/mtg/bin/Res/sets/POR/todo.dat @@ -413,14 +413,7 @@ rarity=C type=Sorcery mana={G} [/card] -[card] -text=Counter target creature or sorcery spell. -id=4268 -name=Mystic Denial -rarity=U -type=Instant -mana={1}{U}{U} -[/card] + [card] text=As an additional cost to play Natural Order, sacrifice a green creature. Search your library for a green creature card and put it into play. Then shuffle your library. id=4307 diff --git a/projects/mtg/bin/Res/sets/RV/_cards.dat b/projects/mtg/bin/Res/sets/RV/_cards.dat index 1a4b20a2b..665f0fd32 100644 --- a/projects/mtg/bin/Res/sets/RV/_cards.dat +++ b/projects/mtg/bin/Res/sets/RV/_cards.dat @@ -403,6 +403,8 @@ subtype=Aura text=Counter target spell. id=1196 name=Counterspell +target=*|stack +auto=fizzle rarity=U type=Instant mana={U}{U} diff --git a/projects/mtg/bin/Res/sets/SHM/_cards.dat b/projects/mtg/bin/Res/sets/SHM/_cards.dat index 12389aa2a..22537508b 100644 --- a/projects/mtg/bin/Res/sets/SHM/_cards.dat +++ b/projects/mtg/bin/Res/sets/SHM/_cards.dat @@ -354,6 +354,16 @@ rarity=R type=Land [/card] [card] +text=Counter target blue instant spell. +target=instant[blue]|stack +auto=fizzle +id=158773 +name=Guttural Response +rarity=U +type=Instant +mana={RG} +[/card] +[card] text=Sacrifice Heap Doll: Remove target card in a graveyard from the game. auto={S}:moveTo(removedfromgame) target(*|graveyard) id=154395 diff --git a/projects/mtg/bin/Res/sets/SHM/todo.dat b/projects/mtg/bin/Res/sets/SHM/todo.dat index b598a5da0..744664815 100644 --- a/projects/mtg/bin/Res/sets/SHM/todo.dat +++ b/projects/mtg/bin/Res/sets/SHM/todo.dat @@ -678,14 +678,7 @@ power=4 subtype=Scarecrow toughness=4 [/card] -[card] -text=Counter target blue instant spell. -id=158773 -name=Guttural Response -rarity=U -type=Instant -mana={RG} -[/card] + [card] text=At the beginning of your upkeep, remove a -1/-1 counter from each creature you control. Persist (When this creature is put into a graveyard from play, if it had no -1/-1 counters on it, return it to play under its owner's control with a -1/-1 counter on it.) diff --git a/projects/mtg/bin/Res/sets/TMP/_cards.dat b/projects/mtg/bin/Res/sets/TMP/_cards.dat index 44094a7d3..83c34aede 100644 --- a/projects/mtg/bin/Res/sets/TMP/_cards.dat +++ b/projects/mtg/bin/Res/sets/TMP/_cards.dat @@ -261,7 +261,8 @@ toughness=5 [card] text=Counter target spell. id=4693 -alias=1196 +target=*|stack +auto=fizzle name=Counterspell Color=Blue rarity=C @@ -377,7 +378,8 @@ type=Instant [card] text=Counter target spell. Draw a card. id=4695 -alias=1196 +target=*|stack +auto=fizzle auto=draw:1 name=Dismiss color=Blue diff --git a/projects/mtg/bin/Res/test/counterspell4.txt b/projects/mtg/bin/Res/test/counterspell4.txt index 82ca8f0b1..b75590fba 100644 --- a/projects/mtg/bin/Res/test/counterspell4.txt +++ b/projects/mtg/bin/Res/test/counterspell4.txt @@ -5,13 +5,13 @@ FIRSTMAIN hand:bad moon manapool:{1}{B} [PLAYER2] -hand:counterspell +hand:counterspell (RV) manapool:{U}{U} [DO] bad moon no yes -counterspell +counterspell (RV) bad moon endinterruption [ASSERT] @@ -21,7 +21,7 @@ graveyard:bad moon manapool:{0} life:20 [PLAYER2] -graveyard:counterspell +graveyard:counterspell (RV) manapool:{0} life:20 [END] \ No newline at end of file diff --git a/projects/mtg/src/ActionStack.cpp b/projects/mtg/src/ActionStack.cpp index 5e9564f47..6e2224c08 100644 --- a/projects/mtg/src/ActionStack.cpp +++ b/projects/mtg/src/ActionStack.cpp @@ -510,7 +510,6 @@ void ActionStack::Update(float dt){ unpackDamageStacks(); for (int i = 0; i < mCount ; i++){ Interruptible * current = (Interruptible *)mObjects[i]; - OutputDebugString("OH MY GOD, TAARGET MODE!\n"); if (tc->canTarget(current)){ if (mObjects[mCurr]) mObjects[mCurr]->Leaving(PSP_CTRL_UP); current->display = 1; diff --git a/projects/mtg/src/MTGAbility.cpp b/projects/mtg/src/MTGAbility.cpp index 5741b2302..3ac8cf501 100644 --- a/projects/mtg/src/MTGAbility.cpp +++ b/projects/mtg/src/MTGAbility.cpp @@ -307,6 +307,25 @@ int AbilityFactory::magicText(int id, Spell * spell, MTGCardInstance * card){ if (s.find("other") != string::npos) lordIncludeSelf = 0; } + + //Fizzle (counterspell...) + found = s.find("fizzle"); + if (found != string::npos){ + if (dryMode) { + dryModeResult = BAKA_EFFECT_BAD; + dryModeResultSet = 1; + break; + } + if (tc){ + //TODO + }else{ + Spell * starget = spell->getNextSpellTarget(); + if (starget) game->mLayers->stackLayer()->Fizzle(starget); + } + result++; + continue; + } + //Untapper (Ley Druid...) found = s.find("untap"); @@ -919,12 +938,12 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){ game->addObserver(NEW AConservator(_id,card)); break; } - case 1196: //Counterspell +/* case 1196: //Counterspell { Spell * starget = spell->getNextSpellTarget(); if (starget) game->mLayers->stackLayer()->Fizzle(starget); break; - } + } */ case 1197: //Creature Bond { game->addObserver(NEW ACreatureBond(_id,card, card->target)); diff --git a/projects/mtg/src/TargetChooser.cpp b/projects/mtg/src/TargetChooser.cpp index 0fba37199..a5abebf90 100644 --- a/projects/mtg/src/TargetChooser.cpp +++ b/projects/mtg/src/TargetChooser.cpp @@ -52,6 +52,10 @@ TargetChooser * TargetChooserFactory::createTargetChooser(string s, MTGCardInsta zones[nbzones] = game->players[0]->game->inPlay; nbzones++; zones[nbzones] = game->players[1]->game->inPlay; + }else if(zoneName.compare("stack") == 0){ + zones[nbzones] = game->players[0]->game->stack; + nbzones++; + zones[nbzones] = game->players[1]->game->stack; }else{ MTGGameZone * zone = MTGGameZone::stringToZone(zoneName, card,card); if (zone) zones[nbzones] = zone; @@ -220,7 +224,7 @@ TargetChooser * TargetChooserFactory::createTargetChooser(MTGCardInstance * card //Any target than cannot be defined automatically is determined by its id switch (id){ //Spell - case 1196: //CounterSpell + //case 1196: //CounterSpell case 1224: //Spell blast { #if defined (WIN32) || defined (LINUX) @@ -273,6 +277,8 @@ int TargetChooser::canTarget(Targetable * target){ MTGCardInstance * card = (MTGCardInstance *) target; if (source && (card->protectedAgainst(source) || card->has(Constants::SHROUD))) return 0; return 1; + }else if (target->typeAsTarget() == TARGET_STACKACTION){ + return 1; } return 0; } @@ -362,14 +368,25 @@ void TypeTargetChooser::addType(int type){ } int TypeTargetChooser::canTarget(Targetable * target ){ + if (!TargetZoneChooser::canTarget(target)) return 0; if (target->typeAsTarget() == TARGET_CARD){ MTGCardInstance * card = (MTGCardInstance *) target; - if (!TargetZoneChooser::canTarget(card)) return 0; for (int i= 0; i < nbtypes; i++){ if (card->hasSubtype(types[i])) return 1; if (Subtypes::subtypesList->find(card->name) == types[i]) return 1; } return 0; + }else if (target->typeAsTarget() == TARGET_STACKACTION){ + Interruptible * action = (Interruptible *) target; + if (action->type == ACTION_SPELL && action->state==NOT_RESOLVED){ + Spell * spell = (Spell *) action; + MTGCardInstance * card = spell->source; + for (int i= 0; i < nbtypes; i++){ + if (card->hasSubtype(types[i])) return 1; + if (Subtypes::subtypesList->find(card->name) == types[i]) return 1; + } + return 0; + } } return 0; } @@ -397,10 +414,17 @@ DescriptorTargetChooser::DescriptorTargetChooser(CardDescriptor * _cd, MTGGameZo } int DescriptorTargetChooser::canTarget(Targetable * target){ + if (!TargetZoneChooser::canTarget(target)) return 0; if (target->typeAsTarget() == TARGET_CARD){ MTGCardInstance * _target = (MTGCardInstance *) target; - if (!TargetZoneChooser::canTarget(_target)) return 0; if (cd->match(_target)) return 1; + }else if (target->typeAsTarget() == TARGET_STACKACTION){ + Interruptible * action = (Interruptible *) target; + if (action->type == ACTION_SPELL && action->state==NOT_RESOLVED){ + Spell * spell = (Spell *) action; + MTGCardInstance * card = spell->source; + if (cd->match(card)) return 1; + } } return 0; } @@ -473,6 +497,16 @@ int TargetZoneChooser::canTarget(Targetable * target){ for (int i = 0; ihasCard(card)) return 1; } + }else if (target->typeAsTarget() == TARGET_STACKACTION){ +OutputDebugString ("CHECKING INTERRUPTIBLE\n"); + Interruptible * action = (Interruptible *) target; + if (action->type == ACTION_SPELL && action->state==NOT_RESOLVED){ + Spell * spell = (Spell *) action; + MTGCardInstance * card = spell->source; + for (int i = 0; ihasCard(card)) return 1; + } + } } return 0; } diff --git a/projects/mtg/src/TestSuiteAI.cpp b/projects/mtg/src/TestSuiteAI.cpp index 537bbfc83..a17ca34d9 100644 --- a/projects/mtg/src/TestSuiteAI.cpp +++ b/projects/mtg/src/TestSuiteAI.cpp @@ -109,6 +109,9 @@ int TestSuiteAI::Act(float dt){ }else{ int mtgid = suite->getMTGId(action); if (mtgid){ + char buffe[512]; + sprintf(buffe, "CARD ID : %i\n", mtgid); + OutputDebugString(buffe); Interruptible * toInterrupt = suite->getActionByMTGId(mtgid); if (toInterrupt){ g->stackObjectClicked(toInterrupt);