コード例 #1
0
ファイル: AbilitiesTests.cs プロジェクト: tomaszkot/Roguelike
        public void TestBulkAttackReal()
        {
            var game    = CreateGame();
            var empOnes = game.GameManager.CurrentNode.GetEmptyNeighborhoodTiles(game.GameManager.Hero, false);

            Assert.Greater(empOnes.Count, 1);
            var enemies = AllEnemies.Where(i => i.PowerKind == EnemyPowerKind.Champion).ToList();

            enemies[0].Stats.GetStat(EntityStatKind.Health).Value.Nominal *= 10;//make sure wont' die
            float en1Health = enemies[0].Stats.Health;
            float en2Health = enemies[1].Stats.Health;

            for (int i = 0; i < 2; i++)
            {
                game.GameManager.CurrentNode.SetTile(enemies[i], empOnes[i].point);
            }
            var ab = game.GameManager.Hero.GetPassiveAbility(Roguelike.Abilities.AbilityKind.BulkAttack);

            MaximizeAbility(ab, game.Hero);

            game.Hero.RecalculateStatFactors(false);
            var sb = game.Hero.GetTotalValue(EntityStatKind.ChanceToBulkAttack);

            for (int i = 0; i < 20; i++)
            {
                //hit only 1st enemy
                game.GameManager.InteractHeroWith(enemies[0]);
                GotoNextHeroTurn();
            }

            Assert.Greater(en1Health, enemies[0].Stats.Health);

            //2nd shall be hit by an ability
            Assert.Greater(en2Health, enemies[1].Stats.Health);
        }
コード例 #2
0
        public void TestWandMastering()//ChanceToElementalBulkAttack()
        {
            var   game = CreateGame();
            float originalStatValue = 0;
            var   destExtraStat     = SetWeapon(AbilityKind.WandsMastering, game.Hero, out originalStatValue);
            var   weapon            = game.Hero.GetActiveWeapon();

            var empOnes = game.GameManager.CurrentNode.GetEmptyNeighborhoodTiles(game.GameManager.Hero, false);

            Assert.Greater(empOnes.Count, 1);
            var enemies = AllEnemies.Where(i => i.PowerKind == EnemyPowerKind.Champion).ToList();

            enemies[0].Stats.GetStat(EntityStatKind.Health).Value.Nominal *= 10;//make sure wont' die
            float en1Health = enemies[0].Stats.Health;
            float en2Health = enemies[1].Stats.Health;

            for (int i = 0; i < 2; i++)
            {
                game.GameManager.CurrentNode.SetTile(enemies[i], empOnes[i].point);
            }
            var ab = game.GameManager.Hero.GetPassiveAbility(Roguelike.Abilities.AbilityKind.WandsMastering);

            for (int i = 0; i < 5; i++)
            {
                ab.IncreaseLevel(game.Hero);
            }

            game.Hero.RecalculateStatFactors(false);
            //var sb = game.Hero.GetTotalValue(EntityStatKind.ChanceToBulkAttack);

            for (int i = 0; i < 20; i++)
            {
                weapon.SpellSource.Count = 20;
                //hit only 1st enemy
                var spell = weapon.SpellSource.CreateSpell(game.Hero);
                Assert.True(game.GameManager.SpellManager.ApplyAttackPolicy(game.Hero, enemies[0], weapon.SpellSource));
                GotoNextHeroTurn();
            }

            Assert.Greater(en1Health, enemies[0].Stats.Health);

            //2nd shall be hit by an ability
            Assert.Greater(en2Health, enemies[1].Stats.Health);
        }