Skip to content

Commit 6cdcfca

Browse files
authored
Merge pull request #477 from rapsealk/impl-card
Implement card 'Ragnaros the Firelord' (EX1_298)
2 parents f38c058 + e2ea841 commit 6cdcfca

3 files changed

Lines changed: 78 additions & 1 deletion

File tree

Documents/CardList.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ HOF | EX1_128 | Conceal | O
456456
HOF | EX1_161 | Naturalize | O
457457
HOF | EX1_284 | Azure Drake | O
458458
HOF | EX1_295 | Ice Block |
459-
HOF | EX1_298 | Ragnaros the Firelord |
459+
HOF | EX1_298 | Ragnaros the Firelord | O
460460
HOF | EX1_310 | Doomguard | O
461461
HOF | EX1_316 | Power Overwhelming | O
462462
HOF | EX1_349 | Divine Favor | O

Sources/Rosetta/PlayMode/CardSets/HoFCardsGen.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -609,6 +609,25 @@ void HoFCardsGen::AddNeutral(std::map<std::string, CardDef>& cards)
609609
power.AddPowerTask(std::make_shared<DrawTask>(1));
610610
cards.emplace("EX1_284", CardDef(power));
611611

612+
// --------------------------------------- MINION - NEUTRAL
613+
// [EX1_298] Ragnaros the Firelord - COST:8 [ATK:8/HP:8]
614+
// - Race: Elemental, Faction: Neutral, Set: HoF, Rarity: Legendary
615+
// --------------------------------------------------------
616+
// Text: Can't attack. At the end of your turn, deal 8 damage
617+
// to a random enemy.
618+
// --------------------------------------------------------
619+
power.ClearData();
620+
power.AddPowerTask(nullptr);
621+
power.AddTrigger(std::make_shared<Trigger>(TriggerType::TURN_END));
622+
power.GetTrigger()->tasks = {
623+
std::make_shared<IncludeTask>(EntityType::ENEMIES),
624+
std::make_shared<FilterStackTask>(SelfCondList{
625+
std::make_shared<SelfCondition>(SelfCondition::IsNotDead()) }),
626+
std::make_shared<RandomTask>(EntityType::STACK, 1),
627+
std::make_shared<DamageTask>(EntityType::STACK, 8)
628+
};
629+
cards.emplace("EX1_298", CardDef(power));
630+
612631
// --------------------------------------- MINION - NEUTRAL
613632
// [EX1_620] Molten Giant - COST:20 [ATK:8/HP:8]
614633
// - Race: Elemental, Faction: Neutral, Set: HoF, Rarity: Epic

Tests/UnitTests/PlayMode/CardSets/HoFCardsGenTests.cpp

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1344,6 +1344,64 @@ TEST_CASE("[Neutral : Minion] - EX1_284 : Azure Drake")
13441344
CHECK_EQ(opPlayer->GetFieldZone()->GetCount(), 0);
13451345
}
13461346

1347+
// --------------------------------------- MINION - NEUTRAL
1348+
// [EX1_298] Ragnaros the Firelord - COST:8 [ATK:8/HP:8]
1349+
// - Race: Elemental, Faction: Neutral, Set: HoF, Rarity: Legendary
1350+
// --------------------------------------------------------
1351+
// Text: Can't attack. At the end of your turn, deal 8 damage
1352+
// to a random enemy.
1353+
// --------------------------------------------------------
1354+
TEST_CASE("[Neutral : Minion] EX1_298 : Ragnaros the Firelord")
1355+
{
1356+
GameConfig config;
1357+
config.player1Class = CardClass::MAGE;
1358+
config.player2Class = CardClass::WARRIOR;
1359+
config.startPlayer = PlayerType::PLAYER1;
1360+
config.doFillDecks = true;
1361+
config.autoRun = false;
1362+
1363+
Game game(config);
1364+
game.Start();
1365+
game.ProcessUntil(Step::MAIN_ACTION);
1366+
1367+
Player* curPlayer = game.GetCurrentPlayer();
1368+
Player* opPlayer = game.GetOpponentPlayer();
1369+
curPlayer->SetTotalMana(10);
1370+
curPlayer->SetUsedMana(0);
1371+
opPlayer->SetTotalMana(10);
1372+
opPlayer->SetUsedMana(0);
1373+
1374+
auto& curField = *(curPlayer->GetFieldZone());
1375+
auto& opField = *(opPlayer->GetFieldZone());
1376+
1377+
CHECK_EQ(opPlayer->GetHero()->GetHealth(), 30);
1378+
1379+
const auto card1 = Generic::DrawCard(
1380+
curPlayer, Cards::FindCardByName("Ragnaros the Firelord"));
1381+
const auto card2 = Generic::DrawCard(
1382+
opPlayer, Cards::FindCardByName("Grommash Hellscream"));
1383+
1384+
game.Process(curPlayer, PlayCardTask::Minion(card1));
1385+
CHECK_EQ(curField.GetCount(), 1);
1386+
1387+
game.Process(curPlayer, EndTurnTask());
1388+
game.ProcessUntil(Step::MAIN_ACTION);
1389+
1390+
CHECK_EQ(opPlayer->GetHero()->GetHealth(), 22);
1391+
1392+
game.Process(opPlayer, PlayCardTask::Minion(card2));
1393+
game.Process(opPlayer, EndTurnTask());
1394+
game.ProcessUntil(Step::MAIN_ACTION);
1395+
1396+
game.Process(curPlayer, EndTurnTask());
1397+
game.ProcessUntil(Step::MAIN_ACTION);
1398+
1399+
CHECK_EQ(opField.GetCount(), 1);
1400+
const bool check =
1401+
opPlayer->GetHero()->GetHealth() == 14 || opField[0]->GetHealth() == 1;
1402+
CHECK_EQ(check, true);
1403+
}
1404+
13471405
// --------------------------------------- MINION - NEUTRAL
13481406
// [EX1_620] Molten Giant - COST:20 [ATK:8/HP:8]
13491407
// - Race: Elemental, Faction: Neutral, Set: HoF, Rarity: Epic

0 commit comments

Comments
 (0)