示例#1
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));
        }
示例#2
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));
        }
        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));
        }
示例#4
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));
        }
        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));
        }
        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));
        }
示例#7
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_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));
        }
示例#9
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}));
        }
示例#10
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));
        }
示例#11
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}));
        }
示例#12
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);
        }
示例#13
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);
        }
示例#14
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));
        }
示例#15
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));
        }
示例#16
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));
        }
示例#17
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)));
        }
示例#18
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));
        }
示例#19
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."));
        }
示例#20
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));
        }
示例#21
0
        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));
        }
示例#22
0
        public void Pike_does_not_protect_from_non_battle_effects()
        {
            // Arrange
            var context = new TestContext();
            var player = context.Player;
            var hero = context.CreateBasicCard<Regular>();
            var pike = context.CreateCard<Pike>();
            context.SetPlayerHand(hero, pike);
            var ogre = context.SetMonsterInFirstRank<OgreHumanoid>("Ogre");

            // Act
            context.HeroEquipsWeapon(hero, pike);
            context.SetPlayerState(Phase.Aftermath);
            player.OnSelectMonster(ogre);
            context.UseAbilityOf(ogre);

            // Assert
            Assert.That(player.Hand, Has.No.Member(hero), "Pike should not protect hero from Ogre.");
        }
示例#23
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));
        }
示例#24
0
        public void When_using_phoenix_trophy()
        {
            // Arrange
            var context = new TestContext();
            var player = context.Player;
            context.SetPlayerState(Phase.Trophy);
            var phoenix = context.CreateCard<BurnmarkedFire>("Phoenix");
            context.SetPlayerHand(phoenix);

            var startingXp = player.Xp;

            // Act
            context.UseAbilityOf(phoenix);
            player.EndTurn();

            // Assert
            Assert.That(player.Xp, Is.EqualTo(startingXp + 3));
            Assert.That(context.GetMonsterInRank(4), Is.SameAs(phoenix));
            Assert.That(phoenix.Owner, Is.EqualTo(CardOwner.Dungeon));
        }
示例#25
0
        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));
        }
示例#26
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));
        }
示例#27
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));
        }
示例#28
0
        public void When_thundermage_bolter_discards_monster()
        {
            // Arrange
            var context = new TestContext();
            var player = context.Player;
            context.SetPlayerState(Phase.Dungeon);
            var bolter = context.CreateCard<Thundermage>("Thundermage Bolter");
            context.SetPlayerHand(bolter);

            var targetMonster = context.GetMonsterInRank(1);

            var startingXp = player.Xp;
            var startingVp = player.Vp;

            // Act
            context.UseAbilityOf(bolter);

            // Assert
            Assert.That(player.Discard.Contains(targetMonster));
            Assert.That(player.Xp, Is.EqualTo(startingXp), "Using the Thundermage Bolter's ability does not generate XP");
            Assert.That(player.Vp, Is.EqualTo(startingVp + targetMonster.Vp));
            Assert.That(context.GetMonsterInRank(1), Is.Not.Null, "Dungeon hall should be refilled");
        }