Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random as rnd
- a = 2
- name = input('введите имя: ')
- class You:
- def __init__(self,hp,att,armor,lv,meh):
- self.meh = meh
- self.armor = armor
- self.lv = lv
- self.hp = hp * lv
- self.att = att * lv * meh
- def show(self):
- print('характеристики',name,':','hp:', self.hp,'att:', self.att,'armor:', self.armor,'lvl:', self.lv,'мечи:', self.meh)
- class Enemy :
- def __init__(self,hp,att,armor, clas,name,):
- self.hp = hp
- self.att = att
- self.armor = armor
- self.clas = clas
- self.name = name
- if name == 'обычная крыса':
- self.toxic = rnd.randint(2,7)
- def show(self):
- print('статы ', self.clas ,'его характеристики:','hp',self.hp,'att',self.att,'armor',self.armor,'шанс отравления',self.toxic,)
- you = You(rnd.randint(30,50),3,rnd.randint(80,120),rnd.randint(1,2),1)
- you.show()
- while you.hp > 0 :
- v = rnd.randint(1,10)
- a = 1
- if v < 7 :
- print('поиск врага 1 или отдых на 2')
- a = input()
- v2 = rnd.randint(1,100)
- if v2 > 1 and v2 < 101 :
- rat = Enemy(rnd.randint(15,30),rnd.randint(5,10),0,'крыса','обычная крыса')
- rat.show()
- print('атака 1, искать 2')
- a = input()
- while you.hp > 0 and rat.hp > 0 :
- if rat.att > you.armor and a == 1:
- rat.hp = rat.hp - (you.att - rat.armor)
- you.hp = you.hp - (rat.att - you.armor)
- you.lv = you.lv + rnd.randint(0.1,0.2)
- you.show()
- rat.show()
- print('атака 1, бежать 2')
- a = input()
- elif rat.att < you.armor and a == 1:
- rat.hp = rat.hp - (you.att - rat.armor)
- you.lv = you.lv + rnd.randint(0,1)
- you.show()
- rat.show()
- a = input()
- if you.hp > 0 and rat.hp < 0 :
- print('я убил',rat.name,'=| нажми 2 и я отдохну')
- a = input()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement