public Enemy(string Name, SeenAt seenAt, double chanceToAppear, Statistics statistics, double chanceToEscape, Weapon weapon, string PathToImage) { if (string.IsNullOrEmpty(Name)) { throw new ArgumentNullException("Name is empty."); } if (chanceToAppear <= 0 || chanceToAppear > 1) { throw new ArgumentException("chanceToAppear must be in the diapason of (0, 1]."); } if (chanceToEscape < 0 || chanceToEscape > 1) { throw new ArgumentException("chanceToEscape must be in the diapason of [0, 1]."); } if (!File.Exists(PathToImage)) { throw new ArgumentException("Could not find the image file"); } this.Name = Name; this.seenAt = seenAt; this.chanceToAppear = chanceToAppear; this.statistics = statistics; this.chanceToEscape = chanceToEscape; this.weapon = weapon; }
public Hero(string name, Statistics statistics, Weapon weapon, string[] image, Statistics levelUpStats) : base(name, image) { this.Statistics = statistics; this.Weapon = weapon; this.LevelUpStats = levelUpStats; }
public Hero(string Name, Statistics statistics, Weapon weapon, VisualElement visibleHero, string pathToImage) { if (string.IsNullOrEmpty(Name)) { throw new ArgumentNullException("Name is empty."); } if (!File.Exists(pathToImage)) { throw new ArgumentException("Could not find the specified file."); } this.Name = Name; this.statistics = statistics; this.weapon = weapon; this.visibleHero = visibleHero; this.pathToImage = pathToImage; }
public Enemy(string name, double chanceToAppear, Statistics statistics, double chanceToEscape, Weapon weapon, string[] image) : base(name, image) { if (string.IsNullOrEmpty(Name)) { throw new ArgumentNullException("Name is empty."); } if (chanceToAppear <= 0 || chanceToAppear > 1) { throw new ArgumentException("chanceToAppear must be in the diapason of (0, 1]."); } if (chanceToEscape < 0 || chanceToEscape > 1) { throw new ArgumentException("chanceToEscape must be in the diapason of [0, 1]."); } this.chanceToAppear = chanceToAppear; this.statistics = statistics; this.chanceToEscape = chanceToEscape; this.weapon = weapon; }
private void DrawMenuInConsole(Hero hero, Weapon weapon) { Drawer draw = new Drawer(); Console.ResetColor(); Console.Clear(); string message = "You have found a new weapon!"; draw.DrawString(message, ConsoleColor.Black, 6, Console.WindowWidth / 2 - message.Length / 2); message = "The weapon is " + weapon.name + " and it's damage is " + weapon.damage; draw.DrawString(message, ConsoleColor.Black, 10, Console.WindowWidth / 2 - message.Length / 2); message = "The weapon's magic is " + weapon.magic.Name + " and it's effects are: "; draw.DrawString(message, ConsoleColor.Black, 11, Console.WindowWidth / 2 - message.Length / 2); int line = 13; if (weapon.magic.damage > 0) { message = "Damage: " + weapon.magic.damage; draw.DrawString(message, ConsoleColor.Black, line, Console.WindowWidth / 2 - message.Length / 2); line++; } if (weapon.magic.damageOnSelf != 0) { if (weapon.magic.damageOnSelf > 0) { message = "Damage on self: " + weapon.magic.damageOnSelf; draw.DrawString(message, ConsoleColor.Black, line, Console.WindowWidth / 2 - message.Length / 2); line++; } else { message = "Heal: " + (0 - weapon.magic.damageOnSelf); draw.DrawString(message, ConsoleColor.Black, line, Console.WindowWidth / 2 - message.Length / 2); line++; } } if (weapon.magic.chanceToStun > 0) { message = "Chance to stun: " + (100 * weapon.magic.chanceToStun) + "%"; draw.DrawString(message, ConsoleColor.Black, line, Console.WindowWidth / 2 - message.Length / 2); line++; } message = "Your current weapon is " + hero.Weapon.name + " and it's damage is " + hero.Weapon.damage; draw.DrawString(message, ConsoleColor.Black, 17, Console.WindowWidth / 2 - message.Length / 2); message = "The weapon's magic is " + hero.Weapon.magic.Name + " and it's effects are: "; draw.DrawString(message, ConsoleColor.Black, 18, Console.WindowWidth / 2 - message.Length / 2); line = 20; if (hero.Weapon.magic.damage > 0) { message = "Damage: " + hero.Weapon.magic.damage; draw.DrawString(message, ConsoleColor.Black, line, Console.WindowWidth / 2 - message.Length / 2); line++; } if (hero.Weapon.magic.damageOnSelf != 0) { if (hero.Weapon.magic.damageOnSelf > 0) { message = "Damage on self: " + hero.Weapon.magic.damageOnSelf; draw.DrawString(message, ConsoleColor.Black, line, Console.WindowWidth / 2 - message.Length / 2); line++; } else { message = "Heal: " + (0 - hero.Weapon.magic.damageOnSelf); draw.DrawString(message, ConsoleColor.Black, line, Console.WindowWidth / 2 - message.Length / 2); line++; } } if (hero.Weapon.magic.chanceToStun > 0) { message = "Chance to stun: " + (100 * hero.Weapon.magic.chanceToStun) + "%"; draw.DrawString(message, ConsoleColor.Black, line, Console.WindowWidth / 2 - message.Length / 2); line++; } message = "Do you want to leave your weapon behind, and take the new weapon?"; draw.DrawString(message, ConsoleColor.Black, 25, Console.WindowWidth / 2 - message.Length / 2); message = "[Y /N] "; draw.DrawString(message, ConsoleColor.Black, 27, Console.WindowWidth / 2 - message.Length / 2); Console.SetCursorPosition(0, 0); }