Exemple #1
0
        public override async Task Execute()
        {
            SoundMan.PlaySound(LotaSound.Xamine);
            await GameControl.WaitAsync(500);

            await TextArea.PrintLine("\n");

            await PrintDungeonLevel();

            DungeonMonster foundMonster    = FirstVisibleMonster(Player.Location, Player.FaceDirection, Player.DungeonLevel);
            int            monsterDistance = RevealDistance(foundMonster);

            bool revealHidden = RevealTrapsUpTo(monsterDistance);

            if (revealHidden)
            {
                XamineFormatter.PrintHiddenObjectsDetected();
                SoundMan.PlaySound(LotaSound.XamineDetected);
            }

            if (foundMonster != null)
            {
                PrintExamineMonsterMessage(foundMonster);
            }
            else
            {
                PrintExamineObjectMessage();
            }
        }
Exemple #2
0
        private bool TryMonsterStep(DungeonMonster monster, Point delta)
        {
            if (delta.X != 0 && delta.Y != 0)
            {
                throw new ArgumentOutOfRangeException();
            }
            if (delta.X == 0 && delta.Y == 0)
            {
                return(false);
            }

            if (delta.X != 0)
            {
                delta.X /= Math.Abs(delta.X);
            }
            if (delta.Y != 0)
            {
                delta.Y /= Math.Abs(delta.Y);
            }

            if (CanMonsterStepInto(monster, new Point(monster.Location.X + delta.X, monster.Location.Y + delta.Y)))
            {
                monster.Location = new Point(
                    monster.Location.X + delta.X,
                    monster.Location.Y + delta.Y);

                return(true);
            }

            return(false);
        }
Exemple #3
0
        protected void SetMonsterDetails()
        {
            int dungeonNumber = 0;

            int.TryParse(DungeonNumber, out dungeonNumber);
            ChosenMonster = DungeonMonsters.First(n => n.DungeonNumber == dungeonNumber);
            StateHasChanged();
        }
Exemple #4
0
        public override async Task Execute()
        {
            await TextArea.PrintLine();

            await TextArea.PrintLine();

            int distance    = 0;
            int maxDistance = 1;

            if (Player.CurrentWeapon.Info(Data).Ranged)
            {
                maxDistance = 5;
            }

            DungeonMonster monst = MonsterInFrontOfPlayer(Player, ref distance);

            if (monst == null)
            {
                await TextArea.PrintLine("Nothing to fight.");

                return;
            }
            else if (distance > maxDistance)
            {
                await TextArea.PrintLine("The " + monst.Name + " is out-of-range");

                await TextArea.PrintLine("of your " + Player.CurrentWeapon.BaseName(Data) + ".");

                return;
            }

            bool hit = RollToHitMonster(monst);

            await TextArea.Print("Hit ");

            await TextArea.Print(monst.Name, XleColor.White);

            await TextArea.PrintLine(" with " + Player.CurrentWeapon.BaseName(Data));

            if (hit)
            {
                int damage = RollDamageToMonster(monst);

                SoundMan.PlaySound(LotaSound.PlayerHit);

                await HitMonster(monst, damage, XleColor.Cyan);
            }
            else
            {
                SoundMan.PlaySound(LotaSound.PlayerMiss);
                await TextArea.PrintLine("Your attack misses.");

                await GameControl.WaitAsync(500);
            }

            return;
        }
Exemple #5
0
        public override int RollDamageToPlayer(DungeonMonster monster)
        {
            var    armor = Player.CurrentArmor;
            double vc    = armor.ID + armor.Quality / 3.5;

            double damage = 10 * TheMap.MonsterDamageScale / (vc + 3) * (Player.DungeonLevel + 7);

            return((int)((Random.NextDouble() + 0.5) * damage));
        }
Exemple #6
0
        protected override void PrintExamineMonsterMessage(DungeonMonster foundMonster)
        {
            if (foundMonster.Data.Name == "king")
            {
                TextArea.PrintLine("You see a king!", XleColor.White);
                return;
            }

            base.PrintExamineMonsterMessage(foundMonster);
        }
Exemple #7
0
        private int RevealDistance(DungeonMonster foundMonster)
        {
            int distance = 5;

            if (foundMonster != null)
            {
                distance = Math.Abs(foundMonster.Location.X - Player.Location.X) + Math.Abs(foundMonster.Location.Y + Player.Location.Y);
            }

            return(distance);
        }
Exemple #8
0
 public override bool RollToHitPlayer(DungeonMonster monster)
 {
     if (Random.NextDouble() * 70 > Player.Attribute[Attributes.dexterity])
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Exemple #9
0
        public void DescribeMonster(DungeonMonster monster)
        {
            string name = " " + monster.Name;

            if ("aeiou".Contains(monster.Name[0]))
            {
                name = "n" + name;
            }

            TextArea.PrintLine("A" + name + " is stalking you!", XleColor.White);
        }
Exemple #10
0
        public async Task ExamineMonster()
        {
            var monster = new DungeonMonster(new Xle.Data.DungeonMonsterData());

            monster.Data.Name = "Slime Wart";

            Services.DungeonAdapter.Setup(x => x.MonsterAt(new Point(4, 2))).Returns(monster);
            formatter.Setup(x => x.DescribeMonster(monster)).Verifiable();

            await command.Execute();

            formatter.Verify(x => x.DescribeMonster(monster), Times.Once);
        }
Exemple #11
0
        private bool CanMonsterStepInto(DungeonMonster monster, Point newPt)
        {
            if (IsMapSpaceBlocked(newPt.X, newPt.Y))
            {
                return(false);
            }

            if (IsSpaceOccupiedByMonster(newPt.X, newPt.Y))
            {
                return(false);
            }

            return(true);
        }
Exemple #12
0
    ////////////////////////////////////////////////////////////////
    override public bool Init(MenuParams parms)
    {
        is_regist = parms.GetObject <bool>("is_regist");

        string deck_type = parms.GetObject("deck_type") as string;

        if (deck_type != null && deck_type == "defense")
        {
            m_DeckType = eDeckType.Defense;
            var team_data = TeamDataManager.Instance.GetTeam(pe_Team.PVP_Defense);
            if (team_data == null)
            {
                m_CurrentTeam = new TeamData(pe_Team.PVP_Defense, null);
            }
            else
            {
                m_CurrentTeam = team_data.Clone();
            }
        }
        else
        {
            m_DeckType = eDeckType.Offense;
            var team_data = TeamDataManager.Instance.GetTeam(pe_Team.PVP);
            if (team_data == null)
            {
                m_CurrentTeam = new TeamData(pe_Team.PVP, null);
            }
            else
            {
                m_CurrentTeam = team_data.Clone();
            }

            foreach (var team_creature in Network.PVPBattleInfo.enemy_team_data.Creatures)
            {
                DungeonMonster enemy = DungeonMonsterManager.GetNewObject <DungeonMonster>(m_GridEnemyHeroes.transform, Vector3.zero);
                enemy.Init(team_creature.creature);
            }
            m_GridEnemyHeroes.Reposition();
        }

        m_ToggleOffenseTeam.value = m_DeckType == eDeckType.Offense;

        toggle_menus[0].value = true;
        InitHeroesItem();
        Init();
        return(true);
    }
Exemple #13
0
        public override DungeonMonster GetMonsterToSpawn()
        {
            if (Random.NextDouble() > 0.07)
            {
                return(null);
            }

            int monsterID = Random.Next(6);

            monsterID += 6 * MonsterGroup(Player.DungeonLevel + 1);

            DungeonMonster monst = new DungeonMonster(
                Data.DungeonMonsters[monsterID]);

            monst.HP = (int)
                       (TheMap.MonsterHealthScale * (.7 + .6 * Random.NextDouble()) * (1 + monsterID / 20.0));

            return(monst);
        }
Exemple #14
0
        private void SpawnMonster()
        {
            DungeonMonster monster = GetMonsterToSpawn();

            if (monster == null)
            {
                return;
            }

            do
            {
                monster.Location = new Point(
                    Random.Next(1, 15),
                    Random.Next(1, 15));
            } while (CanPlayerStepIntoImpl(monster.Location.X, monster.Location.Y) == false || monster.Location == Player.Location);

            monster.DungeonLevel = Player.DungeonLevel;

            Combat.Monsters.Add(monster);
        }
Exemple #15
0
        private async Task HitMonster(DungeonMonster monst, int damage, Color clr)
        {
            await TextArea.Print("Enemy hit by blow of ", clr);

            await TextArea.Print(damage.ToString(), XleColor.White);

            await TextArea.PrintLine("!");

            monst.HP -= damage;
            await GameControl.WaitAsync(1000);

            if (monst.HP <= 0)
            {
                Combat.Monsters.Remove(monst);
                await TextArea.PrintLine(monst.Name + " dies!!");

                SoundMan.PlaySound(LotaSound.EnemyDie);

                await GameControl.WaitAsync(500);
            }
        }
Exemple #16
0
        public override void OnLoad()
        {
            base.OnLoad();

            if (Story.RescuedKing)
            {
                OpenEscapeRoute();
            }
            else
            {
                king = new DungeonMonster(Data.DungeonMonsters[18])
                {
                    DungeonLevel    = 7,
                    Location        = new Point(10, 0),
                    HP              = 400,
                    KillFlashImmune = true,
                };

                Combat.Monsters.Add(king);
            }
        }
Exemple #17
0
        public override DungeonMonster GetMonsterToSpawn()
        {
            if (Random.NextDouble() > 0.07)
            {
                return(null);
            }

            int monsterID = Random.Next(6);

            if (Player.DungeonLevel >= 4)
            {
                monsterID += 6;
            }

            DungeonMonster monst = new DungeonMonster(
                Data.DungeonMonsters[monsterID]);

            monst.HP = (int)
                       ((monsterID + 15 + 15 * Random.NextDouble()) * 2.4 * TheMap.MonsterHealthScale);

            return(monst);
        }
Exemple #18
0
        protected override int RollDamageToMonster(DungeonMonster monster)
        {
            double damage = Player.Attribute[Attributes.strength] + 30;

            damage /= 45;

            var weapon = Player.CurrentWeapon;

            double vd = weapon.ID + 1 + weapon.Quality / 2.8;

            damage *= vd + 4;

            if (Player.WeaponEnchantTurnsRemaining > 0)
            {
                damage *= 2.5;
            }
            else
            {
                damage *= 1.5;
            }

            return((int)(damage * (0.5 + Random.NextDouble())));
        }
Exemple #19
0
        private async Task UseAttackMagic(MagicSpell magic)
        {
            int distance = 0;
            await TextArea.PrintLine();

            await TextArea.PrintLine("Shoot " + magic.Name + ".", XleColor.White);

            DungeonMonster monst      = MonsterInFrontOfPlayer(Player, ref distance);
            var            magicSound = magic.ID == 1 ? LotaSound.MagicFlame : LotaSound.MagicBolt;
            var            hitSound   = magic.ID == 1 ? LotaSound.MagicFlameHit : LotaSound.MagicBoltHit;

            if (monst == null)
            {
                await GameControl.PlayMagicSound(magicSound, hitSound, distance);

                await TextArea.PrintLine("There is no effect.", XleColor.White);
            }
            else
            {
                if (RollSpellFizzle(magic))
                {
                    await GameControl.PlayMagicSound(magicSound, LotaSound.MagicFizzle, distance);

                    await TextArea.PrintLine("Attack fizzles.", XleColor.White);

                    await GameControl.WaitAsync(500);
                }
                else
                {
                    await GameControl.PlayMagicSound(magicSound, hitSound, distance);

                    int damage = RollSpellDamage(magic, distance);

                    await HitMonster(monst, damage, XleColor.White);
                }
            }
        }
Exemple #20
0
        public DungeonMonster MonsterInFrontOfPlayer(Player player, ref int distance)
        {
            Point          fightDir = player.FaceDirection.StepDirection();
            DungeonMonster monst    = null;

            for (int i = 1; i <= 5; i++)
            {
                Point loc = new Point(player.X + fightDir.X * i, player.Y + fightDir.Y * i);

                distance = i;
                monst    = MonsterAt(player.DungeonLevel, loc);

                if (monst != null)
                {
                    break;
                }
                if (CanPlayerStepIntoImpl(loc.X, loc.Y) == false)
                {
                    break;
                }
            }

            return(monst);
        }
        public async Task GetMonsterFromDungeonById_GetIds_ReturnsDungeonMonster()
        {
            var resultDungeonMonster = new DungeonMonster {
                Class = "some class", Constitution = "123", Dexterity = "444", DungeonNumber = 1, Experience = "12"
            };
            var resultListJson = JsonSerializer.Serialize(resultDungeonMonster);
            var httpContent    = new StringContent(resultListJson);
            var httpResponse   = new HttpResponseMessage()
            {
                Content = httpContent
            };

            mockHttpMessageHandler(httpResponse);
            var client = new HttpClient(httpMessageHandlerMocked.Object)
            {
                BaseAddress = new Uri("http://test")
            };

            var service = new DungeonsApiService(client);

            var result = await service.GetMonsterFromDungeonById("dungeon id", "monster id");

            Assert.True(result.Equals(resultDungeonMonster));
        }
 protected override async Task OnParametersSetAsync()
 {
     DungeonMonster = await DungeonsApiService.GetMonsterFromDungeonById(DungeonNumber, DungeonMonsterNumber);
 }
Exemple #23
0
 protected virtual bool RollToHitMonster(DungeonMonster monster)
 {
     return(true);
 }
Exemple #24
0
 protected virtual int RollDamageToMonster(DungeonMonster monster)
 {
     return(9999);
 }
Exemple #25
0
 protected override bool RollToHitMonster(DungeonMonster monster)
 {
     return(Random.NextDouble() * 70 < Player.Attribute[Attributes.dexterity] + 30);
 }
Exemple #26
0
        private async Task MonsterAttackPlayer(DungeonMonster monster)
        {
            await TextArea.PrintLine();

            var delta = new Point(
                monster.Location.X - Player.X,
                monster.Location.Y - Player.Y);

            var  forward     = Player.FaceDirection.StepDirection();
            var  right       = Player.FaceDirection.RightDirection();
            var  left        = Player.FaceDirection.LeftDirection();
            bool allowEffect = false;

            if (delta == forward)
            {
                await TextArea.Print("Attacked by ");

                await TextArea.Print(monster.Name, XleColor.Yellow);

                await TextArea.PrintLine("!");

                allowEffect = true;
            }
            else if (delta == right)
            {
                await TextArea.Print("Attacked from the ");

                await TextArea.Print("right", XleColor.Yellow);

                await TextArea.PrintLine(".");
            }
            else if (delta == left)
            {
                await TextArea.Print("Attacked from the ");

                await TextArea.Print("left", XleColor.Yellow);

                await TextArea.PrintLine(".");
            }
            else
            {
                await TextArea.Print("Attacked from ");

                await TextArea.Print("behind", XleColor.Yellow);

                await TextArea.PrintLine(".");
            }

            if (RollToHitPlayer(monster))
            {
                int damage = RollDamageToPlayer(monster);

                SoundMan.PlaySound(LotaSound.EnemyHit);
                await TextArea.Print("Hit by blow of ");

                await TextArea.Print(damage.ToString(), XleColor.Yellow);

                await TextArea.PrintLine("!");

                Player.HP -= damage;
            }
            else
            {
                SoundMan.PlaySound(LotaSound.EnemyMiss);
                await TextArea.PrintLine("Attack missed.", XleColor.Green);
            }

            await GameControl.WaitAsync(250);
        }
Exemple #27
0
 public virtual int RollDamageToPlayer(DungeonMonster monster)
 {
     return(4);
 }
Exemple #28
0
 public virtual bool RollToHitPlayer(DungeonMonster monster)
 {
     hitAttemptCount++;
     return(hitAttemptCount % 2 == 1);
 }
Exemple #29
0
 protected virtual void PrintExamineMonsterMessage(DungeonMonster foundMonster)
 {
     XamineFormatter.DescribeMonster(foundMonster);
 }