public void CircleOfHealing() { var circleOfHealing = HearthEntityFactory.CreateCard <CircleofHealing>(); circleOfHealing.CurrentManaCost = 0; var playerYeti = HearthEntityFactory.CreateCard <ChillwindYeti>(); playerYeti.BonusSpellPower = 1; playerYeti.MaxHealth = 10; playerYeti.CurrentHealth = 1; var opponentYeti = HearthEntityFactory.CreateCard <ChillwindYeti>(); opponentYeti.MaxHealth = 10; opponentYeti.CurrentHealth = 1; GameEngine.GameState.CurrentPlayerPlayZone[0] = playerYeti; GameEngine.GameState.WaitingPlayerPlayZone[0] = opponentYeti; player.AddCardToHand(circleOfHealing); player.PlayCard(circleOfHealing, null); // Circle of healing shouldn't be affected by spell power so it should just heal for 4 Assert.AreEqual(5, playerYeti.CurrentHealth, "Verify player yeti was healed"); Assert.AreEqual(5, opponentYeti.CurrentHealth, "Verify opponent yeti was healed"); }
public void BaronRivendare() { var baron = HearthEntityFactory.CreateCard <BaronRivendare>(); var playerAbom = HearthEntityFactory.CreateCard <Abomination>(); playerAbom.CurrentManaCost = 0; var opponentAbom = HearthEntityFactory.CreateCard <Abomination>(); opponentAbom.TakeBuff(0, 10); // Just so it doesn't die to double player abom deathrattle opponentAbom.ApplyStatusEffects(MinionStatusEffects.CHARGE); opponentAbom.CurrentManaCost = 0; GameEngine.GameState.CurrentPlayerPlayZone[0] = baron; player.AddCardToHand(playerAbom); opponent.AddCardToHand(opponentAbom); player.PlayCard(playerAbom, null); GameEngine.EndTurn(); // Kill the player Abom which should trigger its deathrattle twice doing 4 damage to everybody opponent.PlayCard(opponentAbom, null); opponentAbom.Attack(playerAbom); Assert.AreEqual(baron.MaxHealth - 4, baron.CurrentHealth, "Verify baron got hit by deathrattle twice"); Assert.AreEqual(6, opponentAbom.CurrentHealth, "Verify opponent abom took 4 damage from retaliation and 4 from double deathrattle"); }
private void OnTurnEnd(BasePlayer player) { var randomDreamCardIndex = GameEngine.Random.Next(this.dreamCardTypes.Count); var randomDreamCardType = this.dreamCardTypes[randomDreamCardIndex]; var createCardMethod = typeof(HearthEntityFactory).GetMethod("CreateCard"); var createCardTypeMethod = createCardMethod.MakeGenericMethod(new[] { randomDreamCardType }); dynamic dreamCard = createCardTypeMethod.Invoke(null, null); player.AddCardToHand(dreamCard); }
public void Setup() { player = new Warlock(); for (int i = 0; i < 10; i++) { player.AddCardToHand(new ChillwindYeti(i)); } GameEngine.Initialize(player, null); GameEngine.GameState.CurrentPlayer = player; }
public void PlayerExhaustion() { var fieryWarAxe = HearthEntityFactory.CreateCard <FieryWarAxe>(); fieryWarAxe.CurrentManaCost = 0; player.AddCardToHand(fieryWarAxe); player.PlayCard(fieryWarAxe, null); player.Attack(opponent); Assert.IsTrue(player.IsExhausted, "Verify the player is exhausted"); Assert.IsFalse(player.CanAttack, "Verify the player can't attack"); player.ApplyStatusEffects(PlayerStatusEffects.WINDFURY); Assert.IsFalse(player.IsExhausted, "Verify the player is unexhausted now"); player.Attack(opponent); Assert.IsTrue(player.IsExhausted, "Verify the player is exhausted"); Assert.IsFalse(player.CanAttack, "Verify the player can't attack"); GameEngine.EndTurn(); Assert.IsFalse(player.IsExhausted, "Verify the player is unexhausted after the turn ends"); }
public void AncientOfLore() { // Verify invalid playing of card var lore = HearthEntityFactory.CreateCard <AncientOfLore>(); lore.CurrentManaCost = 0; lore.Owner = player; player.AddCardToHand(lore); try { player.PlayCard(lore, null); Assert.Fail("You need to choose a card effect to play it!"); } catch (InvalidOperationException) { } finally { GameEngine.GameState.Board.RemoveCard(lore); player.AddCardToHand(lore); } // Verify draw 2 cards player.PlayCard(lore, null, 0, CardEffect.FIRST); Assert.AreEqual(27, player.Health, "Verify the player drew two fatigue cards"); GameEngine.GameState.Board.RemoveCard(lore); player.AddCardToHand(lore); // Verify heal character opponent.Health = 25; player.PlayCard(lore, opponent, 0, CardEffect.SECOND); Assert.AreEqual(30, opponent.Health, "Verify the opponent got healed"); }
internal void OnTurnStart(BasePlayer player) { if (player == this.Owner) { var minionsInHand = this.Owner.Hand.Where(card => card is BaseMinion).ToList(); if (minionsInHand.Any()) { int randomMinionIndex = GameEngine.Random.Next(minionsInHand.Count()); var randomMinion = minionsInHand[randomMinionIndex] as BaseMinion; GameEngine.GameState.Board.RemoveCard(this); player.AddCardToHand(this); GameEventManager.UnregisterForEvents(this); var firstEmptySlot = GameEngine.GameState.CurrentPlayerPlayZone.Count(card => card != null); player.SummonMinion(randomMinion, null, firstEmptySlot, CardEffect.NONE, forceSummoned: true, cardSource: player.hand); } } }
public void GameDraw() { player.Health = 1; opponent.Health = 1; GameEngine.GameState.CurrentPlayer = player; var hellfire = HearthEntityFactory.CreateCard <Hellfire>(); hellfire.Owner = player; hellfire.CurrentManaCost = 0; player.AddCardToHand(hellfire); player.PlayCard(hellfire, null); Task.Factory.StartNew(() => this.WaitUntilGameEnded(250, 8)).Wait(); Assert.IsTrue(this.gameEnded, "Verify the game has ended"); Assert.AreEqual(this.gameResult, GameEngine.GameResult.DRAW, "Verify it was a draw"); }
public void DeathrattleDamageAllMinions() { var yeti1 = HearthEntityFactory.CreateCard <ChillwindYeti>(); var yeti2 = HearthEntityFactory.CreateCard <ChillwindYeti>(); var yeti3 = HearthEntityFactory.CreateCard <ChillwindYeti>(); var yeti4 = HearthEntityFactory.CreateCard <ChillwindYeti>(); var abom1 = HearthEntityFactory.CreateCard <Abomination>(); abom1.CurrentManaCost = 0; player.AddCardToHand(abom1); GameEngine.GameState.CurrentPlayerPlayZone[0] = yeti1; GameEngine.GameState.CurrentPlayerPlayZone[1] = yeti2; GameEngine.GameState.WaitingPlayerPlayZone[0] = yeti3; GameEngine.GameState.WaitingPlayerPlayZone[1] = yeti4; player.PlayCard(abom1, null); GameEngine.EndTurn(); // This should kill the abomination // The yeti should also die from the deathrattle yeti3.Attack(abom1); // The rest of the yetis should have taken 2 damage from the abom deathrattle Assert.IsTrue(GameEngine.DeadCardsThisTurn.Contains(abom1)); Assert.IsTrue(GameEngine.DeadCardsThisTurn.Contains(yeti3)); Assert.AreEqual(3, yeti1.CurrentHealth, "Verify that the other yetis are hurt from the deathrattle"); Assert.AreEqual(3, yeti2.CurrentHealth, "Verify that the other yetis are hurt from the deathrattle"); Assert.AreEqual(3, yeti4.CurrentHealth, "Verify that the other yetis are hurt from the deathrattle"); }
public void AbusiveSergeant() { var sergeant = HearthEntityFactory.CreateCard <AbusiveSergeant>(); var faerie = HearthEntityFactory.CreateCard <FaerieDragon>(); var yeti = HearthEntityFactory.CreateCard <ChillwindYeti>(); GameEngine.GameState.CurrentPlayerPlayZone[0] = yeti; GameEngine.GameState.WaitingPlayerPlayZone[0] = faerie; // Verify buffing friendly minion sergeant.CurrentManaCost = 0; player.AddCardToHand(sergeant); player.PlayCard(sergeant, yeti); Assert.AreEqual(yeti.OriginalAttackPower + 2, yeti.CurrentAttackPower, "Verify yeti got an attack buff"); // Verify buffing enemy minion player.AddCardToHand(sergeant); player.PlayCard(sergeant, faerie); Assert.AreEqual(faerie.OriginalAttackPower + 2, faerie.CurrentAttackPower, "Verify faerie got an attack buff"); // Verify can't buff players player.AddCardToHand(sergeant); try { player.PlayCard(sergeant, player); Assert.Fail("Shouldn't be able to buff player!"); } catch (InvalidOperationException) { } }
public void AcolyteOfPain() { var acolyte = HearthEntityFactory.CreateCard <AcolyteOfPain>(); acolyte.Owner = player; acolyte.CurrentManaCost = 0; player.AddCardToHand(acolyte); player.PlayCard(acolyte, null); acolyte.TakeDamage(1); Assert.AreEqual(29, player.Health, "Verify the player drew a fatigue card"); acolyte.TakeDamage(2); Assert.AreEqual(27, player.Health, "Verify the player drew another fatigue card"); // Acolyte should be dead now so make sure there are no more registered triggered effects Assert.IsFalse(GameEventManager._damageDealtListeners.Any(x => x.Item1 == acolyte)); }