Пример #1
0
        /// <summary>
        /// Create Random Character for the battle
        /// </summary>
        /// <param name="MaxLevel"></param>
        /// <returns></returns>
        public static BaseMonster GetRandomMonster(int MaxLevel)
        {
            // If there are no Monsters in the system, return a default one
            if (MonsterViewModel.Instance.Dataset.Count == 0)
            {
                return(new BaseMonster());
            }

            var rnd = DiceHelper.RollDice(1, MonsterViewModel.Instance.Dataset.Count);

            var result = new BaseMonster(MonsterViewModel.Instance.Dataset.ElementAt(rnd - 1))
            {
                Level = DiceHelper.RollDice(1, MaxLevel),

                // Randomize Name
                Name        = GetMonsterName(),
                Description = GetMonsterDescription(),

                // Randomize the Attributes
                Attack  = GetAbilityValue(),
                Speed   = GetAbilityValue(),
                Defense = GetAbilityValue(),

                ImageURI = GetMonsterImage(),

                Difficulty = GetMonsterDifficultyValue()
            };

            // Adjust values based on Difficulty
            result.Attack  = result.Difficulty.ToModifier(result.Attack);
            result.Defense = result.Difficulty.ToModifier(result.Defense);
            result.Speed   = result.Difficulty.ToModifier(result.Speed);
            result.Level   = result.Difficulty.ToModifier(result.Level);

            // Get the new Max Health
            result.MaxHealth = DiceHelper.RollDice(result.Level, 10);

            // Adjust the health, If the new Max Health is above the rule for the level, use the original
            var MaxHealthAdjusted = result.Difficulty.ToModifier(result.MaxHealth);

            if (MaxHealthAdjusted < result.Level * 10)
            {
                result.MaxHealth = MaxHealthAdjusted;
            }

            // Level up to the new level
            result.LevelUpToValue(result.Level);

            // Set ExperienceRemaining so Monsters can both use this method
            result.ExperienceRemaining = LevelTableHelper.Instance.LevelDetailsList[result.Level + 1].Experience;

            // Enter Battle at full health
            result.CurrHealth = result.MaxHealth;

            return(result);
        }
Пример #2
0
        /// <summary>
        /// Add Monsters to the Round
        ///
        /// Because Monsters can be duplicated, will add 1, 2, 3 to their name
        ///

        /*
         * Hint:
         * I don't have crudi monsters yet so will add 6 new ones...
         * If you have crudi monsters, then pick from the list
         *
         * Consdier how you will scale the monsters up to be appropriate for the characters to fight
         *
         */
        /// </summary>
        /// <returns></returns>
        public int AddMonstersToRound()
        {
            // TODO: Teams, You need to implement your own Logic can not use mine.



            int TargetLevel = 1;

            if (CharacterList.Count() > 0)
            {
                // Get the Min Character Level (linq is soo cool....)
                TargetLevel = Convert.ToInt32(CharacterList.Min(m => m.Level));
            }

            for (var i = 0; i < MaxNumberPartyMonsters; i++)
            {
                var data = Helpers.RandomPlayerHelper.GetRandomMonster(TargetLevel);

                // Help identify which Monster it is
                data.Name += " " + MonsterList.Count() + 1;

                //Scenario 31
                if (BattleScore.RoundCount >= 100)
                {
                    data.Attack     *= 10;
                    data.Speed      *= 10;
                    data.Defense    *= 10;
                    data.CurrHealth *= 10;
                    data.MaxHealth  *= 10;
                }


                MonsterList.Add(new PlayerInfoModel(data));
            }


            if ((BossBattleFunctionality && DiceHelper.RollDice(1, 100) > 90) || testBossHack)
            {
                Debug.WriteLine("BOSS MONSTER APPROACHING!!!!!");
                MonsterList.Clear();
                int scaleFactor = 0;
                for (int i = 0; i < CharacterList.Count; i++)
                {
                    scaleFactor += CharacterList[i].Level;
                }
                if (scaleFactor > 20)
                {
                    scaleFactor = 20;
                }



                var data = new BaseMonster();
                data.LevelUpToValue(scaleFactor);

                data.Attack    = 5000;
                data.Defense   = 5000;
                data.Speed     = 10000;
                data.MaxHealth = data.CurrHealth = 1000;

                MonsterList.Add(new PlayerInfoModel(data));
            }


            return(MonsterList.Count());
        }