Beispiel #1
0
        public void EnemyAttackTest()
        {
            var game = CreateGame();
            var hero = game.Hero;

            var enemy = AllEnemies.Cast <Enemy>().First();

            enemy.PrefferedFightStyle          = PrefferedFightStyle.Magic;//use spells
            enemy.ActiveManaPoweredSpellSource = new Scroll(SpellKind.FireBall);

            var mana = enemy.Stats.Mana;

            Assert.True(game.GameManager.HeroTurn);
            TryToMoveHero();

            var emptyHeroNeib = game.Level.GetEmptyNeighborhoodPoint(game.Hero, EmptyNeighborhoodCallContext.Move);
            var set           = game.Level.SetTile(enemy, emptyHeroNeib.Item1);

            Assert.True(set);

            GotoNextHeroTurn(game);
            var heroHealth = hero.Stats.Health;

            //if (heroHealth == hero.Stats.Health)
            {
                for (int i = 0; i < 10; i++)
                {
                    game.GameManager.EnemiesManager.AttackIfPossible(enemy as Enemy, hero);//TODO
                    if (enemy.Stats.Mana < mana)
                    {
                        break;
                    }
                }
            }
            Assert.Greater(heroHealth, hero.Stats.Health);
            Assert.Greater(mana, enemy.Stats.Mana);//used mana
        }