diff --git a/projects/mtg/bin/Res/sets/10E/_cards.dat b/projects/mtg/bin/Res/sets/10E/_cards.dat index a5cdc12b0..4d302b5c3 100644 --- a/projects/mtg/bin/Res/sets/10E/_cards.dat +++ b/projects/mtg/bin/Res/sets/10E/_cards.dat @@ -998,6 +998,7 @@ mana={1}{G} [/card] [card] text=Flying (This creature can't be blocked except by creatures with flying or reach.) Nightmare's power and toughness are each equal to the number of Swamps you control. +abilities=flying id=129659 alias=1170 name=Nightmare @@ -1491,6 +1492,7 @@ toughness=2 [card] text=Trample, haste (If this creature would deal enough combat damage to its blockers to destroy them, you may have it deal the rest of its damage to defending player. This creature can attack and {T} as soon as it comes under your control.) At end of turn, sacrifice Spark Elemental. abilities=trample,haste +auto=@next endofturn:bury id=129577 name=Spark Elemental rarity=U diff --git a/projects/mtg/bin/Res/sets/ICE/_cards.dat b/projects/mtg/bin/Res/sets/ICE/_cards.dat index 9a31485e7..5a8b64e98 100644 --- a/projects/mtg/bin/Res/sets/ICE/_cards.dat +++ b/projects/mtg/bin/Res/sets/ICE/_cards.dat @@ -1,6 +1,7 @@ #SET: ICE AGE -#VERSION: 1.6 -#Number of playable cards: 132 +#VERSION: 1.6.1 +#Number of playable cards: >132 +#Note : please try to keep cards in alphabetical order of the name if possible [card] text={T}: Centaur Archer deals 1 damage to target creature with flying. id=2718 @@ -1460,3 +1461,14 @@ rarity=R type=Artifact mana={3} [/card] +[card] +text=Vertigo deals 2 damage to target creature with flying; that creature loses flying until end of turn. +id=2658 +name=Vertigo +target=creature[flying] +auto=damage:2 +auto=-flying +rarity=U +type=Instant +mana={R} +[/card] diff --git a/projects/mtg/bin/Res/sets/ICE/todo.dat b/projects/mtg/bin/Res/sets/ICE/todo.dat index b4427f2b6..7c74f7974 100644 --- a/projects/mtg/bin/Res/sets/ICE/todo.dat +++ b/projects/mtg/bin/Res/sets/ICE/todo.dat @@ -1068,16 +1068,6 @@ type=Instant mana={3}{G} [/card] [card] -text=Vertigo deals 2 damage to target creature with flying; that creature loses flying until end of turn. -id=2658 -name=Vertigo -target=creature -auto=damage:2 -rarity=U -type=Instant -mana={R} -[/card] -[card] text=All creatures with flying lose flying until end of turn. If Whiteout is in your graveyard, you may sacrifice a snow-covered land to return Whiteout to your hand. id=2599 name=Whiteout diff --git a/projects/mtg/bin/Res/test/_tests.txt b/projects/mtg/bin/Res/test/_tests.txt index 9739e7292..1e6abccad 100644 --- a/projects/mtg/bin/Res/test/_tests.txt +++ b/projects/mtg/bin/Res/test/_tests.txt @@ -45,6 +45,7 @@ resurrection.txt rootwalla.txt shivan_hellkite.txt shock.txt +spark_elemental.txt stasis.txt terror.txt volcanic_island.txt diff --git a/projects/mtg/bin/Res/test/spark_elemental.txt b/projects/mtg/bin/Res/test/spark_elemental.txt new file mode 100644 index 000000000..867ad8c4d --- /dev/null +++ b/projects/mtg/bin/Res/test/spark_elemental.txt @@ -0,0 +1,24 @@ +#Is Spark elemental destroyed at end of turn ? Does it have haste ? +[INIT] +FIRSTMAIN +[PLAYER1] +hand:129577 +manapool:{R} +[PLAYER2] +[DO] +129577 +next +#combat begin +next +#attackers +129577 +eot +129577 +[ASSERT] +UNTAP +[PLAYER1] +graveyard:129577 +manapool:{0} +[PLAYER2] +life:17 +[END] \ No newline at end of file diff --git a/projects/mtg/include/MTGAbility.h b/projects/mtg/include/MTGAbility.h index 5f2746dd9..d63064685 100644 --- a/projects/mtg/include/MTGAbility.h +++ b/projects/mtg/include/MTGAbility.h @@ -157,6 +157,11 @@ public: int resolve(); }; +class BuryEvent: public TriggeredEvent{ +public: + int resolve(); +}; + class DestroyCondition:public MTGAbilityBasicFeatures{ public: virtual int testDestroy(); diff --git a/projects/mtg/src/MTGAbility.cpp b/projects/mtg/src/MTGAbility.cpp index a3a4a712d..caed1e587 100644 --- a/projects/mtg/src/MTGAbility.cpp +++ b/projects/mtg/src/MTGAbility.cpp @@ -56,6 +56,14 @@ Trigger * AbilityFactory::parseTrigger(string magicText){ } //Some basic functionalities that can be added automatically in the text file +/* + * Several objects are computed from the text string, and have a direct influence on what action we should take + * (direct impact on the game such as draw a card immediately, or create a new GameObserver and add it to the Abilities,etc..) + * These objects are: + * - trigger (if there is an "@" in the string, this is a triggered ability) + * - target (if there ie a "target(" in the string, then this is a TargetAbility) + * - doTap (a dirty way to know if tapping is included in the cost... + */ int AbilityFactory::magicText(int id, Spell * spell, MTGCardInstance * card){ int dryMode = 0; if (!spell) dryMode = 1; @@ -187,28 +195,35 @@ int AbilityFactory::magicText(int id, Spell * spell, MTGCardInstance * card){ result++; continue; } + //Bury found = s.find("bury"); if (found != string::npos){ if (dryMode) return BAKA_EFFECT_BAD; - found = s.find("all("); - if (found != string::npos){ - int end = s.find(")"); - string starget = s.substr(found + 4,end - found - 4); - TargetChooserFactory tcf; - TargetChooser * targetAll = tcf.createTargetChooser(starget, card); - this->destroyAllInPlay(targetAll,1); - delete targetAll; + if (trigger){ + BuryEvent * action = NEW BuryEvent(); + game->addObserver(NEW GenericTriggeredAbility(id, card,trigger,action)); }else{ - if (tc){ - game->addObserver(NEW ABurier(id, card,tc)); - }else{ - target->controller()->game->putInGraveyard(target); - } + found = s.find("all("); + if (found != string::npos){ + int end = s.find(")"); + 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++; continue; } + //Destroy found = s.find("destroy"); if (found != string::npos){ @@ -1742,6 +1757,11 @@ void TriggeredAbility::Update(float dt){ return nbcards; } + int BuryEvent::resolve(){ + MTGCardInstance * _target = (MTGCardInstance *) target; + _target->controller()->game->putInGraveyard(_target); + return 1; + } int DestroyCondition::testDestroy(){ if (!game->isInPlay(source)){ @@ -1762,9 +1782,9 @@ void TriggeredAbility::Update(float dt){ te = _te; dc = _dc; - t->init(_source,_target); - te->init(_source,_target); - if (dc) dc->init(_source,_target); + t->init(source,target); + te->init(source,target); + if (dc) dc->init(source,target); } int GenericTriggeredAbility::trigger(){