Exemplo n.º 1
0
        /// <summary>
        /// Create Characters for Party
        /// </summary>
        public override bool CreateCharacterParty()
        {
            // Picks 6 Characters

            // To use your own characters, populate the List before calling RunAutoBattle

            //// Will first pull from existing characters
            foreach (var data in CharacterIndexViewModel.Instance.Dataset)
            {
                if (Battle.EngineSettings.CharacterList.Count() >= Battle.EngineSettings.MaxNumberPartyCharacters)
                {
                    break;
                }

                // Start off with max health if adding a character in
                data.CurrentHealth = data.GetMaxHealthTotal;
                Battle.PopulateCharacterList(data);
            }

            //If there are not enough will add random ones
            for (int i = Battle.EngineSettings.CharacterList.Count(); i < Battle.EngineSettings.MaxNumberPartyCharacters; i++)
            {
                Battle.PopulateCharacterList(RandomPlayerHelper.GetRandomCharacter(1));
            }

            return(true);
        }
        public void RandomPlayerHelper_GetRandomCharacter_InValid_Empty_CharacterList_Should_Return_New()
        {
            // Arrange
            CharacterIndexViewModel.Instance.Dataset.Clear();

            // Act
            var result = RandomPlayerHelper.GetRandomCharacter(1);

            // Reset

            // Assert
            Assert.AreEqual(true, result.Name.Contains("Elf"));
        }
Exemplo n.º 3
0
        public async Task RandomPlayerHelper_GetRandomCharacter_Valid_CharacterList_1_Should_Return_1()
        {
            // Arrange
            CharacterIndexViewModel.Instance.Dataset.Clear();
            await CharacterIndexViewModel.Instance.CreateAsync(new CharacterModel { Guid = "1" });

            // Act
            var result = RandomPlayerHelper.GetRandomCharacter(1);

            // Reset

            // Assert
            Assert.AreEqual(true, result.Guid.Contains("1"));
        }
Exemplo n.º 4
0
        public void RandomPlayerHelper_GetRandomCharacter_InValid_Empty_CharacterList_Should_Return_New()
        {
            // Arrange
            CharacterViewModel.Instance.Dataset.Clear();

            // Act
            var result = RandomPlayerHelper.GetRandomCharacter(1);


            // Reset

            // Assert
            //our default character when creating a new character is named michelle
            Assert.AreEqual(true, result.Name.Contains("Michelle"));
        }
        public async Task RandomPlayerHelper_GetRandomCharacter_Valid_CharacterList_1_Should_Return_1()
        {
            // Arrange
            CharacterIndexViewModel.Instance.Dataset.Clear();
            await CharacterIndexViewModel.Instance.CreateAsync(new CharacterModel { UniqueItem = "1" });

            // Arrange
            DiceHelper.EnableForcedRolls();
            DiceHelper.SetForcedRollValue(1);

            // Act
            var result = RandomPlayerHelper.GetRandomCharacter(1);

            // Reset
            DiceHelper.DisableForcedRolls();

            // Assert
            Assert.AreEqual(true, result.UniqueItem.Equals("1"));
        }
Exemplo n.º 6
0
        /// <summary>
        /// Constructor for Create makes a new model
        /// </summary>
        public CharacterCreatePage()
        {
            InitializeComponent();

            this.ViewModel.Data = RandomPlayerHelper.GetRandomCharacter(1);

            BindingContext = this.ViewModel;

            this.ViewModel.Title = "Character Create";

            // Load Level Values for the Level Picker
            LoadCharacterLevelPickerValues();

            // Sets the Level Picker to the Character's level
            CharacterLevelPicker.SelectedIndex = ViewModel.Data.Level - 1;

            // Sets the Job Picker to the Character's Type
            CharacterJobPicker.SelectedItem = ViewModel.Data.Job.ToMessage();
        }
        public async Task RandomPlayerHelper_GetRandomCharacter_Valid_Health_Should_Be_Correct()
        {
            // Arrange
            CharacterIndexViewModel.Instance.Dataset.Clear();
            await CharacterIndexViewModel.Instance.CreateAsync(new CharacterModel { UniqueItem = "1" });

            await CharacterIndexViewModel.Instance.CreateAsync(new CharacterModel { UniqueItem = "2" });

            await CharacterIndexViewModel.Instance.CreateAsync(new CharacterModel { UniqueItem = "3" });

            DiceHelper.EnableForcedRolls();
            DiceHelper.SetForcedRollValue(2);

            // Act
            var result = RandomPlayerHelper.GetRandomCharacter(1);

            // Reset
            DiceHelper.DisableForcedRolls();

            // Assert
            Assert.AreEqual(result.MaxHealth, result.CurrentHealth);
        }
Exemplo n.º 8
0
        public async Task RandomPlayerHelper_GetRandomCharacter_Valid_CharacterList_3_Should_Return_2()
        {
            // Arrange
            CharacterIndexViewModel.Instance.Dataset.Clear();
            await CharacterIndexViewModel.Instance.CreateAsync(new CharacterModel { Guid = "1" });

            await CharacterIndexViewModel.Instance.CreateAsync(new CharacterModel { Guid = "2" });

            await CharacterIndexViewModel.Instance.CreateAsync(new CharacterModel { Guid = "3" });

            DiceHelper.EnableForcedRolls();
            DiceHelper.SetForcedRollValue(2);

            // Act
            var result = RandomPlayerHelper.GetRandomCharacter(1);

            // Reset
            DiceHelper.DisableForcedRolls();

            // Assert
            Assert.AreEqual(true, result.Guid.Contains("2"));
        }