Commit 17319b17 by BellCodeEditor

save project

parent 4f2d6564
Showing with 27 additions and 4 deletions
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
class Hero: class Hero:
def __init__(self, name): def __init__(self, name):
self.level = 1 self.level = 1
self.hp = 250 self.hp = 240
self.attack = 40 self.attack = 40
self.name = name self.name = name
def combat(self,enemy): # 攻击 def combat(self,enemy): # 攻击
...@@ -19,12 +19,34 @@ class Hero: ...@@ -19,12 +19,34 @@ class Hero:
print(info) print(info)
exit() exit()
class player(Hero): class player(Hero):
def __init__(self,name) def __init__(self,name):
super().__init__(name) super().__init__(name)
self.hp = 200 self.hp = 200
self.attack = 50 self.attack = 50
houyi= player("后羿")
yase = Hero("垭瑟") yase = Hero("垭瑟")
player=player('后羿') yase.combat(houyi)
houyi.combat(yase)
houyi.combat(yase)
yase.combat(houyi)
yase.combat(houyi)
houyi.combat(yase)
houyi.combat(yase)
yase.combat(houyi)
yase.combat(houyi)
houyi.combat(yase)
houyi.combat(yase)
yase.combat(houyi)
yase.combat(houyi)
houyi.combat(yase)
houyi.combat(yase)
yase.combat(houyi)
yase.combat(houyi)
houyi.combat(yase)
houyi.combat(yase)
yase.combat(houyi)
yase.combat(houyi)
houyi.combat(yase)
houyi.combat(yase)
yase.combat(houyi) yase.combat(houyi)
\ 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