Advertisement
WupEly

С#

Jan 25th, 2022
933
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Artefact rapira = new Artefact("Рапира", 500, 0, 200, 4000);
  2. Console.WriteLine(rapira.getDamage(500));
  3. class Artefact
  4. {
  5.     string name;
  6.     int damage;
  7.     int hpInfluence;
  8.     int armorInfluence;
  9.     int price;
  10.  
  11.     //Инициализатор
  12.     public Artefact(string name, int damage, int hpInfluence, int armorInfluence, int price)
  13.     {
  14.         this.name = name;
  15.         this.damage = damage;
  16.         this.hpInfluence = hpInfluence;
  17.         this.armorInfluence = armorInfluence;
  18.         this.price = price;
  19.  
  20.  
  21.     }
  22.     public int discountPrice(int discount)
  23.     {
  24.             discount = discount / 100;
  25.             return (price - (price / discount));
  26.        
  27.     }
  28.     public int getDamage(int damage)
  29.     {
  30.  
  31.         return (this.damage + damage);
  32.  
  33.     }
  34.     public int getHp(int hp)
  35.     {
  36.         return (hp + this.hpInfluence);
  37.     }
  38.     public int getArmor(int armor)
  39.     {
  40.         return (armor + armorInfluence);
  41.     }
  42. }
  43.  
  44.  
  45.  
  46.  
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement