Advertisement
lelesape

Untitled

Oct 6th, 2020
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. using System.Collections;
  2. using System;
  3. using System.Collections.Generic;
  4.  
  5.  
  6. namespace RoleplayGame
  7. {
  8. public class Wizard:ICharacter
  9. {
  10. private int health = 100;
  11.  
  12. public Wizard(string name)
  13. {
  14. this.Name = name;
  15. this.SpellsBook= new SpellsBook();
  16. this.Staff= new Staff();
  17. }
  18.  
  19. public string Name { get; set; }
  20.  
  21. public SpellsBook SpellsBook { get; set; }
  22.  
  23. public Staff Staff { get; set; }
  24.  
  25. public int AttackValue
  26. {
  27. get
  28. {
  29. return SpellsBook.AttackValue + Staff.AttackValue;
  30. }
  31. }
  32.  
  33. public int DefenseValue
  34. {
  35. get
  36. {
  37. return SpellsBook.DefenseValue + Staff.DefenseValue;
  38. }
  39. }
  40.  
  41. public int Health
  42. {
  43. get
  44. {
  45. return this.health;
  46. }
  47. private set
  48. {
  49. this.health = value < 0 ? 0 : value;
  50. }
  51. }
  52.  
  53. public void ReceiveAttack(int power)
  54. {
  55. if (this.DefenseValue < power)
  56. {
  57. this.Health -= power - this.DefenseValue;
  58. }
  59. }
  60.  
  61.  
  62.  
  63. public void Cure()
  64. {
  65. this.Health = 100;
  66. }
  67.  
  68. }
  69.  
  70. }
  71.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement