public void Setup() { _potion = new StatPotion(PotionStrength.Minor, StatType.Constitution); _player = new Player("test", PlayerClassType.Archer) { Inventory = new List <IItem>() }; }
public void GreaterPotionCreationTest() { _potion = new StatPotion(PotionStrength.Greater, StatType.Constitution); Assert.AreEqual("greater constitution potion", _potion.Name); Assert.AreEqual("A greater constitution potion that increases constitution by 15.", _potion.Desc); Assert.AreEqual(15, _potion.StatAmount); Assert.AreEqual(75, _potion.ItemValue); }
public void NormalPotionCreationTest() { _potion = new StatPotion(PotionStrength.Normal, StatType.Constitution); Assert.AreEqual("constitution potion", _potion.Name); Assert.AreEqual("A constitution potion that increases constitution by 10.", _potion.Desc); Assert.AreEqual(10, _potion.StatAmount); Assert.AreEqual(50, _potion.ItemValue); }
public void MinorPotionCreationTest() { _potion = new StatPotion(PotionStrength.Minor, StatType.Constitution); Assert.AreEqual("minor constitution potion", _potion.Name); Assert.AreEqual("A minor constitution potion that increases constitution by 5.", _potion.Desc); Assert.AreEqual(5, _potion.StatAmount); Assert.AreEqual(25, _potion.ItemValue); }
public void PlayerDrinkPotionIntelligenceTest() { _potion = new StatPotion(PotionStrength.Greater, StatType.Intelligence); _player.Inventory.Add(_potion); _player.Intelligence = 20; int oldPlayerInt = _player.Intelligence; _potion.DrinkPotion(_player); Assert.AreEqual(oldPlayerInt + _potion.StatAmount, _player.Intelligence); Assert.AreEqual(1, _player.Effects.Count); Assert.AreEqual(600, _player.Effects[0].MaxRound); }
public void PlayerDrinkPotionDexterityTest() { _potion = new StatPotion(PotionStrength.Greater, StatType.Dexterity); _player.Inventory.Add(_potion); _player.Dexterity = 20; int oldPlayerDex = _player.Dexterity; _potion.DrinkPotion(_player); Assert.AreEqual(oldPlayerDex + _potion.StatAmount, _player.Dexterity); Assert.AreEqual(1, _player.Effects.Count); Assert.AreEqual(600, _player.Effects[0].MaxRound); }
public void PlayerDrinkPotionConstitutionTest() { _potion = new StatPotion(PotionStrength.Greater, StatType.Constitution); _player.Inventory.Add(_potion); _player.Constitution = 20; int oldPlayerConst = _player.Constitution; _potion.DrinkPotion(_player); Assert.AreEqual(oldPlayerConst + _potion.StatAmount, _player.Constitution); Assert.AreEqual(1, _player.Effects.Count); Assert.AreEqual(600, _player.Effects[0].MaxRound); }
public void ConstitutionPotionUnitTest() { OutputHelper.Display.ClearUserOutput(); Player player = new Player("test", PlayerClassType.Mage) { Inventory = new List <IItem> { new StatPotion(PotionStrength.Minor, StatType.Constitution) } }; int potionIndex = player.Inventory.FindIndex(f => f.GetType() == typeof(StatPotion)); string[] input = new[] { "drink", "constitution" }; string potionName = InputHelper.ParseInput(input); Assert.AreEqual("constitution", potionName); StatPotion potion = player.Inventory[potionIndex] as StatPotion; int statAmount = potion.StatAmount; StatType statType = potion.StatPotionType; int baseConst = player.Constitution; int baseMaxHitPoints = player.MaxHitPoints; player.AttemptDrinkPotion(InputHelper.ParseInput(input)); string drankStatString = $"You drank a potion and increased {statType} by {statAmount}."; Assert.AreEqual(drankStatString, OutputHelper.Display.Output[0][2]); Assert.AreEqual(baseConst + statAmount, player.Constitution); Assert.AreEqual(baseMaxHitPoints + (statAmount * 10), player.MaxHitPoints); Assert.IsEmpty(player.Inventory); Assert.AreEqual(true, player.Effects[0] is ChangeStatEffect); ChangeStatEffect changeStatEffect = player.Effects[0] as ChangeStatEffect; for (int i = 1; i < 601; i++) { Assert.AreEqual(i, player.Effects[0].CurrentRound); changeStatEffect.ProcessChangeStatRound(player); } GameHelper.RemovedExpiredEffectsAsync(player); Thread.Sleep(1000); Assert.AreEqual(false, player.Effects.Any()); Assert.AreEqual(baseConst, player.Constitution); Assert.AreEqual(baseMaxHitPoints, player.MaxHitPoints); player.AttemptDrinkPotion(InputHelper.ParseInput(input)); Assert.AreEqual("What potion did you want to drink?", OutputHelper.Display.Output[1][2]); }
public StatPotionLoot(StatPotion pot) : base((short)pot) { }
public static void ShowInventory(Player player) { OutputHelper.Display.StoreUserOutput( Settings.FormatInfoText(), Settings.FormatDefaultBackground(), "Your inventory contains:"); TextInfo textInfo = new CultureInfo("en-US", false).TextInfo; foreach (IItem item in player.Inventory) { if (!(item is IEquipment equippableItem && equippableItem.Equipped)) { continue; } string itemName = GearHelper.GetItemDetails(item); StringBuilder itemInfo = new StringBuilder(itemName); if (itemName.Contains("Quiver")) { itemInfo.Append($" (Arrows: {player.PlayerQuiver.Quantity}/{player.PlayerQuiver.MaxQuantity})"); } itemInfo.Append(" <_Equipped>"); if (item is Armor || item is Weapon) { IRainbowGear playerItem = item as IRainbowGear; if (playerItem.IsRainbowGear) { GearHelper.StoreRainbowGearOutput(itemInfo.ToString()); continue; } } OutputHelper.Display.StoreUserOutput( Settings.FormatInfoText(), Settings.FormatDefaultBackground(), itemInfo.ToString()); } foreach (IItem item in player.Inventory) { if (item is IEquipment equippableItem && equippableItem.Equipped) { continue; } string itemName = GearHelper.GetItemDetails(item); StringBuilder itemInfo = new StringBuilder(itemName); if (player.PlayerQuiver?.Name == itemName) { itemInfo.Append($"Arrows: {player.PlayerQuiver.Quantity}/{player.PlayerQuiver.MaxQuantity}"); } if (item is Armor || item is Weapon) { IRainbowGear playerItem = item as IRainbowGear; if (playerItem.IsRainbowGear) { GearHelper.StoreRainbowGearOutput(itemInfo.ToString()); continue; } } OutputHelper.Display.StoreUserOutput( Settings.FormatInfoText(), Settings.FormatDefaultBackground(), itemInfo.ToString()); } Dictionary <string, int> consumableDict = new Dictionary <string, int>(); foreach (IItem item in player.Inventory) { StringBuilder itemInfo = new StringBuilder(); itemInfo.Append(item.Name); if (item.Name.Contains("potion")) { if (item is HealthPotion) { HealthPotion potion = item as HealthPotion; itemInfo.Append($" (+{potion.HealthAmount} health)"); } if (item is ManaPotion) { ManaPotion potion = item as ManaPotion; itemInfo.Append($" (+{potion.ManaAmount} mana)"); } if (item is StatPotion) { StatPotion potion = item as StatPotion; itemInfo.Append($" (+{potion.StatAmount} {potion.StatPotionType})"); } } if (item.GetType() == typeof(Arrows)) { Arrows arrows = item as Arrows; itemInfo.Append($" ({arrows.Quantity})"); } string itemName = textInfo.ToTitleCase(itemInfo.ToString()); if (!consumableDict.ContainsKey(itemName)) { consumableDict.Add(itemName, 1); continue; } int dictValue = consumableDict[itemName]; dictValue += 1; consumableDict[itemName] = dictValue; } foreach (KeyValuePair <string, int> consumable in consumableDict) { string Inventorytring = $"{consumable.Key} (Quantity: {consumable.Value})"; OutputHelper.Display.StoreUserOutput( Settings.FormatInfoText(), Settings.FormatDefaultBackground(), Inventorytring); } string goldString = $"_Gold: {player.Gold} coins."; OutputHelper.Display.StoreUserOutput( Settings.FormatInfoText(), Settings.FormatDefaultBackground(), goldString); string weightString = $"_Weight: {GetInventoryWeight(player)}/{player.MaxCarryWeight}"; OutputHelper.Display.StoreUserOutput( Settings.FormatInfoText(), Settings.FormatDefaultBackground(), weightString); }
Tuple.Create(0.1, (ILoot)new StatPotionLoot(StatPotion.Wis)) )) ) )) .Init(0x0d55, Behaves("Horrid Reaper",
Tuple.Create(0.1, (ILoot)new StatPotionLoot(StatPotion.Vit)),
Tuple.Create(0.5, (ILoot)new StatPotionLoot(StatPotion.Life)),