Making sure it uses Microsoft Code Convention
This commit is contained in:
@@ -2,12 +2,12 @@ namespace OOP.RPG
|
||||
{
|
||||
public class Mage : Character
|
||||
{
|
||||
public Mage(int Mana)
|
||||
public Mage(int mana)
|
||||
{
|
||||
this.Mana = Mana;
|
||||
Mana = mana;
|
||||
}
|
||||
|
||||
public int Mana = 10;
|
||||
public int Mana { get; set; } = 10;
|
||||
|
||||
public override int Attack()
|
||||
{
|
||||
|
||||
@@ -4,36 +4,36 @@ namespace OOP.RPG
|
||||
{
|
||||
public Simulation(Character opponent1, Character opponent2)
|
||||
{
|
||||
this.opponent1 = opponent1;
|
||||
this.opponent2 = opponent2;
|
||||
Opponent1 = opponent1;
|
||||
Opponent2 = opponent2;
|
||||
}
|
||||
|
||||
public Character opponent1 { get; set; }
|
||||
public Character opponent2 { get; set; }
|
||||
public Character Opponent1 { get; set; }
|
||||
public Character Opponent2 { get; set; }
|
||||
|
||||
public void StartSimulation()
|
||||
{
|
||||
while (!(opponent1.Health <= 0) && !(opponent2.Health <= 0))
|
||||
while (!(Opponent1.Health <= 0) && !(Opponent2.Health <= 0))
|
||||
{
|
||||
// Attack opponent2
|
||||
|
||||
var attack1 = opponent1.Attack();
|
||||
opponent2.Health -= attack1;
|
||||
var attack1 = Opponent1.Attack();
|
||||
Opponent2.Health -= attack1;
|
||||
Console.WriteLine($"Opponent1 attacks Opponent2");
|
||||
Console.WriteLine($"Opponent1 attacks with {attack1} and Opponent2 has {opponent2.Health} left");
|
||||
Console.WriteLine($"Opponent1 attacks with {attack1} and Opponent2 has {Opponent2.Health} left");
|
||||
|
||||
var attack2 = opponent2.Attack();
|
||||
opponent1.Health -= attack2;
|
||||
var attack2 = Opponent2.Attack();
|
||||
Opponent1.Health -= attack2;
|
||||
Console.WriteLine($"Opponent2 attacks Opponent2");
|
||||
Console.WriteLine($"Opponent2 attacks with {attack2} and Opponent1 has {opponent1.Health} left");
|
||||
Console.WriteLine($"Opponent2 attacks with {attack2} and Opponent1 has {Opponent1.Health} left");
|
||||
}
|
||||
|
||||
if (opponent1.Health <= 0)
|
||||
if (Opponent1.Health <= 0)
|
||||
{
|
||||
Console.WriteLine("Opponent2 wins");
|
||||
}
|
||||
|
||||
if (opponent2.Health <= 0)
|
||||
if (Opponent2.Health <= 0)
|
||||
{
|
||||
Console.WriteLine("Opponent1 wins");
|
||||
}
|
||||
|
||||
@@ -4,16 +4,16 @@ namespace OOP.RPG
|
||||
{
|
||||
public Warrior(int strength)
|
||||
{
|
||||
this.strength = strength;
|
||||
Strength = strength;
|
||||
}
|
||||
|
||||
public int strength = 10;
|
||||
public int Strength { get; set; } = 10;
|
||||
|
||||
public int multiplier = 2;
|
||||
public int Multiplier { get; set; } = 2;
|
||||
|
||||
public override int Attack()
|
||||
{
|
||||
return base.Attack() * multiplier;
|
||||
return base.Attack() * Multiplier;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user