public void When_laird_is_defeated_then_all_kobolds_in_hall_are_defeated()
        {
            // Arrange
            var context = new TestContext();
            var player = context.Player;
            var laird = context.CreateCard<KoboldHumanoid>("Drakeclan Laird");
            var ambusher = context.CreateCard<KoboldHumanoid>("Drakeclan Ambusher");
            var cutter = context.CreateCard<KoboldHumanoid>("Drakeclan Cutter");
            var shaman = context.CreateCard<KoboldHumanoid>("Drakeclan Shaman");
            var kobolds = new[] {laird, ambusher, cutter, shaman};
            context.SetTopOfDungeonDeck(kobolds);
            context.AdvanceMonsterToFirstRank(laird);
            var hand = Enumerable.Range(0, 6).Select(x => context.CreateCard<Criochan>("Criochan Captain")).ToArray();
            context.SetPlayerHand(hand);
            var startingXp = player.Xp;
            var startingVp = player.Vp;

            // Act
            context.WhenBattling(laird);
            player.DetermineBattleResult();

            // Assert
            kobolds.Each(x => Assert.That(player.Discard.Contains(x), "Discard does not contain {0}".Template(x.Name)));
            context.Game.Dungeon.Ranks.Each(r=> Assert.That(r.Card, Is.Not.Null, "Rank {0} is empty".Template(r.Number)));
            kobolds.Each(x => Assert.That(context.Game.Dungeon.Ranks.All(rank => rank.Card != x)));
            Assert.That(player.Xp, Is.EqualTo(startingXp + laird.Xp));
            Assert.That(player.Vp, Is.EqualTo(startingVp + kobolds.Sum(x => x.Vp)));
        }
        public void The_flail_has_no_potential_attack_if_no_heroes_in_hand()
        {
            // Arrange
            var context = new TestContext();
            var player = context.Player;
            var flail = context.CreateCard<SnakeheadFlail>();
            context.SetPlayerHand(flail);

            // Act
            var potential = flail.PotentialPhysicalAttack;

            // Assert
            Assert.That(potential, Is.Null);
        }
        public void Must_be_at_least_2_other_cards_to_use_ability()
        {
            // Arrange
            var context = new TestContext();
            var curse = context.CreateCard<CurseOfDiscord>();
            var regular = context.CreateBasicCard<Regular>();
            context.SetPlayerHand(curse, regular);

            // Act
            var usable = curse.GetAbilities().First().Condition(context.Player);

            // Assert
            Assert.That(usable, Is.False);
        }
        public void Using_ability_destroys_curse()
        {
            // Arrange
            var context = new TestContext();
            var player = context.Player;
            var curse = context.CreateCard<CurseOfSloth>();
            context.SetPlayerHand(curse);
            context.SetPlayerState(Phase.Dungeon);

            // Act
            context.UseAbilityOf(curse);

            // Assert
            Assert.That(player.Hand, Has.No.Member(curse));
        }
        public void Ossuous_can_be_attacked_if_hero_of_at_least_level_1_is_present()
        {
            // Arrange
            var context = new TestContext();
            var hero = context.DrawHeroFromTopOfDeck(x => x.Level == 1);
            context.SetPlayerHand(hero);
            var ossuous = context.SetMonsterInFirstRank<UndeadSkeleton>("Ossuous");

            // Act
            Assert.That(context.Game.Dungeon.Ranks[0].Card, Is.SameAs(ossuous));
            context.Player.SelectMonster();

            // Assert
            Assert.That(context.SelectCardsIds, Has.Member(ossuous.Id), "Valid targets should contain Ossuous");
        }
        public void When_curse_is_in_hand_then_cant_prepare_or_rest()
        {
            // Arrange
            var context = new TestContext();
            var player = context.Player;
            var curse = context.CreateCard<CurseOfWar>();
            context.SetPlayerHand(curse);

            // Act
            player.StartTurn();

            // Assert
            var message = context.Get<StartTurnMessage>();
            Assert.That(message.AvailableActions, Is.EquivalentTo(new[]{"Village", "Dungeon"}));
        }
        public void Using_ability_reduces_number_of_cards_drawn()
        {
            // Arrange
            var context = new TestContext();
            var player = context.Player;
            var curse = context.CreateCard<CurseOfShame>();
            context.SetPlayerHand(curse);
            context.SetPlayerState(Phase.Village);

            // Act
            context.UseAbilityOf(curse);
            context.Player.EndTurn();

            // Assert
            Assert.That(player.Hand.Count, Is.EqualTo(4));
        }
        public void Using_ability_reduces_player_light_to_zero()
        {
            // Arrange
            var context = new TestContext();
            var player = context.Player;
            var curse = context.CreateCard<CurseOfHorror>();
            var torch = context.CreateBasicCard<Torch>();
            context.SetPlayerHand(curse, torch);
            context.SetPlayerState(Phase.Dungeon);

            // Act
            context.UseAbilityOf(curse);

            // Assert
            Assert.That(player.TotalLight, Is.EqualTo(0));
        }
Exemple #9
0
        public void A_hero_not_armed_with_a_pike_is_not_immune_to_battle_effects()
        {
            // Arrange
            var context = new TestContext();
            var player = context.Player;
            var hero = context.CreateCard<Criochan>();
            var pike = context.CreateCard<Pike>();
            context.SetPlayerHand(hero, pike);
            var ettin = context.SetMonsterInFirstRank<OgreHumanoid>("Ettin");

            // Act
            context.WhenBattling(ettin);

            // Assert
            Assert.That(player.Hand, Has.No.Member(hero), "Ettin eats hero.");
        }
Exemple #10
0
        public void Beserker_destroys_other_hero_during_aftermath()
        {
            // Arrange
            var context = new TestContext();
            var berserker = context.CreateCard<Disowned>("Disowned Berserker");
            var otherHero = context.CreateBasicCard<Regular>();
            var weapon = context.CreateCard<Pike>();
            context.SetPlayerHand(berserker, otherHero, weapon);
            context.SetPlayerState(Phase.Aftermath);

            // Act
            context.UseAbilityOf(berserker);

            // Assert
            Assert.That(context.Player.Hand, Is.EquivalentTo(new[]{berserker, weapon}));
        }
        public void Using_ability_destroys_curse()
        {
            // Arrange
            var context = new TestContext();
            var player = context.Player;
            var curse = context.CreateCard<CurseOfNeglect>();
            var longspear = context.CreateBasicCard<Longspear>();
            context.SetPlayerHand(curse, longspear);
            context.SetPlayerState(Phase.Village);

            // Act
            context.UseAbilityOf(curse);

            // Assert
            Assert.That(player.Hand, Has.No.Member(curse));
        }
        public void Using_ability_disables_abilities(Phase phase, bool isActive)
        {
            // Arrange
            var context = new TestContext();
            var player = context.Player;
            var curse = context.CreateCard<CurseOfSloth>();
            context.SetPlayerHand(curse);
            var otherAbility = context.AddAbilityStub(phase);
            context.SetPlayerState(Phase.Dungeon);

            // Act
            context.UseAbilityOf(curse);

            // Assert
            Assert.That(player.ActiveAbilities.Contains(otherAbility), Is.EqualTo(isActive));
        }
        public void Using_ability_reduces_available_gold_by_2()
        {
            // Arrange
            var context = new TestContext();
            var player = context.Player;
            var curse = context.CreateCard<CurseOfNeglect>();
            var longspear = context.CreateBasicCard<Longspear>();
            context.SetPlayerHand(curse, longspear);
            context.SetPlayerState(Phase.Village);

            // Act
            context.UseAbilityOf(curse);

            // Assert
            Assert.That(player.AvailableGold, Is.EqualTo(0));
        }
        public void Necrophidius_trophy_ability()
        {
            // Arrange
            var context = new TestContext();
            var necrophidius = context.CreateCard<UndeadSkeleton>("Necrophidius");
            var hero0 = context.DrawHeroFromTopOfDeck(x => x.Level == 0);
            var hero1 = context.DrawHeroFromTopOfDeck(x => x.Level == 1);
            var hero2 = context.GetHeroFromVillage(x => x.Level == 2);
            context.SetPlayerHand(necrophidius, hero0, hero1, hero2);
            context.SetPlayerState(Phase.Trophy);

            // Act
            context.UseAbilityOf(necrophidius);

            // Assert
            Assert.That(context.SelectCardsIds, Is.EquivalentTo(new[] {hero0.Id, hero1.Id}));
        }
        public void Curse_of_discord_cannot_discard_itself()
        {
            // Arrange
            var context = new TestContext();
            context.Player.State = PlayerState.Village;
            var curse = context.CreateCard<CurseOfDiscord>();
            var regular = context.CreateBasicCard<Regular>();
            var torch = context.CreateBasicCard<Torch>();
            var longspear = context.CreateBasicCard<Longspear>();
            context.SetPlayerHand(curse, regular, torch, longspear);

            // Act
            context.UseAbilityOf(curse);

            // Assert
            Assert.That(context.SelectCardsIds, Has.No.Member(curse.Id));
        }
Exemple #16
0
        public void Bloodrager_destroys_all_other_heroes_during_aftermath()
        {
            // Arrange
            var context = new TestContext();
            var bloodrager = context.CreateCard<Disowned>("Disowned Bloodrager");
            var hero1 = context.CreateBasicCard<Regular>();
            var hero2 = context.CreateBasicCard<Regular>();
            var weapon = context.CreateCard<Pike>();
            context.SetPlayerHand(bloodrager, hero1, hero2, weapon);
            context.SetPlayerState(Phase.Aftermath);

            // Act
            context.UseAbilityOf(bloodrager);

            // Assert
            Assert.That(context.Player.Hand, Is.EquivalentTo(new[] {weapon}));
        }
        public void Hand_must_have_at_least_3_cards_in_order_to_use_ability()
        {
            // Arrange
            var context = new TestContext();
            var player = context.Player;
            var curse = context.CreateCard<CurseOfWar>();
            var card1 = context.CreateBasicCard<Torch>();
            context.SetPlayerHand(curse, card1);
            context.SetPlayerState(Phase.Dungeon);
            var ability = context.GetAbilityOf(curse);

            // Act
            var canUse = ability.Condition(player);

            // Assert
            Assert.That(canUse, Is.False);
        }
Exemple #18
0
        public void Hand_must_contain_another_hero()
        {
            // Arrange
            var context = new TestContext();
            var player = context.Player;
            var honer = context.CreateCard<Whetmage>("Whetmage Honer");
            context.SetPlayerHand(honer);
            player.Xp = 2;
            context.SetPlayerState(Phase.Dungeon);
            var ability = context.GetAbilityOf(honer);

            // Act
            var isUsable = context.IsAbilityUsable(ability);

            // Assert
            Assert.That(isUsable, Is.False);
        }
        public void Using_ability_reduces_total_attack_value_by_3()
        {
            // Arrange
            var context = new TestContext();
            var player = context.Player;
            var curse = context.CreateCard<CurseOfSloth>();
            var sergeant = context.CreateCard<Criochan>();
            var summoner = context.CreateCard<Thundermage>();
            context.SetPlayerHand(curse, sergeant, summoner);
            context.SetPlayerState(Phase.Dungeon);

            // Act
            context.UseAbilityOf(curse);

            // Assert
            Assert.That(player.TotalAttack, Is.EqualTo(sergeant.TotalAttack + summoner.TotalAttack - 3));
        }
        public void Using_ability_destroys_curse_and_reduces_xp_by_2()
        {
            // Arrange
            var context = new TestContext();
            var player = context.Player;
            var curse = context.CreateCard<CurseOfHostility>();
            context.SetPlayerHand(curse);
            context.SetPlayerState(Phase.Dungeon);
            player.Xp = 2;

            // Act
            context.UseAbilityOf(curse);

            // Assert
            Assert.That(player.Hand, Has.No.Member(curse));
            Assert.That(player.Xp, Is.EqualTo(0));
        }
Exemple #21
0
        public void Bloodrager_returns_to_top_of_deck_during_aftermath()
        {
            // Arrange
            var context = new TestContext();
            var bloodrager = context.CreateCard<Disowned>("Disowned Bloodrager");
            var weapon = context.CreateCard<Pike>();
            context.SetPlayerHand(bloodrager, weapon);
            context.HeroEquipsWeapon(bloodrager,weapon);
            context.SetPlayerState(Phase.Aftermath);

            // Act
            context.UseAbilityOf(bloodrager);

            // Assert
            Assert.That(context.Player.Hand, Is.EquivalentTo(new[] {weapon}));
            Assert.That(context.Player.Deck.TopCard, Is.SameAs(bloodrager));
            Assert.That(bloodrager.TotalAttack, Is.EqualTo(bloodrager.GetBaseValue(Attr.PhysicalAttack)));
        }
        public void Stalker_ability_switches_adjacent_monsters()
        {
            // Arrange
            var context = new TestContext();
            var stalker = context.CreateCard<Bhoidwood>("Bhoidwood Stalker");
            context.SetPlayerHand(stalker);
            context.SetPlayerState(Phase.Dungeon);
            var monster1 = context.GetMonsterInRank(1);
            var monster2 = context.GetMonsterInRank(2);
            context.WhenSelectingCardsSelect(monster1);

            // Act
            context.UseAbilityOf(stalker);

            // Assert
            Assert.That(context.GetMonsterInRank(1), Is.SameAs(monster2));
            Assert.That(context.GetMonsterInRank(2), Is.SameAs(monster1));
        }
Exemple #23
0
        public void When_removing_equipped_weapon_from_hand_then_hero_loses_modifier()
        {
            // Arrange
            var context = new TestContext();
            var player = context.Player;
            var regular = context.CreateBasicCard<Regular>();
            var spear = context.CreateBasicCard<Longspear>();
            context.SetPlayerHand(regular, spear);
            context.SetPlayerState(Phase.Dungeon, Phase.Equip);
            context.HeroEquipsWeapon(regular, spear);

            // Act
            player.RemoveFromHand(spear);

            // Assert
            Assert.That(regular.PhysicalAttack, Is.EqualTo(1));
            player.View.AssertWasCalled(x => x.Log("Regular no longer has Longspear equipped."));
        }
Exemple #24
0
        public void Polisher_can_use_ability_multiple_times()
        {
            // Arrange
            var context = new TestContext();
            context.SetPlayerState(Phase.Dungeon);
            var polisher = context.CreateCard<Whetmage>("Whetmage Polisher");
            var hero1 = context.DrawHeroFromTopOfDeck(x=>x.Level==1);
            var hero2 = context.DrawHeroFromTopOfDeck(x => x.Level == 1);
            context.SetPlayerHand(polisher, hero1, hero2);
            context.Player.Xp = 10;
            var levelUp = polisher.GetAbility();

            // Act
            context.UseAbilityOf(polisher);

            // Assert
            Assert.That(context.Player.ActiveAbilities.Any(x=>x.Id == levelUp.Id));
        }
Exemple #25
0
        public void Polisher_cannot_use_ability_to_level_up_card_it_already_leveled_up()
        {
            // Arrange
            var context = new TestContext();
            var player = context.Player;
            player.State = PlayerState.Dungeon;
            var polisher = context.CreateCard<Whetmage>("Whetmage Polisher");
            var hero = context.DrawHeroFromTopOfDeck(x => x.Level == 1);
            context.SetPlayerHand(polisher, hero);
            player.Xp = 10;
            var levelUp = polisher.GetAbility();

            // Act
            context.UseAbility(levelUp);

            // Assert
            Assert.That(levelUp.Condition(player), Is.False);
        }
Exemple #26
0
        public void Looter_spoils_ability_buys_card_and_puts_on_top_of_deck()
        {
            // Arrange
            var context = new TestContext();
            var player = context.Player;
            var looter = context.CreateCard<Rapparee>("Rapparee Looter");
            context.SetPlayerHand(looter);
            context.SetPlayerState(Phase.Spoils);
            var longspear = context.GetVillageDeck(CardType.Weapon, card => card.Name == "Longspear").TopCard;
            context.WhenSelectingCardsSelect(longspear);

            // Act
            context.UseAbilityOf(looter);

            // Assert
            Assert.That(player.Deck.TopCard, Is.SameAs(longspear));
            Assert.That(player.Discard, Has.No.Member(longspear));
        }
        public void Using_ability_destroys_one_random_card()
        {
            // Arrange
            var context = new TestContext();
            var player = context.Player;
            var curse = context.CreateCard<CurseOfWar>();
            var card1 = context.CreateBasicCard<Torch>();
            var card2 = context.CreateBasicCard<Regular>();
            context.SetPlayerHand(curse, card1, card2);
            context.SetPlayerState(Phase.Village);
            context.WhenSelectingCardsSelectFirst();

            // Act
            context.UseAbilityOf(curse);

            // Assert
            Assert.That(player.Hand.Count, Is.EqualTo(1));
        }
        public void Using_ability_destroys_curse(Phase phase)
        {
            // Arrange
            var context = new TestContext();
            var player = context.Player;
            var curse = context.CreateCard<CurseOfWar>();
            var card1 = context.CreateBasicCard<Torch>();
            var card2 = context.CreateBasicCard<Regular>();
            context.SetPlayerHand(curse, card1, card2);
            context.SetPlayerState(phase);
            context.WhenSelectingCardsSelectFirst();

            // Act
            context.UseAbilityOf(curse);

            // Assert
            Assert.That(player.Hand, Has.No.Member(curse));
        }
Exemple #29
0
        public void Level_up_other_hero()
        {
            // Arrange
            var context = new TestContext();
            var player = context.Player;
            context.SetPlayerState(Phase.Dungeon);
            var honer = context.CreateCard<Whetmage>();
            var otherHero = context.DrawHeroFromTopOfDeck(c => c.Level > 0);
            context.SetPlayerHand(honer, otherHero);
            player.Xp = 2;

            // Act
            context.UseAbilityOf(honer);

            // Assert
            Assert.That(player.Hand.Count, Is.EqualTo(2));
            Assert.That(player.Hand.Contains(otherHero), Is.False);
            Assert.That(player.Hand.Single(c=>c != honer).Level, Is.EqualTo(2));
        }
        public void Terror_can_destroy_card()
        {
            // Arrange
            var context = new TestContext();
            var terror = context.CreateCard<Skinshifter>("Terror");
            var otherCard = context.CreateBasicCard<Torch>();
            context.SetPlayerHand(terror, otherCard);
            context.SetPlayerState(Phase.Dungeon);
            context.WhenSelectingOptionSelect("Destroy");

            // Act
            context.UseAbilityOf(terror);

            // Assert
            Assert.That(terror.PhysicalAttack, Is.EqualTo(8));
            Assert.That(terror.Strength, Is.EqualTo(8));
            Assert.That(context.Player.Hand, Has.No.Member(otherCard));
            Assert.That(context.Player.Discard, Has.No.Member(otherCard));
        }