Commit 03135a36 by BellCodeEditor

save project

parent cd80437c
Showing with 32 additions and 18 deletions
import random
class Hero: class Hero:
def __init__(self,name,hp,attack): def __init__(self,name,hp,attack):
self.level=1 self.level=1
...@@ -15,28 +16,41 @@ class Hero: ...@@ -15,28 +16,41 @@ class Hero:
if self.hp>self.maxhp: if self.hp>self.maxhp:
self.hp=self.maxhp self.hp=self.maxhp
print('加60血,,',self.hp) print('加60血,,',self.hp)
a=Hero('yase',300,20) class Player(Hero):
print(a.attack) def __init__(self,name,hp,attack):
a.e() super().__init__(name,hp,attack)
a.e() #self.hp=250
print(a.attack) #self.attack=50
d=Hero('hy',250,23) #self.maxhp=self.hp
print(d.attack) # a.e()
d.e() # a.e()
d.e() # print(a.attack)
print(d.attack) # d=Hero('hy',250,23)
# print(d.attack)
# d.e()
# d.e()
# print(d.attack)
c=Hero('K',5600,199) # c=Hero('K',5600,199)
print(c.attack) # print(c.attack)
c.e() # c.e()
c.e() # c.e()
c.s() # c.s()
print(c.attack) # print(c.attack)
c=Player('K',250,30)
d=Hero('hy',250,23)
print(30*'-') print(30*'-')
print(' 战斗开始') print(' 战斗开始')
while True: while True:
print(30*'-') print(30*'-')
ww=input('技能1|2') ww=input('技能1|2')
if ww=='1':
c.e()
elif ww=='2':
c.s()
xxs=random.randint(1,2)
if xxs=='1':
d.e()
elif xxs=='2':
d.s()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment