public void TurnEngine_SelectCharacterToAttack_D2_2_Should_Return_Player() { // Arrange var save = Engine.EngineSettings.PlayerList; Engine.EngineSettings.PlayerList.Clear(); var characterPlayer = new PlayerInfoModel( new CharacterModel { Name = "Character", CharacterTypeEnum = CharacterTypeEnum.Parent, Speed = 1, Level = 1, MaxHealth = 1, CurrentHealth = 1, }); characterPlayer.PlayerType = PlayerTypeEnum.Character; characterPlayer.Alive = true; Engine.EngineSettings.PlayerList.Add(characterPlayer); DiceHelper.EnableForcedRolls(); DiceHelper.SetForcedRollValue(2); // Act var result = Engine.Round.Turn.SelectCharacterToAttack(); // Reset Engine.EngineSettings.PlayerList = save; DiceHelper.DisableForcedRolls(); // Assert Assert.AreEqual("Character", result.Name); }
public void AutoBattlePage_AttackButton_Clicked_Default_Should_Pass() { // Arrange DiceHelper.EnableForcedRolls(); DiceHelper.SetForcedRollValue(3); DiceHelper.EnableForcedRolls(); DiceHelper.SetForcedRollValue(3); var data = new CharacterModel { Level = 1, MaxHealth = 10 }; page.AutoBattle.Battle.EngineSettings.CharacterList.Add(new PlayerInfoModel(data)); page.AutoBattle.Battle.EngineSettings.CharacterList.Add(new PlayerInfoModel(data)); page.AutoBattle.Battle.EngineSettings.CharacterList.Add(new PlayerInfoModel(data)); page.AutoBattle.Battle.EngineSettings.CharacterList.Add(new PlayerInfoModel(data)); page.AutoBattle.Battle.EngineSettings.CharacterList.Add(new PlayerInfoModel(data)); page.AutoBattle.Battle.EngineSettings.CharacterList.Add(new PlayerInfoModel(data)); // Act page.AutobattleButton_Clicked(null, null); // Reset DiceHelper.DisableForcedRolls(); // Assert Assert.IsTrue(true); // Got to here, so it happened... }
public async Task BasePlayerModel_GetDamageTotalString_Default_Speed_Should_Pass() { // Arrange // Add each model here to warm up and load it. DataSetsHelper.WarmUp(); await ItemIndexViewModel.Instance.CreateAsync(new ItemModel { Attribute = AttributeEnum.Attack, Value = 300, Id = "PrimaryHand", Damage = 1 }); var data = new BasePlayerModel <CharacterModel>(); data.Level = 1; // Add the first item data.AddItem(ItemLocationEnum.PrimaryHand, (await ItemIndexViewModel.Instance.ReadAsync("PrimaryHand")).Id); DiceHelper.EnableForcedRolls(); DiceHelper.SetForcedRollValue(1); // Act // Add the second item, this will return the first item as the one replaced var result = data.GetDamageTotalString; // Reset DiceHelper.DisableForcedRolls(); // Assert Assert.AreEqual("1 + 1D 1", result); }
public async Task AutoBattleEngine_RunAutoBattle_Valid_Default_Should_Pass() { //Arrange DiceHelper.EnableForcedRolls(); DiceHelper.SetForcedRollValue(3); var data = new CharacterModel { Level = 1, MaxHealth = 10 }; AutoBattleEngine.Battle.EngineSettings.CharacterList.Add(new PlayerInfoModel(data)); AutoBattleEngine.Battle.EngineSettings.CharacterList.Add(new PlayerInfoModel(data)); AutoBattleEngine.Battle.EngineSettings.CharacterList.Add(new PlayerInfoModel(data)); AutoBattleEngine.Battle.EngineSettings.CharacterList.Add(new PlayerInfoModel(data)); AutoBattleEngine.Battle.EngineSettings.CharacterList.Add(new PlayerInfoModel(data)); AutoBattleEngine.Battle.EngineSettings.CharacterList.Add(new PlayerInfoModel(data)); //Act var result = await AutoBattleEngine.RunAutoBattle(); //Reset DiceHelper.DisableForcedRolls(); CharacterIndexViewModel.Instance.ForceDataRefresh(); //Assert Assert.AreEqual(true, result); }
public void TurnEngine_TurnAsAttack_Monster_Attacks_Character_Hit_Should_Pass() { // Arrange var Monster = new MonsterModel(); var MonsterPlayer = new PlayerInfoModel(Monster); Engine.MonsterList.Add(MonsterPlayer); var Character = new CharacterModel(); var CharacterPlayer = new PlayerInfoModel(Character); Engine.CharacterList.Add(CharacterPlayer); // Forece a Miss DiceHelper.EnableForcedRolls(); DiceHelper.SetForcedRollValue(20); // Act var result = Engine.TurnAsAttack(MonsterPlayer, CharacterPlayer); // Reset DiceHelper.DisableForcedRolls(); // Assert Assert.AreEqual(true, result); }
public void AutoBattleEngine_RunAutoBattle_Default_Should_Pass() { //Arrange DiceHelper.EnableForcedRolls(); DiceHelper.SetForcedRollValue(3); var data = new CharacterModel { Level = 1, MaxHealth = 10 }; Engine.CharacterList.Add(new PlayerInfoModel(data)); Engine.CharacterList.Add(new PlayerInfoModel(data)); Engine.CharacterList.Add(new PlayerInfoModel(data)); Engine.CharacterList.Add(new PlayerInfoModel(data)); Engine.CharacterList.Add(new PlayerInfoModel(data)); Engine.CharacterList.Add(new PlayerInfoModel(data)); //Act var result = Engine.RunAutoBattle(); //Reset DiceHelper.DisableForcedRolls(); //Assert Assert.IsNotNull(result); }
public void AutoBattleEngine_RunAutoBattle_Default_Should_Pass() { //Arrange DiceHelper.EnableForcedRolls(); DiceHelper.SetForcedRollValue(3); var characterList = new List <CharacterModel>(); var data = new CharacterModel { Level = 1, MaxHealth = 10 }; characterList.Add(new CharacterModel(data)); characterList.Add(new CharacterModel(data)); characterList.Add(new CharacterModel(data)); characterList.Add(new CharacterModel(data)); characterList.Add(new CharacterModel(data)); characterList.Add(new CharacterModel(data)); Engine.Referee.SetParty(characterList); //Act var result = Engine.startBattle(); //Reset DiceHelper.DisableForcedRolls(); //Assert Assert.AreEqual(true, result); }
public async Task RandomPlayerHelper_GetMonsterUniqueItem_2_Should_Return_2() { // Arrange DiceHelper.EnableForcedRolls(); DiceHelper.SetForcedRollValue(2); var save = ItemIndexViewModel.Instance.Dataset; ItemIndexViewModel.Instance.Dataset.Clear(); await ItemIndexViewModel.Instance.CreateAsync(new ItemModel { ItemType = ItemTypeEnum.Calculator }); await ItemIndexViewModel.Instance.CreateAsync(new ItemModel { ItemType = ItemTypeEnum.Diploma }); await ItemIndexViewModel.Instance.CreateAsync(new ItemModel { ItemType = ItemTypeEnum.FoodCourtCard }); var expected = ItemIndexViewModel.Instance.Dataset.ElementAt(1).Id; // Act var result = RandomPlayerHelper.GetMonsterUniqueItem(); // Reset ItemIndexViewModel.Instance.Dataset.Clear(); ItemIndexViewModel.Instance.Dataset = save; DiceHelper.DisableForcedRolls(); // Assert Assert.AreEqual(expected, result); }
public void TurnEngine_TurnAsAttack_Valid_Character_Attacks_Monster_Levels_Up_Should_Pass() { // Arrange var Monster = new MonsterModel(); var MonsterPlayer = new PlayerInfoModel(Monster); Engine.EngineSettings.MonsterList.Add(MonsterPlayer); var Character = new CharacterModel(); var CharacterPlayer = new PlayerInfoModel(Character); CharacterPlayer.ExperienceTotal = 300; // Enough for next level Engine.EngineSettings.CharacterList.Add(CharacterPlayer); // Forece a Miss DiceHelper.EnableForcedRolls(); DiceHelper.SetForcedRollValue(20); // Act var result = Engine.Round.Turn.TurnAsAttack(CharacterPlayer, MonsterPlayer); // Reset DiceHelper.DisableForcedRolls(); // Assert Assert.AreEqual(true, result); Assert.AreEqual(2, CharacterPlayer.Level); }
public void TurnEngine_ChooseToUseAbility_Valid_Roll_2_Yes_Ability_Should_Return_True() { // Arrange var CharacterPlayer = new PlayerInfoModel(new CharacterModel { Job = CharacterJobEnum.Cleric }); // Get the longest range weapon in stock. var weapon = ItemIndexViewModel.Instance.Dataset.Where(m => m.Range > 1).ToList().OrderByDescending(m => m.Range).FirstOrDefault(); CharacterPlayer.PrimaryHand = weapon.Id; Engine.EngineSettings.PlayerList.Add(CharacterPlayer); Engine.EngineSettings.MapModel.PopulateMapModel(Engine.EngineSettings.PlayerList); Engine.EngineSettings.CurrentAction = ActionEnum.Unknown; Engine.EngineSettings.BattleScore.AutoBattle = true; DiceHelper.EnableForcedRolls(); DiceHelper.SetForcedRollValue(2); // Act var result = Engine.Round.Turn.ChooseToUseAbility(CharacterPlayer); // Reset DiceHelper.DisableForcedRolls(); // Assert Assert.AreEqual(true, result); }
public void TurnEngine_TurnAsAttack_Valid_Character_Attacks_Monster_Hit_Death_Should_Pass() { // Arrange var Character = new CharacterModel(); Character.CurrentHealth = 1; var CharacterPlayer = new PlayerInfoModel(Character); Engine.EngineSettings.CharacterList.Add(CharacterPlayer); var Monster = new MonsterModel(); var MonsterPlayer = new PlayerInfoModel(Monster); Engine.EngineSettings.MonsterList.Add(MonsterPlayer); // Forece a Miss DiceHelper.EnableForcedRolls(); DiceHelper.SetForcedRollValue(20); // Act var result = Engine.Round.Turn.TurnAsAttack(CharacterPlayer, MonsterPlayer); // Reset DiceHelper.DisableForcedRolls(); // Assert Assert.AreEqual(true, result); }
public async Task AutoBattleEngine_RunAutoBattle_Default_Should_Pass() { //Arrange DiceHelper.EnableForcedRolls(); DiceHelper.SetForcedRollValue(3); var data = new BaseCharacter { Level = 1, MaxHealth = 10 }; Engine.CharacterList.Add(new PlayerInfoModel(data)); Engine.CharacterList.Add(new PlayerInfoModel(data)); Engine.CharacterList.Add(new PlayerInfoModel(data)); Engine.CharacterList.Add(new PlayerInfoModel(data)); Engine.CharacterList.Add(new PlayerInfoModel(data)); Engine.CharacterList.Add(new PlayerInfoModel(data)); //Act var result = await Engine.RunAutoBattle(); //Reset DiceHelper.DisableForcedRolls(); //Assert Assert.AreEqual(true, result); }
public void TurnEngine_TurnAsAttack_Valid_Force_Critical_Miss_Monster_Attacks_Character_Hit_Should_Pass() { // Arrange var Monster = new MonsterModel(); var MonsterPlayer = new PlayerInfoModel(Monster); Engine.EngineSettings.MonsterList.Add(MonsterPlayer); var Character = new CharacterModel(); var CharacterPlayer = new PlayerInfoModel(Character); Engine.EngineSettings.CharacterList.Add(CharacterPlayer); // Forece a Miss DiceHelper.EnableForcedRolls(); DiceHelper.SetForcedRollValue(1); var oldSetting = Engine.EngineSettings.BattleSettingsModel.AllowCriticalMiss; Engine.EngineSettings.BattleSettingsModel.AllowCriticalMiss = true; // Act var result = Engine.Round.Turn.TurnAsAttack(MonsterPlayer, CharacterPlayer); // Reset DiceHelper.DisableForcedRolls(); Engine.EngineSettings.BattleSettingsModel.AllowCriticalMiss = oldSetting; // Assert Assert.AreEqual(true, result); }
public void RollDiceHelper_SetForcedRollValue_Valid_1_Should_Return_1() { // Arrange DiceHelper.EnableForcedRolls(); // Act var result = DiceHelper.SetForcedRollValue(1); // Reset DiceHelper.DisableForcedRolls(); // Assert Assert.AreEqual(1, result); }
public void RollDiceHelper_EnableForcedRolls_Valid_Should_Return_True() { // Arrange // Act DiceHelper.EnableForcedRolls(); var result = DiceHelper.ForceRollsToNotRandom; // Reset DiceHelper.DisableForcedRolls(); // Assert Assert.AreEqual(true, result); }
public void RandomPlayerHelper_GetItem_2_Should_Return_2() { // Arrange DiceHelper.EnableForcedRolls(); DiceHelper.SetForcedRollValue(2); // Act var result = RandomPlayerHelper.GetItem(Game.Models.ItemLocationEnum.Feet); // Reset DiceHelper.DisableForcedRolls(); // Assert Assert.AreNotEqual(null, result); }
public void RandomPlayerHelper_GetMonsterDescriptionFaculty_2_Should_Return_2() { // Arrange DiceHelper.EnableForcedRolls(); DiceHelper.SetForcedRollValue(2); // Act var result = RandomPlayerHelper.GetMonsterDescriptionFaculty(); // Reset DiceHelper.DisableForcedRolls(); // Assert Assert.AreEqual("You will never pass this class.", result); }
public void RandomPlayerHelper_GetMonsterDescriptionAdministrator_2_Should_Return_2() { // Arrange DiceHelper.EnableForcedRolls(); DiceHelper.SetForcedRollValue(2); // Act var result = RandomPlayerHelper.GetMonsterDescriptionAdministrator(); // Reset DiceHelper.DisableForcedRolls(); // Assert Assert.AreEqual("Oh no, you're not done, here's another form.", result); }
public void RandomPlayerHelper_GetCharacterDescriptionParent_2_Should_Return_2() { // Arrange DiceHelper.EnableForcedRolls(); DiceHelper.SetForcedRollValue(2); // Act var result = RandomPlayerHelper.GetCharacterDescriptionParent(); // Reset DiceHelper.DisableForcedRolls(); // Assert Assert.AreEqual("My child is the best.", result); }
public void RandomPlayerHelper_GetCharacterDescriptionStudent_2_Should_Return_2() { // Arrange DiceHelper.EnableForcedRolls(); DiceHelper.SetForcedRollValue(2); // Act var result = RandomPlayerHelper.GetCharacterDescriptionStudent(); // Reset DiceHelper.DisableForcedRolls(); // Assert Assert.AreEqual("I wish I could graduate.", result); }
public void RandomPlayerHelper_GetRandomCharacterEscapingSchool_2_Should_Return_Parent() { // Arrange DiceHelper.EnableForcedRolls(); DiceHelper.SetForcedRollValue(2); // Act var result = RandomPlayerHelper.GetRandomCharacterEscapingSchool(20); // Reset DiceHelper.DisableForcedRolls(); // Assert Assert.AreEqual(CharacterTypeEnum.Parent, result.CharacterTypeEnum); }
public void RollDiceHelper_RollDice_Valid_1Time_6sided_Forced_6_Should_Pass() { // Arrange DiceHelper.EnableForcedRolls(); DiceHelper.SetForcedRollValue(6); // Act var result = DiceHelper.RollDice(1, 6); // Reset DiceHelper.DisableForcedRolls(); // Assert Assert.AreEqual(6, result); }
public void RollDiceHelper_SetForcedRollValue_InValid_Dice_neg1_Should_Return_0() { // Arrange DiceHelper.EnableForcedRolls(); DiceHelper.SetForcedRollValue(1); // Act var result = DiceHelper.RollDice(-1, 6); // Reset DiceHelper.DisableForcedRolls(); // Assert Assert.AreEqual(0, result); }
public void RandomPlayerHelper_GetMonsterName_2_Should_Return_2() { // Arrange DiceHelper.EnableForcedRolls(); DiceHelper.SetForcedRollValue(2); // Act var result = RandomPlayerHelper.GetMonsterName(); // Reset DiceHelper.DisableForcedRolls(); // Assert Assert.AreEqual("Anais", result); }
public void RandomPlayerHelper_GetMonsterDescription_2_Should_Return_2() { // Arrange DiceHelper.EnableForcedRolls(); DiceHelper.SetForcedRollValue(2); // Act var result = RandomPlayerHelper.GetMonsterDescription(); // Reset DiceHelper.DisableForcedRolls(); // Assert Assert.AreEqual("the Elf hater", result); }
public void RandomPlayerHelper_GetHealth_2_Should_Return_2() { // Arrange DiceHelper.EnableForcedRolls(); DiceHelper.SetForcedRollValue(2); // Act var result = RandomPlayerHelper.GetHealth(1); // Reset DiceHelper.DisableForcedRolls(); // Assert Assert.AreEqual(2, result); }
public void RandomPlayerHelper_GetCharacterImage_2_Should_Return_2() { // Arrange DiceHelper.EnableForcedRolls(); DiceHelper.SetForcedRollValue(2); // Act var result = RandomPlayerHelper.GetCharacterImage(); // Reset DiceHelper.DisableForcedRolls(); // Assert Assert.AreEqual("item.png", result); }
public void RandomPlayerHelper_GetMonsterDifficultyValue_Should_Pass() { // Arrange DiceHelper.EnableForcedRolls(); DiceHelper.SetForcedRollValue(2); // Act var result = RandomPlayerHelper.GetMonsterDifficultyValue(); // Reset DiceHelper.DisableForcedRolls(); // Assert Assert.AreEqual(DifficultyEnum.Average, result); }
public void RandomPlayerHelper_GetRandomMonsterEscapingSchool_2_Should_Return_Administrator() { // Arrange DiceHelper.EnableForcedRolls(); DiceHelper.SetForcedRollValue(2); // Act var result = RandomPlayerHelper.GetRandomMonsterEscapingSchool(20); // Reset DiceHelper.DisableForcedRolls(); // Assert Assert.AreEqual(MonsterTypeEnum.Administrator, result.MonsterTypeEnum); }
public void RandomPlayerHelper_GetCharacterDescription_2_Should_Return_2() { // Arrange DiceHelper.EnableForcedRolls(); DiceHelper.SetForcedRollValue(2); // Act var result = RandomPlayerHelper.GetCharacterDescription(); // Reset DiceHelper.DisableForcedRolls(); // Assert Assert.AreEqual("Never lost a battle", result); }