Advertisement
Guest User

Untitled

a guest
Nov 17th, 2021
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.76 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3.  
  4. namespace Raiding
  5. {
  6. public class Program
  7. {
  8. public static void Main(string[] args)
  9. {
  10. List<BaseHero> raidGroup = new List<BaseHero>();
  11.  
  12. int n = int.Parse(Console.ReadLine());
  13.  
  14. for (int i = 0; i < n; i++)
  15. {
  16. string heroName = Console.ReadLine();
  17. string heroType = Console.ReadLine();
  18.  
  19. BaseHero hero = null;
  20.  
  21. if (heroType == nameof(Druid))
  22. {
  23. hero = new Druid(heroName);
  24. }
  25. else if (heroType == nameof(Paladin))
  26. {
  27. hero = new Paladin(heroName);
  28. }
  29. else if (heroType == nameof(Rogue))
  30. {
  31. hero = new Rogue(heroName);
  32. }
  33. else if (heroType == nameof(Warrior))
  34. {
  35. hero = new Warrior(heroName);
  36. }
  37. else
  38. {
  39. Console.WriteLine("Invalid hero!");
  40. continue;
  41. }
  42.  
  43. raidGroup.Add(hero);
  44. }
  45.  
  46. int bossPower = int.Parse(Console.ReadLine());
  47. int heroTotalPower = 0;
  48.  
  49. foreach (var hero in raidGroup)
  50. {
  51. Console.WriteLine(hero.CastAbility());
  52. heroTotalPower += hero.Power;
  53. }
  54.  
  55. if (heroTotalPower >= bossPower)
  56. {
  57. Console.WriteLine("Victory!");
  58. }
  59. else
  60. {
  61. Console.WriteLine("Defeat...");
  62. }
  63. }
  64. }
  65. }
  66.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement