diff --git a/projects/mtg/bin/Res/sets/10E/_cards.dat b/projects/mtg/bin/Res/sets/10E/_cards.dat index 11861e600..a57f7b250 100644 --- a/projects/mtg/bin/Res/sets/10E/_cards.dat +++ b/projects/mtg/bin/Res/sets/10E/_cards.dat @@ -774,6 +774,19 @@ subtype=Goblin Warrior toughness=2 [/card] [card] +text=When Gravedigger comes into play, you may return target creature card from your graveyard to your hand. +auto=may moveTo(myhand) target(creature|mygraveyard) +id=129584 +name=Gravedigger +rarity=C +color=Black +type=Creature +mana={3}{B} +power=2 +subtype=Zombie +toughness=2 +[/card] +[card] text= id=129586 name=Grizzly Bears diff --git a/projects/mtg/bin/Res/sets/10E/todo.dat b/projects/mtg/bin/Res/sets/10E/todo.dat index 72c8653cc..05ffb13c8 100644 --- a/projects/mtg/bin/Res/sets/10E/todo.dat +++ b/projects/mtg/bin/Res/sets/10E/todo.dat @@ -662,18 +662,7 @@ power=3 subtype=Zombie Spirit toughness=3 [/card] -[card] -text=When Gravedigger comes into play, you may return target creature card from your graveyard to your hand. -id=129584 -name=Gravedigger -rarity=C -color=Black -type=Creature -mana={3}{B} -power=2 -subtype=Zombie -toughness=2 -[/card] + [card] text=Guerrilla Tactics deals 2 damage to target creature or player. When a spell or ability an opponent controls causes you to discard Guerrilla Tactics, Guerrilla Tactics deals 4 damage to target creature or player. id=129588 diff --git a/projects/mtg/bin/Res/test/_tests.txt b/projects/mtg/bin/Res/test/_tests.txt index 5794f1bc5..4b9eae185 100644 --- a/projects/mtg/bin/Res/test/_tests.txt +++ b/projects/mtg/bin/Res/test/_tests.txt @@ -54,6 +54,7 @@ giant_growth2.txt goblin_balloon_brigade.txt goblin_balloon_brigade2.txt goblin_king.txt +gravedigger.txt hymn_of_rebirth.txt icatian_priest.txt keldon_warlord.txt @@ -87,4 +88,4 @@ tranquil_domain.txt volcanic_island.txt white_knight1.txt wrath_of_god.txt -zombie_master.txt +zombie_master.txt \ No newline at end of file diff --git a/projects/mtg/bin/Res/test/gravedigger.txt b/projects/mtg/bin/Res/test/gravedigger.txt new file mode 100644 index 000000000..9faabadfd --- /dev/null +++ b/projects/mtg/bin/Res/test/gravedigger.txt @@ -0,0 +1,20 @@ +# text=When Gravedigger comes into play, you may return target creature card from your graveyard to your hand. +[INIT] +FIRSTMAIN +[PLAYER1] +hand:129584 +manapool:{3}{B} +graveyard:129586 +[PLAYER2] +[DO] +129584 +choice 0 +129586 +[ASSERT] +FIRSTMAIN +[PLAYER1] +inplay:129584 +hand:129586 +manapool:{0} +[PLAYER2] +[END] \ No newline at end of file diff --git a/projects/mtg/include/AllAbilities.h b/projects/mtg/include/AllAbilities.h index a3e38ce30..86a2119c9 100644 --- a/projects/mtg/include/AllAbilities.h +++ b/projects/mtg/include/AllAbilities.h @@ -23,6 +23,56 @@ using std::map; Generic classes */ +//MayAbility: May do something when comes into play (should be extended) +class MayAbility:public MTGAbility{ +public: + int triggered; + MTGAbility * ability; + int deleteAbility; + MayAbility(int _id, MTGAbility * _ability, MTGCardInstance * _source):MTGAbility(_id,_source),ability(_ability){ + triggered = 0; + deleteAbility = 1; + } + + void Update(float dt){ + MTGAbility::Update(dt); + if (!triggered){ + triggered = 1; + game->mLayers->actionLayer()->setMenuObject(source); + OutputDebugString("SetMenuObject!\n"); + } + } + + const char * getMenuText(){ + return ability->getMenuText(); + } + + int testDestroy(){ + if (triggered && !game->mLayers->actionLayer()->menuObject){ + OutputDebugString("Destroy!\n"); + return 1; + } + return 0; + } + + int isReactingToTargetClick(Targetable * card){ + OutputDebugString("IsReacting ???\n"); + if (card == source) return 1; + return 0; + } + + int reactToTargetClick(Targetable * object){ + OutputDebugString("ReactToTargetClick!\n"); + deleteAbility = 0; + game->addObserver(ability); + return ability->reactToTargetClick(object); + } + + ~MayAbility(){ + if (deleteAbility) SAFE_DELETE(ability); + } +}; + //MultiAbility : triggers several actions for a cost class MultiAbility:public ActivatedAbility{ diff --git a/projects/mtg/include/MTGDefinitions.h b/projects/mtg/include/MTGDefinitions.h index 1c867adfb..3c77b05c4 100644 --- a/projects/mtg/include/MTGDefinitions.h +++ b/projects/mtg/include/MTGDefinitions.h @@ -97,8 +97,10 @@ class Constants FLANKING = 36, RAMPAGE1 = 37, CLOUD = 38, + CANTATTACK = 39, + MUSTATTACK = 40, - NB_BASIC_ABILITIES = 39, + NB_BASIC_ABILITIES = 41, RARITY_M = 'M', diff --git a/projects/mtg/src/MTGAbility.cpp b/projects/mtg/src/MTGAbility.cpp index 2bab7b953..fa7a73bc9 100644 --- a/projects/mtg/src/MTGAbility.cpp +++ b/projects/mtg/src/MTGAbility.cpp @@ -157,6 +157,10 @@ int AbilityFactory::magicText(int id, Spell * spell, MTGCardInstance * card){ OutputDebugString("Cost is null\n"); SAFE_DELETE(cost); } + + int may = 0; + if (line.find("may ") != string::npos) may = 1; + int doTap = 0; //Tap in the cost ? if (line.find("{t}") != string::npos) doTap = 1; @@ -306,13 +310,20 @@ int AbilityFactory::magicText(int id, Spell * spell, MTGCardInstance * card){ //MoveTo Move a card from a zone to another found = s.find("moveto("); if (found != string::npos){ + OutputDebugString("may!\n"); if (dryMode) return BAKA_EFFECT_BAD; //TODO : depends on where from, where to... int end = s.find(")"); string szone = s.substr(found + 7,end - found - 7); if (tc){ - if (cost){ - game->addObserver(NEW AZoneMover(id,card,tc,szone,cost,doTap)); - } + //if (cost){ + AZoneMover * a = NEW AZoneMover(id,card,tc,szone,cost,doTap); + if (may){ + game->addObserver(NEW MayAbility(id,a,card)); + OutputDebugString("may!\n"); + }else{ + game->addObserver(a); + } + // } }else{ MTGGameZone * fromZone = target->getCurrentZone();//this is technically incorrect. The initial zone should be as described in the targetchooser MTGGameZone * destZone = MTGGameZone::stringToZone(szone, card, target); diff --git a/projects/mtg/src/MTGDefinitions.cpp b/projects/mtg/src/MTGDefinitions.cpp index 183a5d0f8..4d0c57012 100644 --- a/projects/mtg/src/MTGDefinitions.cpp +++ b/projects/mtg/src/MTGDefinitions.cpp @@ -47,6 +47,8 @@ const char* Constants::MTGBasicAbilities[] = { "flanking", "rampage", "cloud", +"cantattack", +"mustattack", }; const char* Constants::MTGPhaseNames[] =