diff --git a/projects/mtg/bin/Res/sets/primitives/mtg.txt b/projects/mtg/bin/Res/sets/primitives/mtg.txt index a5d7c8b7e..b37e26f12 100644 --- a/projects/mtg/bin/Res/sets/primitives/mtg.txt +++ b/projects/mtg/bin/Res/sets/primitives/mtg.txt @@ -82616,6 +82616,14 @@ power=2 toughness=2 [/card] [card] +name=Serum Powder +auto={T}:Add{1} +autohand={0}:serumpowder +text={T}: Add {1} to your mana pool. -- Any time you could mulligan and Serum Powder is in your hand, you may exile all the cards from your hand, then draw that many cards. (You can do this in addition to taking mulligans.) +mana={3} +type=Artifact +[/card] +[card] name=Serum Tank auto=counter(0/0,1,Charge) auto=@movedTo(other artifact|Battlefield):counter(0/0,1,Charge) diff --git a/projects/mtg/bin/Res/sets/primitives/unsupported.txt b/projects/mtg/bin/Res/sets/primitives/unsupported.txt index c24eaa983..5d4a1bc3e 100644 --- a/projects/mtg/bin/Res/sets/primitives/unsupported.txt +++ b/projects/mtg/bin/Res/sets/primitives/unsupported.txt @@ -14506,12 +14506,6 @@ mana={W} type=Enchantment [/card] [card] -name=Serum Powder -text={T}: Add {1} to your mana pool. -- Any time you could mulligan and Serum Powder is in your hand, you may exile all the cards from your hand, then draw that many cards. (You can do this in addition to taking mulligans.) -mana={3} -type=Artifact -[/card] -[card] name=Serum Visions text=Draw a card. -- Scry 2. (To scry 2, look at the top two cards of your library, then put any number of them on the bottom of your library and the rest on top in any order.) mana={U} diff --git a/projects/mtg/include/AllAbilities.h b/projects/mtg/include/AllAbilities.h index f39949ba0..1e7d361cd 100644 --- a/projects/mtg/include/AllAbilities.h +++ b/projects/mtg/include/AllAbilities.h @@ -5540,6 +5540,17 @@ public: AAShuffle * clone() const; }; +//Mulligan +class AAMulligan: public ActivatedAbilityTP +{ +public: + AAMulligan(GameObserver* observer, int _id, MTGCardInstance * card, Targetable * _target, ManaCost * _cost = NULL, int who = + TargetChooser::UNSET); + int resolve(); + const string getMenuText(); + AAMulligan * clone() const; +}; + //Remove Mana From ManaPool class AARemoveMana: public ActivatedAbilityTP { diff --git a/projects/mtg/include/GameObserver.h b/projects/mtg/include/GameObserver.h index 5b3bfcbbe..25fcf745b 100644 --- a/projects/mtg/include/GameObserver.h +++ b/projects/mtg/include/GameObserver.h @@ -151,6 +151,7 @@ class GameObserver{ bool undo(); bool isLoading(){ return mLoading; }; void Mulligan(Player* player = NULL); + void serumMulligan(Player* player = NULL); Player* getPlayer(size_t index) { return players[index];}; bool isStarted() { return (mLayers!=NULL);}; RandomGenerator* getRandomGenerator() { return &randomGenerator; }; diff --git a/projects/mtg/include/Player.h b/projects/mtg/include/Player.h index 099b24604..66d66acd1 100644 --- a/projects/mtg/include/Player.h +++ b/projects/mtg/include/Player.h @@ -68,6 +68,7 @@ public: MTGInPlay * inPlay(); ManaPool * getManaPool(); void takeMulligan(); + void serumMulligan(); ManaCost * doesntEmpty; ManaCost * poolDoesntEmpty; void cleanupPhase(); diff --git a/projects/mtg/src/AllAbilities.cpp b/projects/mtg/src/AllAbilities.cpp index 26cd01faa..2acd7af90 100644 --- a/projects/mtg/src/AllAbilities.cpp +++ b/projects/mtg/src/AllAbilities.cpp @@ -2941,6 +2941,32 @@ AAShuffle * AAShuffle::clone() const return NEW AAShuffle(*this); } +// Mulligan +AAMulligan::AAMulligan(GameObserver* observer, int _id, MTGCardInstance * card, Targetable * _target, ManaCost * _cost, int who) : + ActivatedAbilityTP(observer, _id, card, _target, _cost, who) +{ +} + +int AAMulligan::resolve() +{ + Player * player = getPlayerFromTarget(getTarget()); + if (player) + { + player->serumMulligan(); + } + return 1; +} + +const string AAMulligan::getMenuText() +{ + return "Mulligan"; +} + +AAMulligan * AAMulligan::clone() const +{ + return NEW AAMulligan(*this); +} + // Remove Mana From ManaPool AARemoveMana::AARemoveMana(GameObserver* observer, int _id, MTGCardInstance * card, Targetable * _target, string manaDesc, int who) : ActivatedAbilityTP(observer, _id, card, _target, NULL, who) diff --git a/projects/mtg/src/GameObserver.cpp b/projects/mtg/src/GameObserver.cpp index 80fb9a0f4..2f77f9d36 100644 --- a/projects/mtg/src/GameObserver.cpp +++ b/projects/mtg/src/GameObserver.cpp @@ -1839,6 +1839,13 @@ void GameObserver::Mulligan(Player* player) player->takeMulligan(); } +void GameObserver::serumMulligan(Player* player) +{ + if(!player) player = currentPlayer; + logAction(player, "mulligan serum powder"); + player->serumMulligan(); +} + Player* GameObserver::createPlayer(const string& playerMode #ifdef TESTSUITE , TestSuiteGame* testgame diff --git a/projects/mtg/src/MTGAbility.cpp b/projects/mtg/src/MTGAbility.cpp index a4ad3f5e2..393ba8a19 100644 --- a/projects/mtg/src/MTGAbility.cpp +++ b/projects/mtg/src/MTGAbility.cpp @@ -2532,6 +2532,16 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG return a; } + //Serum Powder + found = s.find("serumpowder"); + if (found != string::npos) + { + Targetable * t = spell? spell->getNextTarget() : NULL; + MTGAbility * a = NEW AAMulligan(observer, id, card, t, NULL, who); + a->oneShot = 1; + return a; + } + //Remove Mana from ManaPool vector splitRemove = parseBetween(s, "removemana(", ")"); if (splitRemove.size()) diff --git a/projects/mtg/src/Player.cpp b/projects/mtg/src/Player.cpp index 2792c5a11..6cbb98dbd 100644 --- a/projects/mtg/src/Player.cpp +++ b/projects/mtg/src/Player.cpp @@ -217,6 +217,22 @@ void Player::takeMulligan() //Draw hand with 1 less card penalty //almhum } +void Player::serumMulligan() +{ + MTGPlayerCards * currentPlayerZones = game; + int cardsinhand = currentPlayerZones->hand->nb_cards; + for (int i = 0; i < cardsinhand; i++) //Exile + currentPlayerZones->putInZone(currentPlayerZones->hand->cards[0], + currentPlayerZones->hand, + currentPlayerZones->exile); + + currentPlayerZones->library->shuffle(); //Shuffle + + for (int i = 0; i < (cardsinhand); i++) + game->drawFromLibrary(); + //Draw hand no penalty +} + //Cleanup phase at the end of a turn void Player::cleanupPhase() {