Commit 89486f60 by BellCodeEditor

save project

parent 2653470e
Showing with 13 additions and 11 deletions
...@@ -2,14 +2,16 @@ class hero: ...@@ -2,14 +2,16 @@ class hero:
def __init__(self,name,hp,attack): def __init__(self,name,hp,attack):
self.name = name self.name = name
self.level = 1 self.level = 1
self.hp = hp self.hp = 250
self.attack = attack self.attack = 40
def uop(self):
self.level+=1 def combat(self,enmy):
self.hp+=50 enmy.hp-=self.attack
self.attack+=4 if enmy.hp >0:
yase = hero("垭瑟",300,20) print("1")
houyi = hero("后裔",250,23) else:
houyi.uop() print("11")
yase.uop() exit()
print(yase.name,yase.hp,yase.attack) yase = hero("垭瑟")
houyi = hero("后裔")
yase.combat(houyi)
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