Пример #1
0
        /// <summary>
        /// Save by calling for Create
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public async void Save_Clicked(object sender, EventArgs e)
        {
            // if the name or description are not entered, the page remains on the create screen
            if (string.IsNullOrEmpty(ViewModel.Data.Name) || string.IsNullOrEmpty(ViewModel.Data.Description))
            {
                await Navigation.PushModalAsync(new NavigationPage(new MonsterUpdatePage(ViewModel)));

                await Navigation.PopModalAsync();
            }
            // otherwise it creates and saves the new monster
            else
            {
                ViewModel.Data.PlayerType = PlayerTypeEnum.Monster;
                ViewModel.Data.SpecificMonsterTypeEnum = SpecificMonsterTypeEnumHelper.ConvertMessageStringToEnum(MonsterTypePicker.SelectedItem.ToString());
                ViewModel.Data.MonsterTypeEnum         = SpecificMonsterTypeEnumHelper.GetMonsterTypeEnumFromSpecificMonsterTypeEnum(ViewModel.Data.SpecificMonsterTypeEnum);
                ViewModel.Data.ImageURI = SpecificMonsterTypeEnumHelper.ToImageURI(ViewModel.Data.SpecificMonsterTypeEnum);
                ViewModel.Data.Range    = SpecificMonsterTypeEnumHelper.ToRange(ViewModel.Data.SpecificMonsterTypeEnum);

                // Unique Drop item
                MessagingCenter.Send(this, "CreateItem", dropItem);

                MessagingCenter.Send(this, "Create", ViewModel.Data);
                await Navigation.PopModalAsync();
            }
        }
        public void SpecificMonsterTypeEnumHelperTests_ToImageURI_TeachingAssistant_Should_Pass()
        {
            // Arrange

            // Act
            var result = SpecificMonsterTypeEnumHelper.ToImageURI(SpecificMonsterTypeEnum.TeachingAssistant);

            // Reset

            // Assert
            Assert.AreEqual(Constants.SpecificMonsterTypeTeachingAssistantImageURI, result);
        }
        public void SpecificMonsterTypeEnumHelperTests_ToImageURI_RegistrationAdministrator_Should_Pass()
        {
            // Arrange

            // Act
            var result = SpecificMonsterTypeEnumHelper.ToImageURI(SpecificMonsterTypeEnum.RegistrationAdministrator);

            // Reset

            // Assert
            Assert.AreEqual(Constants.SpecificMonsterTypeRegistrationAdministratorImageURI, result);
        }
        public void SpecificMonsterTypeEnumHelperTests_ToImageURI_Professor_Should_Pass()
        {
            // Arrange

            // Act
            var result = SpecificMonsterTypeEnumHelper.ToImageURI(SpecificMonsterTypeEnum.Professor);

            // Reset

            // Assert
            Assert.AreEqual(Constants.SpecificMonsterTypeProfessorImageURI, result);
        }
        public void SpecificMonsterTypeEnumHelperTests_ToImageURI_AdjunctFaculty_Should_Pass()
        {
            // Arrange

            // Act
            var result = SpecificMonsterTypeEnumHelper.ToImageURI(SpecificMonsterTypeEnum.AdjunctFaculty);

            // Reset

            // Assert
            Assert.AreEqual(Constants.SpecificMonsterTypeAdjunctFacultyImageURI, result);
        }
        public void SpecificMonsterTypeEnumHelperTests_ToImageURI_Unknown_Should_Pass()
        {
            // Arrange

            // Act
            var result = SpecificMonsterTypeEnumHelper.ToImageURI(SpecificMonsterTypeEnum.Unknown);

            // Reset

            // Assert
            Assert.AreEqual(Constants.SpecificMonsterTypeDefaultImageURI, result);
        }
Пример #7
0
 /// <summary>
 /// Constructor to create a new MonsterModel.
 /// </summary>
 public MonsterModel()
 {
     PlayerType              = PlayerTypeEnum.Monster;
     MonsterTypeEnum         = MonsterTypeEnum.Faculty;
     SpecificMonsterTypeEnum = SpecificMonsterTypeEnum.TeachingAssistant;
     Guid                = Id;
     Name                = "";
     Description         = "";
     Attack              = 1;
     Difficulty          = DifficultyEnum.Average;
     UniqueDropItem      = null;
     ImageURI            = SpecificMonsterTypeEnumHelper.ToImageURI(SpecificMonsterTypeEnum);
     ExperienceTotal     = 0;
     ExperienceRemaining = LevelTableHelper.LevelDetailsList[Level + 1].Experience - 1;
     TileImageURI        = SpecificMonsterTypeEnumHelper.ToTileImageURI(SpecificMonsterTypeEnum);
 }
Пример #8
0
        /// <summary>
        /// Update
        /// </summary>
        /// <param name="newData"></param>
        /// <returns></returns>
        public override bool Update(MonsterModel newData)
        {
            if (newData == null)
            {
                return(false);
            }

            PlayerType              = newData.PlayerType;
            MonsterTypeEnum         = newData.MonsterTypeEnum;
            SpecificMonsterTypeEnum = newData.SpecificMonsterTypeEnum;
            SpecificMonsterTypeEnum = newData.SpecificMonsterTypeEnum;

            ImageURI    = SpecificMonsterTypeEnumHelper.ToImageURI(SpecificMonsterTypeEnum);
            Guid        = newData.Guid;
            Name        = newData.Name;
            Description = newData.Description;

            Difficulty = newData.Difficulty;

            //Speed = newData.Speed;
            //Defense = newData.Defense;
            Attack = newData.Attack;

            ExperienceTotal     = newData.ExperienceTotal;
            ExperienceRemaining = newData.ExperienceRemaining;
            //CurrentHealth = newData.CurrentHealth;
            //MaxHealth = newData.MaxHealth;

            Head           = newData.Head;
            Necklace       = newData.Necklace;
            PrimaryHand    = newData.PrimaryHand;
            OffHand        = newData.OffHand;
            RightFinger    = newData.RightFinger;
            LeftFinger     = newData.LeftFinger;
            Feet           = newData.Feet;
            UniqueDropItem = newData.UniqueDropItem;

            //Job = newData.Job;

            return(true);
        }
        /// <summary>
        /// Create Random monster faculty for the battle
        /// </summary>
        /// <param name="MaxLevel"></param>
        /// <returns></returns>
        public static MonsterModel GetRandomMonsterAdministrator(int MaxLevel)
        {
            var result = new MonsterModel()
            {
                Level = DiceHelper.RollDice(1, MaxLevel),

                // Randomize Name
                Name            = GetMonsterName(),
                Description     = GetMonsterDescriptionFaculty(),
                MonsterTypeEnum = MonsterTypeEnum.Administrator,

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

                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);

            var specifictype = DiceHelper.RollDice(1, 2);

            result.SpecificMonsterTypeEnum = SpecificMonsterTypeEnum.Unknown;

            switch (specifictype)
            {
            case 1:
                result.SpecificMonsterTypeEnum = SpecificMonsterTypeEnum.HRAdministrator;
                break;

            case 2:
                result.SpecificMonsterTypeEnum = SpecificMonsterTypeEnum.RegistrationAdministrator;
                break;

            default:
                result.SpecificMonsterTypeEnum = SpecificMonsterTypeEnum.Unknown;
                break;
            }

            result.ImageURI     = SpecificMonsterTypeEnumHelper.ToImageURI(result.SpecificMonsterTypeEnum);
            result.TileImageURI = SpecificMonsterTypeEnumHelper.ToTileImageURI(result.SpecificMonsterTypeEnum);

            // Set ExperienceRemaining so Monsters can both use this method
            var LevelData = LevelTableHelper.LevelDetailsList.ElementAtOrDefault(result.Level + 1) ?? LevelTableHelper.LevelDetailsList.Last();

            result.ExperienceRemaining = LevelData.Experience;

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

            var uniqueDrop = result.DropItemBasedOnCharacterType(result.SpecificMonsterTypeEnum);

            if (uniqueDrop != null)
            {
                result.UniqueDropItem = uniqueDrop.Id;
            }

            return(result);
        }