Advertisement
Guest User

Untitled

a guest
Dec 2nd, 2020
34
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.32 KB | None | 0 0
  1. import random as rnd
  2. a = 2
  3. name = input('введите имя: ')
  4. class You:
  5. def __init__(self,hp,att,armor,lv,meh):
  6. self.meh = meh
  7. self.armor = armor
  8. self.lv = lv
  9. self.hp = hp * lv
  10. self.att = att * lv * meh
  11.  
  12. def show(self):
  13. print('характеристики',name,':','hp:', self.hp,'att:', self.att,'armor:', self.armor,'lvl:', self.lv,'мечи:', self.meh)
  14.  
  15. class Enemy :
  16. def __init__(self,hp,att,armor, clas,name,):
  17. self.hp = hp
  18. self.att = att
  19. self.armor = armor
  20.  
  21. self.clas = clas
  22. self.name = name
  23. if name == 'обычная крыса':
  24. self.toxic = rnd.randint(2,7)
  25.  
  26. def show(self):
  27. print('статы ', self.clas ,'его характеристики:','hp',self.hp,'att',self.att,'armor',self.armor,'шанс отравления',self.toxic,)
  28.  
  29. you = You(rnd.randint(30,50),3,rnd.randint(80,120),rnd.randint(1,2),1)
  30. you.show()
  31.  
  32. while you.hp > 0 :
  33.  
  34. v = rnd.randint(1,10)
  35. a = 1
  36.  
  37. if v < 7 :
  38. print('поиск врага 1 или отдых на 2')
  39. a = input()
  40. v2 = rnd.randint(1,100)
  41. if v2 > 1 and v2 < 101 :
  42. rat = Enemy(rnd.randint(15,30),rnd.randint(5,10),0,'крыса','обычная крыса')
  43. rat.show()
  44. print('атака 1, искать 2')
  45. a = input()
  46. while you.hp > 0 and rat.hp > 0 :
  47. if rat.att > you.armor and a == 1:
  48. rat.hp = rat.hp - (you.att - rat.armor)
  49. you.hp = you.hp - (rat.att - you.armor)
  50. you.lv = you.lv + rnd.randint(0.1,0.2)
  51. you.show()
  52. rat.show()
  53.  
  54. print('атака 1, бежать 2')
  55. a = input()
  56.  
  57.  
  58. elif rat.att < you.armor and a == 1:
  59. rat.hp = rat.hp - (you.att - rat.armor)
  60. you.lv = you.lv + rnd.randint(0,1)
  61. you.show()
  62. rat.show()
  63. a = input()
  64.  
  65.  
  66. if you.hp > 0 and rat.hp < 0 :
  67. print('я убил',rat.name,'=| нажми 2 и я отдохну')
  68. a = input()
  69.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement