Advertisement
Guest User

Untitled

a guest
May 20th, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.34 KB | None | 0 0
  1.  public class Champion
  2.     {
  3.         public string name;
  4.         public double health;
  5.         public double mana;
  6.         public int ap;
  7.         public int ad;
  8.         public int armor;
  9.         public int mr;
  10.  
  11.         public Champion(string name, double health, double mana, int ap, int ad, int armor, int mr)
  12.         {
  13.             this.name = name;
  14.             this.health = health;
  15.             this.mana = mana;
  16.             this.ap = ap;
  17.             this.ad = ad;
  18.             this.armor = armor;
  19.             this.mr = mr;
  20.         }
  21.  
  22.         /*
  23.          * this champion get damaged by ap and reduced by mr
  24.          * return true if this champion still a live. false if dead.
  25.          */
  26.         private bool DamageTakenAP(double ap)
  27.         {
  28.            
  29.             this.health -= (ap * 100 / (100 + this.mr));
  30.             return this.health > 0;
  31.         }
  32.  
  33.         private bool DamgeTakenAd(double ad)
  34.         {
  35.  
  36.             this.health -= (ad * 100 / (100 + this.armor));
  37.             return this.health > 0;
  38.         }
  39.  
  40.  
  41.  
  42.         /*
  43.          * Deal damage to other champion
  44.          */
  45.         public void DamageDealtAP(Champion other)
  46.         {
  47.             other.DamageTakenAP(this.ap);
  48.         }
  49.  
  50.         public void DamgeDealtAd(Champion other)
  51.         {
  52.             other.DamageTakenAP(this.ad);
  53.         }
  54.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement