コード例 #1
0
        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)));
        }
コード例 #2
0
        public void Laird_gains_health_equal_to_other_kobolds_in_hall()
        {
            // Arrange
            var context = new TestContext();
            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");
            context.SetTopOfDungeonDeck(laird, ambusher, cutter, shaman);

            // Act
            context.AdvanceMonsterToFirstRank(laird);

            // Assert
            Assert.That(laird.Health, Is.EqualTo(laird.GetBaseValue(Attr.Health) + ambusher.Health + cutter.Health + shaman.Health));
        }
コード例 #3
0
ファイル: PikeTest.cs プロジェクト: Slugburn/Thunderstone
        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.");
        }
コード例 #4
0
ファイル: DisownedTest.cs プロジェクト: Slugburn/Thunderstone
        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}));
        }
コード例 #5
0
        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));
        }
コード例 #6
0
ファイル: DisownedTest.cs プロジェクト: Slugburn/Thunderstone
        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}));
        }
コード例 #7
0
ファイル: DisownedTest.cs プロジェクト: Slugburn/Thunderstone
        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)));
        }
コード例 #8
0
ファイル: PikeTest.cs プロジェクト: Slugburn/Thunderstone
        public void Pike_only_protects_the_hero_that_has_it_equipped()
        {
            // Arrange
            var context = new TestContext();
            var player = context.Player;
            var equippedHero = context.CreateCard<Criochan>();
            var unequippedHero = context.CreateCard<Criochan>();
            var pike = context.CreateCard<Pike>();
            context.SetPlayerHand(equippedHero, pike);
            var ettin = context.SetMonsterInFirstRank<OgreHumanoid>("Ettin");

            // Act
            context.HeroEquipsWeapon(equippedHero, pike);
            context.WhenBattling(ettin);

            // Assert
            Assert.That(player.Hand, Has.Member(equippedHero), "Pike should protect hero from Ettin.");
            Assert.That(player.Hand, Has.No.Member(unequippedHero), "Ettin eats unequipped hero.");
        }
コード例 #9
0
ファイル: DisownedTest.cs プロジェクト: Slugburn/Thunderstone
        public void Bloodrager_can_equip_two_weapons()
        {
            // Arrange
            var context = new TestContext();
            var bloodrager = context.CreateCard<Disowned>("Disowned Bloodrager");
            var weapon1 = context.CreateCard<Pike>();
            var weapon2 = context.CreateCard<SnakeheadFlail>();
            context.SetPlayerHand(bloodrager, weapon1, weapon2);
            context.SetPlayerState(Phase.Dungeon);

            // Act
            context.HeroEquipsWeapon(bloodrager, weapon1);
            context.HeroEquipsWeapon(bloodrager, weapon2);

            // Assert
            Assert.That(bloodrager.IsEquipped, Is.True);
            Assert.That(bloodrager.GetEquipped(), Is.EquivalentTo(new[] {weapon1, weapon2}));
            Assert.That(weapon1.IsEquipped, Is.True);
            Assert.That(weapon2.IsEquipped, Is.True);
            Assert.That(bloodrager.TotalAttack, Is.EqualTo(14));
        }
コード例 #10
0
        public void When_whetmage_levels_other_hero_then_curse_of_decay_ability_is_no_longer_available()
        {
            // Arrange
            var context = new TestContext();
            var player = context.Player;
            var curse = context.CreateCard<CurseOfDecay>();
            var whetmage = context.CreateCard<Whetmage>();
            var hero1 = context.DrawHeroFromTopOfDeck(x => x.Level == 1);
            var hero2 = context.DrawHeroFromTopOfDeck(x => x.Level == 1);
            context.SetPlayerHand(curse, whetmage, hero1, hero2);
            context.SetPlayerState(Phase.Dungeon);
            player.Xp = 2;

            var levelOtherHero = whetmage.GetAbilities().First();
            var curseAbility = curse.GetAbilities().First();

            // Act
            context.UseAbilityOf(whetmage);

            // Assert
            Assert.That(player.ActiveAbilities, Has.No.Member(curseAbility));
        }
コード例 #11
0
        public void If_terror_destroys_disease_then_can_use_ability_one_additional_time()
        {
            var context = new TestContext();
            var terror = context.CreateCard<Skinshifter>("Terror");
            var disease1 = context.CreateCard<CurseOfDecay>();
            var disease2 = context.CreateCard<CurseOfDecay>();
            var disease3 = context.CreateCard<CurseOfDecay>();
            context.SetPlayerHand(terror, disease1, disease2, disease3);
            context.SetPlayerState(Phase.Dungeon);
            context.WhenSelectingOptionSelect("Destroy");
            context.WhenSelectingCardsSelectFirst();
            var ability = context.GetAbilityOf(terror);

            // Act
            context.UseAbility(ability);
            context.UseAbilityOf(terror);

            // Assert
            Assert.That(context.Player.Hand, Has.No.Member(disease1));
            Assert.That(context.Player.Hand, Has.No.Member(disease2));
            Assert.That(context.Player.ActiveAbilities, Has.No.Member(ability));
        }
コード例 #12
0
        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);
        }
コード例 #13
0
        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);
        }
コード例 #14
0
        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));
        }
コード例 #15
0
        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"}));
        }
コード例 #16
0
        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));
        }
コード例 #17
0
        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));
        }
コード例 #18
0
        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));
        }
コード例 #19
0
        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));
        }
コード例 #20
0
        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));
        }
コード例 #21
0
        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);
        }
コード例 #22
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}));
        }
コード例 #23
0
        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));
        }
コード例 #24
0
        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));
        }
コード例 #25
0
ファイル: WhetmageTest.cs プロジェクト: Slugburn/Thunderstone
        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);
        }
コード例 #26
0
ファイル: WhetmageTest.cs プロジェクト: Slugburn/Thunderstone
        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);
        }
コード例 #27
0
        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));
        }
コード例 #28
0
        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));
        }
コード例 #29
0
        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));
        }
コード例 #30
0
ファイル: WhetmageTest.cs プロジェクト: Slugburn/Thunderstone
        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));
        }