- Added destroy all(xxx) and bury all(xxx) keywords in _cards.dat
This commit is contained in:
wagic.the.homebrew
2008-11-13 11:36:14 +00:00
parent 443817a83a
commit da1967270c
8 changed files with 99 additions and 87 deletions

View File

@@ -1292,7 +1292,7 @@ mana={G}{G}
[card] [card]
text=Bury all artifacts, creatures, and lands. text=Bury all artifacts, creatures, and lands.
id=2631 id=2631
auto=destroy auto=bury all(artifact,creature,land)
name=Jokulhaups name=Jokulhaups
rarity=R rarity=R
type=Sorcery type=Sorcery
@@ -1350,6 +1350,7 @@ mana={B}
[/card] [/card]
[card] [card]
text=Destroy all white permanents. text=Destroy all white permanents.
auto=destroy all(*[white])
id=2606 id=2606
name=Anarchy name=Anarchy
rarity=U rarity=U

View File

@@ -69,6 +69,7 @@ mana={2}
[/card] [/card]
[card] [card]
text=Destroy all lands. text=Destroy all lands.
auto=destroy all(land)
id=1328 id=1328
name=Armageddon name=Armageddon
rarity=R rarity=R
@@ -737,6 +738,7 @@ subtype=Aura
[card] [card]
text=Destroy all Plains. text=Destroy all Plains.
id=1293 id=1293
auto=destroy all(plains)
name=Flashfires name=Flashfires
rarity=U rarity=U
type=Sorcery type=Sorcery
@@ -1885,6 +1887,7 @@ mana={1}{R}
[/card] [/card]
[card] [card]
text=Destroy all artifacts. They can't be regenerated. text=Destroy all artifacts. They can't be regenerated.
auto=bury all(artifact)
id=1317 id=1317
name=Shatterstorm name=Shatterstorm
rarity=U rarity=U
@@ -2089,6 +2092,7 @@ toughness=1
[card] [card]
text=Destroy all enchantments. text=Destroy all enchantments.
id=1270 id=1270
auto=destroy all(enchantment)
name=Tranquility name=Tranquility
rarity=C rarity=C
type=Sorcery type=Sorcery
@@ -2107,6 +2111,7 @@ subtype=Island Forest
[card] [card]
text=Destroy all Islands. text=Destroy all Islands.
id=1271 id=1271
auto=destroy all(island)
name=Tsunami name=Tsunami
rarity=U rarity=U
type=Sorcery type=Sorcery
@@ -2434,6 +2439,7 @@ mana={1}
[/card] [/card]
[card] [card]
text=Destroy all creatures. They can't be regenerated. text=Destroy all creatures. They can't be regenerated.
auto=bury all(creature)
id=1372 id=1372
name=Wrath of God name=Wrath of God
rarity=R rarity=R

View File

@@ -11,6 +11,7 @@ generic/wither.txt
######################## ########################
#Specific Cards #Specific Cards
######################## ########################
anarchy.txt
animate_dead.txt animate_dead.txt
animate_dead2.txt animate_dead2.txt
ascendant_evincar.txt ascendant_evincar.txt
@@ -45,4 +46,5 @@ shock.txt
stasis.txt stasis.txt
terror.txt terror.txt
volcanic_island.txt volcanic_island.txt
white_knight1.txt white_knight1.txt
wrath_of_god.txt

View File

@@ -0,0 +1,21 @@
#Does anarchy destroy all white permanents ?
[INIT]
FIRSTMAIN
[PLAYER1]
hand:2606
manapool:{2}{R}{R}
inplay:2672,2718
[PLAYER2]
inplay:2697,2732, 1393, 2771
[DO]
2606
[ASSERT]
FIRSTMAIN
[PLAYER1]
graveyard:2606,2672
inplay:2718
manapool:{0}
[PLAYER2]
graveyard:2732,2697
inplay:1393,2771
[END]

View File

@@ -0,0 +1,21 @@
#Does Wrath of god destroy all creatures ?
[INIT]
FIRSTMAIN
[PLAYER1]
hand:1372
manapool:{2}{W}{W}
inplay:1188,1145,1250,1236,1092,1385
[PLAYER2]
inplay:1323,1268,1151,1393
[DO]
1372
[ASSERT]
FIRSTMAIN
[PLAYER1]
graveyard:1188,1145,1250,1236,1372
inplay:1092,1385
manapool:{0}
[PLAYER2]
graveyard:1323,1268
inplay:1393,1151
[END]

View File

