Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace num
- {
- enum type { Archer = 0, Tank = 1, Thief = 2, Mage =3 }
- enum name { Harold, Thor, Butch, Gerald}
- class warrior
- {
- private name name;
- private type type;
- private int health;
- private int damage;
- private int armor;
- private bool isAlive = true;
- int battle_count;
- public warrior(name name, type type)
- {
- Random rnd = new Random();
- this.name = name;
- this.type = type;
- health = 100;
- armor = rnd.Next(10, 20);
- damage = rnd.Next(10, 30);
- battle_count = 20;
- }
- public void takeDamage(int damage) {
- HealthSystem(health - damage);
- }
- private void HealthSystem(int health)
- {
- if (health <= 0)
- isAlive = false;
- }
- public void print()
- {
- string life;
- if (isAlive)
- life = "Живой";
- else
- life = "Мертвый";
- Console.WriteLine(name + " " + type + " " + health + " " + damage + " " + armor + " " + life);
- }
- }
- class Program
- {
- static void Main(string[] args)
- {
- warrior Harold = new warrior(name.Harold, type.Tank);
- Harold.takeDamage(30);
- Harold.print();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement