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 _145
- {
- class Program
- {
- static void Main(string[] args)
- {
- Wombat wombat = new Wombat()
- {
- Health = 100,
- Armor = 10
- };
- Human human = new Human()
- {
- Health = 100,
- Agility = 5
- };
- human.TakeDamage(110);
- //wombat.TakeDamage(110);
- }
- }
- class Wombat : Entity
- {
- public int Armor;
- public void TakeDamage(int damage)
- {
- Health -= damage - Armor;
- HealthTest();
- }
- }
- class Human : Entity
- {
- public int Agility;
- public void TakeDamage(int damage)
- {
- Health -= damage / Agility;
- HealthTest();
- }
- }
- class Entity
- {
- public int Health;
- public void HealthTest()
- {
- if (Health <= 0)
- {
- Console.WriteLine("Я умер");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement