public void GrindstoneKitAugmentAxeSucceeds() { OutputHelper.Display.ClearUserOutput(); int baseWeaponItemValue = _weapon.ItemValue; int baseWeaponDamage = _weapon.RegDamage; string displayMessage = $"You upgraded {_textInfo.ToTitleCase(_weapon.Name)} with a weapon kit."; _weaponKit.AttemptAugmentPlayerWeapon(_weapon); Assert.AreEqual(displayMessage, OutputHelper.Display.Output[0][2]); Assert.AreEqual(true, _weaponKit.KitHasBeenUsed); Assert.AreEqual(baseWeaponItemValue + _weaponKit.ItemValue, _weapon.ItemValue); Assert.AreEqual(baseWeaponDamage + _weaponKit.KitAugmentAmount, _weapon.RegDamage); }
public void BowstringKitAugmentAxeFails() { OutputHelper.Display.ClearUserOutput(); _weaponKit = new WeaponKit(KitLevel.Light, WeaponKit.WeaponKitType.Bowstring); int baseWeaponItemValue = _weapon.ItemValue; int baseWeaponDamage = _weapon.RegDamage; string displayMessage = $"You can't upgrade {_textInfo.ToTitleCase(_weapon.Name)} with that!"; _weaponKit.AttemptAugmentPlayerWeapon(_weapon); Assert.AreEqual(displayMessage, OutputHelper.Display.Output[0][2]); Assert.AreEqual(false, _weaponKit.KitHasBeenUsed); Assert.AreEqual(baseWeaponItemValue, _weapon.ItemValue); Assert.AreEqual(baseWeaponDamage, _weapon.RegDamage); }
public void BowstringKitAugmentBowSucceeds() { OutputHelper.Display.ClearUserOutput(); _weapon = new Weapon(3, WeaponType.Bow); _weaponKit = new WeaponKit(KitLevel.Light, WeaponKit.WeaponKitType.Bowstring); int baseWeaponItemValue = _weapon.ItemValue; int baseWeaponDamage = _weapon.RegDamage; string displayMessage = $"You upgraded {_textInfo.ToTitleCase(_weapon.Name)} with a weapon kit."; _weaponKit.AttemptAugmentPlayerWeapon(_weapon); Assert.AreEqual(displayMessage, OutputHelper.Display.Output[0][2]); Assert.AreEqual(true, _weaponKit.KitHasBeenUsed); Assert.AreEqual(baseWeaponItemValue + _weaponKit.ItemValue, _weapon.ItemValue); Assert.AreEqual(baseWeaponDamage + _weaponKit.KitAugmentAmount, _weapon.RegDamage); }
public static void UseWeaponKit(Player player, string[] userInput) { int kitIndex = player.Inventory.FindIndex(f => f.Name.Contains(userInput[2])); if (kitIndex == -1) { OutputHelper.Display.StoreUserOutput( Settings.FormatFailureOutputText(), Settings.FormatDefaultBackground(), "What weapon kit did you want to use?"); return; } int weaponIndex = player.Inventory.FindIndex(f => f.Name.Contains(userInput[1].ToLower())); if (weaponIndex == -1) { OutputHelper.Display.StoreUserOutput( Settings.FormatFailureOutputText(), Settings.FormatDefaultBackground(), "What weapon did you want to upgrade?"); return; } Weapon weapon = player.Inventory[weaponIndex] as Weapon; TextInfo textInfo = new CultureInfo("en-US", false).TextInfo; string weaponName = textInfo.ToTitleCase(weapon.Name); if (!weapon.Equipped) { bool inputValid = false; while (!inputValid) { string weaponString = $"{weaponName} is not equipped. Are you sure you want to upgrade that?"; OutputHelper.Display.StoreUserOutput( Settings.FormatFailureOutputText(), Settings.FormatDefaultBackground(), weaponString); OutputHelper.Display.RetrieveUserOutput(); OutputHelper.Display.ClearUserOutput(); string[] input = InputHelper.GetFormattedInput(Console.ReadLine()); if (input[0] == "no" || input[0] == "n") { return; } if (input[0] == "yes" || input[0] == "y") { inputValid = true; } } } WeaponKit weaponKit = player.Inventory[kitIndex] as WeaponKit; weaponKit.AttemptAugmentPlayerWeapon(weapon); if (weaponKit.KitHasBeenUsed) { player.Inventory.RemoveAt(kitIndex); } }