Commit e427d588 by BellCodeEditor

save project

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