Advertisement
Guest User

Untitled

a guest
May 21st, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.57 KB | None | 0 0
  1. using System;
  2.  
  3. namespace ConsoleApp2
  4. {
  5. public class Champion
  6. {
  7. private string name;
  8. private double health;
  9. private double mana;
  10. private int ap;
  11. private int ad;
  12. private int armor;
  13. private int mr;
  14.  
  15. public Champion(string name, double health, double mana, int ap, int ad, int armor, int mr)
  16. {
  17. this.name = name;
  18. this.health = health;
  19. this.mana = mana;
  20. this.ap = ap;
  21. this.ad = ad;
  22. this.armor = armor;
  23. this.mr = mr;
  24. }
  25.  
  26. public string ToString()
  27. {
  28. return $"Name: {name} \nHealth: {health} ";
  29. }
  30.  
  31. public string GetName()
  32. {
  33. return name;
  34. }
  35.  
  36. /*
  37. * this champion get damaged by ap and reduced by mr
  38. * return true if this champion still a live. false if dead.
  39. */
  40. private bool DamageTakenAP(double ap)
  41. {
  42.  
  43. this.health -= (ap * 100 / (100 + this.mr));
  44. return this.health > 0;
  45. }
  46.  
  47. private bool DamgeTakenAd(double ad)
  48. {
  49.  
  50. this.health -= (ad * 100 / (100 + this.armor));
  51. return this.health > 0;
  52. }
  53.  
  54.  
  55.  
  56. /*
  57. * Deal damage to other champion
  58. */
  59. public bool DamageDealtAP(Champion other)
  60. {
  61. other.DamageTakenAP(this.ap);
  62. return other.health <= 0;
  63. }
  64.  
  65. public bool DamgeDealtAd(Champion other)
  66. {
  67. other.DamgeTakenAd(this.ad);
  68. return other.health <= 0;
  69.  
  70. }
  71. }
  72. public class Program
  73. {
  74. static bool Attack(Champion attacker, Champion defender)
  75. {
  76.  
  77.  
  78.  
  79.  
  80.  
  81.  
  82. }
  83. static void Main(string[] args)
  84. {
  85. Champion Annie = new Champion("Annie", 1000, 500, 100, 50, 60, 70);
  86. Champion Cait = new Champion("Caitlyn", 1000, 300, 0, 100, 60, 70);
  87.  
  88. while (true)
  89. {
  90. Champion champion;
  91. Console.WriteLine($"Choose Champion: \na- {Annie.GetName()}\nc- {Cait.GetName()}");
  92. string choice = Console.ReadLine();
  93. if (choice == "a")
  94. {
  95. champion = Annie;
  96. }
  97. else if (choice == "c")
  98. {
  99. champion = Cait;
  100. }
  101. else
  102. {
  103. Console.WriteLine($"No champion {choice}!");
  104. continue;
  105. }
  106. Console.WriteLine($"Champion Status: {champion.ToString()}");
  107. Console.WriteLine("Choose an action: \n1- Attack.\n2- FF!\n3- Go Next?");
  108. choice = Console.ReadLine();
  109. switch (choice)
  110. {
  111. case "1":
  112. if (champion == Annie)
  113. champion.DamageDealtAP(Cait);
  114. else
  115. champion.DamageDealtAP(Annie);
  116. break;
  117. case "2":
  118. Console.WriteLine("Not yet implemented!");
  119. break;
  120. case "3":
  121. break;
  122. default:
  123. Console.WriteLine("Wrong choice!! Go Next selected!");
  124. break;
  125. }
  126. // continue;
  127. }
  128.  
  129. }
  130. }
  131. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement