Пример #1
0
        public void DescriptionTestMethod3()
        {
            Assert.AreEqual("對全部敵方手下造成1點傷害", new DealSpellDamageToAllEnemyMinionsEffect(1, 1).Description(GameUnitTest.InitialGameStatus(), 0));
            Assert.AreEqual("對全部敵方手下造成1點傷害", new DealSpellDamageToAllEnemyMinionsEffect(1, 1).Description(GameUnitTest.InitialGameStatus(), 1));
            Game game = GameUnitTest.InitialGameStatus();
            Card card;

            CardManager.Instance.FindCard(11, out card);
            CardRecord record = game.GameCardManager.CreateCardRecord(card);

            game.Field1.AddCard(record.CardRecordID, 0);
            Assert.AreEqual("對全部敵方手下造成*2點傷害", new DealSpellDamageToAllEnemyMinionsEffect(1, 1).Description(game, 1));
            CardRecord record2 = game.GameCardManager.CreateCardRecord(card);

            game.Field1.AddCard(record2.CardRecordID, 0);
            Assert.AreEqual("對全部敵方手下造成*3點傷害", new DealSpellDamageToAllEnemyMinionsEffect(1, 1).Description(game, 1));
            Effect effect;

            CardManager.Instance.FindEffect(6, out effect);
            Effector effector = game.GameCardManager.CreareEffector(effect);

            record2.AddEffector(effector.EffectorID);
            Assert.AreEqual("對全部敵方手下造成*5點傷害", new DealSpellDamageToAllEnemyMinionsEffect(1, 1).Description(game, 1));
            game.GameCardManager.LoadEffector(new SpellDamageEffector(0, 0));
            record2.AddEffector(0);
            Assert.AreEqual("對全部敵方手下造成*5點傷害", new DealSpellDamageToAllEnemyMinionsEffect(1, 1).Description(game, 1));
            game.GameCardManager.LoadEffector(new TauntEffector(10, 2));
            record2.AddEffector(10);
            Assert.AreEqual("對全部敵方手下造成*5點傷害", new DealSpellDamageToAllEnemyMinionsEffect(1, 1).Description(game, 1));
        }
Пример #2
0
        public void AttackServantTestMethod4()
        {
            Game game = GameUnitTest.InitialGameStatus();

            game.CurrentGamePlayerID = 1;
            Hero hero = game.GamePlayer1.Hero;
            Card card;

            CardManager.Instance.FindCard(13, out card);
            CardRecord weaponRecord = game.GameCardManager.CreateCardRecord(card);

            hero.WeaponCardRecordID = weaponRecord.CardRecordID;

            CardManager.Instance.FindCard(1, out card);
            CardRecord servant1Record = game.GameCardManager.CreateCardRecord(card);

            game.Field2.AddCard(servant1Record.CardRecordID, 0);

            Assert.IsTrue(hero.AttackServant((servant1Record as ServantCardRecord), game.GamePlayer1));
            Assert.AreEqual(0, (servant1Record as ServantCardRecord).RemainedHealth);
            Assert.AreEqual(1, hero.AttackCountInThisTurn);
            Assert.AreEqual(7, (weaponRecord as WeaponCardRecord).Durability);

            game.Field2.RemoveCard(servant1Record.CardRecordID);

            CardManager.Instance.FindCard(8, out card);
            CardRecord servant2Record = game.GameCardManager.CreateCardRecord(card);

            Assert.IsTrue(game.Field2.AddCard(servant2Record.CardRecordID, 0));

            Assert.IsTrue(hero.AttackServant((servant2Record as ServantCardRecord), game.GamePlayer1));
            Assert.AreEqual(28, hero.RemainedHP);
            Assert.AreEqual(2, hero.AttackCountInThisTurn);
            Assert.AreEqual(6, (weaponRecord as WeaponCardRecord).Durability);
        }
Пример #3
0
        public void AttackHeroTestMethod4()
        {
            Game game = GameUnitTest.InitialGameStatus();

            game.CurrentGamePlayerID = 1;
            Hero hero = game.GamePlayer1.Hero;
            Card card;

            CardManager.Instance.FindCard(13, out card);
            CardRecord record = game.GameCardManager.CreateCardRecord(card);

            hero.WeaponCardRecordID = record.CardRecordID;
            Assert.IsTrue(hero.AttackHero(game.GamePlayer2.Hero, game.GamePlayer1));
            Assert.AreEqual(28, game.GamePlayer2.Hero.RemainedHP);
            Assert.AreEqual(1, hero.AttackCountInThisTurn);
            Assert.AreEqual(7, (record as WeaponCardRecord).Durability);

            Assert.IsTrue(hero.AttackHero(game.GamePlayer2.Hero, game.GamePlayer1));
            Assert.AreEqual(26, game.GamePlayer2.Hero.RemainedHP);
            Assert.AreEqual(2, hero.AttackCountInThisTurn);
            Assert.AreEqual(6, (record as WeaponCardRecord).Durability);

            Assert.IsFalse(hero.AttackHero(game.GamePlayer2.Hero, game.GamePlayer1));
            Assert.AreEqual(26, game.GamePlayer2.Hero.RemainedHP);
            Assert.AreEqual(2, hero.AttackCountInThisTurn);
            Assert.AreEqual(6, (record as WeaponCardRecord).Durability);
        }
Пример #4
0
        public void AttackServantTestMethod3()
        {
            Game game = GameUnitTest.InitialGameStatus();
            Hero hero = game.GamePlayer1.Hero;

            hero.Attack = 1;
            Card card;

            CardManager.Instance.FindCard(1, out card);
            CardRecord servant1Record = game.GameCardManager.CreateCardRecord(card);

            game.Field2.AddCard(servant1Record.CardRecordID, 0);
            CardManager.Instance.FindCard(8, out card);
            CardRecord servant2Record = game.GameCardManager.CreateCardRecord(card);

            Assert.IsTrue(game.Field2.AddCard(servant2Record.CardRecordID, 0));
            Assert.IsTrue(game.Field2.AnyTauntServant());
            Assert.IsFalse(hero.AttackServant((servant1Record as ServantCardRecord), game.GamePlayer1));
            Assert.AreEqual(0, hero.AttackCountInThisTurn);
            Assert.AreEqual(30, game.GamePlayer2.Hero.RemainedHP);
            Assert.IsTrue(hero.AttackServant((servant2Record as ServantCardRecord), game.GamePlayer1));
            Assert.AreEqual(1, hero.AttackCountInThisTurn);
            Assert.AreEqual(29, hero.RemainedHP);
            Assert.AreEqual(1, (servant2Record as ServantCardRecord).RemainedHealth);
        }
Пример #5
0
        public void AttackHeroTestMethod1()
        {
            Game game = GameUnitTest.InitialGameStatus();
            Hero hero = game.GamePlayer1.Hero;

            Assert.IsFalse(hero.AttackHero(game.GamePlayer2.Hero, game.GamePlayer1));
        }
Пример #6
0
        public void BindGameTestMethod()
        {
            var   game  = GameUnitTest.InitialGameStatus();
            Field field = new Field(1);

            field.BindGame(game);
            Assert.AreEqual(field.Game, game);
        }
Пример #7
0
        public void AnyTauntServantTestMethod()
        {
            Field field = new Field(1);
            var   game  = GameUnitTest.InitialGameStatus();

            field.BindGame(game);
            Assert.IsTrue(field.AddCard(5, 0));
            Assert.IsFalse(field.AnyTauntServant());
        }
        public void AttackHeroTestMethod1()
        {
            Game game = GameUnitTest.InitialGameStatus();
            Card card;

            CardManager.Instance.FindCard(1, out card);
            CardRecord record = game.GameCardManager.CreateCardRecord(card);

            Assert.IsTrue(game.Field1.AddCard(record.CardRecordID, 0));
            Assert.IsTrue((record as ServantCardRecord).AttackHero(game.GamePlayer2.Hero, game.GamePlayer1));
        }
Пример #9
0
        public void AttackServantTestMethod1()
        {
            Game game = GameUnitTest.InitialGameStatus();
            Hero hero = game.GamePlayer1.Hero;
            Card card;

            CardManager.Instance.FindCard(1, out card);
            CardRecord record = game.GameCardManager.CreateCardRecord(card);

            game.Field2.AddCard(record.CardRecordID, 0);
            Assert.IsFalse(hero.AttackServant(record as ServantCardRecord, game.GamePlayer1));
        }
Пример #10
0
        public void AttackHeroTestMethod2()
        {
            Game game = GameUnitTest.InitialGameStatus();
            Hero hero = game.GamePlayer1.Hero;

            hero.Attack = 2;
            game.GamePlayer2.Hero.Attack = 1;
            Assert.IsTrue(hero.AttackHero(game.GamePlayer2.Hero, game.GamePlayer1));
            Assert.AreEqual(29, hero.RemainedHP);
            Assert.AreEqual(28, game.GamePlayer2.Hero.RemainedHP);
            Assert.AreEqual(1, hero.AttackCountInThisTurn);
            Assert.AreEqual(0, game.GamePlayer2.Hero.AttackCountInThisTurn);
        }
        public void AttackServantTestMethod3()
        {
            Game game = GameUnitTest.InitialGameStatus();
            Card card;

            CardManager.Instance.FindCard(1, out card);
            CardRecord attackServantRecord = game.GameCardManager.CreateCardRecord(card);

            Assert.IsTrue(game.Field1.AddCard(attackServantRecord.CardRecordID, 0));
            CardManager.Instance.FindCard(8, out card);
            CardRecord record = game.GameCardManager.CreateCardRecord(card);

            game.Field2.AddCard(record.CardRecordID, 0);
            Assert.IsTrue(game.Field2.AnyTauntServant());
            Assert.IsTrue((attackServantRecord as ServantCardRecord).AttackServant(record as ServantCardRecord, game.GamePlayer1));
        }
Пример #12
0
        public void AttackWithWeaponTestMethod1()
        {
            Game game = GameUnitTest.InitialGameStatus();
            Hero hero = game.GamePlayer1.Hero;

            Assert.AreEqual(0, hero.AttackWithWeapon(game));
            game.CurrentGamePlayerID = 1;
            Card card;

            CardManager.Instance.FindCard(12, out card);
            CardRecord record = game.GameCardManager.CreateCardRecord(card);

            hero.WeaponCardRecordID = record.CardRecordID;
            Assert.AreEqual(2, hero.AttackWithWeapon(game));
            game.CurrentGamePlayerID = 2;
            Assert.AreEqual(0, hero.AttackWithWeapon(game));
        }
        public void AttackHeroTestMethod3()
        {
            Game game = GameUnitTest.InitialGameStatus();
            Card card;

            CardManager.Instance.FindCard(1, out card);
            CardRecord attackServantRecord = game.GameCardManager.CreateCardRecord(card);

            Assert.IsTrue(game.Field1.AddCard(attackServantRecord.CardRecordID, 0));
            CardManager.Instance.FindCard(8, out card);
            CardRecord record = game.GameCardManager.CreateCardRecord(card);

            Assert.IsTrue(game.Field2.AddCard(record.CardRecordID, 0));
            Assert.IsTrue(game.Field2.AnyTauntServant());
            Assert.IsFalse((attackServantRecord as ServantCardRecord).AttackHero(game.GamePlayer2.Hero, game.GamePlayer1));
            Assert.AreEqual(0, (attackServantRecord as ServantCardRecord).AttackCountInThisTurn);
            Assert.AreEqual(30, game.GamePlayer2.Hero.RemainedHP);
        }
Пример #14
0
        public void AttackServantTestMethod2()
        {
            Game game = GameUnitTest.InitialGameStatus();
            Hero hero = game.GamePlayer1.Hero;

            hero.Attack = 3;
            Card card;

            CardManager.Instance.FindCard(1, out card);
            CardRecord record = game.GameCardManager.CreateCardRecord(card);

            game.Field2.AddCard(record.CardRecordID, 0);
            Assert.IsTrue(hero.AttackServant(record as ServantCardRecord, game.GamePlayer1));
            Assert.AreEqual(29, hero.RemainedHP);
            Assert.AreEqual(-1, (record as ServantCardRecord).RemainedHealth);
            Assert.AreEqual(1, hero.AttackCountInThisTurn);
            Assert.AreEqual(0, (record as ServantCardRecord).AttackCountInThisTurn);
        }
Пример #15
0
        public void AddHandCardTestMethod1()
        {
            GamePlayer gamePlayer = new GamePlayer(null, null, null);

            Assert.IsTrue(gamePlayer.AddHandCard(1));
            Assert.IsFalse(gamePlayer.AddHandCard(1));
            for (int i = 2; i <= 10; i++)
            {
                Assert.IsTrue(gamePlayer.AddHandCard(i));
            }
            Assert.IsFalse(gamePlayer.AddHandCard(11));
            gamePlayer.BindGame(GameUnitTest.InitialGameStatus());
            ServantCardRecord card = new ServantCardRecord(12, 1);

            gamePlayer.Game.GameCardManager.LoadCard(card);
            bool destroyFlag = false;

            card.OnDestroyed += (record) =>
            {
                destroyFlag = true;
            };
            Assert.IsFalse(gamePlayer.AddHandCard(12));
            Assert.IsTrue(destroyFlag);
        }