Started work on Player and Enemy classes, and also different moves.
This commit is contained in:
parent
4b4b59b9a3
commit
53b53fc57d
15 changed files with 49 additions and 30 deletions
2
Main.cs
2
Main.cs
|
|
@ -23,7 +23,7 @@ class Program
|
||||||
|
|
||||||
if (input == "Y")
|
if (input == "Y")
|
||||||
{
|
{
|
||||||
user.UseHealingItem((HealingItem)user.Inventory.FirstOrDefault(m => m.Name == "Super Potion"));
|
user.UseHealingItem((HealingItem)user.Inventory.FirstOrDefault(m => m.Name == "Potion"));
|
||||||
}
|
}
|
||||||
|
|
||||||
user.DisplayStats();
|
user.DisplayStats();
|
||||||
|
|
|
||||||
Binary file not shown.
Binary file not shown.
|
|
@ -13,7 +13,7 @@ using System.Reflection;
|
||||||
[assembly: System.Reflection.AssemblyCompanyAttribute("MiniRPG")]
|
[assembly: System.Reflection.AssemblyCompanyAttribute("MiniRPG")]
|
||||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+0d65f1e71f6545910b66ab67a8d835b4d1e2c5f9")]
|
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+4b4b59b9a31bfc76fb1db2b6e61846e0e23362d0")]
|
||||||
[assembly: System.Reflection.AssemblyProductAttribute("MiniRPG")]
|
[assembly: System.Reflection.AssemblyProductAttribute("MiniRPG")]
|
||||||
[assembly: System.Reflection.AssemblyTitleAttribute("MiniRPG")]
|
[assembly: System.Reflection.AssemblyTitleAttribute("MiniRPG")]
|
||||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
0dc65c6434da51f383575019fc82ae4b29b68e54caebc8f898b0bbe37447dce3
|
2f9f95c4d52ac0c3165163d219ccd0cd9cb08d53b12c9beccc5292d27ab9163e
|
||||||
|
|
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
15
scripts/objects/characters/Character.cs
Normal file
15
scripts/objects/characters/Character.cs
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
public class Character{
|
||||||
|
public string Name { get; set; }
|
||||||
|
public int MaxHealth { get; set; }
|
||||||
|
public int CurrentHealth { get; set; }
|
||||||
|
public int MaxMPoints { get; set; }
|
||||||
|
public int CurrentMPoints { get; set; }
|
||||||
|
|
||||||
|
public Character(string name, int maxhealth, int currenthealth, int maxmpoints, int currentmpoints){
|
||||||
|
Name = name;
|
||||||
|
MaxHealth = maxhealth;
|
||||||
|
CurrentHealth = currenthealth;
|
||||||
|
MaxMPoints = maxmpoints;
|
||||||
|
CurrentMPoints = currentmpoints;
|
||||||
|
}
|
||||||
|
}
|
||||||
8
scripts/objects/characters/Enemy.cs
Normal file
8
scripts/objects/characters/Enemy.cs
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
public class Enemy : Character {
|
||||||
|
|
||||||
|
public List<Move> moves { get; set; }
|
||||||
|
public Enemy(string name, int maxhealth, int currenthealth, int maxmpoints, int currentmpoints) : base(name, maxhealth, currenthealth, maxmpoints, currentmpoints)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,20 +1,12 @@
|
||||||
public class Player
|
public class Player : Character
|
||||||
{
|
{
|
||||||
public string Name { get; set; }
|
|
||||||
public List<Item> Inventory { get; set; }
|
public List<Item> Inventory { get; set; }
|
||||||
public int MaxHealth { get; set; }
|
public List<Move> moves { get; set; }
|
||||||
public int CurrentHealth { get; set; }
|
|
||||||
public int MaxMPoints { get; set; }
|
|
||||||
public int CurrentMPoints { get; set; }
|
|
||||||
|
|
||||||
public Player(string name, List<Item> inventory, int maxhealth, int currenthealth, int maxmpoints, int currentmpoints)
|
public Player(string name, int maxhealth, int currenthealth, int maxmpoints, int currentmpoints, List<Item> inventory) : base(name, maxhealth, currenthealth, maxmpoints, currentmpoints)
|
||||||
{
|
{
|
||||||
Name = name;
|
|
||||||
Inventory = inventory;
|
Inventory = inventory;
|
||||||
MaxHealth = maxhealth;
|
|
||||||
CurrentHealth = currenthealth;
|
|
||||||
MaxMPoints = maxmpoints;
|
|
||||||
CurrentMPoints = currentmpoints;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Returns the players inventory in a Dictionary.
|
//Returns the players inventory in a Dictionary.
|
||||||
|
|
@ -33,14 +25,25 @@ public class Player
|
||||||
//For using a healing item. Doesn't allow you to overheal.
|
//For using a healing item. Doesn't allow you to overheal.
|
||||||
public void UseHealingItem(HealingItem item)
|
public void UseHealingItem(HealingItem item)
|
||||||
{
|
{
|
||||||
if ((CurrentHealth + item.HealingAmount) > MaxHealth)
|
if (Inventory.FirstOrDefault(m => m.Name == item?.Name) != null){
|
||||||
|
Inventory.Remove(Inventory.FirstOrDefault(m => m.Name == item.Name));
|
||||||
|
if ((CurrentHealth + item.HealingAmount) > MaxHealth)
|
||||||
|
{
|
||||||
|
CurrentHealth = MaxHealth;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CurrentHealth += item.HealingAmount;
|
||||||
|
}
|
||||||
|
Console.WriteLine($"Used one {item.Name}. Regained {item.HealingAmount} Health.\n");
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
CurrentHealth = MaxHealth;
|
Console.WriteLine($"{Name} does not have any of that in their inventory.");
|
||||||
} else {
|
|
||||||
CurrentHealth += item.HealingAmount;
|
|
||||||
}
|
}
|
||||||
Inventory.Remove(Inventory.FirstOrDefault(m => m.Name == item.Name));
|
|
||||||
Console.WriteLine($"Used one {item.Name}. Regained {item.HealingAmount} Health.\n");
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//#####DEBUG METHODS#####//
|
//#####DEBUG METHODS#####//
|
||||||
0
scripts/objects/moves/MagicMove.cs
Normal file
0
scripts/objects/moves/MagicMove.cs
Normal file
|
|
@ -4,19 +4,12 @@ public class Move
|
||||||
public string Description { get; set; }
|
public string Description { get; set; }
|
||||||
public int Power { get; set; }
|
public int Power { get; set; }
|
||||||
public int MPCost { get; set; }
|
public int MPCost { get; set; }
|
||||||
public MoveType Type { get; set; }
|
public virtual string Type { get; set; }
|
||||||
|
|
||||||
public enum MoveType {
|
public Move(string name, string description, int power, int mpcost){
|
||||||
Attack,
|
|
||||||
Heal,
|
|
||||||
Buff
|
|
||||||
}
|
|
||||||
|
|
||||||
public Move(string name, string description, int power, int mpcost, MoveType type){
|
|
||||||
Name = name;
|
Name = name;
|
||||||
Description = description;
|
Description = description;
|
||||||
Power = power;
|
Power = power;
|
||||||
MPCost = mpcost;
|
MPCost = mpcost;
|
||||||
Type = type;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
0
scripts/objects/moves/PhysicalMove.cs
Normal file
0
scripts/objects/moves/PhysicalMove.cs
Normal file
Loading…
Add table
Reference in a new issue