@@ -178,8 +178,7 @@ public:
/* Ability Factory */ /* Ability Factory */
class AbilityFactory{ class AbilityFactory{
private: private:
int destroyAllFromTypeInPlay(const char * type, MTGCardInstance * source, int bury = 0); int destroyAllInPlay(TargetChooser * tc, int bury = 0);
int destroyAllFromColorInPlay(int color, MTGCardInstance * source, int bury = 0);
int putInPlayFromZone(MTGCardInstance * card, MTGGameZone * zone, Player * p); int putInPlayFromZone(MTGCardInstance * card, MTGGameZone * zone, Player * p);
Trigger * parseTrigger(string magicText); Trigger * parseTrigger(string magicText);
public: public:

View File

@@ -8,12 +8,14 @@
#include "../include/CardGui.h" #include "../include/CardGui.h"
#include "../include/MTGDeck.h" #include "../include/MTGDeck.h"
int AbilityFactory::destroyAllFromTypeInPlay(const char * type, MTGCardInstance * source, int bury){
int AbilityFactory::destroyAllInPlay(TargetChooser * tc, int bury){
tc->source = NULL; // This is to prevent protection from... as objects that destroy all do not actually target
GameObserver * game = GameObserver::GetInstance(); GameObserver * game = GameObserver::GetInstance();
for (int i = 0; i < 2 ; i++){ for (int i = 0; i < 2 ; i++){
for (int j = 0; j < game->players[i]->game->inPlay->nb_cards; j++){ for (int j = 0; j < game->players[i]->game->inPlay->nb_cards; j++){
MTGCardInstance * current = game->players[i]->game->inPlay->cards[j]; MTGCardInstance * current = game->players[i]->game->inPlay->cards[j];
if (current->hasType(type)){ if (tc->canTarget(current)){
if (bury){ if (bury){
game->players[i]->game->putInGraveyard(current); game->players[i]->game->putInGraveyard(current);
}else{ }else{
@@ -25,22 +27,6 @@ int AbilityFactory::destroyAllFromTypeInPlay(const char * type, MTGCardInstance
return 1; return 1;
} }
int AbilityFactory::destroyAllFromColorInPlay(int color, MTGCardInstance * source, int bury){
GameObserver * game = GameObserver::GetInstance();
for (int i = 0; i < 2 ; i++){
for (int j = 0; j < game->players[i]->game->inPlay->nb_cards; j++){
MTGCardInstance * current = game->players[i]->game->inPlay->cards[j];
if (current->hasColor(color)){
if (bury){
game->players[i]->game->putInGraveyard(current);
}else{
game->mLayers->stackLayer()->addPutInGraveyard(current);
}
}
}
}
return 1;
}
int AbilityFactory::putInPlayFromZone(MTGCardInstance * card, MTGGameZone * zone, Player * p){ int AbilityFactory::putInPlayFromZone(MTGCardInstance * card, MTGGameZone * zone, Player * p){
Spell * spell = NEW Spell(card); Spell * spell = NEW Spell(card);
@@ -122,9 +108,9 @@ int AbilityFactory::magicText(int id, Spell * spell, MTGCardInstance * card){
found = s.find("target("); found = s.find("target(");
if (found != string::npos){ if (found != string::npos){
int end = s.find(")"); int end = s.find(")");
string target = s.substr(found + 7,end - found - 7); string starget = s.substr(found + 7,end - found - 7);
TargetChooserFactory tcf; TargetChooserFactory tcf;
tc = tcf.createTargetChooser(target, card); tc = tcf.createTargetChooser(starget, card);
} }
@@ -205,23 +191,43 @@ int AbilityFactory::magicText(int id, Spell * spell, MTGCardInstance * card){
found = s.find("bury"); found = s.find("bury");
if (found != string::npos){ if (found != string::npos){
if (dryMode) return BAKA_EFFECT_BAD; if (dryMode) return BAKA_EFFECT_BAD;
if (tc){ found = s.find("all(");
game->addObserver(NEW ABurier(id, card,tc)); if (found != string::npos){
}else{ int end = s.find(")");
target->controller()->game->putInGraveyard(target); string starget = s.substr(found + 4,end - found - 4);
} TargetChooserFactory tcf;
TargetChooser * targetAll = tcf.createTargetChooser(starget, card);
this->destroyAllInPlay(targetAll,1);
delete targetAll;
}else{
if (tc){
game->addObserver(NEW ABurier(id, card,tc));
}else{
target->controller()->game->putInGraveyard(target);
}
}
result++; result++;
continue; continue;
} }
//Destroy //Destroy
found = s.find("destroy"); found = s.find("destroy");
if (found != string::npos){ if (found != string::npos){
if (dryMode) return BAKA_EFFECT_BAD; if (dryMode) return BAKA_EFFECT_BAD; //TODO compute according to nb in case of destroy all
if (tc){ found = s.find("all(");
game->addObserver(NEW ADestroyer(id, card,tc)); if (found != string::npos){
}else{ int end = s.find(")");
game->mLayers->stackLayer()->addPutInGraveyard(target); string starget = s.substr(found + 4,end - found - 4);
} TargetChooserFactory tcf;
TargetChooser * targetAll = tcf.createTargetChooser(starget, card);
this->destroyAllInPlay(targetAll);
delete targetAll;
}else{
if (tc){
game->addObserver(NEW ADestroyer(id, card,tc));
}else{
game->mLayers->stackLayer()->addPutInGraveyard(target);
}
}
result++; result++;
continue; continue;
} }
@@ -1044,16 +1050,8 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){
spell->getNextPlayerTarget()->life += x; spell->getNextPlayerTarget()->life += x;
break; break;
} }
case 1270: //tranquility
{
destroyAllFromTypeInPlay("enchantment", card);
break;
}
case 1271: //Tsunami
{
destroyAllFromTypeInPlay("island", card);
break;
}
case 1231: //Volcanic Eruption case 1231: //Volcanic Eruption
{ {
int x = spell->cost->getConvertedCost() - 3; int x = spell->cost->getConvertedCost() - 3;
@@ -1126,11 +1124,7 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){
game->addObserver(NEW AFastbond(_id, card)); game->addObserver(NEW AFastbond(_id, card));
break; break;
} }
case 1293: //FlashFires
{
destroyAllFromTypeInPlay("plains", card);
break;
}
case 1301: // Keldon Warlord case 1301: // Keldon Warlord
{ {
game->addObserver(NEW AKeldonWarlord(_id, card)); game->addObserver(NEW AKeldonWarlord(_id, card));
@@ -1151,11 +1145,6 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){
game->addObserver(NEW AOrcishOriflame(_id, card)); game->addObserver(NEW AOrcishOriflame(_id, card));
break; break;
} }
case 1317: //ShatterStorm
{
destroyAllFromTypeInPlay("artifact", card, 1);
break;
}
case 1326: //Wheel of fortune case 1326: //Wheel of fortune
{ {
for (int i = 0; i < 2; i++){ for (int i = 0; i < 2; i++){
@@ -1170,11 +1159,6 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){
} }
break; break;
} }
case 1328: //Armageddon
{
destroyAllFromTypeInPlay("land", card);
break;
}
case 1331: //Black Ward case 1331: //Black Ward
{ {
game->addObserver(NEW AProtectionFrom( _id,card, card->target, MTG_COLOR_BLACK)); game->addObserver(NEW AProtectionFrom( _id,card, card->target, MTG_COLOR_BLACK));
@@ -1281,11 +1265,7 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){
game->addObserver(NEW AProtectionFrom( _id,card, card->target, MTG_COLOR_WHITE)); game->addObserver(NEW AProtectionFrom( _id,card, card->target, MTG_COLOR_WHITE));
break; break;
} }
case 1372: //Wrath of God
{
destroyAllFromTypeInPlay("creature", card); //TODO -> bury !!!
break;
}
//Addons The Dark //Addons The Dark
case 1797: //Inferno does 6 damage to all players and all creatures. case 1797: //Inferno does 6 damage to all players and all creatures.
@@ -1308,18 +1288,8 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){
break; break;
} }
case 1818: //Tivadar's Crusade
{
destroyAllFromTypeInPlay("goblin", card);
break;
}
//Addons Legends //Addons Legends
case 1470: //Acid Rain
{
destroyAllFromTypeInPlay("forest", card);
break;
}
case 1427: //Abomination case 1427: //Abomination
{ {
game->addObserver(NEW AAbomination(_id,card)); game->addObserver(NEW AAbomination(_id,card));
@@ -1342,13 +1312,6 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){
break; break;
} }
//Addons ICE-AGE Cards //Addons ICE-AGE Cards
case 2631: //Jokulhaups
{
destroyAllFromTypeInPlay("artifact", card);
destroyAllFromTypeInPlay("creature", card);
destroyAllFromTypeInPlay("land", card);
break;
}
case 2650: //Pyroclasm Need to be improved copied from hurricane with does 0 dammage to player and does 2 dammage to each creature case 2650: //Pyroclasm Need to be improved copied from hurricane with does 0 dammage to player and does 2 dammage to each creature
{ {
@@ -1389,11 +1352,7 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){
game->currentlyActing()->getManaPool()->add(MTG_COLOR_BLACK, mana); game->currentlyActing()->getManaPool()->add(MTG_COLOR_BLACK, mana);
break; break;
} }
case 2606: //Anarchy
{
destroyAllFromColorInPlay(MTG_COLOR_WHITE, card);
break;
}
case 2474: //Minion of Leshrac case 2474: //Minion of Leshrac
{ {
game->addObserver(NEW AMinionofLeshrac( _id, card)); game->addObserver(NEW AMinionofLeshrac( _id, card));

View File

@@ -159,6 +159,9 @@ TargetChooser * TargetChooserFactory::createTargetChooser(string s, MTGCardInsta
cd->colors[cid] = -1; cd->colors[cid] = -1;
}else{ }else{
cd->colors[cid] = 1; cd->colors[cid] = 1;
#ifdef WIN32
OutputDebugString("COLOR FOUND !!!");
#endif
} }
} }
} }