Commit e427d588 by BellCodeEditor

save project

parent 5993fe44
Showing with 18 additions and 13 deletions
......@@ -2,16 +2,20 @@ class Hero:
def __init__(self,name,hp,attack):
self.level=1
self.name=name
self.hp=hp
self.attack=attack
def a(self):
self.level=self.level+4
self.hp=self.hp+50
self.attack=self.attack+100
houyi=Hero("后羿",240,23)
houyi.a()
print(houyi.level)
print(houyi.hp)
print(houyi.attack)
self.hp=300
self.attack=150
# def a(self):
# self.level=self.level+4
# self.hp=self.hp+50
# self.attack=self.attack+100
def combat(self,c):
# into1=self.name,"对",c.name,"发起进攻","造成了",self.attack,"点伤害",c.name,"还剩下",c.hp-self.attack,"滴血"
# print(into1)
if combat.hp>0:
into1=self.name,"对",c.name,"发起进攻","造成了",self.attack,"点伤害",c.name,"还剩下",c.hp-self.attack,"滴血"
print(into1)
else:
print("您已阵亡")
exit()
yase=Hero("亚瑟")
houyi=Hero("后羿")
\ No newline at end of file
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