Advertisement
Guest User

dsfs

a guest
Nov 21st, 2019
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.42 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace KDZLibrary
  8. {
  9.     public class Fighter : Human
  10.     {
  11.         protected int damage;
  12.         protected int guard;
  13.         protected double evade;
  14.  
  15.         public void Attack(Fighter enemy)
  16.         {
  17.             if (!(enemy.evade >= rnd.Next(0, 100) * 0.01))
  18.             {
  19.                 enemy.healthy -= damage - enemy.guard;
  20.                 enemy.guard--;
  21.                 enemy.BattleCry();
  22.                 if ((enemy is KDZLibrary.Samurai) && (enemy.retaliation >= rnd.Next(0, 100) * 0.01))
  23.                 {
  24.                     enemy.Attack(this);
  25.                     this.BattleCry();
  26.                 }
  27.             }
  28.         }
  29.         public virtual void BattleCry()
  30.         {
  31.             Console.WriteLine("Хыа!");
  32.         }
  33.     }
  34. }
  35.  
  36.  
  37. using System;
  38. using System.Collections.Generic;
  39. using System.Linq;
  40. using System.Text;
  41. using System.Threading.Tasks;
  42.  
  43. namespace KDZLibrary
  44. {
  45.     public class Samurai : Fighter
  46.     {
  47.         protected double retaliation;
  48.     }
  49. }
  50.  
  51.  
  52. using System;
  53. using System.Collections.Generic;
  54. using System.Linq;
  55. using System.Text;
  56. using System.Threading.Tasks;
  57.  
  58. namespace KDZLibrary
  59. {
  60.     public class Human
  61.     {
  62.         protected Random rnd = new Random();
  63.  
  64.         protected bool poisoned;
  65.         protected double healthy;
  66.     }
  67. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement