diff --git a/projects/mtg/bin/Res/sets/primitives/mtg.txt b/projects/mtg/bin/Res/sets/primitives/mtg.txt index 7349f68b2..50328c774 100644 --- a/projects/mtg/bin/Res/sets/primitives/mtg.txt +++ b/projects/mtg/bin/Res/sets/primitives/mtg.txt @@ -3027,6 +3027,16 @@ power=7 toughness=3 [/card] [card] +name=Azami, Lady of Scrolls +auto={t(wizard[-tapped]|mybattle?field)}:draw:1 controller +text=Tap an untapped Wizard you control: Draw a card. +type=legendary creature +subtype=human wizard +power=0 +toughness=2 +mana={2}{U}{U}{U} +[/card] +[card] name=Azimaet Drake abilities=flying auto={U}:1/0 limit:1 @@ -48478,7 +48488,7 @@ auto=aslongas(*|myhand) damage:2 target(other creature) >=1 auto=aslongas(*|myhand) destroy <1 auto=aslongas(*|myhand) destroy target(other creature) <1 mana={3}{B}{R} -text=Twinstrike deals 2 damage to each of two target creatures. -- Hellbent — Destroy those creatures instead if you have no cards in hand. +text=Twinstrike deals 2 damage to each of two target creatures. -- Hellbent EDestroy those creatures instead if you have no cards in hand. type=Instant [/card] [card] diff --git a/projects/mtg/bin/Res/sets/primitives/zethaddon.txt b/projects/mtg/bin/Res/sets/primitives/zethaddon.txt index 00fe10071..7927458f3 100644 --- a/projects/mtg/bin/Res/sets/primitives/zethaddon.txt +++ b/projects/mtg/bin/Res/sets/primitives/zethaddon.txt @@ -6687,8 +6687,7 @@ mana={u} name=Palinchron auto=token(-12305)*7 auto={2}{U}{U}:moveto(myhand) all(this) -text= Flying -When Palinchron enters the battlefield, untap up to seven lands.{2}{U}{U}: Return Palinchron to its owner's hand. +text=Flying. When Palinchron enters the battlefield, untap up to seven lands.{2}{U}{U}: Return Palinchron to its owner's hand. type=creature subtype=illusion abilities=flying @@ -6757,8 +6756,7 @@ auto=@each myupkeep:aslongas(plains|mybattlefield) counter(0/0,1,fetch) >6 myupk auto={c(0/0.-1.fetch)}:moveto(mybattlefield) target(creature|mygraveyard) limit:1 auto=@each mydraw:counter(0/0,-10,fetch) auto={t}:add{w} -text=Emeria, the Sky Ruin enters the battlefield tapped. -At the beginning of your upkeep, if you control seven or more Plains, you may return target creature card from your graveyard to the battlefield. +text=Emeria, the Sky Ruin enters the battlefield tapped. At the beginning of your upkeep, if you control seven or more Plains, you may return target creature card from your graveyard to the battlefield. type=land mana={0} [/card] @@ -6985,8 +6983,7 @@ auto={T}:Add{W} auto=counter(0/0,1,Spire) auto={1}:counter(0/0,-1,Spire) auto=bury target(land[counter{0/0.1.spire}]|mybattlefield) -text=Rupture Spire enters the battlefield tapped. -When Rupture Spire enters the battlefield, sacrifice it unless you pay {1}.have the {1} mana ready in your mana pool as you play this card.{T}: Add one mana of any color to your mana pool. +text=Rupture Spire enters the battlefield tapped. When Rupture Spire enters the battlefield, sacrifice it unless you pay {1}.have the {1} mana ready in your mana pool as you play this card.{T}: Add one mana of any color to your mana pool. type=land mana={0} [/card] \ No newline at end of file diff --git a/projects/mtg/bin/Res/test/_tests.txt b/projects/mtg/bin/Res/test/_tests.txt index 8613513e3..98ebbb2c5 100644 --- a/projects/mtg/bin/Res/test/_tests.txt +++ b/projects/mtg/bin/Res/test/_tests.txt @@ -55,6 +55,7 @@ generic/regenerate.txt generic/regenerate_wither_i146.txt generic/sacrifice.txt generic/summoning_sickness.txt +generic/tap_other_card_as_cost.txt generic/targetController_life.txt generic/targetController_life2.txt generic/targetController_damage.txt diff --git a/projects/mtg/bin/Res/test/generic/tap_other_card_as_cost.txt b/projects/mtg/bin/Res/test/generic/tap_other_card_as_cost.txt new file mode 100644 index 000000000..a91d3151c --- /dev/null +++ b/projects/mtg/bin/Res/test/generic/tap_other_card_as_cost.txt @@ -0,0 +1,28 @@ +# Test: {t(target)} as an extra cost +# 78697 is Azami, Lady of Scrolls +# Tap an untapped Wizard you control: Draw a card. +[INIT] +FIRSTMAIN +[PLAYER1] +inplay:78697,Cathartic Adept +library:forest +[PLAYER2] +[DO] +78697 +Cathartic Adept +next +#combat begins +next +#attackers +#if he is tapped, Cathartic Adept houldn't be able to attack +Cathartic Adept +next +#endofcombat +[ASSERT] +COMBATEND +[PLAYER1] +inplay:78697,Cathartic Adept +hand:forest +[PLAYER2] +life:20 +[END] \ No newline at end of file diff --git a/projects/mtg/include/AllAbilities.h b/projects/mtg/include/AllAbilities.h index 32c4c91e4..054e99400 100644 --- a/projects/mtg/include/AllAbilities.h +++ b/projects/mtg/include/AllAbilities.h @@ -559,6 +559,8 @@ public: return "Sacrifice"; }else if (dest == g->players[i]->game->library && tc->targetsZone(g->players[i]->game->graveyard)){ return "Recycle"; + }else if (dest == g->players[i]->game->battlefield && tc->targetsZone(g->players[i]->game->graveyard)){ + return "Reanimate"; }else if (dest == g->players[i]->game->library){ return "Put in Library"; }else if (dest == g->players[i]->game->graveyard && tc->targetsZone(g->players[i]->game->hand)){ diff --git a/projects/mtg/include/ExtraCost.h b/projects/mtg/include/ExtraCost.h index 2f00edc52..3193109c7 100644 --- a/projects/mtg/include/ExtraCost.h +++ b/projects/mtg/include/ExtraCost.h @@ -55,6 +55,20 @@ public: virtual SacrificeCost * clone() const; }; +//tap other cost +class TapTargetCost: public ExtraCost{ +public: + MTGCardInstance * target; + TapTargetCost(TargetChooser *_tc = NULL); + virtual int setPayment(MTGCardInstance * card); + virtual int isPaymentSet(); + virtual int canPay(); + virtual int doPay(); + virtual void Render(); + virtual int setSource(MTGCardInstance * _source); + virtual TapTargetCost * clone() const; +}; + class CounterCost: public ExtraCost{ public: Counter * counter; diff --git a/projects/mtg/include/WFont.h b/projects/mtg/include/WFont.h index 756316e0d..66089a121 100644 --- a/projects/mtg/include/WFont.h +++ b/projects/mtg/include/WFont.h @@ -56,7 +56,7 @@ private: }; //Why do we need this ? could it move somewhere else ? -#if defined (LINUX) +#if !defined (WIN32) #define BYTE u8 #define DWORD u32 #endif diff --git a/projects/mtg/src/ExtraCost.cpp b/projects/mtg/src/ExtraCost.cpp index 667f449de..de563a11c 100644 --- a/projects/mtg/src/ExtraCost.cpp +++ b/projects/mtg/src/ExtraCost.cpp @@ -20,7 +20,68 @@ int ExtraCost::setSource(MTGCardInstance * _source){ if (tc){ tc->source = _source; tc->targetter = _source;} return 1; } +//Tap target cost +TapTargetCost * TapTargetCost::clone() const{ + TapTargetCost * ec = NEW TapTargetCost(*this); + if (tc) ec->tc = tc->clone(); + return ec; +} + +TapTargetCost::TapTargetCost(TargetChooser *_tc):ExtraCost(_tc){ + if (tc) tc->targetter = NULL; //tapping targets is not targetting, protections do not apply + target = NULL; +} + +int TapTargetCost::setSource(MTGCardInstance * card){ + ExtraCost::setSource(card); + if (tc) tc->targetter = NULL; //Tapping targets is not targetting, protections do not apply + if (!tc) target = card; + return 1; +} + +int TapTargetCost::setPayment(MTGCardInstance * card){ + if (tc) { + int result = tc->addTarget(card); + if (result) { + target = card; + return result; + } + } + return 0; +} + +int TapTargetCost::isPaymentSet(){ + if (target) return 1; + return 0; +} + +int TapTargetCost::canPay(){ + //tap target does not have any additional restrictions. + return 1; +} + +int TapTargetCost::doPay(){ + MTGCardInstance * _target = (MTGCardInstance *) target; + if(target){ + _target->tap(); + target = NULL; + if (tc) tc->initTargets(); + return 1; + } + return 0; +} + +void TapTargetCost::Render(){ + //TODO : real stuff + WFont * mFont = resources.GetWFont(Constants::MAIN_FONT); + mFont->SetScale(DEFAULT_MAIN_FONT_SCALE); + mFont->SetColor(ARGB(255,255,255,255)); + char buffer[200]; + sprintf(buffer, "%s", _("Tap Target").c_str()); + mFont->DrawString(buffer, 20 ,20, JGETEXT_LEFT); +} +//endtaptargetcost SacrificeCost * SacrificeCost::clone() const{ SacrificeCost * ec = NEW SacrificeCost(*this); if (tc) ec->tc = tc->clone(); diff --git a/projects/mtg/src/GameStateOptions.cpp b/projects/mtg/src/GameStateOptions.cpp index 848f971f7..362f43c03 100644 --- a/projects/mtg/src/GameStateOptions.cpp +++ b/projects/mtg/src/GameStateOptions.cpp @@ -178,7 +178,7 @@ void GameStateOptions::Render() "", "Dev Team: Abrasax, almosthumane, Daddy32, Dr.Solomat" "J, Jeck, Leungclj, linshier, Salmelo, Superhiro", - "Psyringe, Wololo, Yeshua", + "Psyringe, Wololo, Yeshua, Zethfox", "", "Music by Celestial Aeon Project, http://www.jamendo.com", "", diff --git a/projects/mtg/src/ManaCost.cpp b/projects/mtg/src/ManaCost.cpp index aed55fc73..09a110dd8 100644 --- a/projects/mtg/src/ManaCost.cpp +++ b/projects/mtg/src/ManaCost.cpp @@ -65,7 +65,21 @@ ManaCost * ManaCost::parseManaCost(string s, ManaCost * _manaCost, MTGCardInstan tc = tcf.createTargetChooser(target,c); } manaCost->addExtraCost(NEW SacrificeCost(tc)); - }else if (value[0] == 'c'){ + //tap cost + }else if (value[0] == 't'){ + //tap + OutputDebugString("Tap\n"); + TargetChooserFactory tcf; + TargetChooser * tc = NULL; + size_t target_start = value.find("("); + size_t target_end = value.find(")"); + if (target_start!=string::npos && target_end!=string::npos){ + string target = value.substr(target_start+1, target_end-1 - target_start); + tc = tcf.createTargetChooser(target,c); + } + manaCost->addExtraCost(NEW TapTargetCost(tc)); + //tapcost + }else if (value[0] == 'c'){ //Counters OutputDebugString("Counter\n"); size_t counter_start = value.find("(");