Skip to content

Commit

Permalink
Merge pull request #891 from index1207/impl_first_card
Browse files Browse the repository at this point in the history
Implement 1 GVG card
  • Loading branch information
utilForever authored Jun 11, 2024
2 parents 9ff40ba + 724d1cc commit 6df76d9
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 1 deletion.
6 changes: 6 additions & 0 deletions Sources/Rosetta/PlayMode/CardSets/GvgCardsGen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ void GvgCardsGen::AddHeroPowers(std::map<std::string, CardDef>& cards)

void GvgCardsGen::AddDruid(std::map<std::string, CardDef>& cards)
{
CardDef cardDef;

// ----------------------------------------- MINION - DRUID
// [GVG_030] Anodized Robo Cub - COST:2 [ATK:2/HP:2]
// - Race: Mechanical, Set: Gvg, Rarity: Common
Expand Down Expand Up @@ -87,6 +89,10 @@ void GvgCardsGen::AddDruid(std::map<std::string, CardDef>& cards)
// - DEATHRATTLE = 1
// - 542 = 1
// --------------------------------------------------------
cardDef.ClearData();
cardDef.power.AddDeathrattleTask(
std::make_shared<AddCardTask>(EntityType::DECK, "GVG_035"));
cards.emplace("GVG_035", cardDef);

// ------------------------------------------ SPELL - DRUID
// [GVG_041] Dark Wispers - COST:6
Expand Down
52 changes: 51 additions & 1 deletion Tests/UnitTests/PlayMode/CardSets/GvgCardsGenTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -313,4 +313,54 @@ TEST_CASE("[Neutral : Minion] - GVG_121 : Clockwork Giant")

game.Process(opPlayer, PlayCardTask::Minion(card3));
CHECK_EQ(card1->GetCost(), 6);
}
}

// ----------------------------------------- MINION - DRUID
// [GVG_035] Malorne - COST:7 [ATK:9/HP:7]
// - Race: Beast, Set: Gvg, Rarity: Legendary
// --------------------------------------------------------
// Text: <b>Deathrattle:</b> Shuffle this minion into your deck.
// --------------------------------------------------------
// GameTag:
// - ELITE = 1
// - DEATHRATTLE = 1
// - 542 = 1
// --------------------------------------------------------
TEST_CASE("[MINION - DRUID] - GVG_035 : Malorne")
{
GameConfig config;
config.player1Class = CardClass::DRUID;
config.player2Class = CardClass::MAGE;
config.startPlayer = PlayerType::PLAYER1;
config.doFillDecks = false;
config.autoRun = false;

Game game(config);
game.Start();
game.ProcessUntil(Step::MAIN_ACTION);

Player* curPlayer = game.GetCurrentPlayer();
Player* opPlayer = game.GetOpponentPlayer();
curPlayer->SetTotalMana(10);
curPlayer->SetUsedMana(0);
opPlayer->SetTotalMana(10);
opPlayer->SetUsedMana(0);

auto& curField = *(curPlayer->GetFieldZone());
auto& opField = *(opPlayer->GetFieldZone());

const auto card1 =
Generic::DrawCard(curPlayer, Cards::FindCardByName("Malorne"));
const auto card2 =
Generic::DrawCard(opPlayer, Cards::FindCardByName("Pyroblast"));

game.Process(curPlayer, PlayCardTask::Minion(card1));
CHECK_EQ(curField.GetCount(), 1);

game.Process(curPlayer, EndTurnTask());
game.ProcessUntil(Step::MAIN_ACTION);

game.Process(opPlayer, PlayCardTask::SpellTarget(card2, card1));
CHECK_EQ(curField.GetCount(), 0);
CHECK_EQ(curPlayer->GetDeckZone()->GetCount(), 1);
}

0 comments on commit 6df76d9

Please sign in to comment.