Guest User

Untitled

a guest
Oct 24th, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.29 KB | None | 0 0
  1. string enemyName = map.GetLocation().GetEnemyName();
  2.  
  3. Monster Monster = new enemyName(6);
  4.  
  5. static void Combat(ref Map map, ref List<string> menuItems, ref Inventory Inventory, ref Player Player)
  6. {
  7. int choice;
  8. Player.SetInCombat(true);
  9. bool inCombat = Player.GetInCombat();
  10.  
  11. string enemyName = map.GetLocation().GetEnemyName();
  12.  
  13. Console.WriteLine(enemyName);
  14.  
  15. Monster Monster = new Skeleton(6);
  16.  
  17. //Player
  18. int hpPlayer = Player.GetHealth();
  19. int dpPlayer = Convert.ToInt32(Player.GetDefence());
  20. int attackPlayer = Player.GetAttackPoints();
  21.  
  22. bool run = false;
  23.  
  24. //Enemy
  25. string name = Monster.GetName();
  26. int hpEnemy = Monster.GetHealth();
  27. int dpEnemy = Monster.GetDefence();
  28. int enemyLevel = Monster.GetLevel();
  29. int attackEnemy = Monster.GetAttack();
  30. string attackName = Monster.GetAttackName();
  31. }
  32.  
  33. abstract class Monster
  34. {
  35. protected int level;
  36. protected string name;
  37. protected string attackName;
  38. protected int maxHealth;
  39. protected int health;
  40. protected int attack;
  41. protected int defence;
  42. protected int healthMultiplier;
  43. protected int attackMultiplier;
  44. protected int defenceMultiplier;
  45.  
  46. public Monster(int level)
  47. {
  48. this.level = level;
  49. }
  50.  
  51. public string GetName()
  52. {
  53. return name;
  54. }
  55.  
  56. public string GetAttackName()
  57. {
  58. return attackName;
  59. }
  60.  
  61. public int GetMaxHealth()
  62. {
  63. return maxHealth;
  64. }
  65.  
  66. public int GetHealth()
  67. {
  68. return health;
  69. }
  70.  
  71. public int GetAttack()
  72. {
  73. return attack;
  74. }
  75.  
  76. public int GetDefence()
  77. {
  78. return defence;
  79. }
  80.  
  81. public abstract void TakeHit(int damage, ref Player Player);
  82.  
  83. public int GetLevel()
  84. {
  85. return level;
  86. }
  87. }
  88.  
  89. class Skeleton : Monster
  90. {
  91. public Skeleton(int level)
  92. : base(level)
  93. {
  94. //Monster stats
  95.  
  96. name = "Skeleton";
  97. attackName = "Bone_thrower";
  98. healthMultiplier = 2;
  99. attackMultiplier = 1;
  100. defenceMultiplier = 25;
  101.  
  102. maxHealth = (level * healthMultiplier);
  103. health = maxHealth;
  104. attack = (level / attackMultiplier);
  105. defence = (level / defenceMultiplier);
  106. }
  107.  
  108. public override void TakeHit(int damage, ref Player Player)
  109. {
  110. if (health - damage <= 0)
  111. {
  112. Console.ForegroundColor = ConsoleColor.Red;
  113. Console.WriteLine("{0} took {1} points of damage.", name, damage);
  114. Console.ForegroundColor = ConsoleColor.White;
  115. Console.WriteLine("Press any keys to continue...");
  116. Console.ReadKey();
  117. Player.SetInCombat(false);
  118. }
  119. else
  120. {
  121. health -= damage;
  122. Console.ForegroundColor = ConsoleColor.Red;
  123. Console.WriteLine("{0} took {1} points of damage.", name, damage);
  124. Console.ForegroundColor = ConsoleColor.White;
  125. }
  126. }
  127. }
Add Comment
Please, Sign In to add comment