Commit 03135a36 by BellCodeEditor

save project

parent cd80437c
Showing with 32 additions and 18 deletions
import random
class Hero:
def __init__(self,name,hp,attack):
self.level=1
......@@ -15,28 +16,41 @@ class Hero:
if self.hp>self.maxhp:
self.hp=self.maxhp
print('加60血,,',self.hp)
a=Hero('yase',300,20)
print(a.attack)
a.e()
a.e()
print(a.attack)
d=Hero('hy',250,23)
print(d.attack)
d.e()
d.e()
print(d.attack)
class Player(Hero):
def __init__(self,name,hp,attack):
super().__init__(name,hp,attack)
#self.hp=250
#self.attack=50
#self.maxhp=self.hp
# a.e()
# a.e()
# print(a.attack)
# d=Hero('hy',250,23)
# print(d.attack)
# d.e()
# d.e()
# print(d.attack)
c=Hero('K',5600,199)
print(c.attack)
c.e()
c.e()
c.s()
print(c.attack)
# c=Hero('K',5600,199)
# print(c.attack)
# c.e()
# c.e()
# c.s()
# print(c.attack)
c=Player('K',250,30)
d=Hero('hy',250,23)
print(30*'-')
print(' 战斗开始')
while True:
print(30*'-')
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