- Added "stack" as a zone in the perser
- Added "fizzle" keyword in the parser for counterspells
This commit is contained in:
wagic.the.homebrew@gmail.com
2009-05-11 13:23:09 +00:00
parent ab48516788
commit 42e6521155
24 changed files with 162 additions and 133 deletions

View File

@@ -286,7 +286,8 @@ type=Land
[/card] [/card]
[card] [card]
text=Counter target spell. text=Counter target spell.
alias=1196 target=*|stack
auto=fizzle
id=129882 id=129882
name=Cancel name=Cancel
rarity=C rarity=C
@@ -648,6 +649,17 @@ subtype=Goblin Mutant
toughness=2 toughness=2
[/card] [/card]
[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. text={T}: Add {G} to your mana pool.
auto={T}: Add {G} auto={T}: Add {G}
id=129561 id=129561
@@ -1701,6 +1713,17 @@ subtype=Rat
toughness=2 toughness=2
[/card] [/card]
[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. text=You gain 3 life. Draw a card.
auto=life:3 auto=life:3
auto=draw:1 auto=draw:1

View File

@@ -530,15 +530,7 @@ power=1
subtype=Zombie Goblin subtype=Zombie Goblin
toughness=1 toughness=1
[/card] [/card]
[card]
text=Counter target red or green spell.
id=129908
name=Flashfreeze
rarity=U
color=Blue
type=Instant
mana={1}{U}
[/card]
[card] [card]
text=All creatures get +X/-X until end of turn. text=All creatures get +X/-X until end of turn.
id=130542 id=130542
@@ -1163,15 +1155,7 @@ color=Blue
type=Sorcery type=Sorcery
mana={2}{U} mana={2}{U}
[/card] [/card]
[card]
text=Counter target creature spell.
id=129699
name=Remove Soul
rarity=C
color=Blue
type=Instant
mana={1}{U}
[/card]
[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. 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 id=106384

View File

@@ -62,7 +62,8 @@ toughness=5
[card] [card]
text=Counter target spell. text=Counter target spell.
id=178092 id=178092
alias=1196 target=*|stack
auto=fizzle
name=Cancel name=Cancel
rarity=C rarity=C
type=Instant type=Instant

View File

@@ -109,7 +109,8 @@ mana={1}{W}
[card] [card]
text=Counter target spell. text=Counter target spell.
id=2500 id=2500
alias=1196 target=*|stack
auto=fizzle
name=Counterspell name=Counterspell
rarity=C rarity=C
type=Instant type=Instant

View File

@@ -553,14 +553,6 @@ mana={2}{W}
subtype=Aura subtype=Aura
[/card] [/card]
[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. text={4}, {T}: Attach target Aura attached to a creature to another creature.
id=2401 id=2401
name=Crown of the Ages name=Crown of the Ages
@@ -1348,22 +1340,6 @@ subtype=Spirit
toughness=3 toughness=3
[/card] [/card]
[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. 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 id=2407
name=Ice Cauldron name=Ice Cauldron
@@ -2475,22 +2451,6 @@ subtype=Ouphe
toughness=1 toughness=1
[/card] [/card]
[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. text=Blocking creatures get +1/+1 until end of turn.
id=2708 id=2708
name=Rally name=Rally

View File

@@ -1,10 +1,10 @@
[card] [card]
text=Counter target spell. You gain 3 life. text=Counter target spell. You gain 3 life.
alias=1196
id=23155 id=23155
target=*|stack
auto=fizzle
auto=life:3 auto=life:3
name=Absorb name=Absorb
color=White,Blue
rarity=R rarity=R
mana={W}{U}{U} mana={W}{U}{U}
type=Instant type=Instant
@@ -339,6 +339,17 @@ subtype=Elf
toughness=2 toughness=2
[/card] [/card]
[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. 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=lord(creature|myinplay) haste
auto={s}:2/2 target(creature) auto={s}:2/2 target(creature)

View File

@@ -1,12 +1,4 @@
[card] [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. 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 id=23030
name=Addle name=Addle
@@ -723,14 +715,7 @@ type=Enchantment
mana={U} mana={U}
subtype=Aura subtype=Aura
[/card] [/card]
[card]
text=Counter target creature spell. Draw a card.
id=22986
name=Exclude
rarity=C
type=Instant
mana={2}{U}
[/card]
[card] [card]
text=Enchant creature Domain - Enchanted creature gets -1/-1 for each basic land type among lands you control. text=Enchant creature Domain - Enchanted creature gets -1/-1 for each basic land type among lands you control.
id=23032 id=23032

View File

@@ -1051,6 +1051,17 @@ toughness=2
rarity=U rarity=U
[/card] [/card]
[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. text=Flying. Other Griffin creatures get +1/+1.
id=3526 id=3526
name=Zuberi, Golden Feather name=Zuberi, Golden Feather

View File

@@ -3153,14 +3153,7 @@ power=1
subtype=Bird subtype=Bird
toughness=1 toughness=1
[/card] [/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] [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. 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 id=3424

View File

@@ -21,6 +21,16 @@ mana={2}{W}{W}
type=Instant type=Instant
[/card] [/card]
[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. text=Sacrifice an artifact: Atog gets +2/+2 until end of turn.
id=46106 id=46106
alias=1280 alias=1280

View File

@@ -40,14 +40,7 @@ name=Ancient Den
rarity=C rarity=C
type=Artifact Land type=Artifact Land
[/card] [/card]
[card]
text=Counter target artifact or enchantment spell.
id=45976
name=Annul
rarity=C
type=Instant
mana={U}
[/card]
[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. 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 id=48436

View File

@@ -194,7 +194,8 @@ abilities=flying,cloud
[/card] [/card]
[card] [card]
text=Counter target spell. text=Counter target spell.
alias=1196 target=*|stack
auto=fizzle
id=19570 id=19570
name=Counterspell name=Counterspell
color=Blue color=Blue
@@ -546,8 +547,7 @@ color=Black
rarity=U rarity=U
mana={2}{B}{B}{B} mana={2}{B}{B}{B}
type=Enchantment type=Enchantment
[/card] [/card] [card]
text={3}, {T}: Target creature gains first strike until end of turn. text={3}, {T}: Target creature gains first strike until end of turn.
id=19882 id=19882
name=Iron Lance name=Iron Lance

View File

@@ -617,14 +617,6 @@ subtype=Human Minion
toughness=1 toughness=1
[/card] [/card]
[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.) 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 id=19683
name=Cowardice name=Cowardice

View File

@@ -786,6 +786,16 @@ toughness=1
abilities=mountainwalk abilities=mountainwalk
[/card] [/card]
[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. text=Target player gains 8 life.
target=player target=player
auto=life:8 auto=life:8

View File

@@ -413,14 +413,7 @@ rarity=C
type=Sorcery type=Sorcery
mana={G} mana={G}
[/card] [/card]
[card]
text=Counter target creature or sorcery spell.
id=4268
name=Mystic Denial
rarity=U
type=Instant
mana={1}{U}{U}
[/card]
[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. 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 id=4307

View File

@@ -403,6 +403,8 @@ subtype=Aura
text=Counter target spell. text=Counter target spell.
id=1196 id=1196
name=Counterspell name=Counterspell
target=*|stack
auto=fizzle
rarity=U rarity=U
type=Instant type=Instant
mana={U}{U} mana={U}{U}

View File

@@ -354,6 +354,16 @@ rarity=R
type=Land type=Land
[/card] [/card]
[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. text=Sacrifice Heap Doll: Remove target card in a graveyard from the game.
auto={S}:moveTo(removedfromgame) target(*|graveyard) auto={S}:moveTo(removedfromgame) target(*|graveyard)
id=154395 id=154395

View File

@@ -678,14 +678,7 @@ power=4
subtype=Scarecrow subtype=Scarecrow
toughness=4 toughness=4
[/card] [/card]
[card]
text=Counter target blue instant spell.
id=158773
name=Guttural Response
rarity=U
type=Instant
mana={RG}
[/card]
[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.) 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.)

View File

@@ -261,7 +261,8 @@ toughness=5
[card] [card]
text=Counter target spell. text=Counter target spell.
id=4693 id=4693
alias=1196 target=*|stack
auto=fizzle
name=Counterspell name=Counterspell
Color=Blue Color=Blue
rarity=C rarity=C
@@ -377,7 +378,8 @@ type=Instant
[card] [card]
text=Counter target spell. Draw a card. text=Counter target spell. Draw a card.
id=4695 id=4695
alias=1196 target=*|stack
auto=fizzle
auto=draw:1 auto=draw:1
name=Dismiss name=Dismiss
color=Blue color=Blue

View File

@@ -5,13 +5,13 @@ FIRSTMAIN
hand:bad moon hand:bad moon
manapool:{1}{B} manapool:{1}{B}
[PLAYER2] [PLAYER2]
hand:counterspell hand:counterspell (RV)
manapool:{U}{U} manapool:{U}{U}
[DO] [DO]
bad moon bad moon
no no
yes yes
counterspell counterspell (RV)
bad moon bad moon
endinterruption endinterruption
[ASSERT] [ASSERT]
@@ -21,7 +21,7 @@ graveyard:bad moon
manapool:{0} manapool:{0}
life:20 life:20
[PLAYER2] [PLAYER2]
graveyard:counterspell graveyard:counterspell (RV)
manapool:{0} manapool:{0}
life:20 life:20
[END] [END]

View File

@@ -510,7 +510,6 @@ void ActionStack::Update(float dt){
unpackDamageStacks(); unpackDamageStacks();
for (int i = 0; i < mCount ; i++){ for (int i = 0; i < mCount ; i++){
Interruptible * current = (Interruptible *)mObjects[i]; Interruptible * current = (Interruptible *)mObjects[i];
OutputDebugString("OH MY GOD, TAARGET MODE!\n");
if (tc->canTarget(current)){ if (tc->canTarget(current)){
if (mObjects[mCurr]) mObjects[mCurr]->Leaving(PSP_CTRL_UP); if (mObjects[mCurr]) mObjects[mCurr]->Leaving(PSP_CTRL_UP);
current->display = 1; current->display = 1;

View File

@@ -307,6 +307,25 @@ int AbilityFactory::magicText(int id, Spell * spell, MTGCardInstance * card){
if (s.find("other") != string::npos) lordIncludeSelf = 0; 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...) //Untapper (Ley Druid...)
found = s.find("untap"); found = s.find("untap");
@@ -919,12 +938,12 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){
game->addObserver(NEW AConservator(_id,card)); game->addObserver(NEW AConservator(_id,card));
break; break;
} }
case 1196: //Counterspell /* case 1196: //Counterspell
{ {
Spell * starget = spell->getNextSpellTarget(); Spell * starget = spell->getNextSpellTarget();
if (starget) game->mLayers->stackLayer()->Fizzle(starget); if (starget) game->mLayers->stackLayer()->Fizzle(starget);
break; break;
} } */
case 1197: //Creature Bond case 1197: //Creature Bond
{ {
game->addObserver(NEW ACreatureBond(_id,card, card->target)); game->addObserver(NEW ACreatureBond(_id,card, card->target));

View File

@@ -52,6 +52,10 @@ TargetChooser * TargetChooserFactory::createTargetChooser(string s, MTGCardInsta
zones[nbzones] = game->players[0]->game->inPlay; zones[nbzones] = game->players[0]->game->inPlay;
nbzones++; nbzones++;
zones[nbzones] = game->players[1]->game->inPlay; 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{ }else{
MTGGameZone * zone = MTGGameZone::stringToZone(zoneName, card,card); MTGGameZone * zone = MTGGameZone::stringToZone(zoneName, card,card);
if (zone) zones[nbzones] = zone; 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 //Any target than cannot be defined automatically is determined by its id
switch (id){ switch (id){
//Spell //Spell
case 1196: //CounterSpell //case 1196: //CounterSpell
case 1224: //Spell blast case 1224: //Spell blast
{ {
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX)
@@ -273,6 +277,8 @@ int TargetChooser::canTarget(Targetable * target){
MTGCardInstance * card = (MTGCardInstance *) target; MTGCardInstance * card = (MTGCardInstance *) target;
if (source && (card->protectedAgainst(source) || card->has(Constants::SHROUD))) return 0; if (source && (card->protectedAgainst(source) || card->has(Constants::SHROUD))) return 0;
return 1; return 1;
}else if (target->typeAsTarget() == TARGET_STACKACTION){
return 1;
} }
return 0; return 0;
} }
@@ -362,14 +368,25 @@ void TypeTargetChooser::addType(int type){
} }
int TypeTargetChooser::canTarget(Targetable * target ){ int TypeTargetChooser::canTarget(Targetable * target ){
if (!TargetZoneChooser::canTarget(target)) return 0;
if (target->typeAsTarget() == TARGET_CARD){ if (target->typeAsTarget() == TARGET_CARD){
MTGCardInstance * card = (MTGCardInstance *) target; MTGCardInstance * card = (MTGCardInstance *) target;
if (!TargetZoneChooser::canTarget(card)) return 0;
for (int i= 0; i < nbtypes; i++){ for (int i= 0; i < nbtypes; i++){
if (card->hasSubtype(types[i])) return 1; if (card->hasSubtype(types[i])) return 1;
if (Subtypes::subtypesList->find(card->name) == types[i]) return 1; if (Subtypes::subtypesList->find(card->name) == types[i]) return 1;
} }
return 0; 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; return 0;
} }
@@ -397,10 +414,17 @@ DescriptorTargetChooser::DescriptorTargetChooser(CardDescriptor * _cd, MTGGameZo
} }
int DescriptorTargetChooser::canTarget(Targetable * target){ int DescriptorTargetChooser::canTarget(Targetable * target){
if (!TargetZoneChooser::canTarget(target)) return 0;
if (target->typeAsTarget() == TARGET_CARD){ if (target->typeAsTarget() == TARGET_CARD){
MTGCardInstance * _target = (MTGCardInstance *) target; MTGCardInstance * _target = (MTGCardInstance *) target;
if (!TargetZoneChooser::canTarget(_target)) return 0;
if (cd->match(_target)) return 1; 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; return 0;
} }
@@ -473,6 +497,16 @@ int TargetZoneChooser::canTarget(Targetable * target){
for (int i = 0; i<nbzones; i++){ for (int i = 0; i<nbzones; i++){
if (zones[i]->hasCard(card)) return 1; if (zones[i]->hasCard(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; i<nbzones; i++){
if (zones[i]->hasCard(card)) return 1;
}
}
} }
return 0; return 0;
} }

View File

@@ -109,6 +109,9 @@ int TestSuiteAI::Act(float dt){
}else{ }else{
int mtgid = suite->getMTGId(action); int mtgid = suite->getMTGId(action);
if (mtgid){ if (mtgid){
char buffe[512];
sprintf(buffe, "CARD ID : %i\n", mtgid);
OutputDebugString(buffe);
Interruptible * toInterrupt = suite->getActionByMTGId(mtgid); Interruptible * toInterrupt = suite->getActionByMTGId(mtgid);
if (toInterrupt){ if (toInterrupt){
g->stackObjectClicked(toInterrupt); g->stackObjectClicked(toInterrupt);