Example #1
0
        public void TestExplosiveMasteringBurning()
        {
            var game     = CreateGame();
            var champion = ChampionEnemies.First();

            PrepareEnemyToBeBeaten(champion);
            var chempBeginHealth = champion.Stats.Health;
            var hero             = game.GameManager.Hero;

            var explosiveCocktail = new ProjectileFightItem(FightItemKind.ExplosiveCocktail, hero);

            explosiveCocktail.Count = 10;
            hero.Inventory.Add(explosiveCocktail);
            hero.ActiveFightItem = explosiveCocktail;

            for (int i = 0; i < 10; i++)
            {
                //champion.OnHitBy(explosiveCocktail);
                UseFightItem(hero, champion, hero.ActiveProjectileFightItem);
                if (champion.HasLastingEffect(Roguelike.Effects.EffectType.Firing))
                {
                    break;
                }
                GotoNextHeroTurn();
            }

            Assert.True(champion.HasLastingEffect(Roguelike.Effects.EffectType.Firing));
        }
Example #2
0
 public ProjectileFightItem AddFightItem(FightItemKind kind)
 {
     fightItems[kind] = new ProjectileFightItem(kind, this)
     {
         Count = RandHelper.GetRandomInt(2) + 1
     };
     return(fightItems[kind] as ProjectileFightItem);
 }
Example #3
0
        public void TestExplosiveMasteringBurning()
        {
            var game             = CreateGame();
            var champion         = ChampionEnemies.First();
            var chempBeginHealth = champion.Stats.Health;
            var hero             = game.GameManager.Hero;

            var explosiveCocktail = new ProjectileFightItem(FightItemKind.ExplosiveCocktail, hero);

            for (int i = 0; i < 10; i++)
            {
                champion.OnHitBy(explosiveCocktail);
                if (champion.HasLastingEffect(Roguelike.Effects.EffectType.Firing))
                {
                    break;
                }
            }

            Assert.True(champion.HasLastingEffect(Roguelike.Effects.EffectType.Firing));
        }
Example #4
0
        private static ProjectileFightItem CreateFightItem(FightItemKind fik)
        {
            int max = 3;
            int add = 3;
            var fi  = new ProjectileFightItem(fik, null)
            {
            };

            if (fik == FightItemKind.PlainArrow || fik == FightItemKind.PlainBolt)
            {
                max = 6;
            }
            if (fik == FightItemKind.HunterTrap)
            {
                max = 1;
                add = 2;
            }

            fi.Count = RandHelper.GetRandomInt(max) + add;
            return(fi);
        }
Example #5
0
        public void HunterTrapDeactivation()
        {
            var game = CreateGame();
            var hero = game.Hero;
            var fi   = new ProjectileFightItem(FightItemKind.HunterTrap, hero);

            fi.Count = 1;
            game.GameManager.CurrentNode.SetTileAtRandomPosition(fi);
            Assert.AreEqual(game.GameManager.CurrentNode.GetTile(fi.point), fi);

            for (int i = 0; i < 10; i++)
            {
                fi.SetState(FightItemState.Activated);
                fi.SetState(FightItemState.Busy);
                fi.SetState(FightItemState.Deactivated);
                game.GameManager.AppendAction(new LootAction(fi, null)
                {
                    Kind = LootActionKind.Deactivated
                });
            }
            Assert.AreEqual(game.GameManager.CurrentNode.GetTile(fi.point).Symbol, new Tile().Symbol);
        }
Example #6
0
        private float TestWeaponKindMastering(AbilityKind kind)
        {
            var abVal    = 0.0f;
            var abValAux = 0.0f;
            var hero     = game.Hero;

            hero.UseAttackVariation = false;
            float auxStatValue;
            var   destStat = SetWeapon(kind, hero, out auxStatValue);
            var   en       = PlainEnemies.First();

            en.Stats.SetNominal(EntityStatKind.Health, 100);
            en.AddImmunity(Roguelike.Effects.EffectType.Bleeding);//not to mix test results
            var wpn = hero.GetActiveWeapon();

            wpn.StableDamage = true;
            Assert.Greater(wpn.LevelIndex, 0);

            Func <float> hitEnemy = () =>
            {
                var health = en.Stats.Health;
                if (!wpn.IsBowLike)
                {
                    en.OnMelleeHitBy(hero);
                }
                else
                {
                    en.OnHitBy(hero.ActiveFightItem as ProjectileFightItem);
                }
                var health1 = en.Stats.Health;
                return(health - health1);
            };

            if (wpn.IsBowLike)
            {
                ProjectileFightItem pfi = null;
                if (wpn.Kind == Weapon.WeaponKind.Bow)
                {
                    pfi = new ProjectileFightItem(FightItemKind.PlainArrow)
                    {
                        Count = 2
                    };
                }
                else if (wpn.Kind == Weapon.WeaponKind.Crossbow)
                {
                    pfi = new ProjectileFightItem(FightItemKind.PlainBolt)
                    {
                        Count = 2
                    };
                }
                pfi.Caller = hero;
                hero.Inventory.Add(pfi);
                hero.ActiveFightItem = pfi;
            }
            var damage = hitEnemy();

            Assert.Greater(damage, 0);

            var heroAttack = hero.GetAttackValue(AttackKind.Unset).CurrentTotal;

            for (int i = 0; i < MaxAbilityInc + 1; i++)
            {
                hero.IncreaseAbility(kind);
                var ab = hero.GetPassiveAbility(kind);
                Assert.AreNotEqual(ab.PrimaryStat.Kind, EntityStatKind.Unset);
                AssertNextValue(i, ab, abVal, abValAux);

                abVal    = GetFactor(ab, true);
                abValAux = GetFactor(ab, false);
                Assert.Less(abVal, 21);
                Assert.Less(abValAux, 26);

                abVal = ab.PrimaryStat.Factor;
                //Debug.WriteLine(kind + " Level: " + ab.Level + ", value :" + ab.PrimaryStat.Factor);
            }
            var statValueWithAbility = hero.Stats.GetCurrentValue(destStat);

            Assert.Greater(statValueWithAbility, auxStatValue);

            var heroAttackWithAbility = hero.GetAttackValue(AttackKind.Unset).CurrentTotal;

            Assert.Greater(heroAttackWithAbility, heroAttack);
            var damageWithAbility = hitEnemy();

            if (damageWithAbility < damage)
            {
                int k = 0;
                k++;
            }
            Assert.Greater(damageWithAbility, damage);
            return(abVal);
        }