diff --git a/Main.cs b/Main.cs index 6107bfb..18a9cac 100644 --- a/Main.cs +++ b/Main.cs @@ -12,10 +12,10 @@ class Program Player user = new("Tanner", [], 100, 90, 20, 20); user.DisplayStats(); - user.Inventory.Add(allItems.FirstOrDefault(m => m.Name == "Potion")); user.Inventory.Add(allItems.FirstOrDefault(m => m.Name == "Super Potion")); user.Inventory.Add(allItems.FirstOrDefault(m => m.Name == "Hyper Potion")); user.Inventory.Add(allItems.FirstOrDefault(m => m.Name == "Elixir")); + user.Inventory.Add(allItems.FirstOrDefault(m => m.Name == "Dagger")); Console.WriteLine("Do you want to use your Potion? (Y/N)"); string? input = Console.ReadLine().ToUpper(); @@ -23,7 +23,7 @@ class Program if (input == "Y") { - user.UseHealingItem((HealingItem)user.Inventory.FirstOrDefault(m => m.Name == "Potion")); + user.UseHealingItem((HealingItem)user.Inventory.FirstOrDefault(m => m.Name == "Super Potion")); } user.DisplayStats(); diff --git a/bin/Debug/net8.0/MiniRPG.dll b/bin/Debug/net8.0/MiniRPG.dll index e46947a..0692fe2 100644 Binary files a/bin/Debug/net8.0/MiniRPG.dll and b/bin/Debug/net8.0/MiniRPG.dll differ diff --git a/bin/Debug/net8.0/MiniRPG.pdb b/bin/Debug/net8.0/MiniRPG.pdb index 37dca14..faf1bf1 100644 Binary files a/bin/Debug/net8.0/MiniRPG.pdb and b/bin/Debug/net8.0/MiniRPG.pdb differ diff --git a/data/items.json b/data/items.json index 6f1bb51..37a6624 100644 --- a/data/items.json +++ b/data/items.json @@ -21,5 +21,11 @@ "Name": "Elixir", "Description": "A simple potion.", "Type": "Support" + }, + { + "Name": "Dagger", + "Description": "Stabby.", + "Type": "Weapon", + "Damage": 5 } ] \ No newline at end of file diff --git a/obj/Debug/net8.0/MiniRPG.AssemblyInfo.cs b/obj/Debug/net8.0/MiniRPG.AssemblyInfo.cs index c2da1a1..159243c 100644 --- a/obj/Debug/net8.0/MiniRPG.AssemblyInfo.cs +++ b/obj/Debug/net8.0/MiniRPG.AssemblyInfo.cs @@ -13,7 +13,7 @@ using System.Reflection; [assembly: System.Reflection.AssemblyCompanyAttribute("MiniRPG")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] -[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+b44401c8d7d108f0c10a5464d7c3d52644511ce0")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+0d65f1e71f6545910b66ab67a8d835b4d1e2c5f9")] [assembly: System.Reflection.AssemblyProductAttribute("MiniRPG")] [assembly: System.Reflection.AssemblyTitleAttribute("MiniRPG")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] diff --git a/obj/Debug/net8.0/MiniRPG.AssemblyInfoInputs.cache b/obj/Debug/net8.0/MiniRPG.AssemblyInfoInputs.cache index 371e73a..8e5b23a 100644 --- a/obj/Debug/net8.0/MiniRPG.AssemblyInfoInputs.cache +++ b/obj/Debug/net8.0/MiniRPG.AssemblyInfoInputs.cache @@ -1 +1 @@ -c3f2c804e2ee64e4e07e15b987abb29b0956207f6714fc9b00396faa7781a1ea +0dc65c6434da51f383575019fc82ae4b29b68e54caebc8f898b0bbe37447dce3 diff --git a/obj/Debug/net8.0/MiniRPG.csproj.CoreCompileInputs.cache b/obj/Debug/net8.0/MiniRPG.csproj.CoreCompileInputs.cache index 7283e83..bf4180d 100644 --- a/obj/Debug/net8.0/MiniRPG.csproj.CoreCompileInputs.cache +++ b/obj/Debug/net8.0/MiniRPG.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -552d7776ba252b8ba7a98c694923b3d159470fb983c96ce88fa765b810f80c32 +6b3357f22fac92c605e1eb42055d105ac36a261e46edee8677ddb0fa786a34ba diff --git a/obj/Debug/net8.0/MiniRPG.dll b/obj/Debug/net8.0/MiniRPG.dll index e46947a..0692fe2 100644 Binary files a/obj/Debug/net8.0/MiniRPG.dll and b/obj/Debug/net8.0/MiniRPG.dll differ diff --git a/obj/Debug/net8.0/MiniRPG.pdb b/obj/Debug/net8.0/MiniRPG.pdb index 37dca14..faf1bf1 100644 Binary files a/obj/Debug/net8.0/MiniRPG.pdb and b/obj/Debug/net8.0/MiniRPG.pdb differ diff --git a/obj/Debug/net8.0/ref/MiniRPG.dll b/obj/Debug/net8.0/ref/MiniRPG.dll index ec845f2..2cdd2e3 100644 Binary files a/obj/Debug/net8.0/ref/MiniRPG.dll and b/obj/Debug/net8.0/ref/MiniRPG.dll differ diff --git a/obj/Debug/net8.0/refint/MiniRPG.dll b/obj/Debug/net8.0/refint/MiniRPG.dll index ec845f2..2cdd2e3 100644 Binary files a/obj/Debug/net8.0/refint/MiniRPG.dll and b/obj/Debug/net8.0/refint/MiniRPG.dll differ diff --git a/scripts/loaders/ItemConverter.cs b/scripts/loaders/ItemConverter.cs index d0c4b08..2ff6ccf 100644 --- a/scripts/loaders/ItemConverter.cs +++ b/scripts/loaders/ItemConverter.cs @@ -26,6 +26,10 @@ public class ItemConverter : JsonConverter item = new SupportItem("", ""); break; + case "Weapon": + item = new WeaponItem("", "", 0); + break; + default: throw new JsonSerializationException($"Unknown item type: {type}"); } diff --git a/scripts/objects/items/HealingItem.cs b/scripts/objects/items/HealingItem.cs index 945f843..de2b9a7 100644 --- a/scripts/objects/items/HealingItem.cs +++ b/scripts/objects/items/HealingItem.cs @@ -10,4 +10,9 @@ public class HealingItem : Item { Console.WriteLine("Healing item has been used"); } + + public override Item Clone() + { + return new HealingItem(Name, Description, HealingAmount); + } } \ No newline at end of file diff --git a/scripts/objects/items/Item.cs b/scripts/objects/items/Item.cs index 0f32f39..7efd09b 100644 --- a/scripts/objects/items/Item.cs +++ b/scripts/objects/items/Item.cs @@ -2,16 +2,23 @@ public class Item { public string Name { get; set; } public string Description { get; set; } - public int Amount { get; set; } public virtual string Type { get; set; } + public Item(string name, string description){ + Name = name; + Description = description; + } + public virtual void Action() { Console.WriteLine("Item has been used"); } - public Item(string name, string description){ - Name = name; - Description = description; + public virtual Item Clone() + { + return new Item(Name, Description) + { + Type = this.Type + }; } } \ No newline at end of file diff --git a/scripts/objects/items/WeaponItem.cs b/scripts/objects/items/WeaponItem.cs new file mode 100644 index 0000000..3464473 --- /dev/null +++ b/scripts/objects/items/WeaponItem.cs @@ -0,0 +1,18 @@ +public class WeaponItem : Item +{ + public int Damage { get; set; } + public override string Type => "Weapon"; + public WeaponItem(string name, string description, int damage) : base(name, description){ + Damage = damage; + } + + public override void Action() + { + Console.WriteLine("Weapon item has been used"); + } + + public override Item Clone() + { + return new WeaponItem(Name, Description, Damage); + } +} \ No newline at end of file